1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <stdint.h>
18 #include <sys/types.h>
19 
20 #include <utils/Errors.h>
21 #include <utils/RefBase.h>
22 #include <utils/Timers.h>
23 
24 #include <binder/Parcel.h>
25 #include <binder/IInterface.h>
26 
27 #include "IExynosHWC.h"
28 
29 namespace android {
30 
31 enum {
32     ADD_VIRTUAL_DISPLAY_DEVICE = 0,
33     DESTROY_VIRTUAL_DISPLAY_DEVICE,
34     SET_WFD_MODE,
35     GET_WFD_MODE,
36     SEND_WFD_COMMAND,
37     SET_SECURE_VDS_MODE,
38     SET_WFD_OUTPUT_RESOLUTION,
39     GET_WFD_OUTPUT_RESOLUTION,
40     SET_PRESENTATION_MODE,
41     GET_PRESENTATION_MODE,
42     SET_VDS_GLES_FORMAT,
43     HWC_CONTROL,
44     SET_BOOT_FINISHED,
45     SET_VIRTUAL_HPD,
46     GET_EXTERNAL_DISPLAY_CONFIG,
47     SET_EXTERNAL_DISPLAY_CONFIG,
48     ENABLE_MPP,
49     SET_EXTERNAL_VSYNC,
50     SET_DDISCALER,
51     GET_EXTERNAL_HDR_CAPA,
52     SET_SCALE_DOWN_RATIO,
53 #if 0
54     NOTIFY_PSR_EXIT,
55 #endif
56     SET_HWC_DEBUG = 105,
57     GET_HWC_DEBUG = 106,
58     SET_HWC_FENCE_DEBUG = 107,
59     GET_HWC_FENCE_DEBUG = 108,
60     SET_DISPLAY_DEVICE_MODE = 1000,
61     SET_PANEL_GAMMA_TABLE_SOURCE = 1001,
62     SET_DISPLAY_BRIGHTNESS = 1002,
63     SET_DISPLAY_LHBM = 1003,
64     SET_LBE_CTRL = 1004,
65     SET_MIN_IDLE_REFRESH_RATE = 1005,
66     SET_REFRESH_RATE_THROTTLE = 1006,
67 };
68 
69 class BpExynosHWCService : public BpInterface<IExynosHWCService> {
70 public:
BpExynosHWCService(const sp<IBinder> & impl)71     BpExynosHWCService(const sp<IBinder>& impl)
72         : BpInterface<IExynosHWCService>(impl)
73     {
74     }
75 
addVirtualDisplayDevice()76     virtual int addVirtualDisplayDevice()
77     {
78         Parcel data, reply;
79         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
80         int result = remote()->transact(ADD_VIRTUAL_DISPLAY_DEVICE, data, &reply);
81         if (result == NO_ERROR)
82             result = reply.readInt32();
83         else
84             ALOGE("ADD_VIRTUAL_DISPLAY_DEVICE transact error(%d)", result);
85         return result;
86     }
87 
destroyVirtualDisplayDevice()88     virtual int destroyVirtualDisplayDevice()
89     {
90         Parcel data, reply;
91         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
92         int result = remote()->transact(DESTROY_VIRTUAL_DISPLAY_DEVICE, data, &reply);
93         if (result == NO_ERROR)
94             result = reply.readInt32();
95         else
96             ALOGE("DESTROY_VIRTUAL_DISPLAY_DEVICE transact error(%d)", result);
97         return result;
98     }
99 
setWFDMode(unsigned int mode)100     virtual int setWFDMode(unsigned int mode)
101     {
102         Parcel data, reply;
103         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
104         data.writeInt32(mode);
105         int result = remote()->transact(SET_WFD_MODE, data, &reply);
106         if (result == NO_ERROR)
107             result = reply.readInt32();
108         else
109             ALOGE("SET_WFD_MODE transact error(%d)", result);
110         return result;
111     }
112 
getWFDMode()113     virtual int getWFDMode()
114     {
115         Parcel data, reply;
116         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
117         int result = remote()->transact(GET_WFD_MODE, data, &reply);
118         if (result == NO_ERROR)
119             result = reply.readInt32();
120         else
121             ALOGE("GET_WFD_MODE transact error(%d)", result);
122         return result;
123     }
124 
sendWFDCommand(int32_t cmd,int32_t ext1,int32_t ext2)125     virtual int sendWFDCommand(int32_t cmd, int32_t ext1, int32_t ext2)
126     {
127         Parcel data, reply;
128         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
129         data.writeInt32(cmd);
130         data.writeInt32(ext1);
131         data.writeInt32(ext2);
132         int result = remote()->transact(SEND_WFD_COMMAND, data, &reply);
133         if (result == NO_ERROR)
134             result = reply.readInt32();
135         else
136             ALOGE("SEND_WFD_COMMAND transact error(%d)", result);
137         return result;
138     }
139 
setSecureVDSMode(unsigned int mode)140     virtual int setSecureVDSMode(unsigned int mode)
141     {
142         Parcel data, reply;
143         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
144         data.writeInt32(mode);
145         int result = remote()->transact(SET_SECURE_VDS_MODE, data, &reply);
146         if (result == NO_ERROR)
147             result = reply.readInt32();
148         else
149             ALOGE("SET_SECURE_VDS_MODE transact error(%d)", result);
150         return result;
151     }
152 
setWFDOutputResolution(unsigned int width,unsigned int height)153     virtual int setWFDOutputResolution(unsigned int width, unsigned int height)
154     {
155         Parcel data, reply;
156         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
157         data.writeInt32(width);
158         data.writeInt32(height);
159         int result = remote()->transact(SET_WFD_OUTPUT_RESOLUTION, data, &reply);
160         if (result == NO_ERROR)
161             result = reply.readInt32();
162         else
163             ALOGE("SET_WFD_OUTPUT_RESOLUTION transact error(%d)", result);
164         return result;
165     }
166 
getWFDOutputResolution(unsigned int * width,unsigned int * height)167     virtual void getWFDOutputResolution(unsigned int *width, unsigned int *height)
168     {
169         Parcel data, reply;
170         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
171         int result = remote()->transact(GET_WFD_OUTPUT_RESOLUTION, data, &reply);
172         if (result == NO_ERROR) {
173             *width  = reply.readInt32();
174             *height = reply.readInt32();
175         } else
176             ALOGE("GET_WFD_OUTPUT_RESOLUTION transact error(%d)", result);
177     }
178 
setPresentationMode(bool use)179     virtual void setPresentationMode(bool use)
180     {
181         Parcel data, reply;
182         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
183         data.writeInt32(use);
184         int result = remote()->transact(SET_PRESENTATION_MODE, data, &reply);
185         if (result != NO_ERROR)
186             ALOGE("SET_PRESENTATION_MODE transact error(%d)", result);
187     }
188 
getPresentationMode(void)189     virtual int getPresentationMode(void)
190     {
191         Parcel data, reply;
192         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
193         int result = remote()->transact(GET_PRESENTATION_MODE, data, &reply);
194         if (result == NO_ERROR)
195             result = reply.readInt32();
196         else
197             ALOGE("GET_PRESENTATION_MODE transact error(%d)", result);
198         return result;
199     }
200 
setVDSGlesFormat(int format)201     virtual int setVDSGlesFormat(int format)
202     {
203         Parcel data, reply;
204         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
205         data.writeInt32(format);
206         int result = remote()->transact(SET_VDS_GLES_FORMAT, data, &reply);
207         if (result == NO_ERROR)
208             result = reply.readInt32();
209         else
210             ALOGE("SET_VDS_GLES_FORMAT transact error(%d)", result);
211         return result;
212     }
213 
getExternalDisplayConfigs()214     virtual int getExternalDisplayConfigs()
215     {
216         Parcel data, reply;
217         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
218         int result = remote()->transact(GET_EXTERNAL_DISPLAY_CONFIG, data, &reply);
219         if (result == NO_ERROR)
220             result = reply.readInt32();
221         else
222             ALOGE("GET_EXTERNAL_DISPLAY_CONFIG transact error(%d)", result);
223         return result;
224     }
225 
setExternalDisplayConfig(unsigned int index)226     virtual int setExternalDisplayConfig(unsigned int index)
227     {
228         Parcel data, reply;
229         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
230         data.writeInt32(index);
231         int result = remote()->transact(SET_EXTERNAL_DISPLAY_CONFIG, data, &reply);
232         if (result == NO_ERROR)
233             result = reply.readInt32();
234         else
235             ALOGE("SET_EXTERNAL_DISPLAY_CONFIG transact error(%d)", result);
236         return result;
237     }
238 
setExternalVsyncEnabled(unsigned int index)239     virtual int setExternalVsyncEnabled(unsigned int index)
240     {
241         Parcel data, reply;
242         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
243         data.writeInt32(index);
244         int result = remote()->transact(SET_EXTERNAL_VSYNC, data, &reply);
245         if (result == NO_ERROR)
246             result = reply.readInt32();
247         else
248             ALOGE("SET_EXTERNAL_VSYNC transact error(%d)", result);
249         return result;
250     }
251 
getExternalHdrCapabilities()252     virtual int getExternalHdrCapabilities()
253     {
254         Parcel data, reply;
255         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
256         int result = remote()->transact(GET_EXTERNAL_HDR_CAPA, data, &reply);
257         if (result == NO_ERROR)
258             result = reply.readInt32();
259         else
260             ALOGE("GET_EXTERNAL_HDR_CAPA transact error(%d)", result);
261 
262         return result;
263     }
264 
setBootFinished()265     virtual void setBootFinished()
266     {
267         Parcel data, reply;
268         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
269         int result = remote()->transact(SET_BOOT_FINISHED, data, &reply);
270         if (result != NO_ERROR)
271             ALOGE("SET_BOOT_FINISHED transact error(%d)", result);
272     }
273 
enableMPP(uint32_t physicalType,uint32_t physicalIndex,uint32_t logicalIndex,uint32_t enable)274     virtual void enableMPP(uint32_t physicalType, uint32_t physicalIndex, uint32_t logicalIndex, uint32_t enable)
275     {
276         Parcel data, reply;
277         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
278         data.writeInt32(physicalType);
279         data.writeInt32(physicalIndex);
280         data.writeInt32(logicalIndex);
281         data.writeInt32(enable);
282         int result = remote()->transact(ENABLE_MPP, data, &reply);
283         if (result != NO_ERROR)
284             ALOGE("ENABLE_MPP transact error(%d)", result);
285     }
286 
setScaleDownRatio(uint32_t physicalType,uint32_t physicalIndex,uint32_t logicalIndex,uint32_t scaleDownRatio)287     virtual void setScaleDownRatio(uint32_t physicalType, uint32_t physicalIndex,
288             uint32_t logicalIndex, uint32_t scaleDownRatio)
289     {
290         Parcel data, reply;
291         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
292         data.writeInt32(physicalType);
293         data.writeInt32(physicalIndex);
294         data.writeInt32(logicalIndex);
295         data.writeInt32(scaleDownRatio);
296         int result = remote()->transact(SET_SCALE_DOWN_RATIO, data, &reply);
297         if (result != NO_ERROR)
298             ALOGE("SET_SCALE_DOWN_RATIO transact error(%d)", result);
299     }
300 
setLbeCtrl(uint32_t display_id,uint32_t state,uint32_t lux)301     virtual void setLbeCtrl(uint32_t display_id, uint32_t state, uint32_t lux) {
302         Parcel data, reply;
303         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
304         data.writeInt32(display_id);
305         data.writeInt32(state);
306         data.writeInt32(lux);
307         int result = remote()->transact(SET_LBE_CTRL, data, &reply);
308         if (result != NO_ERROR) ALOGE("SET_LBE_CTRL transact error(%d)", result);
309     }
310 
setHWCDebug(int debug)311     virtual void setHWCDebug(int debug)
312     {
313         Parcel data, reply;
314         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
315         data.writeInt32(debug);
316         int result = remote()->transact(SET_HWC_DEBUG, data, &reply);
317         if (result != NO_ERROR)
318             ALOGE("SET_HWC_DEBUG transact error(%d)", result);
319     }
320 
getHWCDebug()321     virtual uint32_t getHWCDebug()
322     {
323         Parcel data, reply;
324         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
325         int result = remote()->transact(GET_HWC_DEBUG, data, &reply);
326         if (result == NO_ERROR)
327             result = reply.readInt32();
328         else {
329             ALOGE("GET_HWC_DEBUG transact error(%d)", result);
330         }
331         return result;
332     }
333 
setHWCFenceDebug(uint32_t fenceNum,uint32_t ipNum,uint32_t mode)334     virtual void setHWCFenceDebug(uint32_t fenceNum, uint32_t ipNum, uint32_t mode)
335     {
336         Parcel data, reply;
337         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
338         data.writeInt32(fenceNum);
339         data.writeInt32(ipNum);
340         data.writeInt32(mode);
341         remote()->transact(SET_HWC_FENCE_DEBUG, data, &reply);
342     }
343 
getHWCFenceDebug()344     virtual void getHWCFenceDebug()
345     {
346         Parcel data, reply;
347         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
348         remote()->transact(GET_HWC_FENCE_DEBUG, data, &reply);
349     }
350 
setHWCCtl(uint32_t display,uint32_t ctrl,int32_t val)351     virtual int setHWCCtl(uint32_t display, uint32_t ctrl, int32_t val) {
352         Parcel data, reply;
353         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
354         data.writeInt32(display);
355         data.writeInt32(ctrl);
356         data.writeInt32(val);
357         int result = remote()->transact(HWC_CONTROL, data, &reply);
358         if (result == NO_ERROR)
359             result = reply.readInt32();
360         else
361             ALOGE("HWC_CONTROL transact error(%d)", result);
362         return result;
363     };
364 
setDDIScaler(uint32_t width,uint32_t height)365     virtual int setDDIScaler(uint32_t width, uint32_t height) {
366         Parcel data, reply;
367         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
368         data.writeInt32(width);
369         data.writeInt32(height);
370         int result = remote()->transact(SET_DDISCALER, data, &reply);
371         if (result == NO_ERROR)
372             result = reply.readInt32();
373         else
374             ALOGE("SET_DDISCALER transact error(%d)", result);
375         return result;
376     }
377 
378     /*
379     virtual void notifyPSRExit()
380     {
381         Parcel data, reply;
382         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
383         remote()->transact(NOTIFY_PSR_EXIT, data, &reply);
384     }
385     */
386 
setDisplayDeviceMode(int32_t display_id,int32_t mode)387     int32_t setDisplayDeviceMode(int32_t display_id, int32_t mode)
388     {
389         ALOGD("null func: %s(%d %d)", __func__, display_id, mode);
390         return NO_ERROR;
391     }
392 
setPanelGammaTableSource(int32_t display_id,int32_t type,int32_t source)393     virtual int32_t setPanelGammaTableSource(int32_t display_id, int32_t type, int32_t source) {
394         ALOGD("null func: %s(%d %d %d)", __func__, display_id, type, source);
395         return NO_ERROR;
396     }
397 
setDisplayBrightness(int32_t display_id,float brightness)398     virtual int32_t setDisplayBrightness(int32_t display_id, float brightness) {
399         Parcel data, reply;
400         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
401         data.writeInt32(display_id);
402         data.writeFloat(brightness);
403         int result = remote()->transact(SET_DISPLAY_BRIGHTNESS, data, &reply);
404         if (result)
405             ALOGE("SET_DISPLAY_BRIGHTNESS transact error(%d)", result);
406         return result;
407     }
408 
setDisplayLhbm(int32_t display_id,uint32_t on)409     virtual int32_t setDisplayLhbm(int32_t display_id, uint32_t on) {
410         Parcel data, reply;
411         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
412         data.writeInt32(display_id);
413         data.writeInt32(on);
414         int result = remote()->transact(SET_DISPLAY_LHBM, data, &reply);
415         if (result) ALOGE("SET_DISPLAY_LHBM transact error(%d)", result);
416         return result;
417     }
418 
setMinIdleRefreshRate(uint32_t display_id,int32_t fps)419     virtual int32_t setMinIdleRefreshRate(uint32_t display_id, int32_t fps) {
420         Parcel data, reply;
421         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
422         data.writeUint32(display_id);
423         data.writeInt32(fps);
424         int result = remote()->transact(SET_MIN_IDLE_REFRESH_RATE, data, &reply);
425         if (result) ALOGE("SET_MIN_IDLE_REFRESH_RATE transact error(%d)", result);
426         return result;
427     }
428 
setRefreshRateThrottle(uint32_t display_id,int32_t delay_ms)429     virtual int32_t setRefreshRateThrottle(uint32_t display_id, int32_t delay_ms) {
430         Parcel data, reply;
431         data.writeInterfaceToken(IExynosHWCService::getInterfaceDescriptor());
432         data.writeUint32(display_id);
433         data.writeInt32(delay_ms);
434         int result = remote()->transact(SET_REFRESH_RATE_THROTTLE, data, &reply);
435         if (result) ALOGE("SET_REFRESH_RATE_THROTTLE transact error(%d)", result);
436         return result;
437     }
438 };
439 
440 IMPLEMENT_META_INTERFACE(ExynosHWCService, "android.hal.ExynosHWCService");
441 
onTransact(uint32_t code,const Parcel & data,Parcel * reply,uint32_t flags)442 status_t BnExynosHWCService::onTransact(
443     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
444 {
445     switch(code) {
446         case ADD_VIRTUAL_DISPLAY_DEVICE: {
447             CHECK_INTERFACE(IExynosHWCService, data, reply);
448             int res = addVirtualDisplayDevice();
449             reply->writeInt32(res);
450             return NO_ERROR;
451         } break;
452         case DESTROY_VIRTUAL_DISPLAY_DEVICE: {
453             CHECK_INTERFACE(IExynosHWCService, data, reply);
454             int res = destroyVirtualDisplayDevice();
455             reply->writeInt32(res);
456             return NO_ERROR;
457         } break;
458         case SET_WFD_MODE: {
459             CHECK_INTERFACE(IExynosHWCService, data, reply);
460             int mode = data.readInt32();
461             int res = setWFDMode(mode);
462             reply->writeInt32(res);
463             return NO_ERROR;
464         } break;
465         case GET_WFD_MODE: {
466             CHECK_INTERFACE(IExynosHWCService, data, reply);
467             int res = getWFDMode();
468             reply->writeInt32(res);
469             return NO_ERROR;
470         } break;
471         case SEND_WFD_COMMAND: {
472             CHECK_INTERFACE(IExynosHWCService, data, reply);
473             int cmd = data.readInt32();
474             int ext1 = data.readInt32();
475             int ext2 = data.readInt32();
476             int res = sendWFDCommand(cmd, ext1, ext2);
477             reply->writeInt32(res);
478             return NO_ERROR;
479         } break;
480         case SET_SECURE_VDS_MODE: {
481             CHECK_INTERFACE(IExynosHWCService, data, reply);
482             int mode = data.readInt32();
483             int res = setSecureVDSMode(mode);
484             reply->writeInt32(res);
485             return NO_ERROR;
486         } break;
487         case SET_WFD_OUTPUT_RESOLUTION: {
488             CHECK_INTERFACE(IExynosHWCService, data, reply);
489             int width  = data.readInt32();
490             int height = data.readInt32();
491             int res = setWFDOutputResolution(width, height);
492             reply->writeInt32(res);
493             return NO_ERROR;
494         } break;
495         case GET_WFD_OUTPUT_RESOLUTION: {
496             CHECK_INTERFACE(IExynosHWCService, data, reply);
497             uint32_t width, height;
498             getWFDOutputResolution(&width, &height);
499             reply->writeInt32(width);
500             reply->writeInt32(height);
501             return NO_ERROR;
502         } break;
503         case SET_PRESENTATION_MODE: {
504             CHECK_INTERFACE(IExynosHWCService, data, reply);
505             int use = data.readInt32();
506             setPresentationMode(use);
507             return NO_ERROR;
508         } break;
509         case GET_PRESENTATION_MODE: {
510             CHECK_INTERFACE(IExynosHWCService, data, reply);
511             int res = getPresentationMode();
512             reply->writeInt32(res);
513             return NO_ERROR;
514         } break;
515         case SET_VDS_GLES_FORMAT: {
516             CHECK_INTERFACE(IExynosHWCService, data, reply);
517             int format  = data.readInt32();
518             int res = setVDSGlesFormat(format);
519             reply->writeInt32(res);
520             return NO_ERROR;
521         } break;
522        case HWC_CONTROL: {
523             CHECK_INTERFACE(IExynosHWCService, data, reply);
524             int display = data.readInt32();
525             int ctrl = data.readInt32();
526             int value = data.readInt32();
527             int res = setHWCCtl(display, ctrl, value);
528             reply->writeInt32(res);
529             return NO_ERROR;
530         } break;
531         case GET_EXTERNAL_DISPLAY_CONFIG: {
532             CHECK_INTERFACE(IExynosHWCService, data, reply);
533             int res = getExternalDisplayConfigs();
534             reply->writeInt32(res);
535             return NO_ERROR;
536         } break;
537         case SET_EXTERNAL_DISPLAY_CONFIG: {
538             CHECK_INTERFACE(IExynosHWCService, data, reply);
539             int index = data.readInt32();
540             int res = setExternalDisplayConfig(index);
541             reply->writeInt32(res);
542             return NO_ERROR;
543         } break;
544         case SET_EXTERNAL_VSYNC: {
545             CHECK_INTERFACE(IExynosHWCService, data, reply);
546             int index = data.readInt32();
547             int res = setExternalVsyncEnabled(index);
548             reply->writeInt32(res);
549             return NO_ERROR;
550         } break;
551         case GET_EXTERNAL_HDR_CAPA: {
552             CHECK_INTERFACE(IExynosHWCService, data, reply);
553             int res = getExternalHdrCapabilities();
554             reply->writeInt32(res);
555             return NO_ERROR;
556         } break;
557         case SET_BOOT_FINISHED: {
558             CHECK_INTERFACE(IExynosHWCService, data, reply);
559             setBootFinished();
560             return NO_ERROR;
561         } break;
562         case ENABLE_MPP: {
563             CHECK_INTERFACE(IExynosHWCService, data, reply);
564             uint32_t type = data.readInt32();
565             uint32_t physicalIdx = data.readInt32();
566             uint32_t logicalIdx = data.readInt32();
567             uint32_t enable = data.readInt32();
568             enableMPP(type, physicalIdx, logicalIdx, enable);
569             return NO_ERROR;
570         } break;
571         case SET_SCALE_DOWN_RATIO: {
572             CHECK_INTERFACE(IExynosHWCService, data, reply);
573             uint32_t type = data.readInt32();
574             uint32_t physicalIdx = data.readInt32();
575             uint32_t logicalIdx = data.readInt32();
576             uint32_t scaleDownRatio = data.readInt32();
577             setScaleDownRatio(type, physicalIdx, logicalIdx, scaleDownRatio);
578             return NO_ERROR;
579         } break;
580         case SET_HWC_DEBUG: {
581             CHECK_INTERFACE(IExynosHWCService, data, reply);
582             int debug = data.readInt32();
583             setHWCDebug(debug);
584             reply->writeInt32(debug);
585             return NO_ERROR;
586         } break;
587         case GET_HWC_DEBUG: {
588             CHECK_INTERFACE(IExynosHWCService, data, reply);
589             int debugFlag = getHWCDebug();
590             reply->writeInt32(debugFlag);
591             return NO_ERROR;
592         } break;
593         case SET_HWC_FENCE_DEBUG: {
594             CHECK_INTERFACE(IExynosHWCService, data, reply);
595             uint32_t fenceNum = data.readInt32();
596             uint32_t ipNum = data.readInt32();
597             uint32_t mode = data.readInt32();
598             setHWCFenceDebug(fenceNum, ipNum, mode);
599             return NO_ERROR;
600         } break;
601         case SET_DDISCALER: {
602             CHECK_INTERFACE(IExynosHWCService, data, reply);
603             uint32_t width = data.readInt32();
604             uint32_t height = data.readInt32();
605             int error = setDDIScaler(width, height);
606             reply->writeInt32(error);
607             return NO_ERROR;
608         } break;
609 
610 #if 0
611         case SET_HWC_CTL_MAX_OVLY_CNT: {
612             CHECK_INTERFACE(IExynosHWCService, data, reply);
613             int val = data.readInt32();
614             setHWCCtl(SET_HWC_CTL_MAX_OVLY_CNT, val);
615             return NO_ERROR;
616         } break;
617         case SET_HWC_CTL_VIDEO_OVLY_CNT: {
618             CHECK_INTERFACE(IExynosHWCService, data, reply);
619             int val = data.readInt32();
620             setHWCCtl(SET_HWC_CTL_VIDEO_OVLY_CNT, val);
621             return NO_ERROR;
622         } break;
623          case SET_HWC_CTL_DYNAMIC_RECOMP: {
624             CHECK_INTERFACE(IExynosHWCService, data, reply);
625             int val = data.readInt32();
626             setHWCCtl(SET_HWC_CTL_DYNAMIC_RECOMP, val);
627             return NO_ERROR;
628         } break;
629         case SET_HWC_CTL_SKIP_STATIC: {
630             CHECK_INTERFACE(IExynosHWCService, data, reply);
631             int val = data.readInt32();
632             setHWCCtl(SET_HWC_CTL_SKIP_STATIC, val);
633             return NO_ERROR;
634         } break;
635         case SET_HWC_CTL_SECURE_DMA: {
636             CHECK_INTERFACE(IExynosHWCService, data, reply);
637             int val = data.readInt32();
638             setHWCCtl(SET_HWC_CTL_SECURE_DMA, val);
639             return NO_ERROR;
640         } break;
641         case NOTIFY_PSR_EXIT: {
642             CHECK_INTERFACE(IExynosHWCService, data, reply);
643             notifyPSRExit();
644             return NO_ERROR;
645         }
646 #endif
647         case SET_DISPLAY_DEVICE_MODE: {
648             CHECK_INTERFACE(IExynosHWCService, data, reply);
649             int32_t display_id = data.readInt32();
650             int32_t mode = data.readInt32();
651             int32_t error = setDisplayDeviceMode(display_id, mode);
652             reply->writeInt32(error);
653             return NO_ERROR;
654         } break;
655         case SET_PANEL_GAMMA_TABLE_SOURCE: {
656             CHECK_INTERFACE(IExynosHWCService, data, reply);
657             int32_t display_id = data.readInt32();
658             int32_t type = data.readInt32();
659             int32_t source = data.readInt32();
660             int32_t error = setPanelGammaTableSource(display_id, type, source);
661             reply->writeInt32(error);
662             return NO_ERROR;
663         } break;
664 
665         case SET_DISPLAY_BRIGHTNESS: {
666             CHECK_INTERFACE(IExynosHWCService, data, reply);
667             int32_t display_id = data.readInt32();
668             float brightness = data.readFloat();
669             int32_t error = setDisplayBrightness(display_id, brightness);
670             reply->writeInt32(error);
671             return NO_ERROR;
672         } break;
673 
674         case SET_DISPLAY_LHBM: {
675             CHECK_INTERFACE(IExynosHWCService, data, reply);
676             int32_t display_id = data.readInt32();
677             uint32_t on = data.readInt32();
678             int32_t error = setDisplayLhbm(display_id, on);
679             reply->writeInt32(error);
680             return NO_ERROR;
681         } break;
682 
683         case SET_LBE_CTRL: {
684             CHECK_INTERFACE(IExynosHWCService, data, reply);
685             uint32_t display_id = data.readInt32();
686             uint32_t state = data.readInt32();
687             uint32_t lux = data.readInt32();
688             setLbeCtrl(display_id, state, lux);
689             return NO_ERROR;
690         } break;
691 
692         case SET_MIN_IDLE_REFRESH_RATE: {
693             CHECK_INTERFACE(IExynosHWCService, data, reply);
694             uint32_t display_id = data.readUint32();
695             int32_t fps = data.readInt32();
696             return setMinIdleRefreshRate(display_id, fps);
697         } break;
698 
699         case SET_REFRESH_RATE_THROTTLE: {
700             CHECK_INTERFACE(IExynosHWCService, data, reply);
701             uint32_t display_id = data.readUint32();
702             int32_t delay_ms = data.readInt32();
703             return setRefreshRateThrottle(display_id, delay_ms);
704         } break;
705 
706         default:
707             return BBinder::onTransact(code, data, reply, flags);
708     }
709 }
710 }
711