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 #ifndef ANDROID_IQSERVICE_H
22 #define ANDROID_IQSERVICE_H
23 
24 #include <stdint.h>
25 #include <sys/types.h>
26 #include <utils/Errors.h>
27 #include <utils/RefBase.h>
28 #include <binder/IInterface.h>
29 #include <binder/IBinder.h>
30 #include <IQClient.h>
31 #include <IQHDMIClient.h>
32 
33 
34 namespace qService {
35 // ----------------------------------------------------------------------------
36 
37 class IQService : public android::IInterface
38 {
39 public:
40     DECLARE_META_INTERFACE(QService);
41     enum {
42       COMMAND_LIST_START = android::IBinder::FIRST_CALL_TRANSACTION,
43       GET_PANEL_BRIGHTNESS = 2,                // Provides ability to set the panel brightness
44       SET_PANEL_BRIGHTNESS = 3,                // Provides ability to get the panel brightness
45       CONNECT_HWC_CLIENT = 4,                  // Connect to qservice
46       SCREEN_REFRESH = 5,                      // Refresh screen through SF invalidate
47       GET_DISPLAY_VISIBLE_REGION = 11,         // Get the visibleRegion for dpy
48       SET_SECONDARY_DISPLAY_STATUS = 12,       // Sets secondary display status
49       SET_MAX_PIPES_PER_MIXER = 13,            // Set max pipes per mixer for MDPComp
50       DYNAMIC_DEBUG = 15,                      // Enable more logging on the fly
51       SET_IDLE_TIMEOUT = 16,                   // Set idle timeout for GPU fallback
52       CONFIGURE_DYN_REFRESH_RATE = 18,         //  Enable/Disable/Set refresh rate dynamically
53       CONTROL_PARTIAL_UPDATE = 19,             // Provides ability to enable/disable partial update
54       TOGGLE_SCREEN_UPDATES = 20,              // Provides ability to set the panel brightness
55       SET_FRAME_DUMP_CONFIG = 21,              // Provides ability to set the frame dump config
56       CONNECT_HDMI_CLIENT = 23,                // Connect HDMI CEC HAL Client
57       QDCM_SVC_CMDS = 24,                      // request QDCM services.
58       SET_ACTIVE_CONFIG = 25,                  // Set a specified display config
59       GET_ACTIVE_CONFIG = 26,                  // Get the current config index
60       GET_CONFIG_COUNT = 27,                   // Get the number of supported display configs
61       GET_DISPLAY_ATTRIBUTES_FOR_CONFIG = 28,  // Get attr for specified config
62       SET_DISPLAY_MODE = 29,                   // Set display mode to command or video mode
63       SET_CAMERA_STATUS = 30,                  // To notify display when camera is on and off
64       MIN_HDCP_ENCRYPTION_LEVEL_CHANGED = 31,
65       GET_BW_TRANSACTION_STATUS = 32,   // Client can query BW transaction status.
66       SET_LAYER_MIXER_RESOLUTION = 33,  // Enables client to set layer mixer resolution.
67       SET_COLOR_MODE = 34,              // Overrides the QDCM mode on the display
68       SET_COLOR_MODE_BY_ID = 36,        // Overrides the QDCM mode using the given mode ID
69       GET_COMPOSER_STATUS = 37,  // Get composer init status-true if primary display init is done
70       SET_QSYNC_MODE = 38,       // Set qsync mode. 0 - (none)disable qsync, 1 - continuous mode.
71       SET_COLOR_MODE_WITH_RENDER_INTENT = 39,  // Overrides the QDCM mode with render intent
72       SET_IDLE_PC = 40,                        // Enable/disable Idle power collapse
73       SET_DPPS_AD4_ROI_CONFIG = 41,            // Set ad4 roi config for debug
74       SET_DSI_CLK = 42,                        // Set DSI Clk.
75       GET_DSI_CLK = 43,                        // Get DSI Clk.
76       GET_SUPPORTED_DSI_CLK = 44,              // Get supported DSI Clk.
77       SET_COLOR_MODE_FROM_CLIENT = 45,         // Overrides the QDCM mode using the given mode ID
78       SET_FRAME_TRIGGER_MODE = 46,             // Set frame trigger mode for debug
79       SET_PANEL_LUMINANCE = 47,                // Set Panel Luminance attributes.
80       SET_BRIGHTNESS_SCALE = 48,               // Set brightness scale ratio
81       SET_COLOR_SAMPLING_ENABLED = 49,         // Toggle the collection of display color stats
82       SET_STAND_BY_MODE = 50,                  // Set stand by mode for MDP hardware
83       SET_DISPLAY_DEVICE_STATUS = 100,         // Set display device status
84       SET_PANEL_GAMMA_TABLE_SOURCE = 101,      // Update panel gamma table
85       COMMAND_LIST_END = 400,
86     };
87 
88     enum {
89         END = 0,
90         START,
91     };
92 
93     enum {
94         DEBUG_ALL,
95         DEBUG_MDPCOMP,
96         DEBUG_VSYNC,
97         DEBUG_VD,
98         DEBUG_PIPE_LIFECYCLE,
99         DEBUG_DRIVER_CONFIG,
100         DEBUG_ROTATOR,
101         DEBUG_QDCM,
102         DEBUG_SCALAR,
103         DEBUG_CLIENT,
104         DEBUG_DISPLAY,
105         DEBUG_MAX_VAL = DEBUG_DISPLAY, // Used to check each bit of the debug command paramater.
106         // Update DEBUG_MAX_VAL when adding new debug tag.
107     };
108 
109     enum {
110         PREF_POST_PROCESSING,
111         PREF_PARTIAL_UPDATE,
112         ENABLE_PARTIAL_UPDATE,
113     };
114 
115     enum {
116         QSYNC_MODE_NONE,
117         QSYNC_MODE_CONTINUOUS,
118         QSYNC_MODE_ONESHOT,    // Not supported
119     };
120 
121     // Register a HWC client that can be notified
122     // This client is generic and is intended to get
123     // dispatches of all events calling into QService
124     virtual void connect(const android::sp<qClient::IQClient>& client) = 0;
125     // Register an HDMI client. This client gets notification of HDMI events
126     // such as plug/unplug and CEC messages
127     virtual void connect(const android::sp<qClient::IQHDMIClient>& client) = 0;
128     // Generic function to dispatch binder commands
129     // The type of command decides how the data is parceled
130     virtual android::status_t dispatch(uint32_t command,
131             const android::Parcel* inParcel,
132             android::Parcel* outParcel) = 0;
133 };
134 
135 // ----------------------------------------------------------------------------
136 
137 class BnQService : public android::BnInterface<IQService>
138 {
139 public:
140     virtual android::status_t onTransact( uint32_t code,
141                                           const android::Parcel& data,
142                                           android::Parcel* reply,
143                                           uint32_t flags = 0);
144 };
145 
146 // ----------------------------------------------------------------------------
147 }; // namespace qService
148 
149 #endif // ANDROID_IQSERVICE_H
150