summaryrefslogtreecommitdiffstats
path: root/libhwcomposer
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2012-07-14 19:40:13 +0700
committerPawit Pornkitprasan <p.pawit@gmail.com>2012-07-14 19:40:13 +0700
commit9e9cbf2798ae64f48b25a5716bbdeb43e36e32cf (patch)
tree78decdc46aa76a0fd3cf00bbb371966571cf902e /libhwcomposer
parent83f873cb99c5827c794c31b6e0003e12b05069e3 (diff)
downloaddevice_samsung_aries-common-9e9cbf2798ae64f48b25a5716bbdeb43e36e32cf.zip
device_samsung_aries-common-9e9cbf2798ae64f48b25a5716bbdeb43e36e32cf.tar.gz
device_samsung_aries-common-9e9cbf2798ae64f48b25a5716bbdeb43e36e32cf.tar.bz2
jellybean bring up
Change-Id: I19a95c3c8613a81d02f1146941fcb2f9ecc4efae
Diffstat (limited to 'libhwcomposer')
-rw-r--r--libhwcomposer/Android.mk2
-rw-r--r--libhwcomposer/SecHWC.cpp187
-rw-r--r--libhwcomposer/SecHWCUtils.cpp112
-rw-r--r--libhwcomposer/SecHWCUtils.h5
4 files changed, 210 insertions, 96 deletions
diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk
index e8766cd..405dcb0 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
+LOCAL_SHARED_LIBRARIES := liblog libcutils libEGL libGLESv1_CM libhardware libhardware_legacy
LOCAL_CFLAGS += -DLOG_TAG=\"hwcomposer\"
LOCAL_C_INCLUDES := \
diff --git a/libhwcomposer/SecHWC.cpp b/libhwcomposer/SecHWC.cpp
index 31c0b2c..dda1108 100644
--- a/libhwcomposer/SecHWC.cpp
+++ b/libhwcomposer/SecHWC.cpp
@@ -23,10 +23,12 @@
*
*/
+#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;
@@ -41,8 +43,8 @@ static struct hw_module_methods_t hwc_module_methods = {
hwc_module_t HAL_MODULE_INFO_SYM = {
common: {
tag: HARDWARE_MODULE_TAG,
- version_major: 1,
- version_minor: 0,
+ module_api_version: HWC_MODULE_API_VERSION_0_1,
+ hal_api_version: HARDWARE_HAL_API_VERSION,
id: HWC_HARDWARE_MODULE_ID,
name: "Samsung S5PC11X hwcomposer module",
author: "SAMSUNG",
@@ -51,7 +53,7 @@ hwc_module_t HAL_MODULE_INFO_SYM = {
};
static void dump_layer(hwc_layer_t const* l) {
- LOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}, {%d,%d,%d,%d}",
+ 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,
l->sourceCrop.top,
@@ -118,7 +120,7 @@ static int set_src_dst_info(hwc_layer_t *cur,
dst_rect->w = win->rect_info.w;
dst_rect->h = win->rect_info.h;
- LOGV("%s::sr_x %d sr_y %d sr_w %d sr_h %d dr_x %d dr_y %d dr_w %d dr_h %d ",
+ ALOGV("%s::sr_x %d sr_y %d sr_w %d sr_h %d dr_x %d dr_y %d dr_w %d dr_h %d ",
__func__, src_rect->x, src_rect->y, src_rect->w, src_rect->h,
dst_rect->x, dst_rect->y, dst_rect->w, dst_rect->h);
@@ -128,7 +130,7 @@ static int set_src_dst_info(hwc_layer_t *cur,
static int get_hwc_compos_decision(hwc_layer_t* cur)
{
if(cur->flags & HWC_SKIP_LAYER || !cur->handle) {
- LOGV("%s::is_skip_layer %d cur->handle %x",
+ ALOGV("%s::is_skip_layer %d cur->handle %x",
__func__, cur->flags & HWC_SKIP_LAYER, (uint32_t)cur->handle);
return HWC_FRAMEBUFFER;
}
@@ -156,7 +158,7 @@ static int get_hwc_compos_decision(hwc_layer_t* cur)
else
compositionType = HWC_FRAMEBUFFER;
- LOGV("%s::compositionType %d bpp %d format %x usage %x",
+ ALOGV("%s::compositionType %d bpp %d format %x usage %x",
__func__,compositionType, prev_handle->uiBpp, prev_handle->iFormat,
prev_handle->usage & GRALLOC_USAGE_PHYS_CONTIG);
@@ -196,7 +198,7 @@ static int assign_overlay_window(struct hwc_context_t *ctx,
win->layer_index = layer_idx;
win->status = HWC_WIN_RESERVED;
- LOGV("%s:: win_x %d win_y %d win_w %d win_h %d lay_idx %d win_idx %d",
+ ALOGV("%s:: win_x %d win_y %d win_w %d win_h %d lay_idx %d win_idx %d",
__func__, win->rect_info.x, win->rect_info.y, win->rect_info.w,
win->rect_info.h, win->layer_index, win_idx );
@@ -231,7 +233,7 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
}
ctx->num_of_hwc_layer = 0;
ctx->num_of_fb_layer = 0;
- LOGV("%s:: hwc_prepare list->numHwLayers %d", __func__, list->numHwLayers);
+ 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];
@@ -262,7 +264,7 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
}
if(list->numHwLayers != (ctx->num_of_fb_layer + ctx->num_of_hwc_layer))
- LOGV("%s:: numHwLayers %d num_of_fb_layer %d num_of_hwc_layer %d ",
+ ALOGV("%s:: numHwLayers %d num_of_fb_layer %d num_of_hwc_layer %d ",
__func__, list->numHwLayers, ctx->num_of_fb_layer,
ctx->num_of_hwc_layer);
@@ -292,7 +294,6 @@ 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.
@@ -358,7 +359,7 @@ static int hwc_set(hwc_composer_device_t *dev,
ret = gpsGrallocModule->GetPhyAddrs(gpsGrallocModule,
cur->handle, phyAddr);
if (ret) {
- LOGE("%s::GetPhyAddrs fail : ret=%d\n", __func__, ret);
+ ALOGE("%s::GetPhyAddrs fail : ret=%d\n", __func__, ret);
skipped_window_mask |= (1 << i);
continue;
}
@@ -370,7 +371,7 @@ static int hwc_set(hwc_composer_device_t *dev,
ret = runFimc(ctx, &src_img, &src_rect, &dst_img, &dst_rect,
phyAddr, cur->transform);
if (ret < 0){
- LOGE("%s::runFimc fail : ret=%d\n", __func__, ret);
+ ALOGE("%s::runFimc fail : ret=%d\n", __func__, ret);
skipped_window_mask |= (1 << i);
continue;
}
@@ -378,7 +379,7 @@ static int hwc_set(hwc_composer_device_t *dev,
if (win->set_win_flag == 1) {
/* turnoff the window and set the window position with new conf... */
if (window_set_pos(win) < 0) {
- LOGE("%s::window_set_pos is failed : %s", __func__,
+ ALOGE("%s::window_set_pos is failed : %s", __func__,
strerror(errno));
skipped_window_mask |= (1 << i);
continue;
@@ -400,13 +401,13 @@ static int hwc_set(hwc_composer_device_t *dev,
window_show(win);
} else {
- LOGE("%s:: error : layer %d compositionType should have been \
+ ALOGE("%s:: error : layer %d compositionType should have been \
HWC_OVERLAY", __func__, win->layer_index);
skipped_window_mask |= (1 << i);
continue;
}
} else {
- LOGE("%s:: error : window status should have been HWC_WIN_RESERVED \
+ ALOGE("%s:: error : window status should have been HWC_WIN_RESERVED \
by now... ", __func__);
skipped_window_mask |= (1 << i);
continue;
@@ -424,6 +425,94 @@ 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;
@@ -432,26 +521,38 @@ static int hwc_device_close(struct hw_device_t *dev)
if (ctx) {
if (destroyFimc(&ctx->fimc) < 0) {
- LOGE("%s::destroyFimc fail", __func__);
+ ALOGE("%s::destroyFimc fail", __func__);
+ 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) {
- LOGE("%s::window_close() fail", __func__);
+ ALOGE("%s::window_close() fail", __func__);
ret = -1;
}
}
+ // 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,
@@ -472,32 +573,42 @@ 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 = 0;
+ dev->device.common.version = HWC_DEVICE_API_VERSION_0_3;
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++) {
if (window_open(&(dev->win[i]), i) < 0) {
- LOGE("%s:: Failed to open window %d device ", __func__, i);
+ ALOGE("%s:: Failed to open window %d device ", __func__, i);
status = -EINVAL;
goto err;
}
}
+ /* 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->lcd_info) < 0) {
- LOGE("%s::window_get_global_lcd_info is failed : %s",
- __func__, strerror(errno));
+ if (window_get_global_lcd_info(dev) < 0) {
+ ALOGE("%s::window_get_global_lcd_info is failed : %s",
+ __func__, strerror(errno));
status = -EINVAL;
goto err;
}
@@ -516,15 +627,15 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
win->rect_info.h = win->var_info.yres;
if (window_set_pos(win) < 0) {
- LOGE("%s::window_set_pos is failed : %s",
- __func__, strerror(errno));
+ ALOGE("%s::window_set_pos is failed : %s",
+ __func__, strerror(errno));
status = -EINVAL;
goto err;
}
if (window_get_info(win) < 0) {
- LOGE("%s::window_get_info is failed : %s",
- __func__, strerror(errno));
+ ALOGE("%s::window_get_info is failed : %s",
+ __func__, strerror(errno));
status = -EINVAL;
goto err;
}
@@ -532,35 +643,45 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
win->size = win->fix_info.line_length * win->var_info.yres;
if (!win->fix_info.smem_start){
- LOGE("%s:: win-%d failed to get the reserved memory", __func__, i);
+ ALOGE("%s:: win-%d failed to get the reserved memory", __func__, i);
status = -EINVAL;
goto err;
}
for (int j = 0; j < NUM_OF_WIN_BUF; j++) {
win->addr[j] = win->fix_info.smem_start + (win->size * j);
- LOGI("%s::win-%d add[%d] %x ", __func__, i, j, win->addr[j]);
+ ALOGI("%s::win-%d add[%d] %x ", __func__, i, j, win->addr[j]);
}
}
/* open pp */
if (createFimc(&dev->fimc) < 0) {
- LOGE("%s::creatFimc() fail", __func__);
+ ALOGE("%s::creatFimc() fail", __func__);
status = -EINVAL;
goto err;
}
- LOGD("%s:: success\n", __func__);
+ 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;
err:
if (destroyFimc(&dev->fimc) < 0)
- LOGE("%s::destroyFimc() fail", __func__);
+ 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)
- LOGE("%s::window_close() fail", __func__);
+ ALOGE("%s::window_close() fail", __func__);
}
return status;
diff --git a/libhwcomposer/SecHWCUtils.cpp b/libhwcomposer/SecHWCUtils.cpp
index 5b84742..3c0f6f9 100644
--- a/libhwcomposer/SecHWCUtils.cpp
+++ b/libhwcomposer/SecHWCUtils.cpp
@@ -44,7 +44,7 @@ int window_open(struct hwc_win_info_t *win, int id)
case 2:
break;
default:
- LOGE("%s::id(%d) is weird", __func__, id);
+ ALOGE("%s::id(%d) is weird", __func__, id);
goto error;
}
@@ -52,7 +52,7 @@ int window_open(struct hwc_win_info_t *win, int id)
win->fd = open(name, O_RDWR);
if (win->fd < 0) {
- LOGE("%s::Failed to open window device (%s) : %s",
+ ALOGE("%s::Failed to open window device (%s) : %s",
__func__, strerror(errno), device_template);
goto error;
}
@@ -93,7 +93,7 @@ int window_set_pos(struct hwc_win_info_t *win)
win->var_info.activate |= FB_ACTIVATE_FORCE;
if (ioctl(win->fd, FBIOPUT_VSCREENINFO, &(win->var_info)) < 0) {
- LOGE("%s::FBIOPUT_VSCREENINFO(%d, %d) fail",
+ ALOGE("%s::FBIOPUT_VSCREENINFO(%d, %d) fail",
__func__, win->rect_info.w, win->rect_info.h);
return -1;
}
@@ -102,7 +102,7 @@ int window_set_pos(struct hwc_win_info_t *win)
window.y = win->rect_info.y;
if (ioctl(win->fd, SECFB_WIN_POSITION, &window) < 0) {
- LOGE("%s::S3CFB_WIN_POSITION(%d, %d) fail",
+ ALOGE("%s::S3CFB_WIN_POSITION(%d, %d) fail",
__func__, window.x, window.y);
return -1;
}
@@ -113,7 +113,7 @@ int window_set_pos(struct hwc_win_info_t *win)
int window_get_info(struct hwc_win_info_t *win)
{
if (ioctl(win->fd, FBIOGET_FSCREENINFO, &win->fix_info) < 0) {
- LOGE("FBIOGET_FSCREENINFO failed : %s", strerror(errno));
+ ALOGE("FBIOGET_FSCREENINFO failed : %s", strerror(errno));
goto error;
}
@@ -132,7 +132,7 @@ int window_pan_display(struct hwc_win_info_t *win)
lcd_info->yoffset = lcd_info->yres * win->buf_index;
if (ioctl(win->fd, FBIOPAN_DISPLAY, lcd_info) < 0) {
- LOGE("%s::FBIOPAN_DISPLAY(%d / %d / %d) fail(%s)",
+ ALOGE("%s::FBIOPAN_DISPLAY(%d / %d / %d) fail(%s)",
__func__, lcd_info->yres, win->buf_index, lcd_info->yres_virtual,
strerror(errno));
return -1;
@@ -144,7 +144,7 @@ int window_show(struct hwc_win_info_t *win)
{
if(win->power_state == 0) {
if (ioctl(win->fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) {
- LOGE("%s: FBIOBLANK failed : (%d:%s)", __func__, win->fd,
+ ALOGE("%s: FBIOBLANK failed : (%d:%s)", __func__, win->fd,
strerror(errno));
return -1;
}
@@ -157,7 +157,7 @@ int window_hide(struct hwc_win_info_t *win)
{
if (win->power_state == 1) {
if (ioctl(win->fd, FBIOBLANK, FB_BLANK_POWERDOWN) < 0) {
- LOGE("%s::FBIOBLANK failed : (%d:%s)",
+ ALOGE("%s::FBIOBLANK failed : (%d:%s)",
__func__, win->fd, strerror(errno));
return -1;
}
@@ -166,40 +166,30 @@ int window_hide(struct hwc_win_info_t *win)
return 0;
}
-int window_get_global_lcd_info(struct fb_var_screeninfo *lcd_info)
+int window_get_global_lcd_info(struct hwc_context_t *ctx)
{
struct hwc_win_info_t win;
int ret = 0;
- if (window_open(&win, 2) < 0) {
- LOGE("%s:: Failed to open window 2 device ", __func__);
+ if (ioctl(ctx->global_lcd_win.fd, FBIOGET_VSCREENINFO, &ctx->lcd_info) < 0) {
+ ALOGE("FBIOGET_VSCREENINFO failed : %s", strerror(errno));
return -1;
}
- if (ioctl(win.fd, FBIOGET_VSCREENINFO, lcd_info) < 0) {
- LOGE("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.xres == 0) {
+ ctx->lcd_info.xres = DEFAULT_LCD_WIDTH;
+ ctx->lcd_info.xres_virtual = DEFAULT_LCD_WIDTH;
}
- 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.yres == 0) {
+ ctx->lcd_info.yres = DEFAULT_LCD_HEIGHT;
+ ctx->lcd_info.yres_virtual = DEFAULT_LCD_HEIGHT * NUM_OF_WIN_BUF;
}
- if (lcd_info->bits_per_pixel == 0)
- lcd_info->bits_per_pixel = DEFAULT_LCD_BPP;
+ if (ctx->lcd_info.bits_per_pixel == 0)
+ ctx->lcd_info.bits_per_pixel = DEFAULT_LCD_BPP;
-fun_err:
- if (window_close(&win) < 0)
- LOGE("%s::window2 close fail", __func__);
-
- return ret;
+ return 0;
}
int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src)
@@ -219,7 +209,7 @@ int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src)
fmt.fmt.pix.field = V4L2_FIELD_NONE;
if (ioctl (fd, VIDIOC_S_FMT, &fmt) < 0) {
- LOGE("VIDIOC_S_FMT failed : errno=%d (%s) : fd=%d", errno,
+ ALOGE("VIDIOC_S_FMT failed : errno=%d (%s) : fd=%d", errno,
strerror(errno), fd);
return -1;
}
@@ -238,7 +228,7 @@ int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src)
crop.c.width = src->width;
crop.c.height = src->height;
if (ioctl(fd, VIDIOC_S_CROP, &crop) < 0) {
- LOGE("Error in video VIDIOC_S_CROP (%d, %d, %d, %d)",
+ ALOGE("Error in video VIDIOC_S_CROP (%d, %d, %d, %d)",
crop.c.left, crop.c.top, crop.c.width, crop.c.height);
return -1;
}
@@ -251,7 +241,7 @@ int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src)
req.memory = V4L2_MEMORY_USERPTR;
if (ioctl (fd, VIDIOC_REQBUFS, &req) < 0) {
- LOGE("Error in VIDIOC_REQBUFS");
+ ALOGE("Error in VIDIOC_REQBUFS");
return -1;
}
@@ -275,21 +265,21 @@ int fimc_v4l2_set_dst(int fd,
vc.id = V4L2_CID_HFLIP;
vc.value = flag_h_flip;
if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
- LOGE("Error in video VIDIOC_S_CTRL - flag_h_flip (%d)", flag_h_flip);
+ ALOGE("Error in video VIDIOC_S_CTRL - flag_h_flip (%d)", flag_h_flip);
return -1;
}
vc.id = V4L2_CID_VFLIP;
vc.value = flag_v_flip;
if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
- LOGE("Error in video VIDIOC_S_CTRL - flag_v_flip (%d)", flag_v_flip);
+ ALOGE("Error in video VIDIOC_S_CTRL - flag_v_flip (%d)", flag_v_flip);
return -1;
}
vc.id = V4L2_CID_ROTATION;
vc.value = rotation;
if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
- LOGE("Error in video VIDIOC_S_CTRL - rotation (%d)", rotation);
+ ALOGE("Error in video VIDIOC_S_CTRL - rotation (%d)", rotation);
return -1;
}
@@ -297,7 +287,7 @@ int fimc_v4l2_set_dst(int fd,
* set size, format & address for destination image (DMA-OUTPUT)
*/
if (ioctl (fd, VIDIOC_G_FBUF, &fbuf) < 0) {
- LOGE("Error in video VIDIOC_G_FBUF");
+ ALOGE("Error in video VIDIOC_G_FBUF");
return -1;
}
@@ -306,7 +296,7 @@ int fimc_v4l2_set_dst(int fd,
fbuf.fmt.height = dst->full_height;
fbuf.fmt.pixelformat = dst->color_space;
if (ioctl (fd, VIDIOC_S_FBUF, &fbuf) < 0) {
- LOGE("Error in video VIDIOC_S_FBUF 0x%x %d %d %d",
+ ALOGE("Error in video VIDIOC_S_FBUF 0x%x %d %d %d",
(void *)addr, dst->full_width, dst->full_height,
dst->color_space);
return -1;
@@ -321,7 +311,7 @@ int fimc_v4l2_set_dst(int fd,
sFormat.fmt.win.w.width = dst->width;
sFormat.fmt.win.w.height = dst->height;
if (ioctl(fd, VIDIOC_S_FMT, &sFormat) < 0) {
- LOGE("Error in video VIDIOC_S_FMT %d %d %d %d",
+ ALOGE("Error in video VIDIOC_S_FMT %d %d %d %d",
dst->start_x, dst->start_y, dst->width, dst->height);
return -1;
}
@@ -332,7 +322,7 @@ int fimc_v4l2_set_dst(int fd,
int fimc_v4l2_stream_on(int fd, enum v4l2_buf_type type)
{
if (ioctl (fd, VIDIOC_STREAMON, &type) < 0) {
- LOGE("Error in VIDIOC_STREAMON");
+ ALOGE("Error in VIDIOC_STREAMON");
return -1;
}
@@ -350,7 +340,7 @@ int fimc_v4l2_queue(int fd, struct fimc_buf *fimc_buf)
buf.index = 0;
if (ioctl (fd, VIDIOC_QBUF, &buf) < 0) {
- LOGE("Error in VIDIOC_QBUF");
+ ALOGE("Error in VIDIOC_QBUF");
return -1;
}
@@ -365,7 +355,7 @@ int fimc_v4l2_dequeue(int fd)
buf.memory = V4L2_MEMORY_USERPTR;
if (ioctl (fd, VIDIOC_DQBUF, &buf) < 0) {
- LOGE("Error in VIDIOC_DQBUF");
+ ALOGE("Error in VIDIOC_DQBUF");
return -1;
}
@@ -378,7 +368,7 @@ int fimc_v4l2_stream_off(int fd)
type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
if (ioctl (fd, VIDIOC_STREAMOFF, &type) < 0) {
- LOGE("Error in VIDIOC_STREAMOFF");
+ ALOGE("Error in VIDIOC_STREAMOFF");
return -1;
}
@@ -394,7 +384,7 @@ int fimc_v4l2_clr_buf(int fd)
req.memory = V4L2_MEMORY_USERPTR;
if (ioctl (fd, VIDIOC_REQBUFS, &req) < 0) {
- LOGE("Error in VIDIOC_REQBUFS");
+ ALOGE("Error in VIDIOC_REQBUFS");
}
return 0;
@@ -405,30 +395,30 @@ int fimc_handle_oneshot(int fd, struct fimc_buf *fimc_buf)
int ret =0;
if (fimc_v4l2_stream_on(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT) < 0) {
- LOGE("Fail : v4l2_stream_on()");
+ ALOGE("Fail : v4l2_stream_on()");
return -1;
}
if (fimc_v4l2_queue(fd, fimc_buf) < 0) {
- LOGE("Fail : v4l2_queue()");
+ ALOGE("Fail : v4l2_queue()");
ret = -1;
goto stream_off;
}
if (fimc_v4l2_dequeue(fd) < 0) {
- LOGE("Fail : v4l2_dequeue()");
+ ALOGE("Fail : v4l2_dequeue()");
ret = -1;
goto stream_off;
}
stream_off:
if (fimc_v4l2_stream_off(fd) < 0) {
- LOGE("Fail : v4l2_stream_off()");
+ ALOGE("Fail : v4l2_stream_off()");
return -1;
}
if (fimc_v4l2_clr_buf(fd) < 0) {
- LOGE("Fail : v4l2_clr_buf()");
+ ALOGE("Fail : v4l2_clr_buf()");
return -1;
}
@@ -448,12 +438,12 @@ static int get_src_phys_addr(struct hwc_context_t *ctx,
fimc->params.src.buf_addr_phy_cb = phyAddr[1];
break;
default:
- LOGE("%s format error (format=0x%x)", __func__,
+ ALOGE("%s format error (format=0x%x)", __func__,
src_img->format);
return -1;
}
} else {
- LOGE("%s mem_type error (mem_type=%d)", __func__, src_img->mem_type);
+ ALOGE("%s mem_type error (mem_type=%d)", __func__, src_img->mem_type);
return -1;
}
@@ -468,7 +458,7 @@ static int get_dst_phys_addr(struct hwc_context_t *ctx,
if (HWC_PHYS_MEM_TYPE == dst_img->mem_type && 0 != dst_img->base)
dst_phys_addr = dst_img->base;
else {
- LOGE("%s::get_dst_phys_addr fail ", __func__);
+ ALOGE("%s::get_dst_phys_addr fail ", __func__);
dst_phys_addr = 0;
}
return dst_phys_addr;
@@ -639,7 +629,7 @@ static int runcFimcCore(struct hwc_context_t *ctx,
/* check minimum */
if (src_rect->w < 16 || src_rect->h < 8) {
- LOGE("%s src size is not supported by fimc : f_w=%d f_h=%d x=%d y=%d \
+ ALOGE("%s src size is not supported by fimc : f_w=%d f_h=%d x=%d y=%d \
w=%d h=%d (ow=%d oh=%d) format=0x%x", __func__,
params->src.full_width, params->src.full_height,
params->src.start_x, params->src.start_y, params->src.width,
@@ -708,7 +698,7 @@ switch (rotate_value) {
/* check minimum */
if (dst_rect->w < 8 || dst_rect->h < 4) {
- LOGE("%s dst size is not supported by fimc : \
+ ALOGE("%s dst size is not supported by fimc : \
f_w=%d f_h=%d x=%d y=%d w=%d h=%d (ow=%d oh=%d) format=0x%x",
__func__, params->dst.full_width, params->dst.full_height,
params->dst.start_x, params->dst.start_y, params->dst.width,
@@ -724,7 +714,7 @@ switch (rotate_value) {
((src_rect->w / dst_rect->w) > MAX_RESIZING_RATIO_LIMIT)) ||
((dst_rect->w > src_rect->w) &&
((dst_rect->w / src_rect->w) > MAX_RESIZING_RATIO_LIMIT))) {
- LOGE("%s over scaling limit : src.w=%d dst.w=%d (limit=%d)",
+ ALOGE("%s over scaling limit : src.w=%d dst.w=%d (limit=%d)",
__func__, src_rect->w, dst_rect->w, MAX_RESIZING_RATIO_LIMIT);
return -1;
}
@@ -789,24 +779,24 @@ int createFimc(s5p_fimc_t *fimc)
fimc->dev_fd = open(PP_DEVICE_DEV_NAME, O_RDWR);
if (fimc->dev_fd < 0) {
- LOGE("%s::Post processor open error (%d)", __func__, errno);
+ ALOGE("%s::Post processor open error (%d)", __func__, errno);
goto err;
}
}
/* check capability */
if (ioctl(fimc->dev_fd, VIDIOC_QUERYCAP, &cap) < 0) {
- LOGE("VIDIOC_QUERYCAP failed");
+ ALOGE("VIDIOC_QUERYCAP failed");
goto err;
}
if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
- LOGE("%d has no streaming support", fimc->dev_fd);
+ ALOGE("%d has no streaming support", fimc->dev_fd);
goto err;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
- LOGE("%d is no video output", fimc->dev_fd);
+ ALOGE("%d is no video output", fimc->dev_fd);
goto err;
}
@@ -815,7 +805,7 @@ int createFimc(s5p_fimc_t *fimc)
*/
fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
if (ioctl(fimc->dev_fd, VIDIOC_G_FMT, &fmt) < 0) {
- LOGE("%s::Error in video VIDIOC_G_FMT", __func__);
+ ALOGE("%s::Error in video VIDIOC_G_FMT", __func__);
goto err;
}
@@ -823,7 +813,7 @@ int createFimc(s5p_fimc_t *fimc)
vc.value = 0;
if (ioctl(fimc->dev_fd, VIDIOC_G_CTRL, &vc) < 0) {
- LOGE("%s::Error in video VIDIOC_G_CTRL", __func__);
+ ALOGE("%s::Error in video VIDIOC_G_CTRL", __func__);
goto err;
}
fimc->hw_ver = vc.value;
diff --git a/libhwcomposer/SecHWCUtils.h b/libhwcomposer/SecHWCUtils.h
index 21d6598..d59c120 100644
--- a/libhwcomposer/SecHWCUtils.h
+++ b/libhwcomposer/SecHWCUtils.h
@@ -113,8 +113,11 @@ 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;
@@ -127,7 +130,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 fb_var_screeninfo *lcd_info);
+int window_get_global_lcd_info(struct hwc_context_t *ctx);
int createFimc(s5p_fimc_t *fimc);
int destroyFimc(s5p_fimc_t *fimc);