Merge "hwc : Fix cache based partial MDP composition."
diff --git a/libhwcomposer/hwc_qclient.cpp b/libhwcomposer/hwc_qclient.cpp
index 3b98788..a3f6b5b 100644
--- a/libhwcomposer/hwc_qclient.cpp
+++ b/libhwcomposer/hwc_qclient.cpp
@@ -86,12 +86,10 @@
static android::status_t screenRefresh(hwc_context_t *ctx) {
status_t result = NO_INIT;
-#ifdef QCOM_BSP
if(ctx->proc) {
ctx->proc->invalidate(ctx->proc);
result = NO_ERROR;
}
-#endif
return result;
}
@@ -100,11 +98,9 @@
const Parcel* inParcel,
Parcel* outParcel) {
status_t result = NO_INIT;
-#ifdef QCOM_BSP
#ifdef VPU_TARGET
result = ctx->mVPUClient->processCommand(command, inParcel, outParcel);
#endif
-#endif
return result;
}
@@ -112,6 +108,34 @@
ctx->mExtOrientation = orientation;
}
+static void isExternalConnected(hwc_context_t* ctx, Parcel* outParcel) {
+ int connected;
+ connected = ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected ? 1 : 0;
+ outParcel->writeInt32(connected);
+}
+
+static void getDisplayAttributes(hwc_context_t* ctx, const Parcel* inParcel,
+ Parcel* outParcel) {
+ int dpy = inParcel->readInt32();
+ outParcel->writeInt32(ctx->dpyAttr[dpy].vsync_period);
+ outParcel->writeInt32(ctx->dpyAttr[dpy].xres);
+ outParcel->writeInt32(ctx->dpyAttr[dpy].yres);
+ outParcel->writeFloat(ctx->dpyAttr[dpy].xdpi);
+ outParcel->writeFloat(ctx->dpyAttr[dpy].ydpi);
+ //XXX: Need to check what to return for HDMI
+ outParcel->writeInt32(ctx->mMDP.panel);
+}
+static void setHSIC(hwc_context_t* ctx, const Parcel* inParcel) {
+ int dpy = inParcel->readInt32();
+ HSICData_t hsic_data;
+ hsic_data.hue = inParcel->readInt32();
+ hsic_data.saturation = inParcel->readFloat();
+ hsic_data.intensity = inParcel->readInt32();
+ hsic_data.contrast = inParcel->readFloat();
+ //XXX: Actually set the HSIC data through ABL lib
+}
+
+
static void setBufferMirrorMode(hwc_context_t *ctx, uint32_t enable) {
ctx->mBufferMirrorMode = enable;
}
@@ -140,6 +164,15 @@
case IQService::BUFFER_MIRRORMODE:
setBufferMirrorMode(mHwcContext, inParcel->readInt32());
break;
+ case IQService::CHECK_EXTERNAL_STATUS:
+ isExternalConnected(mHwcContext, outParcel);
+ break;
+ case IQService::GET_DISPLAY_ATTRIBUTES:
+ getDisplayAttributes(mHwcContext, inParcel, outParcel);
+ break;
+ case IQService::SET_HSIC_DATA:
+ setHSIC(mHwcContext, inParcel);
+ break;
default:
return NO_ERROR;
}
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 095189f..e632843 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -756,6 +756,7 @@
(int)ctx->dpyAttr[dpy].xres, (int)ctx->dpyAttr[dpy].yres);
ctx->listStats[dpy].secureUI = false;
ctx->listStats[dpy].yuv4k2kCount = 0;
+ ctx->mViewFrame[dpy] = (hwc_rect_t){0, 0, 0, 0};
trimList(ctx, list, dpy);
optimizeLayerRects(ctx, list, dpy);
@@ -764,6 +765,9 @@
hwc_layer_1_t const* layer = &list->hwLayers[i];
private_handle_t *hnd = (private_handle_t *)layer->handle;
+ // Calculate view frame of each display from the layer displayframe
+ ctx->mViewFrame[dpy] = getUnion(ctx->mViewFrame[dpy],
+ layer->displayFrame);
#ifdef QCOM_BSP
if (layer->flags & HWC_SCREENSHOT_ANIMATOR_LAYER) {
ctx->listStats[dpy].isDisplayAnimating = true;
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 9751199..7db0f36 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -437,6 +437,7 @@
qhwc::LayerProp *layerProp[HWC_NUM_DISPLAY_TYPES];
qhwc::MDPComp *mMDPComp[HWC_NUM_DISPLAY_TYPES];
qhwc::HwcDebug *mHwcDebug[HWC_NUM_DISPLAY_TYPES];
+ hwc_rect_t mViewFrame[HWC_NUM_DISPLAY_TYPES];
qhwc::AssertiveDisplay *mAD;
qhwc::VPUClient *mVPUClient;
diff --git a/libqdutils/Android.mk b/libqdutils/Android.mk
index d514405..06f4f00 100644
--- a/libqdutils/Android.mk
+++ b/libqdutils/Android.mk
@@ -4,14 +4,16 @@
LOCAL_MODULE := libqdutils
LOCAL_MODULE_TAGS := optional
-LOCAL_SHARED_LIBRARIES := $(common_libs) libui
+LOCAL_SHARED_LIBRARIES := $(common_libs) libui libbinder libqservice
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdutils\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
+LOCAL_COPY_HEADERS_TO := $(common_header_export_path)
+LOCAL_COPY_HEADERS := display_config.h mdp_version.h
LOCAL_SRC_FILES := profiler.cpp mdp_version.cpp \
idle_invalidator.cpp \
comptype.cpp qd_utils.cpp \
- cb_utils.cpp
+ cb_utils.cpp display_config.cpp
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
diff --git a/libqdutils/display_config.cpp b/libqdutils/display_config.cpp
new file mode 100644
index 0000000..eaf5384
--- /dev/null
+++ b/libqdutils/display_config.cpp
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2013 The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation. nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <display_config.h>
+#include <QServiceUtils.h>
+
+using namespace android;
+using namespace qService;
+
+namespace qdutils {
+
+int isExternalConnected(void) {
+ int ret;
+ status_t err = FAILED_TRANSACTION;
+ sp<IQService> binder = getBinder();
+ Parcel inParcel, outParcel;
+ if(binder != NULL) {
+ err = binder->dispatch(IQService::CHECK_EXTERNAL_STATUS,
+ &inParcel , &outParcel);
+ }
+ if(err) {
+ ALOGE("%s: Failed to get external status err=%d", __FUNCTION__, err);
+ ret = err;
+ } else {
+ ret = outParcel.readInt32();
+ }
+ return ret;
+}
+
+int getDisplayAttributes(int dpy, DisplayAttributes_t& dpyattr) {
+ status_t err = FAILED_TRANSACTION;
+ sp<IQService> binder = getBinder();
+ Parcel inParcel, outParcel;
+ inParcel.writeInt32(dpy);
+ if(binder != NULL) {
+ err = binder->dispatch(IQService::GET_DISPLAY_ATTRIBUTES,
+ &inParcel, &outParcel);
+ }
+ if(!err) {
+ dpyattr.vsync_period = outParcel.readInt32();
+ dpyattr.xres = outParcel.readInt32();
+ dpyattr.yres = outParcel.readInt32();
+ dpyattr.xdpi = outParcel.readFloat();
+ dpyattr.ydpi = outParcel.readFloat();
+ dpyattr.panel_type = (char) outParcel.readInt32();
+ } else {
+ ALOGE("%s: Failed to get display attributes err=%d", __FUNCTION__, err);
+ }
+ return err;
+}
+
+int setHSIC(int dpy, const HSICData_t& hsic_data) {
+ status_t err = FAILED_TRANSACTION;
+ sp<IQService> binder = getBinder();
+ Parcel inParcel, outParcel;
+ inParcel.writeInt32(dpy);
+ inParcel.writeInt32(hsic_data.hue);
+ inParcel.writeFloat(hsic_data.saturation);
+ inParcel.writeInt32(hsic_data.intensity);
+ inParcel.writeFloat(hsic_data.contrast);
+ if(binder != NULL) {
+ err = binder->dispatch(IQService::SET_HSIC_DATA, &inParcel, &outParcel);
+ }
+ if(err)
+ ALOGE("%s: Failed to get external status err=%d", __FUNCTION__, err);
+ return err;
+}
+}; //namespace
diff --git a/libqdutils/display_config.h b/libqdutils/display_config.h
new file mode 100644
index 0000000..c7d8ce9
--- /dev/null
+++ b/libqdutils/display_config.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2013 The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <gralloc_priv.h>
+#include <qdMetaData.h>
+#include <mdp_version.h>
+
+// This header is for clients to use to set/get global display configuration
+// The functions in this header run in the client process and wherever necessary
+// do a binder call to HWC to get/set data.
+// Only primary and external displays are supported here.
+// WiFi/virtual displays are not supported.
+
+namespace qdutils {
+
+// Use this enum to specify the dpy parameters where needed
+enum {
+ DISPLAY_PRIMARY = 0,
+ DISPLAY_EXTERNAL,
+};
+
+// Display Attributes that are available to clients of this library
+// Not to be confused with a similar struct in hwc_utils (in the hwc namespace)
+struct DisplayAttributes_t {
+ uint32_t vsync_period; //nanoseconds
+ uint32_t xres;
+ uint32_t yres;
+ float xdpi;
+ float ydpi;
+ char panel_type;
+};
+
+// Check if external display is connected. Useful to check before making
+// calls for external displays
+// Returns 1 if connected, 0 if disconnected, negative values on errors
+int isExternalConnected(void);
+
+// Get display vsync period which is in nanoseconds
+// i.e vsync_period = 1000000000l / fps
+// Returns 0 on success, negative values on errors
+int getDisplayAttributes(int dpy, DisplayAttributes_t& dpyattr);
+
+// Set HSIC data on a given display ID
+// Returns 0 on success, negative values on errors
+int setHSIC(int dpy, const HSICData_t& hsic_data);
+
+}; //namespace
diff --git a/libqservice/Android.mk b/libqservice/Android.mk
index 17b2eda..0c6123b 100644
--- a/libqservice/Android.mk
+++ b/libqservice/Android.mk
@@ -6,7 +6,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
-LOCAL_SHARED_LIBRARIES := $(common_libs) libexternal libbinder
+LOCAL_SHARED_LIBRARIES := $(common_libs) libbinder
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdqservice\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := QService.cpp \
diff --git a/libqservice/IQService.h b/libqservice/IQService.h
index 7ad443d..d6e525a 100644
--- a/libqservice/IQService.h
+++ b/libqservice/IQService.h
@@ -45,6 +45,9 @@
SCREEN_REFRESH, // Refresh screen through SF invalidate
EXTERNAL_ORIENTATION, // Set external orientation
BUFFER_MIRRORMODE, // Buffer mirrormode
+ CHECK_EXTERNAL_STATUS, // Check status of external display
+ GET_DISPLAY_ATTRIBUTES, // Get display attributes
+ SET_HSIC_DATA, // Set HSIC on dspp
VPU_COMMAND_LIST_START = 100, //Reserved block for VPU commands
VPU_COMMAND_LIST_END = 200,
COMMAND_LIST_END = 400,