summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2012-07-14 22:16:55 +0700
committerPawit Pornkitprasan <p.pawit@gmail.com>2012-07-14 22:16:55 +0700
commita519f2f1fadfde6e4dad8b4452ee6094f90cd6dd (patch)
tree8b5f27b36a3ca07fb0508c6cec675f31dd6f8210
parent4058ab09f0d05814a1a11a0e7b75ba4bdc4bd860 (diff)
downloaddevice_samsung_aries-common-a519f2f1fadfde6e4dad8b4452ee6094f90cd6dd.zip
device_samsung_aries-common-a519f2f1fadfde6e4dad8b4452ee6094f90cd6dd.tar.gz
device_samsung_aries-common-a519f2f1fadfde6e4dad8b4452ee6094f90cd6dd.tar.bz2
aries-common: using ics libhwcomposer for now
Change-Id: Ia5fb2f6dbe3e0aba4f620a7934d84a43db657ed0
-rw-r--r--libhwcomposer/Android.mk2
-rw-r--r--libhwcomposer/SecHWC.cpp139
-rw-r--r--libhwcomposer/SecHWCUtils.cpp34
-rw-r--r--libhwcomposer/SecHWCUtils.h5
4 files changed, 33 insertions, 147 deletions
diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk
index 405dcb0..e8766cd 100644
--- a/libhwcomposer/Android.mk
+++ b/libhwcomposer/Android.mk
@@ -19,7 +19,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-LOCAL_SHARED_LIBRARIES := liblog libcutils libEGL libGLESv1_CM libhardware libhardware_legacy
+LOCAL_SHARED_LIBRARIES := liblog libcutils libEGL libGLESv1_CM libhardware
LOCAL_CFLAGS += -DLOG_TAG=\"hwcomposer\"
LOCAL_C_INCLUDES := \
diff --git a/libhwcomposer/SecHWC.cpp b/libhwcomposer/SecHWC.cpp
index dda1108..e63558b 100644
--- a/libhwcomposer/SecHWC.cpp
+++ b/libhwcomposer/SecHWC.cpp
@@ -23,12 +23,10 @@
*
*/
-#include <sys/resource.h>
#include <cutils/log.h>
#include <cutils/atomic.h>
#include <EGL/egl.h>
#include <GLES/gl.h>
-#include <hardware_legacy/uevent.h>
#include "SecHWCUtils.h"
static IMG_gralloc_module_public_t *gpsGrallocModule;
@@ -43,8 +41,8 @@ static struct hw_module_methods_t hwc_module_methods = {
hwc_module_t HAL_MODULE_INFO_SYM = {
common: {
tag: HARDWARE_MODULE_TAG,
- module_api_version: HWC_MODULE_API_VERSION_0_1,
- hal_api_version: HARDWARE_HAL_API_VERSION,
+ version_major: 1,
+ version_minor: 0,
id: HWC_HARDWARE_MODULE_ID,
name: "Samsung S5PC11X hwcomposer module",
author: "SAMSUNG",
@@ -294,6 +292,7 @@ static int hwc_set(hwc_composer_device_t *dev,
struct sec_rect src_rect;
struct sec_rect dst_rect;
+
if (dpy == NULL && sur == NULL && list == NULL) {
// release our resources, the screen is turning off
// in our case, there is nothing to do.
@@ -425,94 +424,6 @@ static int hwc_set(hwc_composer_device_t *dev,
return 0;
}
-static void hwc_registerProcs(struct hwc_composer_device* dev,
- hwc_procs_t const* procs)
-{
- struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
- ctx->procs = const_cast<hwc_procs_t *>(procs);
-}
-
-static int hwc_query(struct hwc_composer_device* dev,
- int what, int* value)
-{
- struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
-
- switch (what) {
- case HWC_BACKGROUND_LAYER_SUPPORTED:
- // we don't support the background layer yet
- value[0] = 0;
- break;
- case HWC_VSYNC_PERIOD:
- // vsync period in nanosecond
- value[0] = 1000000000.0 / gpsGrallocModule->psFrameBufferDevice->base.fps;
- break;
- default:
- // unsupported query
- return -EINVAL;
- }
- return 0;
-}
-
-static int hwc_eventControl(struct hwc_composer_device* dev,
- int event, int enabled)
-{
- struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
-
- switch (event) {
- case HWC_EVENT_VSYNC:
- int val = !!enabled;
- int err = ioctl(ctx->global_lcd_win.fd, S3CFB_SET_VSYNC_INT, &val);
- if (err < 0)
- return -errno;
-
- return 0;
- }
-
- return -EINVAL;
-}
-
-void handle_vsync_uevent(hwc_context_t *ctx, const char *buff, int len)
-{
- uint64_t timestamp = 0;
- const char *s = buff;
-
- if(!ctx->procs || !ctx->procs->vsync)
- return;
-
- s += strlen(s) + 1;
-
- while(*s) {
- if (!strncmp(s, "VSYNC=", strlen("VSYNC=")))
- timestamp = strtoull(s + strlen("VSYNC="), NULL, 0);
-
- s += strlen(s) + 1;
- if (s - buff >= len)
- break;
- }
-
- ctx->procs->vsync(ctx->procs, 0, timestamp);
-}
-
-static void *hwc_vsync_thread(void *data)
-{
- hwc_context_t *ctx = (hwc_context_t *)(data);
- char uevent_desc[4096];
- memset(uevent_desc, 0, sizeof(uevent_desc));
-
- setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
-
- uevent_init();
- while(true) {
- int len = uevent_next_event(uevent_desc, sizeof(uevent_desc) - 2);
-
- bool vsync = !strcmp(uevent_desc, "change@/devices/platform/s3cfb");
- if(vsync)
- handle_vsync_uevent(ctx, uevent_desc, len);
- }
-
- return NULL;
-}
-
static int hwc_device_close(struct hw_device_t *dev)
{
struct hwc_context_t* ctx = (struct hwc_context_t*)dev;
@@ -525,11 +436,6 @@ static int hwc_device_close(struct hw_device_t *dev)
ret = -1;
}
- if (window_close(&ctx->global_lcd_win) < 0) {
- ALOGE("%s::window_close() fail", __func__);
- ret = -1;
- }
-
for (i = 0; i < NUM_OF_WIN; i++) {
if (window_close(&ctx->win[i]) < 0) {
ALOGE("%s::window_close() fail", __func__);
@@ -537,22 +443,15 @@ static int hwc_device_close(struct hw_device_t *dev)
}
}
- // TODO: stop vsync_thread
-
free(ctx);
}
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)
{
int status = 0;
- int err;
struct hwc_win_info_t *win;
if(hw_get_module(GRALLOC_HARDWARE_MODULE_ID,
@@ -573,21 +472,18 @@ 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 = 0;
dev->device.common.module = const_cast<hw_module_t*>(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.query = hwc_query;
- dev->device.methods = &hwc_methods;
*device = &dev->device.common;
/* initializing */
memset(&(dev->fimc), 0, sizeof(s5p_fimc_t));
- dev->fimc.dev_fd = -1;
+ dev->fimc.dev_fd = -1;
/* open WIN0 & WIN1 here */
for (int i = 0; i < NUM_OF_WIN; i++) {
@@ -598,17 +494,10 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
}
}
- /* open window 2, used to query global LCD info */
- if (window_open(&dev->global_lcd_win, 2) < 0) {
- ALOGE("%s:: Failed to open window 2 device ", __func__);
- status = -EINVAL;
- goto err;
- }
-
/* get default window config */
- if (window_get_global_lcd_info(dev) < 0) {
+ if (window_get_global_lcd_info(&dev->lcd_info) < 0) {
ALOGE("%s::window_get_global_lcd_info is failed : %s",
- __func__, strerror(errno));
+ __func__, strerror(errno));
status = -EINVAL;
goto err;
}
@@ -628,14 +517,14 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
if (window_set_pos(win) < 0) {
ALOGE("%s::window_set_pos is failed : %s",
- __func__, strerror(errno));
+ __func__, strerror(errno));
status = -EINVAL;
goto err;
}
if (window_get_info(win) < 0) {
ALOGE("%s::window_get_info is failed : %s",
- __func__, strerror(errno));
+ __func__, strerror(errno));
status = -EINVAL;
goto err;
}
@@ -661,13 +550,6 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
goto err;
}
- err = pthread_create(&dev->vsync_thread, NULL, hwc_vsync_thread, dev);
- if (err) {
- ALOGE("%s::pthread_create() failed : %s", __func__, strerror(err));
- status = -err;
- goto err;
- }
-
ALOGD("%s:: success\n", __func__);
return 0;
@@ -676,9 +558,6 @@ err:
if (destroyFimc(&dev->fimc) < 0)
ALOGE("%s::destroyFimc() fail", __func__);
- if (window_close(&dev->global_lcd_win) < 0)
- ALOGE("%s::window_close() fail", __func__);
-
for (int i = 0; i < NUM_OF_WIN; i++) {
if (window_close(&dev->win[i]) < 0)
ALOGE("%s::window_close() fail", __func__);
diff --git a/libhwcomposer/SecHWCUtils.cpp b/libhwcomposer/SecHWCUtils.cpp
index 3c0f6f9..2665937 100644
--- a/libhwcomposer/SecHWCUtils.cpp
+++ b/libhwcomposer/SecHWCUtils.cpp
@@ -166,30 +166,40 @@ int window_hide(struct hwc_win_info_t *win)
return 0;
}
-int window_get_global_lcd_info(struct hwc_context_t *ctx)
+int window_get_global_lcd_info(struct fb_var_screeninfo *lcd_info)
{
struct hwc_win_info_t win;
int ret = 0;
- if (ioctl(ctx->global_lcd_win.fd, FBIOGET_VSCREENINFO, &ctx->lcd_info) < 0) {
- ALOGE("FBIOGET_VSCREENINFO failed : %s", strerror(errno));
+ if (window_open(&win, 2) < 0) {
+ ALOGE("%s:: Failed to open window 2 device ", __func__);
return -1;
}
- if (ctx->lcd_info.xres == 0) {
- ctx->lcd_info.xres = DEFAULT_LCD_WIDTH;
- ctx->lcd_info.xres_virtual = DEFAULT_LCD_WIDTH;
+ if (ioctl(win.fd, FBIOGET_VSCREENINFO, lcd_info) < 0) {
+ ALOGE("FBIOGET_VSCREENINFO failed : %s", strerror(errno));
+ ret = -1;
+ goto fun_err;
+ }
+
+ if (lcd_info->xres == 0) {
+ lcd_info->xres = DEFAULT_LCD_WIDTH;
+ lcd_info->xres_virtual = DEFAULT_LCD_WIDTH;
}
- if (ctx->lcd_info.yres == 0) {
- ctx->lcd_info.yres = DEFAULT_LCD_HEIGHT;
- ctx->lcd_info.yres_virtual = DEFAULT_LCD_HEIGHT * NUM_OF_WIN_BUF;
+ if (lcd_info->yres == 0) {
+ lcd_info->yres = DEFAULT_LCD_HEIGHT;
+ lcd_info->yres_virtual = DEFAULT_LCD_HEIGHT * NUM_OF_WIN_BUF;
}
- if (ctx->lcd_info.bits_per_pixel == 0)
- ctx->lcd_info.bits_per_pixel = DEFAULT_LCD_BPP;
+ if (lcd_info->bits_per_pixel == 0)
+ lcd_info->bits_per_pixel = DEFAULT_LCD_BPP;
- return 0;
+fun_err:
+ if (window_close(&win) < 0)
+ ALOGE("%s::window2 close fail", __func__);
+
+ return ret;
}
int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src)
diff --git a/libhwcomposer/SecHWCUtils.h b/libhwcomposer/SecHWCUtils.h
index d59c120..21d6598 100644
--- a/libhwcomposer/SecHWCUtils.h
+++ b/libhwcomposer/SecHWCUtils.h
@@ -113,11 +113,8 @@ struct hwc_context_t {
/* our private state goes below here */
struct hwc_win_info_t win[NUM_OF_WIN];
- struct hwc_win_info_t global_lcd_win;
struct fb_var_screeninfo lcd_info;
s5p_fimc_t fimc;
- hwc_procs_t *procs;
- pthread_t vsync_thread;
unsigned int num_of_fb_layer;
unsigned int num_of_hwc_layer;
unsigned int num_of_fb_layer_prev;
@@ -130,7 +127,7 @@ int window_get_info(struct hwc_win_info_t *win);
int window_pan_display(struct hwc_win_info_t *win);
int window_show(struct hwc_win_info_t *win);
int window_hide(struct hwc_win_info_t *win);
-int window_get_global_lcd_info(struct hwc_context_t *ctx);
+int window_get_global_lcd_info(struct fb_var_screeninfo *lcd_info);
int createFimc(s5p_fimc_t *fimc);
int destroyFimc(s5p_fimc_t *fimc);