summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2017-11-03 17:18:36 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-11-16 13:52:02 -0800
commitd300145b093cf67277648a664d3748b881d4a315 (patch)
treeb33ac1e2eafebb020d81ee8c7599fa844f583c0b
parent1ef809ecd434bfc0fd1d669ba925d58b1255d163 (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.c33
-rw-r--r--evdi.c7
-rw-r--r--exynos.c15
-rw-r--r--gma500.c7
-rw-r--r--helpers.c14
-rw-r--r--helpers.h4
-rw-r--r--i915.c48
-rw-r--r--marvell.c7
-rw-r--r--mediatek.c13
-rw-r--r--nouveau.c7
-rw-r--r--radeon.c7
-rw-r--r--rockchip.c12
-rw-r--r--tegra.c13
-rw-r--r--udl.c7
-rw-r--r--vc4.c7
-rw-r--r--vgem.c13
-rw-r--r--virtio_gpu.c13
17 files changed, 73 insertions, 154 deletions
diff --git a/amdgpu.c b/amdgpu.c
index 4a3eb7b..9abb79f 100644
--- a/amdgpu.c
+++ b/amdgpu.c
@@ -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)
diff --git a/evdi.c b/evdi.c
index 3bac658..bfa62a0 100644
--- a/evdi.c
+++ b/evdi.c
@@ -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);
}
diff --git a/exynos.c b/exynos.c
index 455416e..526603e 100644
--- a/exynos.c
+++ b/exynos.c
@@ -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);
}
diff --git a/gma500.c b/gma500.c
index bcc3bc8..366f232 100644
--- a/gma500.c
+++ b/gma500.c
@@ -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);
}
diff --git a/helpers.c b/helpers.c
index 9a33804..0eba698 100644
--- a/helpers.c
+++ b/helpers.c
@@ -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,
diff --git a/helpers.h b/helpers.h
index 92a5017..b0fbdee 100644
--- a/helpers.h
+++ b/helpers.h
@@ -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);
diff --git a/i915.c b/i915.c
index 0b30703..d4f2ece 100644
--- a/i915.c
+++ b/i915.c
@@ -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)
diff --git a/marvell.c b/marvell.c
index f209139..c0b600b 100644
--- a/marvell.c
+++ b/marvell.c
@@ -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));
diff --git a/mediatek.c b/mediatek.c
index ebc000f..737a8d7 100644
--- a/mediatek.c
+++ b/mediatek.c
@@ -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);
}
diff --git a/nouveau.c b/nouveau.c
index 4efbda2..d0f25d4 100644
--- a/nouveau.c
+++ b/nouveau.c
@@ -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);
}
diff --git a/radeon.c b/radeon.c
index 84b01c5..68445c1 100644
--- a/radeon.c
+++ b/radeon.c
@@ -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);
}
diff --git a/rockchip.c b/rockchip.c
index 14c042b..7964676 100644
--- a/rockchip.c
+++ b/rockchip.c
@@ -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);
diff --git a/tegra.c b/tegra.c
index 4551fcf..f0651d7 100644
--- a/tegra.c
+++ b/tegra.c
@@ -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);
diff --git a/udl.c b/udl.c
index 5ec2307..12dc967 100644
--- a/udl.c
+++ b/udl.c
@@ -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);
}
diff --git a/vc4.c b/vc4.c
index 82b7047..7960247 100644
--- a/vc4.c
+++ b/vc4.c
@@ -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);
}
diff --git a/vgem.c b/vgem.c
index a4e893b..5380b78 100644
--- a/vgem.c
+++ b/vgem.c
@@ -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);
}