panfrost: support PIPE_RESOURCE_PARAM_NPLANES query
While panfrost doesn't support multi-planar formats directly, we might still import multi-planar BOs through GBM (for example, when doing direct scanout in weston). We can support PIPE_RESOURCE_PARAM_NPLANES by simply counting the planes we have. Signed-off-by: Derek Foreman <derek.foreman@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13039>
This commit is contained in:
parent
f96ad5d71c
commit
1c4f1c2290
|
@ -204,6 +204,8 @@ panfrost_resource_get_param(struct pipe_screen *pscreen,
|
||||||
unsigned usage, uint64_t *value)
|
unsigned usage, uint64_t *value)
|
||||||
{
|
{
|
||||||
struct panfrost_resource *rsrc = (struct panfrost_resource *) prsc;
|
struct panfrost_resource *rsrc = (struct panfrost_resource *) prsc;
|
||||||
|
struct pipe_resource *cur;
|
||||||
|
unsigned count;
|
||||||
|
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case PIPE_RESOURCE_PARAM_STRIDE:
|
case PIPE_RESOURCE_PARAM_STRIDE:
|
||||||
|
@ -215,6 +217,16 @@ panfrost_resource_get_param(struct pipe_screen *pscreen,
|
||||||
case PIPE_RESOURCE_PARAM_MODIFIER:
|
case PIPE_RESOURCE_PARAM_MODIFIER:
|
||||||
*value = rsrc->image.layout.modifier;
|
*value = rsrc->image.layout.modifier;
|
||||||
return true;
|
return true;
|
||||||
|
case PIPE_RESOURCE_PARAM_NPLANES:
|
||||||
|
/* Panfrost doesn't directly support multi-planar formats,
|
||||||
|
* but we should still handle this case for gbm users
|
||||||
|
* that might want to use resources shared with panfrost
|
||||||
|
* on video processing hardware that does.
|
||||||
|
*/
|
||||||
|
for (count = 0, cur = prsc; cur; cur = cur->next)
|
||||||
|
count++;
|
||||||
|
*value = count;
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue