OSDN Git Service

minigbm: cros_gralloc: don't fail BO_USE_SW_*_OFTEN | BO_USE_RENDERING allocation
authorGurchetan Singh <gurchetansingh@chromium.org>
Tue, 27 Dec 2016 18:25:18 +0000 (10:25 -0800)
committerchrome-bot <chrome-bot@chromium.org>
Thu, 29 Dec 2016 08:58:17 +0000 (00:58 -0800)
Some camera CTS tests pass down the following usage:

GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_WRITE_OFTEN,

which we convert. Since we generally want to create a tiled buffer when
GRALLOC_USAGE_HW_TEXTURE is specified and tiled buffers are inefficient for
frequent software access, many drivers don't support this combination.

When this occurs, let's drop the BO_USE_RENDERING flag and try the allocation again
with different flags.

BUG=chromium:616275
TEST=run cts --disable-reboot --class android.hardware.camera2.cts.MultiViewTest
passes on kevin

Change-Id: Id3364edb849fe92d4710c765ed664e8aa4a4738d
Reviewed-on: https://chromium-review.googlesource.com/424318
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
cros_gralloc/cros_alloc_device.cc

index 5405744..97c8186 100644 (file)
@@ -29,6 +29,14 @@ static struct cros_gralloc_bo *cros_gralloc_bo_create(struct driver *drv,
                                                         DRM_FORMAT_MOD_NONE);
        }
 
+       if (!supported && (drv_usage & BO_USE_RENDERING) &&
+           (drv_usage && (BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN))) {
+               drv_usage &= ~BO_USE_RENDERING;
+               supported = drv_is_combination_supported(drv, drv_format,
+                                                        drv_usage,
+                                                        DRM_FORMAT_MOD_NONE);
+       }
+
        if (!supported) {
                cros_gralloc_error("Unsupported combination -- HAL format: %u, "
                                   "HAL flags: %u, drv_format: %u, "