diff options
author | Gurchetan Singh <gurchetansingh@chromium.org> | 2017-11-03 17:18:36 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-16 13:52:02 -0800 |
commit | d300145b093cf67277648a664d3748b881d4a315 (patch) | |
tree | b33ac1e2eafebb020d81ee8c7599fa844f583c0b | |
parent | 1ef809ecd434bfc0fd1d669ba925d58b1255d163 (diff) |
minigbm: make drv_add_combinations return nothing
Two reasons for this:
1) We can use drv_array for driver combinations (see next patch)
2) It's less verbose.
BUG=chromium:764871
TEST=gbmtest passes
Change-Id: I39bea6e2e9e4c76d2ca78566926a79bdc17f11d0
Reviewed-on: https://chromium-review.googlesource.com/758148
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
-rw-r--r-- | amdgpu.c | 33 | ||||
-rw-r--r-- | evdi.c | 7 | ||||
-rw-r--r-- | exynos.c | 15 | ||||
-rw-r--r-- | gma500.c | 7 | ||||
-rw-r--r-- | helpers.c | 14 | ||||
-rw-r--r-- | helpers.h | 4 | ||||
-rw-r--r-- | i915.c | 48 | ||||
-rw-r--r-- | marvell.c | 7 | ||||
-rw-r--r-- | mediatek.c | 13 | ||||
-rw-r--r-- | nouveau.c | 7 | ||||
-rw-r--r-- | radeon.c | 7 | ||||
-rw-r--r-- | rockchip.c | 12 | ||||
-rw-r--r-- | tegra.c | 13 | ||||
-rw-r--r-- | udl.c | 7 | ||||
-rw-r--r-- | vc4.c | 7 | ||||
-rw-r--r-- | vgem.c | 13 | ||||
-rw-r--r-- | virtio_gpu.c | 13 |
17 files changed, 73 insertions, 154 deletions
@@ -273,7 +273,6 @@ static void *amdgpu_addrlib_init(int fd) static int amdgpu_init(struct driver *drv) { - int ret; void *addrlib; struct format_metadata metadata; uint64_t use_flags = BO_USE_RENDER_MASK; @@ -284,10 +283,8 @@ static int amdgpu_init(struct driver *drv) drv->priv = addrlib; - ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), - &LINEAR_METADATA, BO_USE_TEXTURE_MASK); - if (ret) - return ret; + drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), + &LINEAR_METADATA, BO_USE_TEXTURE_MASK); /* YUV format for camera */ drv_modify_combination(drv, DRM_FORMAT_NV12, &LINEAR_METADATA, @@ -306,10 +303,8 @@ static int amdgpu_init(struct driver *drv) metadata.priority = 2; metadata.modifier = DRM_FORMAT_MOD_LINEAR; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, use_flags); drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); @@ -319,10 +314,8 @@ static int amdgpu_init(struct driver *drv) metadata.priority = 3; metadata.modifier = DRM_FORMAT_MOD_LINEAR; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, use_flags); use_flags &= ~BO_USE_SW_WRITE_OFTEN; use_flags &= ~BO_USE_SW_READ_OFTEN; @@ -331,10 +324,8 @@ static int amdgpu_init(struct driver *drv) metadata.tiling = ADDR_DISPLAYABLE << 16 | ADDR_TM_2D_TILED_THIN1; metadata.priority = 4; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, use_flags); drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_SCANOUT); drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_SCANOUT); @@ -343,12 +334,10 @@ static int amdgpu_init(struct driver *drv) metadata.tiling = ADDR_NON_DISPLAYABLE << 16 | ADDR_TM_2D_TILED_THIN1; metadata.priority = 5; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, use_flags); - return ret; + return 0; } static void amdgpu_close(struct driver *drv) @@ -12,11 +12,8 @@ static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMA static int evdi_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); return drv_modify_linear_combinations(drv); } @@ -25,16 +25,11 @@ static const uint32_t texture_source_formats[] = { DRM_FORMAT_NV12 }; static int exynos_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; - - ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), - &LINEAR_METADATA, BO_USE_TEXTURE_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); + + drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), + &LINEAR_METADATA, BO_USE_TEXTURE_MASK); return drv_modify_linear_combinations(drv); } @@ -12,11 +12,8 @@ static const uint32_t render_target_formats[] = { DRM_FORMAT_RGBX8888 }; static int gma500_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); return drv_modify_linear_combinations(drv); } @@ -444,18 +444,12 @@ int drv_add_combination(struct driver *drv, uint32_t format, struct format_metad return 0; } -int drv_add_combinations(struct driver *drv, const uint32_t *formats, uint32_t num_formats, - struct format_metadata *metadata, uint64_t use_flags) +void drv_add_combinations(struct driver *drv, const uint32_t *formats, uint32_t num_formats, + struct format_metadata *metadata, uint64_t use_flags) { - int ret; uint32_t i; - for (i = 0; i < num_formats; i++) { - ret = drv_add_combination(drv, formats[i], metadata, use_flags); - if (ret) - return ret; - } - - return 0; + for (i = 0; i < num_formats; i++) + drv_add_combination(drv, formats[i], metadata, use_flags); } void drv_modify_combination(struct driver *drv, uint32_t format, struct format_metadata *metadata, @@ -27,8 +27,8 @@ void drv_decrement_reference_count(struct driver *drv, struct bo *bo, size_t pla uint32_t drv_log_base2(uint32_t value); int drv_add_combination(struct driver *drv, uint32_t format, struct format_metadata *metadata, uint64_t usage); -int drv_add_combinations(struct driver *drv, const uint32_t *formats, uint32_t num_formats, - struct format_metadata *metadata, uint64_t usage); +void drv_add_combinations(struct driver *drv, const uint32_t *formats, uint32_t num_formats, + struct format_metadata *metadata, uint64_t usage); void drv_modify_combination(struct driver *drv, uint32_t format, struct format_metadata *metadata, uint64_t usage); struct kms_item *drv_query_kms(struct driver *drv, uint32_t *num_items); @@ -96,21 +96,15 @@ static int i915_add_combinations(struct driver *drv) metadata.priority = 1; metadata.modifier = DRM_FORMAT_MOD_LINEAR; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, render_use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, render_use_flags); - ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), - &metadata, texture_use_flags); - if (ret) - return ret; + drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), + &metadata, texture_use_flags); - ret = drv_add_combinations(drv, tileable_texture_source_formats, - ARRAY_SIZE(tileable_texture_source_formats), &metadata, - texture_use_flags); - if (ret) - return ret; + drv_add_combinations(drv, tileable_texture_source_formats, + ARRAY_SIZE(tileable_texture_source_formats), &metadata, + texture_use_flags); drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); @@ -139,31 +133,23 @@ static int i915_add_combinations(struct driver *drv) metadata.priority = 2; metadata.modifier = I915_FORMAT_MOD_X_TILED; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, render_use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, render_use_flags); - ret = drv_add_combinations(drv, tileable_texture_source_formats, - ARRAY_SIZE(tileable_texture_source_formats), &metadata, - texture_use_flags); - if (ret) - return ret; + drv_add_combinations(drv, tileable_texture_source_formats, + ARRAY_SIZE(tileable_texture_source_formats), &metadata, + texture_use_flags); metadata.tiling = I915_TILING_Y; metadata.priority = 3; metadata.modifier = I915_FORMAT_MOD_Y_TILED; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, render_use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, render_use_flags); - ret = drv_add_combinations(drv, tileable_texture_source_formats, - ARRAY_SIZE(tileable_texture_source_formats), &metadata, - texture_use_flags); - if (ret) - return ret; + drv_add_combinations(drv, tileable_texture_source_formats, + ARRAY_SIZE(tileable_texture_source_formats), &metadata, + texture_use_flags); items = drv_query_kms(drv, &num_items); if (!items || !num_items) @@ -14,11 +14,8 @@ static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMA static int marvell_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); return drv_add_linear_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats)); @@ -32,16 +32,11 @@ static const uint32_t texture_source_formats[] = { DRM_FORMAT_R8, DRM_FORMAT_YVU static int mediatek_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); - ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), - &LINEAR_METADATA, BO_USE_TEXTURE_MASK); - if (ret) - return ret; + drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), + &LINEAR_METADATA, BO_USE_TEXTURE_MASK); return drv_modify_linear_combinations(drv); } @@ -12,11 +12,8 @@ static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMA static int nouveau_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); return drv_modify_linear_combinations(drv); } @@ -12,11 +12,8 @@ static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMA static int radeon_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); return drv_modify_linear_combinations(drv); } @@ -120,15 +120,11 @@ static int rockchip_init(struct driver *drv) metadata.priority = 1; metadata.modifier = DRM_FORMAT_MOD_LINEAR; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, BO_USE_RENDER_MASK); - ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), - &metadata, BO_USE_TEXTURE_MASK); - if (ret) - return ret; + drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), + &metadata, BO_USE_TEXTURE_MASK); drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); @@ -179,7 +179,6 @@ static void transfer_tiled_memory(struct bo *bo, uint8_t *tiled, uint8_t *untile static int tegra_init(struct driver *drv) { - int ret; struct format_metadata metadata; uint64_t use_flags = BO_USE_RENDER_MASK; @@ -187,10 +186,8 @@ static int tegra_init(struct driver *drv) metadata.priority = 1; metadata.modifier = DRM_FORMAT_MOD_LINEAR; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, use_flags); drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); @@ -202,10 +199,8 @@ static int tegra_init(struct driver *drv) metadata.tiling = NV_MEM_KIND_C32_2CRA; metadata.priority = 2; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &metadata, use_flags); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &metadata, use_flags); drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_SCANOUT); drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_SCANOUT); @@ -12,11 +12,8 @@ static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMA static int udl_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); return drv_modify_linear_combinations(drv); } @@ -21,11 +21,8 @@ static const uint32_t render_target_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMA static int vc4_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); return drv_modify_linear_combinations(drv); } @@ -20,16 +20,11 @@ static const uint32_t texture_source_formats[] = { DRM_FORMAT_R8, DRM_FORMAT_YVU static int vgem_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); - ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), - &LINEAR_METADATA, BO_USE_TEXTURE_MASK); - if (ret) - return ret; + drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), + &LINEAR_METADATA, BO_USE_TEXTURE_MASK); return drv_modify_linear_combinations(drv); } diff --git a/virtio_gpu.c b/virtio_gpu.c index 447a17d..957292c 100644 --- a/virtio_gpu.c +++ b/virtio_gpu.c @@ -20,16 +20,11 @@ static const uint32_t texture_source_formats[] = { DRM_FORMAT_R8, DRM_FORMAT_YVU static int virtio_gpu_init(struct driver *drv) { - int ret; - ret = drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), - &LINEAR_METADATA, BO_USE_RENDER_MASK); - if (ret) - return ret; + drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats), + &LINEAR_METADATA, BO_USE_RENDER_MASK); - ret = drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), - &LINEAR_METADATA, BO_USE_TEXTURE_MASK); - if (ret) - return ret; + drv_add_combinations(drv, texture_source_formats, ARRAY_SIZE(texture_source_formats), + &LINEAR_METADATA, BO_USE_TEXTURE_MASK); return drv_modify_linear_combinations(drv); } |