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