OSDN Git Service

minigbm: fix stride logic
authorGurchetan Singh <gurchetansingh@chromium.org>
Wed, 29 Mar 2017 19:37:01 +0000 (12:37 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Thu, 30 Mar 2017 03:48:33 +0000 (20:48 -0700)
We shouldn't round up to the nearest byte. This way we can represent
formats like Y41P.  Makes no difference currently since
drv_bpp_from_format only returns numbers divisible by eight.

Change-Id: I57bcab383f1661ea11e9aa1d30e18750574143e2
Reviewed-on: https://chromium-review.googlesource.com/462478
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
drv.c

diff --git a/drv.c b/drv.c
index 667151d..1b94bd6 100644 (file)
--- a/drv.c
+++ b/drv.c
@@ -506,8 +506,8 @@ uint32_t drv_resolve_format(struct driver *drv, uint32_t format)
  */
 int drv_stride_from_format(uint32_t format, uint32_t width, size_t plane)
 {
-       int stride = width * DIV_ROUND_UP(drv_bpp_from_format(format, plane),
-                                         8);
+       int stride = DIV_ROUND_UP(width * drv_bpp_from_format(format, plane),
+                                 8);
 
        /*
         * Only downsample for certain multiplanar formats which have horizontal