Mesa (master): panfrost: Ensure we have ro before using it
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 9 22:39:25 UTC 2020
Module: Mesa
Branch: master
Commit: 5d547858dac2e9a608416e3b1310b01805e6f5d4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d547858dac2e9a608416e3b1310b01805e6f5d4
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Tue Jun 9 16:04:37 2020 -0400
panfrost: Ensure we have ro before using it
Even through the resouce requested has a BIND_SCANOUT or related tag,
this does not mean that we have a render-only driver.
This can trivially happen as one requests such resource from GBM, while
using the panfrost fd (and hence panfrost_dri.so)
Forward port of !3000
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Robert Foss <robert.foss at collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Closes: #2664
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5410>
---
src/gallium/drivers/panfrost/pan_resource.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 0506163f291..84f82ab7689 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -508,6 +508,8 @@ static struct pipe_resource *
panfrost_resource_create(struct pipe_screen *screen,
const struct pipe_resource *template)
{
+ struct panfrost_device *dev = pan_device(screen);
+
/* Make sure we're familiar */
switch (template->target) {
case PIPE_BUFFER:
@@ -523,13 +525,11 @@ panfrost_resource_create(struct pipe_screen *screen,
assert(0);
}
- if (template->bind &
- (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_SHARED))
+ if (dev->ro && (template->bind &
+ (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_SHARED)))
return panfrost_create_scanout_res(screen, template);
struct panfrost_resource *so = rzalloc(screen, struct panfrost_resource);
- struct panfrost_device *dev = pan_device(screen);
-
so->base = *template;
so->base.screen = screen;
so->internal_format = template->format;
More information about the mesa-commit
mailing list