OSDN Git Service

minigbm: align first plane to 64 bytes
authorGurchetan Singh <gurchetansingh@chromium.org>
Wed, 8 Feb 2017 23:09:13 +0000 (15:09 -0800)
committerchrome-bot <chrome-bot@chromium.org>
Sat, 18 Feb 2017 08:39:28 +0000 (00:39 -0800)
The chroma stride of Android YV12 buffers is required to be
aligned to 16 bytes (see <system/graphics.h>).

Additionally, the size of the ARM L1 cache line is 64-bytes
(see chrome-os-partner:45777).

Let's always align the first plane to 64 bytes. The chroma strides
will be aligned to 32 bytes in that case.

BUG=chromium:616275
TEST=

ImageReaderDecoderTest#testGoogH264ImageReader

passes on veyron_minnie-cheets.

Change-Id: I87a309ce0612bf8c5be8f8e47dad3da10d61a081
Reviewed-on: https://chromium-review.googlesource.com/441912
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
mediatek.c
rockchip.c

index 7e85f63..a1db9db 100644 (file)
@@ -49,7 +49,13 @@ static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height,
        int ret;
        size_t plane;
        struct drm_mtk_gem_create gem_create;
+       uint32_t bytes_per_pixel = drv_stride_from_format(format, 1, 0);
 
+       /*
+        * Since the ARM L1 cache line size is 64 bytes, align to that as a
+        * performance optimization.
+        */
+       width = ALIGN(width, DIV_ROUND_UP(64, bytes_per_pixel));
        drv_bo_from_format(bo, width, height, format);
 
        memset(&gem_create, 0, sizeof(gem_create));
index 30b6822..140ec93 100644 (file)
@@ -142,6 +142,13 @@ static int rockchip_bo_create_with_modifiers(struct bo *bo,
                        fprintf(stderr, "no usable modifier found\n");
                        return -1;
                }
+
+               /*
+                * Since the ARM L1 cache line size is 64 bytes, align to that
+                * as a performance optimization.
+                */
+               uint32_t bytes_per_pixel = drv_stride_from_format(format, 1, 0);
+               width = ALIGN(width, DIV_ROUND_UP(64, bytes_per_pixel));
                drv_bo_from_format(bo, width, height, format);
        }