mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 03:30:10 +01:00
iris: Add and use get_num_planes
This function counts the number of objects in a pipe_resource linked list. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12795>
This commit is contained in:
parent
a16d6bc179
commit
8510d17ff4
1 changed files with 11 additions and 4 deletions
|
|
@ -1198,6 +1198,16 @@ mod_plane_is_clear_color(uint64_t modifier, uint32_t plane)
|
|||
}
|
||||
}
|
||||
|
||||
static unsigned
|
||||
get_num_planes(const struct pipe_resource *resource)
|
||||
{
|
||||
unsigned count = 0;
|
||||
for (const struct pipe_resource *cur = resource; cur; cur = cur->next)
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct pipe_resource *
|
||||
iris_resource_from_handle(struct pipe_screen *pscreen,
|
||||
const struct pipe_resource *templ,
|
||||
|
|
@ -1425,10 +1435,7 @@ iris_resource_get_param(struct pipe_screen *pscreen,
|
|||
res->mod_info->modifier,
|
||||
res->external_format);
|
||||
} else {
|
||||
unsigned count = 0;
|
||||
for (struct pipe_resource *cur = resource; cur; cur = cur->next)
|
||||
count++;
|
||||
*value = count;
|
||||
*value = get_num_planes(&res->base.b);
|
||||
}
|
||||
return true;
|
||||
case PIPE_RESOURCE_PARAM_STRIDE:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue