summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/lima/lima_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa/src/gallium/drivers/lima/lima_resource.c')
-rw-r--r--lib/mesa/src/gallium/drivers/lima/lima_resource.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/mesa/src/gallium/drivers/lima/lima_resource.c b/lib/mesa/src/gallium/drivers/lima/lima_resource.c
index 260212178..ad55fa5c8 100644
--- a/lib/mesa/src/gallium/drivers/lima/lima_resource.c
+++ b/lib/mesa/src/gallium/drivers/lima/lima_resource.c
@@ -59,7 +59,10 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
struct lima_screen *screen = lima_screen(pscreen);
struct renderonly_scanout *scanout;
struct winsys_handle handle;
- struct pipe_resource *pres;
+
+ struct lima_resource *res = CALLOC_STRUCT(lima_resource);
+ if (!res)
+ return NULL;
struct pipe_resource scanout_templat = *templat;
scanout_templat.width0 = width;
@@ -71,20 +74,31 @@ lima_resource_create_scanout(struct pipe_screen *pscreen,
if (!scanout)
return NULL;
+ res->base = *templat;
+ res->base.screen = pscreen;
+ pipe_reference_init(&res->base.reference, 1);
+ res->levels[0].offset = handle.offset;
+ res->levels[0].stride = handle.stride;
+
assert(handle.type == WINSYS_HANDLE_TYPE_FD);
- pres = pscreen->resource_from_handle(pscreen, templat, &handle,
- PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
+ res->bo = lima_bo_import(screen, &handle);
+ if (!res->bo) {
+ FREE(res);
+ return NULL;
+ }
+
+ res->modifier_constant = true;
close(handle.handle);
- if (!pres) {
+ if (!res->bo) {
renderonly_scanout_destroy(scanout, screen->ro);
+ FREE(res);
return NULL;
}
- struct lima_resource *res = lima_resource(pres);
res->scanout = scanout;
- return pres;
+ return &res->base;
}
static uint32_t