• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  * Copyright (C) 2012-2014, 2016-2019, 2021, The Linux Foundation. All rights reserved.
4  *
5  * Not a Contribution, Apache license notifications and license are
6  * retained for attribution purposes only.
7 
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 /*
22 * Changes from Qualcomm Innovation Center are provided under the following license:
23 *
24 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
25 *
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted (subject to the limitations in the
28 * disclaimer below) provided that the following conditions are met:
29 *
30 *    * Redistributions of source code must retain the above copyright
31 *      notice, this list of conditions and the following disclaimer.
32 *
33 *    * Redistributions in binary form must reproduce the above
34 *      copyright notice, this list of conditions and the following
35 *      disclaimer in the documentation and/or other materials provided
36 *      with the distribution.
37 *
38 *    * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
39 *      contributors may be used to endorse or promote products derived
40 *      from this software without specific prior written permission.
41 *
42 * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
43 * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
44 * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
45 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
46 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
47 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
48 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
50 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
52 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
53 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
54 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */
56 
57 #ifndef ANDROID_IQSERVICE_H
58 #define ANDROID_IQSERVICE_H
59 
60 #include <stdint.h>
61 #include <sys/types.h>
62 #include <utils/Errors.h>
63 #include <utils/RefBase.h>
64 #include <binder/IInterface.h>
65 #include <binder/IBinder.h>
66 #include <IQClient.h>
67 #include <IQHDMIClient.h>
68 
69 
70 namespace qService {
71 // ----------------------------------------------------------------------------
72 
73 class IQService : public android::IInterface
74 {
75 public:
76     DECLARE_META_INTERFACE(QService);
77     enum {
78       COMMAND_LIST_START = android::IBinder::FIRST_CALL_TRANSACTION,
79       GET_PANEL_BRIGHTNESS = 2,                // Provides ability to set the panel brightness
80       SET_PANEL_BRIGHTNESS = 3,                // Provides ability to get the panel brightness
81       CONNECT_HWC_CLIENT = 4,                  // Connect to qservice
82       SCREEN_REFRESH = 5,                      // Refresh screen through SF invalidate
83       GET_DISPLAY_VISIBLE_REGION = 11,         // Get the visibleRegion for dpy
84       SET_SECONDARY_DISPLAY_STATUS = 12,       // Sets secondary display status
85       SET_MAX_PIPES_PER_MIXER = 13,            // Set max pipes per mixer for MDPComp
86       DYNAMIC_DEBUG = 15,                      // Enable more logging on the fly
87       SET_IDLE_TIMEOUT = 16,                   // Set idle timeout for GPU fallback
88       CONFIGURE_DYN_REFRESH_RATE = 18,         //  Enable/Disable/Set refresh rate dynamically
89       CONTROL_PARTIAL_UPDATE = 19,             // Provides ability to enable/disable partial update
90       TOGGLE_SCREEN_UPDATES = 20,              // Provides ability to set the panel brightness
91       SET_FRAME_DUMP_CONFIG = 21,              // Provides ability to set the frame dump config
92       CONNECT_HDMI_CLIENT = 23,                // Connect HDMI CEC HAL Client
93       QDCM_SVC_CMDS = 24,                      // request QDCM services.
94       SET_ACTIVE_CONFIG = 25,                  // Set a specified display config
95       GET_ACTIVE_CONFIG = 26,                  // Get the current config index
96       GET_CONFIG_COUNT = 27,                   // Get the number of supported display configs
97       GET_DISPLAY_ATTRIBUTES_FOR_CONFIG = 28,  // Get attr for specified config
98       SET_DISPLAY_MODE = 29,                   // Set display mode to command or video mode
99       SET_CAMERA_STATUS = 30,                  // To notify display when camera is on and off
100       MIN_HDCP_ENCRYPTION_LEVEL_CHANGED = 31,
101       GET_BW_TRANSACTION_STATUS = 32,   // Client can query BW transaction status.
102       SET_LAYER_MIXER_RESOLUTION = 33,  // Enables client to set layer mixer resolution.
103       SET_COLOR_MODE = 34,              // Overrides the QDCM mode on the display
104       SET_COLOR_MODE_BY_ID = 36,        // Overrides the QDCM mode using the given mode ID
105       GET_COMPOSER_STATUS = 37,  // Get composer init status-true if primary display init is done
106       SET_QSYNC_MODE = 38,       // Set qsync mode. 0 - (none)disable qsync, 1 - continuous mode.
107       SET_COLOR_MODE_WITH_RENDER_INTENT = 39,  // Overrides the QDCM mode with render intent
108       SET_IDLE_PC = 40,                        // Enable/disable Idle power collapse
109       SET_DPPS_AD4_ROI_CONFIG = 41,            // Set ad4 roi config for debug
110       SET_DSI_CLK = 42,                        // Set DSI Clk.
111       GET_DSI_CLK = 43,                        // Get DSI Clk.
112       GET_SUPPORTED_DSI_CLK = 44,              // Get supported DSI Clk.
113       SET_COLOR_MODE_FROM_CLIENT = 45,         // Overrides the QDCM mode using the given mode ID
114       SET_FRAME_TRIGGER_MODE = 46,             // Set frame trigger mode for debug
115       SET_PANEL_LUMINANCE = 47,                // Set Panel Luminance attributes.
116       SET_BRIGHTNESS_SCALE = 48,               // Set brightness scale ratio
117       SET_COLOR_SAMPLING_ENABLED = 49,         // Toggle the collection of display color stats
118       SET_STAND_BY_MODE = 50,                  // Set stand by mode for MDP hardware
119       GET_PANEL_RESOLUTION = 51,               // Get Panel Resolution
120       DELAY_FIRST_COMMIT = 52,                 // Delay first commit when PowerOn
121       SET_DISPLAY_DEVICE_STATUS = 100,         // Set display device status
122       SET_PANEL_GAMMA_TABLE_SOURCE = 101,      // Update panel gamma table
123       COMMAND_LIST_END = 400,
124     };
125 
126     enum {
127         END = 0,
128         START,
129     };
130 
131     enum {
132         DEBUG_ALL,
133         DEBUG_MDPCOMP,
134         DEBUG_VSYNC,
135         DEBUG_VD,
136         DEBUG_PIPE_LIFECYCLE,
137         DEBUG_DRIVER_CONFIG,
138         DEBUG_ROTATOR,
139         DEBUG_QDCM,
140         DEBUG_SCALAR,
141         DEBUG_CLIENT,
142         DEBUG_DISPLAY,
143         DEBUG_MAX_VAL = DEBUG_DISPLAY, // Used to check each bit of the debug command paramater.
144         // Update DEBUG_MAX_VAL when adding new debug tag.
145     };
146 
147     enum {
148         PREF_POST_PROCESSING,
149         PREF_PARTIAL_UPDATE,
150         ENABLE_PARTIAL_UPDATE,
151     };
152 
153     enum {
154         QSYNC_MODE_NONE,
155         QSYNC_MODE_CONTINUOUS,
156         QSYNC_MODE_ONESHOT,    // Not supported
157     };
158 
159     // Register a HWC client that can be notified
160     // This client is generic and is intended to get
161     // dispatches of all events calling into QService
162     virtual void connect(const android::sp<qClient::IQClient>& client) = 0;
163     // Register an HDMI client. This client gets notification of HDMI events
164     // such as plug/unplug and CEC messages
165     virtual void connect(const android::sp<qClient::IQHDMIClient>& client) = 0;
166     // Generic function to dispatch binder commands
167     // The type of command decides how the data is parceled
168     virtual android::status_t dispatch(uint32_t command,
169             const android::Parcel* inParcel,
170             android::Parcel* outParcel) = 0;
171 };
172 
173 // ----------------------------------------------------------------------------
174 
175 class BnQService : public android::BnInterface<IQService>
176 {
177 public:
178     virtual android::status_t onTransact( uint32_t code,
179                                           const android::Parcel& data,
180                                           android::Parcel* reply,
181                                           uint32_t flags = 0);
182 };
183 
184 // ----------------------------------------------------------------------------
185 }; // namespace qService
186 
187 #endif // ANDROID_IQSERVICE_H
188