mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 07:40:11 +01:00
llvmpipe: misc fixes for sparse binding
This change: 1. Move size validation within sparse binding, but not escape to non-sparse code path. 2. Error out if sparse is requested on unsupported platforms. Fixes:d747c4a874("lavapipe: Implement sparse buffers and images") Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38074> (cherry picked from commite0acc5c2b4)
This commit is contained in:
parent
36f0885c44
commit
6ce43552cd
2 changed files with 9 additions and 3 deletions
|
|
@ -2854,7 +2854,7 @@
|
|||
"description": "llvmpipe: misc fixes for sparse binding",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "d747c4a8746834d3c9a6fbd7b455b7ce9441fb38",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1598,9 +1598,13 @@ llvmpipe_resource_bind_backing(struct pipe_screen *pscreen,
|
|||
if (!lpr->backable)
|
||||
return false;
|
||||
|
||||
if ((lpr->base.flags & PIPE_RESOURCE_FLAG_SPARSE) && offset < lpr->size_required) {
|
||||
if (lpr->base.flags & PIPE_RESOURCE_FLAG_SPARSE) {
|
||||
#if DETECT_OS_LINUX
|
||||
struct llvmpipe_memory_allocation *mem = (struct llvmpipe_memory_allocation *)pmem;
|
||||
|
||||
if (offset >= lpr->size_required)
|
||||
return false;
|
||||
|
||||
if (mem) {
|
||||
if (llvmpipe_resource_is_texture(&lpr->base)) {
|
||||
mmap((char *)lpr->tex_data + offset, size, PROT_READ|PROT_WRITE,
|
||||
|
|
@ -1620,9 +1624,11 @@ llvmpipe_resource_bind_backing(struct pipe_screen *pscreen,
|
|||
MAP_SHARED|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
addr = llvmpipe_map_memory(pscreen, pmem);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue