mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
radeonsi: set all pipe buffer functions in r600_buffer_common.c
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
63f88644a5
commit
eae85b99fc
4 changed files with 44 additions and 45 deletions
|
|
@ -21,6 +21,7 @@
|
|||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "radeonsi/si_pipe.h"
|
||||
#include "r600_cs.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_upload_mgr.h"
|
||||
|
|
@ -310,8 +311,8 @@ void si_replace_buffer_storage(struct pipe_context *ctx,
|
|||
rctx->rebind_buffer(ctx, dst, old_gpu_address);
|
||||
}
|
||||
|
||||
void si_invalidate_resource(struct pipe_context *ctx,
|
||||
struct pipe_resource *resource)
|
||||
static void si_invalidate_resource(struct pipe_context *ctx,
|
||||
struct pipe_resource *resource)
|
||||
{
|
||||
struct r600_common_context *rctx = (struct r600_common_context*)ctx;
|
||||
struct r600_resource *rbuffer = r600_resource(resource);
|
||||
|
|
@ -562,10 +563,10 @@ static void r600_buffer_transfer_unmap(struct pipe_context *ctx,
|
|||
slab_free(&rctx->pool_transfers, transfer);
|
||||
}
|
||||
|
||||
void si_buffer_subdata(struct pipe_context *ctx,
|
||||
struct pipe_resource *buffer,
|
||||
unsigned usage, unsigned offset,
|
||||
unsigned size, const void *data)
|
||||
static void si_buffer_subdata(struct pipe_context *ctx,
|
||||
struct pipe_resource *buffer,
|
||||
unsigned usage, unsigned offset,
|
||||
unsigned size, const void *data)
|
||||
{
|
||||
struct pipe_transfer *transfer = NULL;
|
||||
struct pipe_box box;
|
||||
|
|
@ -616,9 +617,9 @@ r600_alloc_buffer_struct(struct pipe_screen *screen,
|
|||
return rbuffer;
|
||||
}
|
||||
|
||||
struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ,
|
||||
unsigned alignment)
|
||||
static struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ,
|
||||
unsigned alignment)
|
||||
{
|
||||
struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
|
||||
struct r600_resource *rbuffer = r600_alloc_buffer_struct(screen, templ);
|
||||
|
|
@ -656,7 +657,7 @@ struct pipe_resource *si_aligned_buffer_create(struct pipe_screen *screen,
|
|||
return si_buffer_create(screen, &buffer, alignment);
|
||||
}
|
||||
|
||||
struct pipe_resource *
|
||||
static struct pipe_resource *
|
||||
si_buffer_from_user_memory(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ,
|
||||
void *user_memory)
|
||||
|
|
@ -689,3 +690,30 @@ si_buffer_from_user_memory(struct pipe_screen *screen,
|
|||
|
||||
return &rbuffer->b.b;
|
||||
}
|
||||
|
||||
static struct pipe_resource *si_resource_create(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ)
|
||||
{
|
||||
if (templ->target == PIPE_BUFFER) {
|
||||
return si_buffer_create(screen, templ, 256);
|
||||
} else {
|
||||
return si_texture_create(screen, templ);
|
||||
}
|
||||
}
|
||||
|
||||
void si_init_screen_buffer_functions(struct si_screen *sscreen)
|
||||
{
|
||||
sscreen->b.b.resource_create = si_resource_create;
|
||||
sscreen->b.b.resource_destroy = u_resource_destroy_vtbl;
|
||||
sscreen->b.b.resource_from_user_memory = si_buffer_from_user_memory;
|
||||
}
|
||||
|
||||
void si_init_buffer_functions(struct si_context *sctx)
|
||||
{
|
||||
sctx->b.b.invalidate_resource = si_invalidate_resource;
|
||||
sctx->b.b.transfer_map = u_transfer_map_vtbl;
|
||||
sctx->b.b.transfer_flush_region = u_transfer_flush_region_vtbl;
|
||||
sctx->b.b.transfer_unmap = u_transfer_unmap_vtbl;
|
||||
sctx->b.b.texture_subdata = u_default_texture_subdata;
|
||||
sctx->b.b.buffer_subdata = si_buffer_subdata;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -414,13 +414,7 @@ bool si_common_context_init(struct r600_common_context *rctx,
|
|||
rctx->family = rscreen->family;
|
||||
rctx->chip_class = rscreen->chip_class;
|
||||
|
||||
rctx->b.invalidate_resource = si_invalidate_resource;
|
||||
rctx->b.resource_commit = r600_resource_commit;
|
||||
rctx->b.transfer_map = u_transfer_map_vtbl;
|
||||
rctx->b.transfer_flush_region = u_transfer_flush_region_vtbl;
|
||||
rctx->b.transfer_unmap = u_transfer_unmap_vtbl;
|
||||
rctx->b.texture_subdata = u_default_texture_subdata;
|
||||
rctx->b.buffer_subdata = si_buffer_subdata;
|
||||
|
||||
if (rscreen->info.drm_major == 2 && rscreen->info.drm_minor >= 43) {
|
||||
rctx->b.get_device_reset_status = r600_get_reset_status;
|
||||
|
|
@ -576,22 +570,9 @@ static const struct debug_named_value common_debug_options[] = {
|
|||
DEBUG_NAMED_VALUE_END /* must be last */
|
||||
};
|
||||
|
||||
struct pipe_resource *si_resource_create_common(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ)
|
||||
{
|
||||
if (templ->target == PIPE_BUFFER) {
|
||||
return si_buffer_create(screen, templ, 256);
|
||||
} else {
|
||||
return si_texture_create(screen, templ);
|
||||
}
|
||||
}
|
||||
|
||||
bool si_common_screen_init(struct r600_common_screen *rscreen,
|
||||
struct radeon_winsys *ws)
|
||||
{
|
||||
rscreen->b.resource_destroy = u_resource_destroy_vtbl;
|
||||
rscreen->b.resource_from_user_memory = si_buffer_from_user_memory;
|
||||
|
||||
si_init_screen_texture_functions(rscreen);
|
||||
si_init_screen_query_functions(rscreen);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@
|
|||
#include "util/u_threaded_context.h"
|
||||
|
||||
struct u_log_context;
|
||||
struct si_screen;
|
||||
struct si_context;
|
||||
|
||||
#define R600_RESOURCE_FLAG_TRANSFER (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
|
||||
#define R600_RESOURCE_FLAG_FLUSHED_DEPTH (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
|
||||
|
|
@ -612,32 +614,21 @@ bool si_rings_is_buffer_referenced(struct r600_common_context *ctx,
|
|||
void *si_buffer_map_sync_with_rings(struct r600_common_context *ctx,
|
||||
struct r600_resource *resource,
|
||||
unsigned usage);
|
||||
void si_buffer_subdata(struct pipe_context *ctx,
|
||||
struct pipe_resource *buffer,
|
||||
unsigned usage, unsigned offset,
|
||||
unsigned size, const void *data);
|
||||
void si_init_resource_fields(struct r600_common_screen *rscreen,
|
||||
struct r600_resource *res,
|
||||
uint64_t size, unsigned alignment);
|
||||
bool si_alloc_resource(struct r600_common_screen *rscreen,
|
||||
struct r600_resource *res);
|
||||
struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ,
|
||||
unsigned alignment);
|
||||
struct pipe_resource *si_aligned_buffer_create(struct pipe_screen *screen,
|
||||
unsigned flags,
|
||||
unsigned usage,
|
||||
unsigned size,
|
||||
unsigned alignment);
|
||||
struct pipe_resource *
|
||||
si_buffer_from_user_memory(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ,
|
||||
void *user_memory);
|
||||
void si_invalidate_resource(struct pipe_context *ctx,
|
||||
struct pipe_resource *resource);
|
||||
void si_replace_buffer_storage(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
struct pipe_resource *src);
|
||||
void si_init_screen_buffer_functions(struct si_screen *sscreen);
|
||||
void si_init_buffer_functions(struct si_context *sctx);
|
||||
|
||||
/* r600_common_pipe.c */
|
||||
void si_gfx_write_event_eop(struct r600_common_context *ctx,
|
||||
|
|
@ -661,8 +652,6 @@ bool si_extra_shader_checks(struct r600_common_screen *rscreen,
|
|||
unsigned processor);
|
||||
void si_screen_clear_buffer(struct r600_common_screen *rscreen, struct pipe_resource *dst,
|
||||
uint64_t offset, uint64_t size, unsigned value);
|
||||
struct pipe_resource *si_resource_create_common(struct pipe_screen *screen,
|
||||
const struct pipe_resource *templ);
|
||||
void si_need_dma_space(struct r600_common_context *ctx, unsigned num_dw,
|
||||
struct r600_resource *dst, struct r600_resource *src);
|
||||
void si_save_cs(struct radeon_winsys *ws, struct radeon_winsys_cs *cs,
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
|
|||
if (sscreen->b.info.drm_major == 3)
|
||||
sctx->b.b.get_device_reset_status = si_amdgpu_get_reset_status;
|
||||
|
||||
si_init_buffer_functions(sctx);
|
||||
si_init_clear_functions(sctx);
|
||||
si_init_blit_functions(sctx);
|
||||
si_init_compute_functions(sctx);
|
||||
|
|
@ -598,9 +599,9 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws,
|
|||
/* Set functions first. */
|
||||
sscreen->b.b.context_create = si_pipe_create_context;
|
||||
sscreen->b.b.destroy = si_destroy_screen;
|
||||
sscreen->b.b.resource_create = si_resource_create_common;
|
||||
|
||||
si_init_screen_get_functions(sscreen);
|
||||
si_init_screen_buffer_functions(sscreen);
|
||||
si_init_screen_fence_functions(sscreen);
|
||||
si_init_screen_state_functions(sscreen);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue