summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGowtham Tammana <g-tammana@ti.com>2017-02-08 10:57:24 -0600
committerGowtham Tammana <g-tammana@ti.com>2017-02-13 14:49:08 -0500
commit79a618b84d81ca66c858e1b8407ceb77d0144b39 (patch)
treede3d789c59985cbb42e8daa2722fbee036e2c37e
parentad648e97891f5c8a910afe143364fff8c5a1a937 (diff)
downloaddra7xx-79a618b84d81ca66c858e1b8407ceb77d0144b39.tar.gz
hwc: Enable NV12 DSS composition
Enables support for NV12 layer composition using DSS pipes. Normally the layers are assigned to pipes in the order they are enumerated in hwc. GFX pipe is usually the first pipe and in the event of first layer being NV12, we swap it to the next available VID pipe. Change-Id: Ic654ad621871c1253604468d91b52974b73d1410 Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
-rw-r--r--hwcomposer/color_fmt.c3
-rw-r--r--hwcomposer/display.c41
-rw-r--r--hwcomposer/hwc.c13
3 files changed, 27 insertions, 30 deletions
diff --git a/hwcomposer/color_fmt.c b/hwcomposer/color_fmt.c
index 2dc8310..321166f 100644
--- a/hwcomposer/color_fmt.c
+++ b/hwcomposer/color_fmt.c
@@ -35,8 +35,7 @@ bool is_valid_format(uint32_t format)
return false;
case HAL_PIXEL_FORMAT_NV12:
- /* Dropping NV12 for now */
- return false;
+ return true;
case HAL_PIXEL_FORMAT_RGBX_8888:
case HAL_PIXEL_FORMAT_BGRX_8888:
diff --git a/hwcomposer/display.c b/hwcomposer/display.c
index 31257ae..992e311 100644
--- a/hwcomposer/display.c
+++ b/hwcomposer/display.c
@@ -884,19 +884,17 @@ int display_create_drm_fb(display_t *display, buffer_handle_t handle,
IMG_native_handle_t *img_hnd;
kms_display_t *kdisp;
int drm_fd;
- composition_t *comp;
-
uint32_t gem_handle;
if (!display || !fb_info || !handle)
return EINVAL;
+
if (fb_info->bo[0]) {
ALOGE("existing handle needs to be closed first");
return EINVAL;
}
kdisp = &display->disp_link;
drm_fd = kdisp->ctx->drm_fd;
- comp = &display->composition;
img_hnd = (IMG_native_handle_t *)handle;
ret = drmPrimeFDToHandle(drm_fd, img_hnd->fd[0], &gem_handle);
@@ -909,26 +907,23 @@ int display_create_drm_fb(display_t *display, buffer_handle_t handle,
fb_info->width = img_hnd->iWidth;
fb_info->height = img_hnd->iHeight;
fb_info->format = convert_hal_to_drm_format(img_hnd->iFormat, true);
- fb_info->pitches[0] = ALIGN(img_hnd->iWidth, HW_ALIGN) * 4;
+ fb_info->pitches[0] =
+ ALIGN(img_hnd->iWidth, HW_ALIGN) * get_format_bpp(img_hnd->iFormat)>>3;
fb_info->bo[0] = gem_handle;
fb_info->offsets[0] = 0;
- if (!plane_data) {
+ if (plane_data) {
/* this fb is for overlay plane */
- struct drm_mode_set_plane *ovl = plane_data;
+ drm_plane_props_t *ovl = (drm_plane_props_t *)plane_data;
switch (fb_info->format) {
case DRM_FORMAT_NV12:
fb_info->bo[1] = gem_handle;
- fb_info->pitches[0] = ALIGN(img_hnd->iWidth, 32);
+ fb_info->pitches[0] = ALIGN(img_hnd->iWidth, HW_ALIGN);
fb_info->pitches[1] = fb_info->pitches[0];
- fb_info->offsets[0] = ALIGN(ovl->src_x +
- (img_hnd->iWidth * ovl->src_y), 32);
- fb_info->offsets[1] = ALIGN(img_hnd->iWidth *
- (img_hnd->iHeight + (ovl->src_y/2)) +
- ovl->src_x, 32);
+ fb_info->offsets[1] = fb_info->pitches[0] * img_hnd->iHeight;
break;
case DRM_FORMAT_ARGB8888:
break;
@@ -955,6 +950,7 @@ int display_release_drm_fb(display_t *display, drm_fb_info_t *fb_info)
{
int ret = 0;
int drm_fd = 0;
+ uint32_t i = 0;
struct drm_gem_close close_args;
if (!display || !fb_info)
@@ -973,15 +969,16 @@ int display_release_drm_fb(display_t *display, drm_fb_info_t *fb_info)
* so clean. ideally need to loop through the four handles and close
* each one of it.
*/
- if (fb_info->bo[0]) {
- close_args.handle = fb_info->bo[0];
- ret = drmIoctl(drm_fd, DRM_IOCTL_GEM_CLOSE, &close_args);
- if (ret) {
- return ret;
- } else {
- memset(fb_info, 0, sizeof(drm_fb_info_t));
-
- return 0;
+ for (i = 0; i < 4; i++) {
+ if (fb_info->bo[i]) {
+ close_args.handle = fb_info->bo[i];
+ ret = drmIoctl(drm_fd, DRM_IOCTL_GEM_CLOSE, &close_args);
+ if (ret) {
+ return ret;
+ } else {
+ memset(fb_info, 0, sizeof(drm_fb_info_t));
+ return 0;
+ }
}
}
return errno;
@@ -1785,3 +1782,5 @@ free_plane:
return err;
}
+
+
diff --git a/hwcomposer/hwc.c b/hwcomposer/hwc.c
index f634714..bfd0208 100644
--- a/hwcomposer/hwc.c
+++ b/hwcomposer/hwc.c
@@ -216,6 +216,7 @@ static void hwc_check_dss_composition(omap_hwc_device_t *hwc_dev, int disp)
comp->use_dss = false;
return;
}
+
static int hwc_prepare_for_display(omap_hwc_device_t *hwc_dev, int disp)
{
if (!is_valid_display(hwc_dev, disp))
@@ -246,13 +247,11 @@ static int hwc_prepare_for_display(omap_hwc_device_t *hwc_dev, int disp)
} else if (!comp->use_blitter && !comp->use_sgx && comp->use_dss) {
/* DSS only composition */
if (is_nv12_layer(&list->hwLayers[0])) {
- /* First layer is NV12, GFX pipe cannot handle NV12, swap the
- * zorder */
- comp->plane_info[0].zorder = 1;
- comp->plane_info[0].layer = comp->plane_info[1].layer;
-
- comp->plane_info[1].zorder = 0;
- comp->plane_info[1].layer = &list->hwLayers[0];
+ /* GFX pipe cannot handle NV12, swap out if layer[0] is NV12,
+ * assuming second is non-NV12. FIXME
+ */
+ adjust_drm_plane_to_layer(&list->hwLayers[0], 0, &comp->plane_info[1]);
+ adjust_drm_plane_to_layer(&list->hwLayers[1], 1, &comp->plane_info[0]);
}
}