mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
llvmpipe: properly save llvmpipe_memory_allocation in memory_object
Importing an opaque fd no longer returns the mapped pointer but a pointer to llvmpipe_memory_allocation to support both memfds and dma bufs. This saves the pointer with the correct type and we can unwrap the mapped data in a correct way. Fixes:d74ea2c117("llvmpipe: Implement dmabuf handling") Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31022> (cherry picked from commit3e01c15fa7)
This commit is contained in:
parent
660ddc297c
commit
66f32ddd11
3 changed files with 10 additions and 6 deletions
|
|
@ -1174,7 +1174,7 @@
|
|||
"description": "llvmpipe: properly save llvmpipe_memory_allocation in memory_object",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "d74ea2c117fe96e527471e572336f931c3c77da1",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -452,7 +452,11 @@ llvmpipe_memobj_create_from_handle(struct pipe_screen *pscreen,
|
|||
pipe_reference_init(&memobj->reference, 1);
|
||||
|
||||
if (handle->type == WINSYS_HANDLE_TYPE_FD &&
|
||||
pscreen->import_memory_fd(pscreen, handle->handle, &memobj->data, &memobj->size, false)) {
|
||||
pscreen->import_memory_fd(pscreen,
|
||||
handle->handle,
|
||||
(struct pipe_memory_allocation **)&memobj->mem_alloc,
|
||||
&memobj->size,
|
||||
false)) {
|
||||
return &memobj->b;
|
||||
}
|
||||
free(memobj);
|
||||
|
|
@ -471,7 +475,7 @@ llvmpipe_memobj_destroy(struct pipe_screen *pscreen,
|
|||
if (pipe_reference(&lpmo->reference, NULL))
|
||||
{
|
||||
#ifdef PIPE_MEMORY_FD
|
||||
pscreen->free_memory_fd(pscreen, lpmo->data);
|
||||
pscreen->free_memory_fd(pscreen, (struct pipe_memory_allocation *)lpmo->mem_alloc);
|
||||
#endif
|
||||
free(lpmo);
|
||||
}
|
||||
|
|
@ -501,7 +505,7 @@ llvmpipe_resource_from_memobj(struct pipe_screen *pscreen,
|
|||
goto fail;
|
||||
if (lpmo->size < lpr->size_required)
|
||||
goto fail;
|
||||
lpr->tex_data = lpmo->data;
|
||||
lpr->tex_data = lpmo->mem_alloc->cpu_addr;
|
||||
} else {
|
||||
/* other data (vertex buffer, const buffer, etc) */
|
||||
const uint bytes = templat->width0;
|
||||
|
|
@ -527,7 +531,7 @@ llvmpipe_resource_from_memobj(struct pipe_screen *pscreen,
|
|||
|
||||
if (lpmo->size < lpr->size_required)
|
||||
goto fail;
|
||||
lpr->data = lpmo->data;
|
||||
lpr->data = lpmo->mem_alloc->cpu_addr;
|
||||
}
|
||||
lpr->id = id_counter++;
|
||||
lpr->imported_memory = &lpmo->b;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ struct llvmpipe_memory_object
|
|||
{
|
||||
struct pipe_memory_object b;
|
||||
struct pipe_reference reference;
|
||||
struct pipe_memory_allocation *data;
|
||||
struct llvmpipe_memory_allocation *mem_alloc;
|
||||
uint64_t size;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue