summaryrefslogtreecommitdiffstats
path: root/hwc
diff options
context:
space:
mode:
Diffstat (limited to 'hwc')
-rw-r--r--hwc/hwc.c287
1 files changed, 66 insertions, 221 deletions
diff --git a/hwc/hwc.c b/hwc/hwc.c
index 4ff0754..2762af7 100644
--- a/hwc/hwc.c
+++ b/hwc/hwc.c
@@ -137,17 +137,11 @@ struct omap4_hwc_device {
int flags_rgb_order;
int flags_nv12_only;
- int on_tv;
int force_sgx;
omap4_hwc_ext_t ext; /* external mirroring data */
int idle;
int ovls_blending;
- float lcd_m[2][3]; /* internal transformation matrix */
- float lcd_hdmi_m[2][3]; /* internal transformation matrix */
- int lcd_rotation;
- hwc_rect_t lcd_region;
-
/* composition data */
struct dsscomp_setup_dispc_data dsscomp_data;
buffer_handle_t *buffers;
@@ -158,7 +152,6 @@ struct omap4_hwc_device {
int ext_ovls_wanted; /* # of overlays that should be on external display for current composition */
int last_ext_ovls; /* # of overlays on external/internal display for last composition */
int last_int_ovls;
- int lcd_transform;
};
typedef struct omap4_hwc_device omap4_hwc_device_t;
@@ -179,7 +172,7 @@ static int debug = 0;
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,
@@ -195,7 +188,7 @@ static void dump_dsscomp(struct dsscomp_setup_dispc_data *d)
{
unsigned i;
- LOGD("[%08x] set: %c%c%c %d ovls\n",
+ ALOGD("[%08x] set: %c%c%c %d ovls\n",
d->sync_id,
(d->mode & DSSCOMP_SETUP_MODE_APPLY) ? 'A' : '-',
(d->mode & DSSCOMP_SETUP_MODE_DISPLAY) ? 'D' : '-',
@@ -204,7 +197,7 @@ static void dump_dsscomp(struct dsscomp_setup_dispc_data *d)
for (i = 0; i < d->num_mgrs; i++) {
struct dss2_mgr_info *mi = &d->mgrs[i];
- LOGD(" (dis%d alpha=%d col=%08x ilace=%d)\n",
+ ALOGD(" (dis%d alpha=%d col=%08x ilace=%d)\n",
mi->ix,
mi->alpha_blending, mi->default_color,
mi->interlaced);
@@ -214,10 +207,10 @@ static void dump_dsscomp(struct dsscomp_setup_dispc_data *d)
struct dss2_ovl_info *oi = &d->ovls[i];
struct dss2_ovl_cfg *c = &oi->cfg;
if (c->zonly)
- LOGD("ovl%d(%s z%d)\n",
+ ALOGD("ovl%d(%s z%d)\n",
c->ix, c->enabled ? "ON" : "off", c->zorder);
else
- LOGD("ovl%d(%s z%d %s%s *%d%% %d*%d:%d,%d+%d,%d rot%d%s => %d,%d+%d,%d %p/%p|%d)\n",
+ ALOGD("ovl%d(%s z%d %s%s *%d%% %d*%d:%d,%d+%d,%d rot%d%s => %d,%d+%d,%d %p/%p|%d)\n",
c->ix, c->enabled ? "ON" : "off", c->zorder, DSS_FMT(c->color_mode),
c->pre_mult_alpha ? " premult" : "",
(c->global_alpha * 100 + 128) / 255,
@@ -293,7 +286,7 @@ static void dump_set_info(omap4_hwc_device_t *hwc_dev, hwc_layer_list_t* list)
}
dump_printf(&log, "}%s\n", hwc_dev->use_sgx ? " swap" : "");
- LOGD("%s", log.buf);
+ ALOGD("%s", log.buf);
}
static int sync_id = 0;
@@ -315,7 +308,7 @@ static int omap4_hwc_is_valid_format(int format)
}
}
-static int scaled(hwc_layer_t *layer,omap4_hwc_device_t *hwc_dev)
+static int scaled(hwc_layer_t *layer)
{
int w = WIDTH(layer->sourceCrop);
int h = HEIGHT(layer->sourceCrop);
@@ -323,7 +316,7 @@ static int scaled(hwc_layer_t *layer,omap4_hwc_device_t *hwc_dev)
if (layer->transform & HWC_TRANSFORM_ROT_90)
swap(w, h);
- return (hwc_dev->fb_dis.timings.x_res != w || hwc_dev->fb_dis.timings.y_res != h);
+ return WIDTH(layer->displayFrame) != w || HEIGHT(layer->displayFrame) != h;
}
static int is_protected(hwc_layer_t *layer)
@@ -432,7 +425,7 @@ omap4_hwc_setup_layer_base(struct dss2_ovl_cfg *oc, int index, int format, int b
default:
/* Should have been filtered out */
- LOGV("Unsupported pixel format");
+ ALOGV("Unsupported pixel format");
return;
}
@@ -695,56 +688,6 @@ omap4_hwc_adjust_ext_layer(omap4_hwc_ext_t *ext, struct dss2_ovl_info *ovl)
oc->mirror = !oc->mirror;
}
-static void
-omap4_hwc_adjust_lcd_layer(omap4_hwc_device_t *hwc_dev, struct dss2_ovl_info *ovl)
-{
- struct dss2_ovl_cfg *oc = &ovl->cfg;
- float x, y, w, h;
-
- /* crop to lcd region if mirroring */
- if (crop_to_rect(&ovl->cfg, hwc_dev->lcd_region) != 0) {
- ovl->cfg.enabled = 0;
- return;
- }
-
- /* display position */
- x = hwc_dev->lcd_m[0][0] * oc->win.x + hwc_dev->lcd_m[0][1] * oc->win.y + hwc_dev->lcd_m[0][2];
- y = hwc_dev->lcd_m[1][0] * oc->win.x + hwc_dev->lcd_m[1][1] * oc->win.y + hwc_dev->lcd_m[1][2];
- w = hwc_dev->lcd_m[0][0] * oc->win.w + hwc_dev->lcd_m[0][1] * oc->win.h;
- h = hwc_dev->lcd_m[1][0] * oc->win.w + hwc_dev->lcd_m[1][1] * oc->win.h;
- oc->win.x = m_round(w > 0 ? x : x + w);
- oc->win.y = m_round(h > 0 ? y : y + h);
- oc->win.w = m_round(w > 0 ? w : -w);
- oc->win.h = m_round(h > 0 ? h : -h);
-
- /* combining transformations: F^a*R^b*F^i*R^j = F^(a+b)*R^(j+b*(-1)^i), because F*R = R^(-1)*F */
- oc->rotation += (oc->mirror ? -1 : 1) * hwc_dev->lcd_rotation;
- oc->rotation &= 3;
-}
-static void
-omap4_hwc_adjust_lcd_layer_to_hdmi(omap4_hwc_device_t *hwc_dev, struct dss2_ovl_info *ovl)
-{
- struct dss2_ovl_cfg *oc = &ovl->cfg;
- float x, y, w, h;
-
- if (!hwc_dev->ext.current.docking &&
- crop_to_rect(&ovl->cfg, hwc_dev->ext.mirror_region) != 0) {
- ovl->cfg.enabled = 0;
- return;
- }
-
- /* display position */
- x = hwc_dev->lcd_hdmi_m[0][0] * oc->win.x + hwc_dev->lcd_hdmi_m[0][1] * oc->win.y + hwc_dev->lcd_hdmi_m[0][2];
- y = hwc_dev->lcd_hdmi_m[1][0] * oc->win.x + hwc_dev->lcd_hdmi_m[1][1] * oc->win.y + hwc_dev->lcd_hdmi_m[1][2];
- w = hwc_dev->lcd_hdmi_m[0][0] * oc->win.w + hwc_dev->lcd_hdmi_m[0][1] * oc->win.h;
- h = hwc_dev->lcd_hdmi_m[1][0] * oc->win.w + hwc_dev->lcd_hdmi_m[1][1] * oc->win.h;
- oc->win.x = m_round(w > 0 ? x : x + w);
- oc->win.y = m_round(h > 0 ? y : y + h);
- oc->win.w = m_round(w > 0 ? w : -w);
- oc->win.h = m_round(h > 0 ? h : -h);
-
-}
-
static struct dsscomp_dispc_limitations {
__u8 max_xdecim_2d;
__u8 max_ydecim_2d;
@@ -886,12 +829,10 @@ static __u32 add_scaling_score(__u32 score,
static int omap4_hwc_set_best_hdmi_mode(omap4_hwc_device_t *hwc_dev, __u32 xres, __u32 yres,
float xpy)
{
- int dis_ix = hwc_dev->on_tv ? 0 : 1;
-
struct _qdis {
struct dsscomp_display_info dis;
struct dsscomp_videomode modedb[32];
- } d = { .dis = { .ix = dis_ix } };
+ } d = { .dis = { .ix = 1 } };
omap4_hwc_ext_t *ext = &hwc_dev->ext;
d.dis.modedb_len = sizeof(d.modedb) / sizeof(*d.modedb);
@@ -955,9 +896,9 @@ static int omap4_hwc_set_best_hdmi_mode(omap4_hwc_device_t *hwc_dev, __u32 xres,
score = add_scaling_score(score, xres, yres, 60, ext_fb_xres, ext_fb_yres,
mode_xres, mode_yres, d.modedb[i].refresh ? : 1);
- LOGD("#%d: %dx%d %dHz", i, mode_xres, mode_yres, d.modedb[i].refresh);
+ ALOGD("#%d: %dx%d %dHz", i, mode_xres, mode_yres, d.modedb[i].refresh);
if (debug)
- LOGD(" score=0x%x adj.res=%dx%d", score, ext_fb_xres, ext_fb_yres);
+ ALOGD(" score=0x%x adj.res=%dx%d", score, ext_fb_xres, ext_fb_yres);
if (best_score < score) {
ext->width = ext_width;
ext->height = ext_height;
@@ -968,9 +909,9 @@ static int omap4_hwc_set_best_hdmi_mode(omap4_hwc_device_t *hwc_dev, __u32 xres,
}
}
if (~best) {
- struct dsscomp_setup_display_data sdis = { .ix = dis_ix, };
+ struct dsscomp_setup_display_data sdis = { .ix = 1, };
sdis.mode = d.dis.modedb[best];
- LOGD("picking #%d", best);
+ ALOGD("picking #%d", best);
/* only reconfigure on change */
if (ext->last_mode != ~best)
ioctl(hwc_dev->dsscomp_fd, DSSCIOC_SETUP_DISPLAY, &sdis);
@@ -987,7 +928,7 @@ static int omap4_hwc_set_best_hdmi_mode(omap4_hwc_device_t *hwc_dev, __u32 xres,
!omap4_hwc_can_scale(xres, yres, ext_fb_xres, ext_fb_yres,
1, &d.dis, &limits,
d.dis.timings.pixel_clock)) {
- LOGW("DSS scaler cannot support HDMI cloning");
+ ALOGW("DSS scaler cannot support HDMI cloning");
return -1;
}
}
@@ -1029,7 +970,7 @@ static void gather_layer_statistics(omap4_hwc_device_t *hwc_dev, struct counts *
num->possible_overlay_layers++;
/* NV12 layers can only be rendered on scaling overlays */
- if (scaled(layer,hwc_dev) || is_NV12(handle))
+ if (scaled(layer) || is_NV12(handle))
num->scaled_layers++;
if (is_BGR(handle))
@@ -1103,17 +1044,13 @@ static void decide_supported_cloning(omap4_hwc_device_t *hwc_dev, struct counts
if (hwc_dev->ext_ovls && ext->current.enabled && !ext->current.docking)
num->max_hw_overlays = hwc_dev->ext_ovls;
- /*If FB is not same resolution as LCD dont use GFX pipe line*/
- if (hwc_dev->lcd_transform)
- num->max_hw_overlays -= 1;
- else
- num->max_scaling_overlays = num->max_hw_overlays - nonscaling_ovls;
+ num->max_scaling_overlays = num->max_hw_overlays - nonscaling_ovls;
}
static int can_dss_render_all(omap4_hwc_device_t *hwc_dev, struct counts *num)
{
omap4_hwc_ext_t *ext = &hwc_dev->ext;
- int on_tv = hwc_dev->on_tv || (ext->on_tv && ext->current.enabled);
+ int on_tv = ext->on_tv && ext->current.enabled;
int tform = ext->current.enabled && (ext->current.rotation || ext->current.hflip);
return !hwc_dev->force_sgx &&
@@ -1137,7 +1074,7 @@ static inline int can_dss_render_layer(omap4_hwc_device_t *hwc_dev,
IMG_native_handle_t *handle = (IMG_native_handle_t *)layer->handle;
omap4_hwc_ext_t *ext = &hwc_dev->ext;
- int on_tv = hwc_dev->on_tv || (ext->on_tv && ext->current.enabled);
+ int on_tv = ext->on_tv && ext->current.enabled;
int tform = ext->current.enabled && (ext->current.rotation || ext->current.hflip);
return omap4_hwc_is_valid_layer(hwc_dev, layer, handle) &&
@@ -1164,7 +1101,7 @@ static int clone_layer(omap4_hwc_device_t *hwc_dev, int ix) {
struct dss2_ovl_info *o = &dsscomp->ovls[dsscomp->num_ovls];
if (dsscomp->num_ovls >= MAX_HW_OVERLAYS) {
- LOGE("**** cannot clone layer #%d. using all %d overlays.", ix, dsscomp->num_ovls);
+ ALOGE("**** cannot clone layer #%d. using all %d overlays.", ix, dsscomp->num_ovls);
return -EBUSY;
}
@@ -1179,9 +1116,6 @@ static int clone_layer(omap4_hwc_device_t *hwc_dev, int ix) {
/* use distinct z values (to simplify z-order checking) */
o->cfg.zorder += hwc_dev->post2_layers;
- if (hwc_dev->lcd_transform)
- omap4_hwc_adjust_lcd_layer_to_hdmi(hwc_dev,o);
-
omap4_hwc_adjust_ext_layer(&hwc_dev->ext, o);
dsscomp->num_ovls++;
return 0;
@@ -1211,7 +1145,7 @@ static int clone_external_layer(omap4_hwc_device_t *hwc_dev, int ix) {
yres != ext->last_yres_used ||
xpy < ext->last_xpy * (1.f - ASPECT_RATIO_TOLERANCE) ||
xpy * (1.f - ASPECT_RATIO_TOLERANCE) > ext->last_xpy) {
- LOGD("set up HDMI for %d*%d\n", xres, yres);
+ ALOGD("set up HDMI for %d*%d\n", xres, yres);
if (omap4_hwc_set_best_hdmi_mode(hwc_dev, xres, yres, xpy)) {
ext->current.enabled = 0;
return -ENODEV;
@@ -1323,8 +1257,8 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
/* ensure GFX layer is never scaled */
if (dsscomp->num_ovls == 0) {
- scaled_gfx = scaled(layer,hwc_dev) || is_NV12(handle);
- } else if (scaled_gfx && !scaled(layer,hwc_dev) && !is_NV12(handle)) {
+ scaled_gfx = scaled(layer) || is_NV12(handle);
+ } else if (scaled_gfx && !scaled(layer) && !is_NV12(handle)) {
/* swap GFX layer with this one */
dsscomp->ovls[dsscomp->num_ovls].cfg.ix = 0;
dsscomp->ovls[0].cfg.ix = dsscomp->num_ovls;
@@ -1337,7 +1271,6 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
display_area(&dsscomp->ovls[dsscomp->num_ovls]) > display_area(&dsscomp->ovls[ix_docking])))
ix_docking = dsscomp->num_ovls;
- omap4_hwc_adjust_lcd_layer(hwc_dev, &dsscomp->ovls[dsscomp->num_ovls]);
dsscomp->num_ovls++;
z++;
} else if (hwc_dev->use_sgx) {
@@ -1361,7 +1294,7 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
/* assign a z-layer for fb */
if (fb_z < 0) {
if (num.composited_layers)
- LOGE("**** should have assigned z-layer for fb");
+ ALOGE("**** should have assigned z-layer for fb");
fb_z = z++;
}
@@ -1374,11 +1307,6 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
dsscomp->ovls[0].cfg.pre_mult_alpha = 1;
dsscomp->ovls[0].addressing = OMAP_DSS_BUFADDR_LAYER_IX;
dsscomp->ovls[0].ba = 0;
- if (hwc_dev->lcd_transform)
- dsscomp->ovls[0].cfg.ix = num.max_hw_overlays;
- else
- dsscomp->ovls[0].cfg.ix = num.max_hw_overlays-1;
- omap4_hwc_adjust_lcd_layer(hwc_dev, &dsscomp->ovls[0]);
}
/* mirror layers */
@@ -1387,10 +1315,8 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
omap4_hwc_ext_t *ext = &hwc_dev->ext;
if (ext->current.enabled && hwc_dev->ext_ovls) {
if (ext->current.docking && ix_docking >= 0) {
- if (clone_external_layer(hwc_dev, ix_docking) == 0) {
+ if (clone_external_layer(hwc_dev, ix_docking) == 0)
dsscomp->ovls[dsscomp->num_ovls - 1].cfg.zorder = z++;
- dsscomp->ovls[dsscomp->num_ovls - 1].cfg.ix = MAX_HW_OVERLAYS - dsscomp->num_ovls;
- }
} else if (ext->current.docking && ix_docking < 0 && ext->force_dock) {
ix_docking = dsscomp->num_ovls;
struct dss2_ovl_info *oi = &dsscomp->ovls[ix_docking];
@@ -1400,7 +1326,6 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
if (clone_external_layer(hwc_dev, ix_docking) == 0) {
oi->addressing = OMAP_DSS_BUFADDR_FB;
oi->ba = 0;
- oi->cfg.ix = MAX_HW_OVERLAYS - dsscomp->num_ovls;
z++;
}
} else if (!ext->current.docking) {
@@ -1421,16 +1346,16 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
ext->last = ext->current;
if (z != dsscomp->num_ovls || dsscomp->num_ovls > MAX_HW_OVERLAYS)
- LOGE("**** used %d z-layers for %d overlays\n", z, dsscomp->num_ovls);
+ ALOGE("**** used %d z-layers for %d overlays\n", z, dsscomp->num_ovls);
/* verify all z-orders and overlay indices are distinct */
for (i = z = ix = 0; i < dsscomp->num_ovls; i++) {
struct dss2_ovl_cfg *c = &dsscomp->ovls[i].cfg;
if (z & (1 << c->zorder))
- LOGE("**** used z-order #%d multiple times", c->zorder);
+ ALOGE("**** used z-order #%d multiple times", c->zorder);
if (ix & (1 << c->ix))
- LOGE("**** used ovl index #%d multiple times", c->ix);
+ ALOGE("**** used ovl index #%d multiple times", c->ix);
z |= 1 << c->zorder;
ix |= 1 << c->ix;
}
@@ -1448,7 +1373,7 @@ static int omap4_hwc_prepare(struct hwc_composer_device *dev, hwc_layer_list_t*
}
if (debug) {
- LOGD("prepare (%d) - %s (comp=%d, poss=%d/%d scaled, RGB=%d,BGR=%d,NV12=%d) (ext=%s%s%ddeg%s %dex/%dmx (last %dex,%din)\n",
+ ALOGD("prepare (%d) - %s (comp=%d, poss=%d/%d scaled, RGB=%d,BGR=%d,NV12=%d) (ext=%s%s%ddeg%s %dex/%dmx (last %dex,%din)\n",
dsscomp->sync_id,
hwc_dev->use_sgx ? "SGX+OVL" : "all-OVL",
num.composited_layers,
@@ -1478,18 +1403,18 @@ static void omap4_hwc_reset_screen(omap4_hwc_device_t *hwc_dev)
/* remove bootloader image from the screen as blank/unblank does not change the composition */
ret = ioctl(hwc_dev->dsscomp_fd, DSSCIOC_SETUP_DISPC, &d);
if (ret)
- LOGW("failed to remove bootloader image");
+ ALOGW("failed to remove bootloader image");
/* blank and unblank fd to make sure display is properly programmed on boot.
* This is needed because the bootloader can not be trusted.
*/
ret = ioctl(hwc_dev->fb_fd, FBIOBLANK, FB_BLANK_POWERDOWN);
if (ret)
- LOGW("failed to blank display");
+ ALOGW("failed to blank display");
ret = ioctl(hwc_dev->fb_fd, FBIOBLANK, FB_BLANK_UNBLANK);
if (ret)
- LOGW("failed to blank display");
+ ALOGW("failed to blank display");
}
}
@@ -1517,7 +1442,7 @@ static int omap4_hwc_set(struct hwc_composer_device *dev, hwc_display_t dpy,
if (hwc_dev->use_sgx) {
if (!eglSwapBuffers((EGLDisplay)dpy, (EGLSurface)sur)) {
- LOGE("eglSwapBuffers error");
+ ALOGE("eglSwapBuffers error");
err = HWC_EGL_ERROR;
goto err_out;
}
@@ -1534,20 +1459,11 @@ static int omap4_hwc_set(struct hwc_composer_device *dev, hwc_display_t dpy,
hwc_dev->buffers,
hwc_dev->post2_layers,
dsscomp, sizeof(*dsscomp));
-
- if (!hwc_dev->use_sgx) {
- __u32 crt = 0;
- int err2 = ioctl(hwc_dev->fb_fd, FBIO_WAITFORVSYNC, &crt);
- if (err2) {
- LOGE("failed to wait for vsync (%d)", errno);
- err = err ? : -errno;
- }
- }
}
hwc_dev->last_ext_ovls = hwc_dev->ext_ovls;
hwc_dev->last_int_ovls = hwc_dev->post2_layers;
if (err)
- LOGE("Post2 error");
+ ALOGE("Post2 error");
err_out:
pthread_mutex_unlock(&hwc_dev->lock);
@@ -1600,7 +1516,7 @@ static int load_png_image(omap4_hwc_device_t *hwc_dev, char *path, struct omap4_
FILE *fd = fopen(path, "rb");
if (!fd) {
- LOGE("failed to open PNG file %s: (%d)", path, errno);
+ ALOGE("failed to open PNG file %s: (%d)", path, errno);
return -EINVAL;
}
@@ -1608,7 +1524,7 @@ static int load_png_image(omap4_hwc_device_t *hwc_dev, char *path, struct omap4_
__u8 header[SIZE_PNG_HEADER];
fread(header, 1, SIZE_PNG_HEADER, fd);
if (png_sig_cmp(header, 0, SIZE_PNG_HEADER)) {
- LOGE("%s is not a PNG file", path);
+ ALOGE("%s is not a PNG file", path);
goto fail;
}
@@ -1656,7 +1572,7 @@ static int load_png_image(omap4_hwc_device_t *hwc_dev, char *path, struct omap4_
png_set_bgr(png_ptr);
break;
default:
- LOGE("unsupported PNG color: %x", color_type);
+ ALOGE("unsupported PNG color: %x", color_type);
goto fail_alloc;
}
@@ -1666,14 +1582,14 @@ static int load_png_image(omap4_hwc_device_t *hwc_dev, char *path, struct omap4_
const int bpp = 4;
img->size = ALIGN(width * height * bpp, 4096);
if (img->size > hwc_dev->img_mem_size) {
- LOGE("image does not fit into framebuffer area (%d > %d)", img->size, hwc_dev->img_mem_size);
+ ALOGE("image does not fit into framebuffer area (%d > %d)", img->size, hwc_dev->img_mem_size);
goto fail_alloc;
}
img->ptr = hwc_dev->img_mem_ptr;
row_pointers = calloc(height, sizeof(*row_pointers));
if (!row_pointers) {
- LOGE("failed to allocate row pointers");
+ ALOGE("failed to allocate row pointers");
goto fail_alloc;
}
__u32 i;
@@ -1696,7 +1612,7 @@ fail_alloc:
free_png_image(hwc_dev, img);
free(row_pointers);
if (!png_ptr || !info_ptr)
- LOGE("failed to allocate PNG structures");
+ ALOGE("failed to allocate PNG structures");
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fail:
fclose(fd);
@@ -1745,78 +1661,14 @@ static int omap4_hwc_open_fb_hal(IMG_framebuffer_device_public_t **fb_dev)
return 0;
err_out:
- LOGE("Composer HAL failed to load compatible Graphics HAL");
+ ALOGE("Composer HAL failed to load compatible Graphics HAL");
return err;
}
-static void set_lcd_transform_matrix(omap4_hwc_device_t *hwc_dev)
-{
-/* create LCD translation matrix */
-
- hwc_rect_t region = { .left = 0, .top = 0, .right = hwc_dev->fb_dev->base.width, .bottom = hwc_dev->fb_dev->base.height };
- hwc_dev->fb_dis.ix = 0;/*Default display*/
- int ret = ioctl(hwc_dev->dsscomp_fd, DSSCIOC_QUERY_DISPLAY, &hwc_dev->fb_dis);
- if (ret) {
- LOGE("failed to get display info (%d): %m", errno);
- }
-
- int lcd_w = hwc_dev->fb_dis.timings.x_res;
- int lcd_h = hwc_dev->fb_dis.timings.y_res;
- int orig_w = WIDTH(region);
- int orig_h = HEIGHT(region);
- hwc_dev->lcd_region = region;
- hwc_dev->lcd_rotation = ((lcd_w > lcd_h) ^ (orig_w > orig_h)) ? 1 : 0;
- hwc_dev->lcd_transform = ((lcd_w != orig_w)||(lcd_h != orig_h)) ? 1 : 0;
-
- LOGI("transforming FB (%dx%d) => (%dx%d) rot%d", orig_w, orig_h, lcd_w, lcd_h, hwc_dev->lcd_rotation);
-
- /* reorientation matrix is:
- m = (center-from-target-center) * (scale-to-target) * (mirror) * (rotate) * (center-to-original-center) */
-
- memcpy(hwc_dev->lcd_m, m_unit, sizeof(m_unit));
- m_translate(hwc_dev->lcd_m, -(orig_w >> 1) - region.left, -(orig_h >> 1) - region.top);
- m_rotate(hwc_dev->lcd_m, hwc_dev->lcd_rotation);
- if (hwc_dev->lcd_rotation & 1)
- swap(orig_w, orig_h);
- m_scale(hwc_dev->lcd_m, orig_w, lcd_w, orig_h, lcd_h);
- m_translate(hwc_dev->lcd_m, lcd_w >> 1, lcd_h >> 1);
-
- /*create reverse LCD transformation*/
- memcpy(hwc_dev->lcd_hdmi_m, m_unit, sizeof(m_unit));
- m_translate(hwc_dev->lcd_hdmi_m, -(lcd_w >> 1) - 0, -(lcd_h >> 1) - 0);
- m_rotate(hwc_dev->lcd_hdmi_m, hwc_dev->lcd_rotation);
- if (hwc_dev->lcd_rotation & 1)
- swap(lcd_w, lcd_h);
- m_scale(hwc_dev->lcd_hdmi_m, lcd_w, orig_w, lcd_h, orig_h);
- m_translate(hwc_dev->lcd_hdmi_m, (orig_w >> 1) - region.left,(orig_h >> 1) - region.top);
- return;
-}
static void handle_hotplug(omap4_hwc_device_t *hwc_dev)
{
omap4_hwc_ext_t *ext = &hwc_dev->ext;
__u8 state = ext->hdmi_state;
- /* Ignore external HDMI logic if the primary display is HDMI */
- if (hwc_dev->on_tv) {
- LOGI("Primary display is HDMI - skip clone/dock logic");
-
- if (state) {
- __u32 xres = WIDTH(ext->mirror_region);
- __u32 yres = HEIGHT(ext->mirror_region);
- if (omap4_hwc_set_best_hdmi_mode(hwc_dev, xres, yres, ext->lcd_xpy)) {
- LOGE("Failed to set HDMI mode");
- }
- set_lcd_transform_matrix(hwc_dev);
- ioctl(hwc_dev->fb_fd, FBIOBLANK, FB_BLANK_UNBLANK);
-
- if (hwc_dev->procs && hwc_dev->procs->invalidate) {
- hwc_dev->procs->invalidate(hwc_dev->procs);
- }
- } else {
- ext->last_mode = 0;
- }
-
- return;
- }
pthread_mutex_lock(&hwc_dev->lock);
ext->dock.enabled = ext->mirror.enabled = 0;
@@ -1835,7 +1687,7 @@ static void handle_hotplug(omap4_hwc_device_t *hwc_dev)
ext->dock.rotation = atoi(value) & EXT_ROTATION;
ext->dock.hflip = (atoi(value) & EXT_HFLIP) > 0;
ext->dock.docking = 1;
- property_get("persist.hwc.mirroring.transform", value, hwc_dev->fb_dis.timings.y_res > hwc_dev->fb_dis.timings.x_res ? "3" : "0");
+ property_get("persist.hwc.mirroring.transform", value, hwc_dev->fb_dev->base.height > hwc_dev->fb_dev->base.width ? "3" : "0");
ext->mirror.rotation = atoi(value) & EXT_ROTATION;
ext->mirror.hflip = (atoi(value) & EXT_HFLIP) > 0;
ext->mirror.docking = 0;
@@ -1865,7 +1717,7 @@ static void handle_hotplug(omap4_hwc_device_t *hwc_dev)
} else {
ext->last_mode = 0;
}
- LOGI("external display changed (state=%d, mirror={%s tform=%ddeg%s}, dock={%s tform=%ddeg%s%s}, tv=%d", state,
+ ALOGI("external display changed (state=%d, mirror={%s tform=%ddeg%s}, dock={%s tform=%ddeg%s%s}, tv=%d", state,
ext->mirror.enabled ? "enabled" : "disabled",
ext->mirror.rotation * 90,
ext->mirror.hflip ? "+hflip" : "",
@@ -1949,7 +1801,7 @@ static void *omap4_hwc_hdmi_thread(void *data)
if (err == -1) {
if (errno != EINTR)
- LOGE("event error: %m");
+ ALOGE("event error: %m");
continue;
}
@@ -1995,7 +1847,7 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name,
return err;
if (!hwc_mod->fb_dev) {
- LOGE("Framebuffer HAL not opened before HWC");
+ ALOGE("Framebuffer HAL not opened before HWC");
return -EFAULT;
}
hwc_mod->fb_dev->bBypassPost = 1;
@@ -2008,7 +1860,7 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name,
memset(hwc_dev, 0, sizeof(*hwc_dev));
hwc_dev->base.common.tag = HARDWARE_DEVICE_TAG;
- hwc_dev->base.common.version = HWC_API_VERSION;
+ hwc_dev->base.common.version = HWC_DEVICE_API_VERSION;
hwc_dev->base.common.module = (hw_module_t *)module;
hwc_dev->base.common.close = omap4_hwc_device_close;
hwc_dev->base.prepare = omap4_hwc_prepare;
@@ -2020,21 +1872,28 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name,
hwc_dev->dsscomp_fd = open("/dev/dsscomp", O_RDWR);
if (hwc_dev->dsscomp_fd < 0) {
- LOGE("failed to open dsscomp (%d)", errno);
+ ALOGE("failed to open dsscomp (%d)", errno);
+ err = -errno;
+ goto done;
+ }
+
+ hwc_dev->hdmi_fb_fd = open("/dev/graphics/fb1", O_RDWR);
+ if (hwc_dev->hdmi_fb_fd < 0) {
+ ALOGE("failed to open hdmi fb (%d)", errno);
err = -errno;
goto done;
}
hwc_dev->fb_fd = open("/dev/graphics/fb0", O_RDWR);
if (hwc_dev->fb_fd < 0) {
- LOGE("failed to open fb (%d)", errno);
+ ALOGE("failed to open fb (%d)", errno);
err = -errno;
goto done;
}
struct fb_fix_screeninfo fix;
if (ioctl(hwc_dev->fb_fd, FBIOGET_FSCREENINFO, &fix)) {
- LOGE("failed to get fb info (%d)", errno);
+ ALOGE("failed to get fb info (%d)", errno);
err = -errno;
goto done;
}
@@ -2042,7 +1901,7 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name,
hwc_dev->img_mem_size = fix.smem_len;
hwc_dev->img_mem_ptr = mmap(NULL, fix.smem_len, PROT_WRITE, MAP_SHARED, hwc_dev->fb_fd, 0);
if (hwc_dev->img_mem_ptr == MAP_FAILED) {
- LOGE("failed to map fb memory");
+ ALOGE("failed to map fb memory");
err = -errno;
goto done;
}
@@ -2055,41 +1914,27 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name,
int ret = ioctl(hwc_dev->dsscomp_fd, DSSCIOC_QUERY_DISPLAY, &hwc_dev->fb_dis);
if (ret) {
- LOGE("failed to get display info (%d): %m", errno);
+ ALOGE("failed to get display info (%d): %m", errno);
err = -errno;
goto done;
}
hwc_dev->ext.lcd_xpy = (float) hwc_dev->fb_dis.width_in_mm / hwc_dev->fb_dis.timings.x_res /
hwc_dev->fb_dis.height_in_mm * hwc_dev->fb_dis.timings.y_res;
- if (hwc_dev->fb_dis.channel == OMAP_DSS_CHANNEL_DIGIT) {
- LOGI("Primary display is HDMI");
- hwc_dev->on_tv = 1;
- }
- else {
- hwc_dev->hdmi_fb_fd = open("/dev/graphics/fb1", O_RDWR);
- if (hwc_dev->hdmi_fb_fd < 0) {
- LOGE("failed to open hdmi fb (%d)", errno);
- err = -errno;
- goto done;
- }
- }
- set_lcd_transform_matrix( hwc_dev );
-
if (pipe(hwc_dev->pipe_fds) == -1) {
- LOGE("failed to event pipe (%d): %m", errno);
+ ALOGE("failed to event pipe (%d): %m", errno);
err = -errno;
goto done;
}
if (pthread_mutex_init(&hwc_dev->lock, NULL)) {
- LOGE("failed to create mutex (%d): %m", errno);
+ ALOGE("failed to create mutex (%d): %m", errno);
err = -errno;
goto done;
}
if (pthread_create(&hwc_dev->hdmi_thread, NULL, omap4_hwc_hdmi_thread, hwc_dev))
{
- LOGE("failed to create HDMI listening thread (%d): %m", errno);
+ ALOGE("failed to create HDMI listening thread (%d): %m", errno);
err = -errno;
goto done;
}
@@ -2113,10 +1958,10 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name,
&hwc_dev->ext.mirror_region.right, &hwc_dev->ext.mirror_region.bottom) != 4 ||
hwc_dev->ext.mirror_region.left >= hwc_dev->ext.mirror_region.right ||
hwc_dev->ext.mirror_region.top >= hwc_dev->ext.mirror_region.bottom) {
- struct hwc_rect fb_region = { .right = hwc_dev->fb_dis.timings.x_res, .bottom = hwc_dev->fb_dis.timings.y_res };
+ struct hwc_rect fb_region = { .right = hwc_dev->fb_dev->base.width, .bottom = hwc_dev->fb_dev->base.height };
hwc_dev->ext.mirror_region = fb_region;
}
- LOGI("clone region is set to (%d,%d) to (%d,%d)",
+ ALOGI("clone region is set to (%d,%d) to (%d,%d)",
hwc_dev->ext.mirror_region.left, hwc_dev->ext.mirror_region.top,
hwc_dev->ext.mirror_region.right, hwc_dev->ext.mirror_region.bottom);
@@ -2137,7 +1982,7 @@ static int omap4_hwc_device_open(const hw_module_t* module, const char* name,
}
handle_hotplug(hwc_dev);
- LOGI("omap4_hwc_device_open(rgb_order=%d nv12_only=%d)",
+ ALOGI("omap4_hwc_device_open(rgb_order=%d nv12_only=%d)",
hwc_dev->flags_rgb_order, hwc_dev->flags_nv12_only);
done:
@@ -2164,8 +2009,8 @@ omap4_hwc_module_t HAL_MODULE_INFO_SYM = {
.base = {
.common = {
.tag = HARDWARE_MODULE_TAG,
- .version_major = 1,
- .version_minor = 0,
+ .module_api_version = HWC_MODULE_API_VERSION,
+ .hal_api_version = HARDWARE_HAL_API_VERSION,
.id = HWC_HARDWARE_MODULE_ID,
.name = "OMAP 44xx Hardware Composer HAL",
.author = "Texas Instruments",