From 3646886dd3edb8bb182276520670b381f23cff2d Mon Sep 17 00:00:00 2001 From: tchew6 Date: Thu, 24 Jun 2021 13:20:53 +0800 Subject: [PATCH] iris/kmsro: use ro device to allocate scanout for render Signed-off-by: Chew, Tong Liang Signed-off-by: Mazlan, Hazwan Arif Tracked-On: OAM-127438 Signed-off-by: Weifeng Liu (cherry picked from commit 89218cdd35aecf98a766be95c62d3488bb6bc0bc) Signed-off-by: Lina Sun --- src/gallium/drivers/iris/iris_resource.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 01c0a3acc6d..c3e84b9df36 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1176,11 +1176,14 @@ iris_resource_create_for_image(struct pipe_screen *pscreen, { struct iris_screen *screen = (struct iris_screen *)pscreen; const struct intel_device_info *devinfo = screen->devinfo; + struct pipe_resource *pres; if (screen->ro && (templ->bind & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_SHARED))) { - return iris_resource_create_renderonly(pscreen, templ); + pres = iris_resource_create_renderonly(pscreen, templ); + if (pres) + return pres; } struct iris_resource *res = iris_alloc_resource(pscreen, templ); @@ -1954,8 +1957,7 @@ iris_resource_get_handle(struct pipe_screen *pscreen, case WINSYS_HANDLE_TYPE_KMS: { iris_gem_set_tiling(bo, &res->surf); - if (screen->ro) { - assert(res->scanout); + if (screen->ro && res->scanout) { return renderonly_get_handle(res->scanout, whandle); } /* Because we share the same drm file across multiple iris_screen, when