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:
Derek Foreman 2021-10-25 15:53:21 -05:00 committed by Marge Bot
parent 1cd43ff030
commit f96ad5d71c
1 changed files with 15 additions and 2 deletions

View File

@ -135,8 +135,21 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
unsigned usage)
{
struct panfrost_device *dev = pan_device(pscreen);
struct panfrost_resource *rsrc = (struct panfrost_resource *) pt;
struct renderonly_scanout *scanout = rsrc->scanout;
struct panfrost_resource *rsrc;
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;
rsrc->modifier_constant = true;