OSDN Git Service

minigbm: i915: Determine tiling based on the combinations
authorTomasz Figa <tfiga@chromium.org>
Fri, 23 Jun 2017 09:04:02 +0000 (18:04 +0900)
committerchrome-bot <chrome-bot@chromium.org>
Tue, 11 Jul 2017 07:38:59 +0000 (00:38 -0700)
We already have the combinations infrastructure, which contains all the
information about supported tiling modes for given usage. Instead of
hardcoding this in i915_bo_create() one more time, let's just query for
the best available combination.

BUG=b:37615277
TEST=test_that reef graphics_Drm.bvt

Change-Id: I320da6419d001a41e965df00595de2fe17bd60f8
Reviewed-on: https://chromium-review.googlesource.com/544488
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
i915.c

diff --git a/i915.c b/i915.c
index adf2739..2f99ce5 100644 (file)
--- a/i915.c
+++ b/i915.c
@@ -271,16 +271,13 @@ static int i915_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32
        uint32_t stride;
        struct drm_i915_gem_create gem_create;
        struct drm_i915_gem_set_tiling gem_set_tiling;
+       struct combination *combo;
 
-       if (flags & (BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN))
-               bo->tiling = I915_TILING_NONE;
-       else if (flags & BO_USE_SCANOUT)
-               bo->tiling = I915_TILING_X;
-       else
-               bo->tiling = I915_TILING_Y;
+       combo = drv_get_combination(bo->drv, format, flags);
+       if (!combo)
+               return -EINVAL;
 
-       if (format == DRM_FORMAT_YVU420 || format == DRM_FORMAT_YVU420_ANDROID)
-               bo->tiling = I915_TILING_NONE;
+       bo->tiling = combo->metadata.tiling;
 
        stride = drv_stride_from_format(format, width, 0);