hwc: support drm video play back.
authorSanghee Kim <haya93@samsung.com>
Thu, 9 Aug 2012 06:31:10 +0000 (23:31 -0700)
committerDima Zavin <dima@android.com>
Tue, 28 Aug 2012 07:25:26 +0000 (00:25 -0700)
In case of drm video play back, GSC's destination buffer
should be allocateed from reserved memory using protected flag
in gralloc.
If src buffer is protected buffer, dst buffer should be same.

Change-Id: I5eb2a698f2ca404a585c436d6536462580ca4ba6
Signed-off-by: Sanghee Kim <haya93@samsung.com>
libhwc/hwc.cpp

index 4e7877a3f7e10f5b3abe7771fbc0e3c8a1493a99..3378a451795e22644b8e3a2aed351a500e7db430 100644 (file)
@@ -743,6 +743,7 @@ static int exynos5_config_gsc_m2m(hwc_layer_1_t &layer,
         src_cfg.vaddr = src_handle->fd2;
     }
     src_cfg.format = src_handle->format;
+    src_cfg.drmMode = !!(src_handle->flags & GRALLOC_USAGE_PROTECTED);
 
     dst_cfg.x = 0;
     dst_cfg.y = 0;
@@ -760,7 +761,9 @@ static int exynos5_config_gsc_m2m(hwc_layer_1_t &layer,
         int usage = GRALLOC_USAGE_SW_READ_NEVER |
                 GRALLOC_USAGE_SW_WRITE_NEVER |
                 GRALLOC_USAGE_HW_COMPOSER;
-        // TODO: add GRALLOC_USAGE_PROTECTED if source buffer is also protected
+
+        if (src_handle->flags & GRALLOC_USAGE_PROTECTED)
+            usage |= GRALLOC_USAGE_PROTECTED;
 
         int w = ALIGN(WIDTH(layer.displayFrame), GSC_W_ALIGNMENT);
         int h = ALIGN(HEIGHT(layer.displayFrame), GSC_H_ALIGNMENT);
@@ -790,6 +793,7 @@ static int exynos5_config_gsc_m2m(hwc_layer_1_t &layer,
     dst_cfg.fw = dst_handle->stride;
     dst_cfg.fh = dst_handle->vstride;
     dst_cfg.yaddr = dst_handle->fd;
+    dst_cfg.drmMode = !!(dst_handle->flags & GRALLOC_USAGE_PROTECTED);
 
     ALOGV("destination configuration:");
     dump_gsc_img(dst_cfg);