hwc: Add vpu client

Stub implementation of VPU in HWC.
This commit passes through binder calls from HWC
to the VPU library. It also has stub prepare/draw calls
in the VPU client object which can be used to configure
VPU in the composition cycle.

Change-Id: I2606f2884e870448d29ef26e02faac92e157e2c6
diff --git a/libqservice/IQService.cpp b/libqservice/IQService.cpp
index e45f42e..33f79c6 100644
--- a/libqservice/IQService.cpp
+++ b/libqservice/IQService.cpp
@@ -85,6 +85,15 @@
         data.writeInt32(enable);
         remote()->transact(BUFFER_MIRRORMODE, data, &reply);
     }
+
+    virtual status_t vpuCommand(uint32_t command, uint32_t setting) {
+        Parcel data, reply;
+        data.writeInterfaceToken(IQService::getInterfaceDescriptor());
+        data.writeInt32(setting);
+        remote()->transact(command, data, &reply);
+        status_t result = reply.readInt32();
+        return result;
+    }
 };
 
 IMPLEMENT_META_INTERFACE(QService, "android.display.IQService");
@@ -107,6 +116,18 @@
 
     const bool permission = (callerUid == AID_MEDIA);
 
+    if (code > VPU_COMMAND_LIST_START && code < VPU_COMMAND_LIST_END) {
+        if(callerUid != AID_SYSTEM && callerUid != AID_ROOT) {
+            ALOGE("display.qservice VPU command access denied: \
+                  pid=%d uid=%d process=%s",callerPid,
+                  callerUid, callingProcName);
+            return PERMISSION_DENIED;
+        }
+        CHECK_INTERFACE(IQService, data, reply);
+        int32_t setting = data.readInt32();
+        return vpuCommand(code, setting);
+    }
+
     switch(code) {
         case SECURING: {
             if(!permission) {