OSDN Git Service

Populate the stride field when creating gbm_bos
authorDaniel Nicoara <dnicoara@chromium.org>
Thu, 25 Sep 2014 22:53:19 +0000 (18:53 -0400)
committerchrome-internal-fetch <chrome-internal-fetch@google.com>
Fri, 26 Sep 2014 03:24:00 +0000 (03:24 +0000)
BUG=chromium:394868,chromium:402597,chromium:413947,chromium:412508
TEST=compiled & verified stride value on pixel

Change-Id: I5555289a9549b803ee29a7d4fbf75987b02afa1b
Reviewed-on: https://chromium-review.googlesource.com/219865
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Daniel Nicoara <dnicoara@chromium.org>
Tested-by: Daniel Nicoara <dnicoara@chromium.org>
exynos.c
helpers.c
i915.c
rockchip.c
tegra.c

index 6b2e6d8..6015d75 100644 (file)
--- a/exynos.c
+++ b/exynos.c
@@ -29,6 +29,7 @@ int gbm_exynos_bo_create(struct gbm_bo *bo, uint32_t width, uint32_t height, uin
 
        bo->handle.u32 = gem_create.handle;
        bo->size = size;
+       bo->stride = width * gbm_bytes_from_format(format);
 
        return 0;
 }
index 4158f0f..5d86451 100644 (file)
--- a/helpers.c
+++ b/helpers.c
@@ -104,6 +104,7 @@ int gbm_dumb_bo_create(struct gbm_bo *bo, uint32_t width, uint32_t height, uint3
 
        bo->handle.u32 = create_dumb.handle;
        bo->size = create_dumb.size;
+       bo->stride = create_dumb.pitch;
 
        return 0;
 }
diff --git a/i915.c b/i915.c
index 1dd67a0..8d120c4 100644 (file)
--- a/i915.c
+++ b/i915.c
@@ -108,13 +108,15 @@ int gbm_i915_bo_create(struct gbm_bo *bo, uint32_t width, uint32_t height, uint3
        else if (flags & GBM_BO_USE_RENDERING)
                tiling_mode = I915_TILING_Y;
 
+       bo->stride = i915_get_pitch(bo->gbm,
+               width * gbm_bytes_from_format(format),
+               tiling_mode);
+
        memset(&gem_set_tiling, 0, sizeof(gem_set_tiling));
        do {
                gem_set_tiling.handle = bo->handle.u32;
                gem_set_tiling.tiling_mode = tiling_mode;
-               gem_set_tiling.stride = i915_get_pitch(bo->gbm,
-                                                       width * gbm_bytes_from_format(format),
-                                                       tiling_mode);
+               gem_set_tiling.stride = bo->stride;
                ret = drmIoctl(bo->gbm->fd, DRM_IOCTL_I915_GEM_SET_TILING, &gem_set_tiling);
        } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
 
index 72748cf..282b74c 100644 (file)
@@ -14,7 +14,7 @@
 
 int gbm_rockchip_bo_create(struct gbm_bo *bo, uint32_t width, uint32_t height, uint32_t format, uint32_t flags)
 {
-       size_t size = width * height * ;
+       size_t size = width * height * gbm_bytes_from_format(format);
        struct drm_rockchip_gem_create gem_create;
        int ret;
 
@@ -27,6 +27,7 @@ int gbm_rockchip_bo_create(struct gbm_bo *bo, uint32_t width, uint32_t height, u
 
        bo->handle.u32 = gem_create.handle;
        bo->size = size;
+       bo->stride = width * gbm_bytes_from_format(format);
 
        return 0;
 }
diff --git a/tegra.c b/tegra.c
index 46105a3..0463ca7 100644 (file)
--- a/tegra.c
+++ b/tegra.c
@@ -29,6 +29,7 @@ int gbm_tegra_bo_create(struct gbm_bo *bo, uint32_t width, uint32_t height, uint
 
        bo->handle.u32 = gem_create.handle;
        bo->size = size;
+       bo->stride = width * gbm_bytes_from_format(format);
 
        return 0;
 }