mesa/st: mark internal texture map calls as UNSYNCHRONIZED

these are new textures with empty contents which are immediately
unmapped after a strided memcpy, so there's no reason to force
the driver (or tc) to sync

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36634>
This commit is contained in:
Mike Blumenkrantz 2025-08-06 15:03:54 -04:00 committed by Marge Bot
parent fe499db5b5
commit 25b97a3a96
6 changed files with 15 additions and 14 deletions

View file

@ -55,7 +55,7 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
uint i, j;
dest = (uint *) pipe_texture_map(pipe,
pt, 0, 0, PIPE_MAP_WRITE,
pt, 0, 0, PIPE_MAP_WRITE | PIPE_MAP_UNSYNCHRONIZED,
0, 0, texSize, texSize, &transfer);
/* Pack four 1D maps into a 2D texture:

View file

@ -140,7 +140,7 @@ st_make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height,
* Create texture to hold bitmap pattern.
*/
pt = st_texture_create(st, st->internal_target, st->bitmap.tex_format,
0, width, height, 1, 1, 0, 0,
0, width, height, 1, 1, 0, PIPE_RESOURCE_FLAG_MAP_UNSYNCHRONIZED,
PIPE_BIND_SAMPLER_VIEW, false,
PIPE_COMPRESSION_FIXED_RATE_NONE);
if (!pt) {
@ -149,7 +149,7 @@ st_make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height,
}
dest = pipe_texture_map(st->pipe, pt, 0, 0,
PIPE_MAP_WRITE,
PIPE_MAP_WRITE | PIPE_MAP_UNSYNCHRONIZED,
0, 0, width, height, &transfer);
/* Put image into texture transfer */
@ -373,7 +373,7 @@ reset_cache(struct st_context *st)
cache->texture = st_texture_create(st, st->internal_target,
st->bitmap.tex_format, 0,
BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
1, 1, 0, 0,
1, 1, 0, PIPE_RESOURCE_FLAG_MAP_UNSYNCHRONIZED,
PIPE_BIND_SAMPLER_VIEW,
false,
PIPE_COMPRESSION_FIXED_RATE_NONE);
@ -416,7 +416,7 @@ create_cache_trans(struct st_context *st)
* Subsequent glBitmap calls will write into the texture image.
*/
cache->buffer = pipe_texture_map(pipe, cache->texture, 0, 0,
PIPE_MAP_WRITE, 0, 0,
PIPE_MAP_WRITE | PIPE_MAP_UNSYNCHRONIZED, 0, 0,
BITMAP_CACHE_WIDTH,
BITMAP_CACHE_HEIGHT, &cache->trans);

View file

@ -439,12 +439,12 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
*/
static struct pipe_resource *
alloc_texture(struct st_context *st, GLsizei width, GLsizei height,
enum pipe_format texFormat, unsigned bind)
enum pipe_format texFormat, unsigned flags, unsigned bind)
{
struct pipe_resource *pt;
pt = st_texture_create(st, st->internal_target, texFormat, 0,
width, height, 1, 1, 0, 0, bind, false,
width, height, 1, 1, 0, flags, bind, false,
PIPE_COMPRESSION_FIXED_RATE_NONE);
return pt;
@ -631,7 +631,7 @@ make_texture(struct st_context *st,
return NULL;
/* alloc temporary texture */
pt = alloc_texture(st, width, height, pipeFormat, PIPE_BIND_SAMPLER_VIEW);
pt = alloc_texture(st, width, height, pipeFormat, PIPE_RESOURCE_FLAG_MAP_UNSYNCHRONIZED, PIPE_BIND_SAMPLER_VIEW);
if (!pt) {
_mesa_unmap_pbo_source(ctx, unpack);
return NULL;
@ -647,7 +647,7 @@ make_texture(struct st_context *st,
/* map texture transfer */
dest = pipe_texture_map(pipe, pt, 0, 0,
PIPE_MAP_WRITE | PIPE_MAP_DISCARD_WHOLE_RESOURCE,
PIPE_MAP_WRITE | PIPE_MAP_DISCARD_WHOLE_RESOURCE | PIPE_MAP_UNSYNCHRONIZED,
0, 0, width, height, &transfer);
if (!dest) {
pipe_resource_reference(&pt, NULL);
@ -1833,7 +1833,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
readH = MAX2(0, readH);
/* Allocate the temporary texture. */
pt = alloc_texture(st, width, height, srcFormat, srcBind);
pt = alloc_texture(st, width, height, srcFormat, 0, srcBind);
if (!pt)
return;

View file

@ -2284,6 +2284,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
memset(&src_templ, 0, sizeof(src_templ));
src_templ.target = gl_target_to_pipe(gl_target);
src_templ.format = src_format;
src_templ.flags = PIPE_RESOURCE_FLAG_MAP_UNSYNCHRONIZED;
src_templ.bind = PIPE_BIND_SAMPLER_VIEW;
src_templ.usage = PIPE_USAGE_STAGING;
@ -2328,7 +2329,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims,
height = 1;
}
map = pipe_texture_map_3d(pipe, src, 0, PIPE_MAP_WRITE, 0, 0, 0,
map = pipe_texture_map_3d(pipe, src, 0, PIPE_MAP_WRITE | PIPE_MAP_UNSYNCHRONIZED, 0, 0, 0,
width, height, depth, &transfer);
if (!map) {
_mesa_unmap_teximage_pbo(ctx, unpack);

View file

@ -481,7 +481,7 @@ sw_decode_astc(struct st_context *st,
/* Create the destination */
struct pipe_resource *rgba8_tex =
st_texture_create(st, PIPE_TEXTURE_2D, PIPE_FORMAT_R8G8B8A8_UNORM, 0,
width_px, height_px, 1, 1, 0, 0,
width_px, height_px, 1, 1, 0, PIPE_RESOURCE_FLAG_MAP_UNSYNCHRONIZED,
PIPE_BIND_SAMPLER_VIEW, false,
PIPE_COMPRESSION_FIXED_RATE_NONE);
if (!rgba8_tex)
@ -490,7 +490,7 @@ sw_decode_astc(struct st_context *st,
/* Temporarily map the destination and decode into the returned pointer */
struct pipe_transfer *rgba8_xfer;
void *rgba8_map = pipe_texture_map(st->pipe, rgba8_tex, 0, 0,
PIPE_MAP_WRITE, 0, 0,
PIPE_MAP_WRITE | PIPE_MAP_UNSYNCHRONIZED, 0, 0,
width_px, height_px, &rgba8_xfer);
if (!rgba8_map) {
pipe_resource_reference(&rgba8_tex, NULL);

View file

@ -446,7 +446,7 @@ st_create_color_map_texture(struct gl_context *ctx)
/* create texture for color map/table */
pt = st_texture_create(st, PIPE_TEXTURE_2D, format, 0,
texSize, texSize, 1, 1, 0, 0, PIPE_BIND_SAMPLER_VIEW, false,
texSize, texSize, 1, 1, 0, PIPE_RESOURCE_FLAG_MAP_UNSYNCHRONIZED, PIPE_BIND_SAMPLER_VIEW, false,
PIPE_COMPRESSION_FIXED_RATE_NONE);
return pt;
}