panfrost,asahi: Support ARB_buffer_storage

After a great deal of spec lawyering in #dri-devel, I am convinced this
is probably okay for the same reasons as v3d and freedreno. The batch
reordering and flush deferral optimizations are seemingly still ok. The
requirement that writes are visible "immediately" in the spec actually
means "in the subsequent [OpenGL] command" for the CPU -> GPU direction,
which avoids pitfalls where PERSISTENT|COHERENT could be used as a
"doorbell". With that understanding, the extension doesn't actually
require anything special for tilers other than coherency at GPU submit
boundaries, which is true for any driver that does not use a sync ioctl.

After this commit, the remaining drivers that don't set the CAP are
d3d12, softpipe, etnaviv, and i915g. I am unsure about d3d12, but the
latter 3 could probbaly enable it trivially for the same reason.

v2: Don't use copy_resource path for persistent mappings (Emma). Emma
explained on GitLab:

   I don't think you should have the copy_resource path taken for
   PIPE_RESOURCE_FLAG_MAP_PERSISTENT BOs.  Imagine the user has a
   general-purpose BO they're streaming stuff into and doing draws that
   they keep persistently mapped until wrapping.  They call some GL
   function on the same buffer that does a fallback write map on the BO
   (u_default_buffer_subdata, util_resource_copy_region, whatever) -- the
   buffer is in use, copy triggers, allocates a new BO.  Whoops, the user's
   pointer for streaming writes is now freed.

Closes: #7570
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19351>
This commit is contained in:
Alyssa Rosenzweig
2022-10-27 11:23:53 -04:00
committed by Marge Bot
parent 99b832008a
commit 10ace5de3a
4 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -195,7 +195,7 @@ GL 4.3, GLSL 4.30 -- all DONE: i965/gen8+, nvc0, r600, radeonsi, llvmpipe, virgl
GL 4.4, GLSL 4.40 -- all DONE: i965/gen8+, nvc0, r600, radeonsi, llvmpipe, zink
GL_MAX_VERTEX_ATTRIB_STRIDE DONE (all drivers)
GL_ARB_buffer_storage DONE (freedreno, i965, nv50, v3d, vc4, lima)
GL_ARB_buffer_storage DONE (freedreno, i965, nv50, v3d, vc4, lima, panfrost, asahi)
GL_ARB_clear_texture DONE (i965, nv50, softpipe, virgl)
GL_ARB_enhanced_layouts DONE (freedreno/a3xx+, i965, nv50, softpipe, virgl)
- compile-time constant expressions DONE
+1
View File
@@ -731,6 +731,7 @@ agx_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
case PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD:
case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
case PIPE_CAP_DEPTH_CLIP_DISABLE:
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES:
@@ -1010,6 +1010,7 @@ panfrost_ptr_map(struct pipe_context *pctx,
if (!create_new_bo &&
!(usage & PIPE_MAP_UNSYNCHRONIZED) &&
!(resource->flags & PIPE_RESOURCE_FLAG_MAP_PERSISTENT) &&
(usage & PIPE_MAP_WRITE) &&
!(resource->target == PIPE_BUFFER
&& !util_ranges_intersect(&rsrc->valid_buffer_range, box->x, box->x + box->width)) &&
@@ -113,6 +113,7 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
case PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD:
case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
case PIPE_CAP_DEPTH_CLIP_DISABLE:
case PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE:
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES: