diff options
author | Marek Olšák <[email protected]> | 2012-10-28 17:52:48 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-10-31 01:53:50 +0100 |
commit | c9f2af3df719c5ed608ef72b09f6907e1015079c (patch) | |
tree | 490b09022a3bd5995921b85e7bc0c57ddd2411ba /src | |
parent | f2f782d50fa9ba3e2352a404f812a51451b20ae5 (diff) |
gallium: expose ARB_map_buffer_alignment on Radeon
Reviewed-by: Brian Paul <[email protected]>
v2: update relnotes-9.1
v3: use align_malloc and align_free for malloced buffers in r300g
v4: document the new CAP in the docs
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/docs/source/screen.rst | 6 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/nv30/nv30_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen_buffer.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_pipe.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 6 |
14 files changed, 32 insertions, 3 deletions
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 7a5568477f0..6c89171cd73 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -130,6 +130,12 @@ The integer capabilities: pipe_draw_info::start_instance. * ``PIPE_CAP_QUERY_TIMESTAMP``: Whether PIPE_QUERY_TIMESTAMP and the pipe_screen::get_timestamp hook are implemented. +* ``PIPE_CAP_TEXTURE_MULTISAMPLE``: Whether all MSAA resources supported + for rendering are also supported for texturing. +* ``PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT``: The minimum alignment that should be + expected for a pointer returned by transfer_map if the resource is + PIPE_BUFFER. In other words, the pointer returned by transfer_map is + always aligned to this value. .. _pipe_capf: diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 1c82474bb17..45f48c2a4fb 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -209,6 +209,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_START_INSTANCE: case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index b64a6c0f36c..19ffd4ee9ae 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -212,6 +212,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_START_INSTANCE: case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; } /* should only get here on unhandled cases */ diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 18ad3a87461..4733661863d 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -119,6 +119,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 168f3785863..9461af92556 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -174,6 +174,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; default: NOUVEAU_ERR("unknown PIPE_CAP %d\n", param); diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index 4ff2f992e6f..0e0b6661b69 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -152,6 +152,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; default: NOUVEAU_ERR("unknown PIPE_CAP %d\n", param); diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 42904390c29..36b5dc78db9 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -107,6 +107,9 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_USER_CONSTANT_BUFFERS: return 1; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; + case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 16; diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index 652d757db5d..41a979cbf3a 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -55,7 +55,7 @@ static void r300_buffer_destroy(struct pipe_screen *screen, { struct r300_resource *rbuf = r300_resource(buf); - FREE(rbuf->malloced_buffer); + align_free(rbuf->malloced_buffer); if (rbuf->buf) pb_reference(&rbuf->buf, NULL); @@ -146,7 +146,7 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen, if (templ->bind & PIPE_BIND_CONSTANT_BUFFER || (!r300screen->caps.has_tcl && (templ->bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)))) { - rbuf->malloced_buffer = MALLOC(templ->width0); + rbuf->malloced_buffer = align_malloc(templ->width0, 64); return &rbuf->b.b; } diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 7a1e1353553..b5280e32160 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -400,6 +400,9 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: return 1; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; + case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 256; diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c index e069f1f2203..fa16f4c5dde 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c @@ -326,6 +326,9 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_NPOT_TEXTURES: return 1; + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: + return 64; + case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 256; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 445e31c1564..5051462bf12 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -166,6 +166,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_START_INSTANCE: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; case PIPE_CAP_QUERY_TIMESTAMP: return 1; diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 4f7970df45c..e2ca188b551 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -256,6 +256,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_START_INSTANCE: case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_TEXTURE_MULTISAMPLE: + case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: return 1; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index b145bc0e8ee..184136e4725 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -488,7 +488,8 @@ enum pipe_cap { PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT = 71, PIPE_CAP_START_INSTANCE = 72, PIPE_CAP_QUERY_TIMESTAMP = 73, - PIPE_CAP_TEXTURE_MULTISAMPLE = 74 + PIPE_CAP_TEXTURE_MULTISAMPLE = 74, + PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT = 75 }; /** diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 0560f3a8a39..bcc700d955e 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -637,4 +637,10 @@ void st_init_extensions(struct st_context *st) } if (st->options.force_glsl_extensions_warn) ctx->Const.ForceGLSLExtensionsWarn = 1; + + ctx->Const.MinMapBufferAlignment = + screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); + if (ctx->Const.MinMapBufferAlignment >= 64) { + ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; + } } |