panfrost: Support planar formats for scanout
While panfrost doesn't directly support planar formats, we can get here from GBM. This happens, for example, when weston is trying to use a BO for direct scanout. Walk the list of planes to find the right one. 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
1cd43ff030
commit
f96ad5d71c
|
@ -135,8 +135,21 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
|
||||||
unsigned usage)
|
unsigned usage)
|
||||||
{
|
{
|
||||||
struct panfrost_device *dev = pan_device(pscreen);
|
struct panfrost_device *dev = pan_device(pscreen);
|
||||||
struct panfrost_resource *rsrc = (struct panfrost_resource *) pt;
|
struct panfrost_resource *rsrc;
|
||||||
struct renderonly_scanout *scanout = rsrc->scanout;
|
struct renderonly_scanout *scanout;
|
||||||
|
struct pipe_resource *cur = pt;
|
||||||
|
|
||||||
|
/* Even though panfrost doesn't support multi-planar formats, we
|
||||||
|
* can get here through GBM, which does. Walk the list of planes
|
||||||
|
* to find the right one.
|
||||||
|
*/
|
||||||
|
for (int i = 0; i < handle->plane; i++) {
|
||||||
|
cur = cur->next;
|
||||||
|
if (!cur)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
rsrc = pan_resource(cur);
|
||||||
|
scanout = rsrc->scanout;
|
||||||
|
|
||||||
handle->modifier = rsrc->image.layout.modifier;
|
handle->modifier = rsrc->image.layout.modifier;
|
||||||
rsrc->modifier_constant = true;
|
rsrc->modifier_constant = true;
|
||||||
|
|
Loading…
Reference in New Issue