e_plane: correct the layer size information 14/90914/5
authorBoram Park <boram1288.park@samsung.com>
Wed, 5 Oct 2016 02:38:33 +0000 (11:38 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 10 Oct 2016 02:16:23 +0000 (11:16 +0900)
Change-Id: I57868132c0747d86a3b7509af17ecd82e8ef7960

src/bin/e_plane.c

index ba851d2e52b5f4c2ce1628751e871a69c3bf7aa4..7a91d55eb0d003f85c48f1d720773b4391a2df1f 100644 (file)
@@ -118,10 +118,34 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
    tdm_layer *tlayer = plane->tlayer;
    E_Output *output = plane->output;
    E_Client *ec = plane->ec;
+   int aligned_width;
 
    /* set layer when the layer infomation is different from the previous one */
    tbm_surface_get_info(tsurface, &surf_info);
 
+   switch (surf_info.format)
+     {
+      case TBM_FORMAT_YUV420:
+      case TBM_FORMAT_YVU420:
+      case TBM_FORMAT_YUV422:
+      case TBM_FORMAT_YVU422:
+      case TBM_FORMAT_NV12:
+      case TBM_FORMAT_NV21:
+        aligned_width = surf_info.planes[0].stride;
+        break;
+      case TBM_FORMAT_YUYV:
+      case TBM_FORMAT_UYVY:
+        aligned_width = surf_info.planes[0].stride >> 1;
+        break;
+      case TBM_FORMAT_ARGB8888:
+      case TBM_FORMAT_XRGB8888:
+        aligned_width = surf_info.planes[0].stride >> 2;
+        break;
+      default:
+        ERR("not supported format: %x", surf_info.format);
+        return EINA_FALSE;
+     }
+
    if (ec)
      {
         if (plane->info.src_config.size.h != surf_info.planes[0].stride ||
@@ -136,7 +160,7 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
             plane->info.dst_pos.h != surf_info.height ||
             plane->info.transform != TDM_TRANSFORM_NORMAL)
           {
-              plane->info.src_config.size.h = surf_info.planes[0].stride;
+              plane->info.src_config.size.h = aligned_width;
               plane->info.src_config.size.v = surf_info.height;
               plane->info.src_config.pos.x = 0;
               plane->info.src_config.pos.y = 0;
@@ -170,7 +194,7 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
             plane->info.dst_pos.h != output->config.geom.h ||
             plane->info.transform != TDM_TRANSFORM_NORMAL)
           {
-              plane->info.src_config.size.h = surf_info.planes[0].stride;
+              plane->info.src_config.size.h = aligned_width;
               plane->info.src_config.size.v = surf_info.height;
               plane->info.src_config.pos.x = 0;
               plane->info.src_config.pos.y = 0;