OSDN Git Service

check usage flags against device's supported formats in gbm_bo_create
authorZach Reizner <zachr@google.com>
Thu, 25 Feb 2016 19:44:36 +0000 (11:44 -0800)
committerchrome-bot <chrome-bot@chromium.org>
Fri, 26 Feb 2016 02:25:42 +0000 (18:25 -0800)
Previously, gbm_bo_create called gbm_device_is_format_supported with 0
hardcoded as the usage flags. This meant gbm_bo_create could attempt to
create buffer objects for unsupported combos of usage flags and pixel
formats. Using 0 as the usage flag basically meant ANY usage flag that
was supported by the device would work.

Of course that's not the reality, and the usage flag should be
considered along with the pixel format during buffer object creation,
which is what this CL does.

TEST=ui works
BUG=None

Change-Id: Icd3bd0f47dc33790e4476515f2024f9765bea0a2
Reviewed-on: https://chromium-review.googlesource.com/329306
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
gbm.c

diff --git a/gbm.c b/gbm.c
index 628ed3f..2408d0c 100644 (file)
--- a/gbm.c
+++ b/gbm.c
@@ -218,7 +218,7 @@ PUBLIC struct gbm_bo *gbm_bo_create(struct gbm_device *gbm, uint32_t width,
        struct gbm_bo *bo;
        int ret;
 
-       if (!gbm_device_is_format_supported(gbm, format, 0))
+       if (!gbm_device_is_format_supported(gbm, format, flags))
                return NULL;
 
        bo = gbm_bo_new(gbm, width, height, format);