etnaviv: fix renderonly check in etna_resource_alloc
authorSimon Ser <contact@emersion.fr>
Tue, 27 Jul 2021 06:52:45 +0000 (08:52 +0200)
committerSimon Ser <contact@emersion.fr>
Thu, 29 Jul 2021 18:59:21 +0000 (20:59 +0200)
When the driver hasn't been initialized via renderonly, screen->ro
will be NULL. This fixes a crash when passing USE_SCANOUT to etnaviv
when it's missing renderonly.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12074>

src/gallium/drivers/etnaviv/etnaviv_resource.c

index ce37b0e..fa865f2 100644 (file)
@@ -272,7 +272,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
 
    size = setup_miptree(rsc, paddingX, paddingY, msaa_xscale, msaa_yscale);
 
-   if (unlikely(templat->bind & PIPE_BIND_SCANOUT) && screen->ro->kms_fd >= 0) {
+   if (unlikely(templat->bind & PIPE_BIND_SCANOUT) && screen->ro) {
       struct pipe_resource scanout_templat = *templat;
       struct winsys_handle handle;