v3d: find linear modifier when required

The goal of the commit is to fix a dead assignment detected by static
analyzer: value stored to `linear_ok` is never read.

But instead of just removing the dead assignment, we just remove the
full variable, and instead search for the linear modifier in the place
that is required.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32772>
This commit is contained in:
Juan A. Suarez Romero 2024-12-23 17:46:47 +01:00 committed by Marge Bot
parent f13f0e1f77
commit 90087c1a73

View file

@ -788,7 +788,6 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
{
struct v3d_screen *screen = v3d_screen(pscreen);
bool linear_ok = drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count);
struct v3d_resource *rsc = v3d_resource_setup(pscreen, tmpl);
struct pipe_resource *prsc = &rsc->base;
/* Use a tiled layout if we can, for better 3D performance. */
@ -828,13 +827,12 @@ v3d_resource_create_with_modifiers(struct pipe_screen *pscreen,
/* No user-specified modifier; determine our own. */
if (count == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID) {
linear_ok = true;
rsc->tiled = should_tile;
} else if (should_tile &&
drm_find_modifier(DRM_FORMAT_MOD_BROADCOM_UIF,
modifiers, count)) {
rsc->tiled = true;
} else if (linear_ok) {
} else if (drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count)) {
rsc->tiled = false;
} else {
fprintf(stderr, "Unsupported modifier requested\n");