From b9ae8e0e0d6d35121650fb0b926038bc00d2883c Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan
Date: Fri, 23 Nov 2012 14:24:32 +0700
Subject: [PATCH] s5pc110: hwcomposer: update to hwcomposer HAL v1 api
Change-Id: I2dc71cca002a1c36898831c54e2bea281ac98744
---
exynos3/s5pc110/libhwcomposer/SecHWC.cpp | 67 ++++++++++++++-------
exynos3/s5pc110/libhwcomposer/SecHWCUtils.h | 2 +-
2 files changed, 47 insertions(+), 22 deletions(-)
diff --git a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
index f8a3d1a6..88a8e8c0 100644
--- a/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
+++ b/exynos3/s5pc110/libhwcomposer/SecHWC.cpp
@@ -23,6 +23,8 @@
*
*/
+#define HWC_REMOVE_DEPRECATED_VERSIONS 1
+
#include
#include
#include
@@ -52,7 +54,7 @@ hwc_module_t HAL_MODULE_INFO_SYM = {
}
};
-static void dump_layer(hwc_layer_t const* l) {
+static void dump_layer(hwc_layer_1_t const* l) {
ALOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}, {%d,%d,%d,%d}",
l->compositionType, l->flags, l->handle, l->transform, l->blending,
l->sourceCrop.left,
@@ -65,7 +67,7 @@ static void dump_layer(hwc_layer_t const* l) {
l->displayFrame.bottom);
}
-static int set_src_dst_info(hwc_layer_t *cur,
+static int set_src_dst_info(hwc_layer_1_t *cur,
struct hwc_win_info_t *win,
struct sec_img *src_img,
struct sec_img *dst_img,
@@ -127,7 +129,7 @@ static int set_src_dst_info(hwc_layer_t *cur,
return 0;
}
-static int get_hwc_compos_decision(hwc_layer_t* cur)
+static int get_hwc_compos_decision(hwc_layer_1_t* cur)
{
if(cur->flags & HWC_SKIP_LAYER || !cur->handle) {
ALOGV("%s::is_skip_layer %d cur->handle %x",
@@ -166,7 +168,7 @@ static int get_hwc_compos_decision(hwc_layer_t* cur)
}
static int assign_overlay_window(struct hwc_context_t *ctx,
- hwc_layer_t *cur,
+ hwc_layer_1_t *cur,
int win_idx,
int layer_idx)
{
@@ -214,7 +216,8 @@ static void reset_win_rect_info(hwc_win_info_t *win)
return;
}
-static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
+static int hwc_prepare(hwc_composer_device_1_t *dev,
+ size_t numDisplays, hwc_display_contents_1_t** displays)
{
struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
@@ -222,6 +225,12 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
int compositionType = 0;
int ret;
+ // Compat
+ hwc_display_contents_1_t* list = NULL;
+ if (numDisplays > 0) {
+ list = displays[0];
+ }
+
//if geometry is not changed, there is no need to do any work here
if( !list || (!(list->flags & HWC_GEOMETRY_CHANGED)))
return 0;
@@ -236,7 +245,7 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
ALOGV("%s:: hwc_prepare list->numHwLayers %d", __func__, list->numHwLayers);
for (int i = 0; i < list->numHwLayers ; i++) {
- hwc_layer_t* cur = &list->hwLayers[i];
+ hwc_layer_1_t* cur = &list->hwLayers[i];
if (overlay_win_cnt < NUM_OF_WIN) {
compositionType = get_hwc_compos_decision(cur);
@@ -278,15 +287,13 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
return 0;
}
-static int hwc_set(hwc_composer_device_t *dev,
- hwc_display_t dpy,
- hwc_surface_t sur,
- hwc_layer_list_t* list)
+static int hwc_set(hwc_composer_device_1_t *dev,
+ size_t numDisplays, hwc_display_contents_1_t** displays)
{
struct hwc_context_t *ctx = (struct hwc_context_t *)dev;
unsigned int phyAddr[MAX_NUM_PLANES];
int skipped_window_mask = 0;
- hwc_layer_t* cur;
+ hwc_layer_1_t* cur;
struct hwc_win_info_t *win;
int ret;
struct sec_img src_img;
@@ -294,6 +301,11 @@ static int hwc_set(hwc_composer_device_t *dev,
struct sec_rect src_rect;
struct sec_rect dst_rect;
+ // Only support one display
+ hwc_display_t dpy = displays[0]->dpy;
+ hwc_surface_t sur = displays[0]->sur;
+ hwc_display_contents_1_t* list = displays[0];
+
if (dpy == NULL && sur == NULL && list == NULL) {
// release our resources, the screen is turning off
// in our case, there is nothing to do.
@@ -461,14 +473,30 @@ static int hwc_set(hwc_composer_device_t *dev,
return 0;
}
-static void hwc_registerProcs(struct hwc_composer_device* dev,
+static void hwc_registerProcs(struct hwc_composer_device_1* dev,
hwc_procs_t const* procs)
{
struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
ctx->procs = const_cast(procs);
}
-static int hwc_query(struct hwc_composer_device* dev,
+static int hwc_blank(struct hwc_composer_device_1 *dev,
+ int disp, int blank)
+{
+ struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
+ if (blank) {
+ // release our resources, the screen is turning off
+ // in our case, there is nothing to do.
+ ctx->num_of_fb_layer_prev = 0;
+ return 0;
+ }
+ else {
+ // No need to unblank, will unblank on set()
+ return 0;
+ }
+}
+
+static int hwc_query(struct hwc_composer_device_1* dev,
int what, int* value)
{
struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
@@ -500,7 +528,7 @@ pthread_mutex_t vsync_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t vsync_condition = PTHREAD_COND_INITIALIZER;
#endif
-static int hwc_eventControl(struct hwc_composer_device* dev,
+static int hwc_eventControl(struct hwc_composer_device_1* dev, int dpy,
int event, int enabled)
{
struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
@@ -632,10 +660,6 @@ static int hwc_device_close(struct hw_device_t *dev)
return ret;
}
-static const struct hwc_methods hwc_methods = {
- eventControl: hwc_eventControl
-};
-
static int hwc_device_open(const struct hw_module_t* module, const char* name,
struct hw_device_t** device)
{
@@ -664,15 +688,16 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
/* initialize the procs */
dev->device.common.tag = HARDWARE_DEVICE_TAG;
- dev->device.common.version = HWC_DEVICE_API_VERSION_0_3;
+ dev->device.common.version = HWC_DEVICE_API_VERSION_1_0;
dev->device.common.module = const_cast(module);
dev->device.common.close = hwc_device_close;
dev->device.prepare = hwc_prepare;
dev->device.set = hwc_set;
- dev->device.registerProcs = hwc_registerProcs;
+ dev->device.eventControl = hwc_eventControl;
+ dev->device.blank = hwc_blank;
dev->device.query = hwc_query;
- dev->device.methods = &hwc_methods;
+ dev->device.registerProcs = hwc_registerProcs;
*device = &dev->device.common;
diff --git a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
index ac81c0bb..ff9ef4a4 100644
--- a/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
+++ b/exynos3/s5pc110/libhwcomposer/SecHWCUtils.h
@@ -112,7 +112,7 @@ enum {
};
struct hwc_context_t {
- hwc_composer_device_t device;
+ hwc_composer_device_1_t device;
/* our private state goes below here */
struct hwc_win_info_t win[NUM_OF_WIN];