r600g,radeonsi: share the async dma interface
r600_texture.c is one step closer to r600g.
This commit is contained in:
parent
e916267285
commit
2814202ef4
|
@ -3739,13 +3739,13 @@ static void evergreen_dma_copy_tile(struct r600_context *rctx,
|
|||
}
|
||||
}
|
||||
|
||||
boolean evergreen_dma_blit(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box)
|
||||
static boolean evergreen_dma_blit(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box)
|
||||
{
|
||||
struct r600_context *rctx = (struct r600_context *)ctx;
|
||||
struct r600_texture *rsrc = (struct r600_texture*)src;
|
||||
|
@ -3904,5 +3904,7 @@ void evergreen_init_state_functions(struct r600_context *rctx)
|
|||
rctx->b.b.get_sample_position = evergreen_get_sample_position;
|
||||
else
|
||||
rctx->b.b.get_sample_position = cayman_get_sample_position;
|
||||
rctx->b.dma_copy = evergreen_dma_blit;
|
||||
|
||||
evergreen_init_compute_state_functions(rctx);
|
||||
}
|
||||
|
|
|
@ -1290,10 +1290,8 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
|
|||
|
||||
if (rscreen->b.chip_class >= EVERGREEN) {
|
||||
rscreen->b.b.is_format_supported = evergreen_is_format_supported;
|
||||
rscreen->dma_blit = &evergreen_dma_blit;
|
||||
} else {
|
||||
rscreen->b.b.is_format_supported = r600_is_format_supported;
|
||||
rscreen->dma_blit = &r600_dma_blit;
|
||||
}
|
||||
rscreen->b.b.context_create = r600_create_context;
|
||||
rscreen->b.b.fence_reference = r600_fence_reference;
|
||||
|
|
|
@ -201,14 +201,6 @@ struct r600_pipe_fences {
|
|||
pipe_mutex mutex;
|
||||
};
|
||||
|
||||
typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box);
|
||||
|
||||
/* logging */
|
||||
#define DBG_TEX_DEPTH (1 << 0)
|
||||
#define DBG_COMPUTE (1 << 1)
|
||||
|
@ -260,7 +252,6 @@ struct r600_screen {
|
|||
struct r600_resource *trace_bo;
|
||||
uint32_t *trace_ptr;
|
||||
unsigned cs_count;
|
||||
r600g_dma_blit_t dma_blit;
|
||||
|
||||
/* Auxiliary context. Mainly used to initialize resources.
|
||||
* It must be locked prior to using and flushed before unlocking. */
|
||||
|
@ -739,13 +730,6 @@ void r600_dma_copy(struct r600_context *rctx,
|
|||
uint64_t dst_offset,
|
||||
uint64_t src_offset,
|
||||
uint64_t size);
|
||||
boolean r600_dma_blit(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box);
|
||||
void r600_flag_resource_cache_flush(struct r600_context *rctx,
|
||||
struct pipe_resource *res);
|
||||
|
||||
|
@ -758,13 +742,6 @@ void evergreen_dma_copy(struct r600_context *rctx,
|
|||
uint64_t dst_offset,
|
||||
uint64_t src_offset,
|
||||
uint64_t size);
|
||||
boolean evergreen_dma_blit(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box);
|
||||
|
||||
/* r600_state_common.c */
|
||||
void r600_init_common_state_functions(struct r600_context *rctx);
|
||||
|
|
|
@ -3119,13 +3119,13 @@ static boolean r600_dma_copy_tile(struct r600_context *rctx,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
boolean r600_dma_blit(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box)
|
||||
static boolean r600_dma_blit(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box)
|
||||
{
|
||||
struct r600_context *rctx = (struct r600_context *)ctx;
|
||||
struct r600_texture *rsrc = (struct r600_texture*)src;
|
||||
|
@ -3263,7 +3263,7 @@ void r600_init_state_functions(struct r600_context *rctx)
|
|||
rctx->b.b.set_framebuffer_state = r600_set_framebuffer_state;
|
||||
rctx->b.b.set_polygon_stipple = r600_set_polygon_stipple;
|
||||
rctx->b.b.set_scissor_states = r600_set_scissor_states;
|
||||
|
||||
rctx->b.b.get_sample_position = r600_get_sample_position;
|
||||
rctx->b.dma_copy = r600_dma_blit;
|
||||
}
|
||||
/* this function must be last */
|
||||
|
|
|
@ -81,9 +81,9 @@ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_t
|
|||
return;
|
||||
}
|
||||
|
||||
if (!rctx->screen->dma_blit(ctx, dst, 0, 0, 0, 0,
|
||||
src, transfer->level,
|
||||
&transfer->box)) {
|
||||
if (!rctx->b.dma_copy(ctx, dst, 0, 0, 0, 0,
|
||||
src, transfer->level,
|
||||
&transfer->box)) {
|
||||
ctx->resource_copy_region(ctx, dst, 0, 0, 0, 0,
|
||||
src, transfer->level, &transfer->box);
|
||||
}
|
||||
|
@ -107,9 +107,9 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600
|
|||
return;
|
||||
}
|
||||
|
||||
if (!rctx->screen->dma_blit(ctx, dst, transfer->level,
|
||||
transfer->box.x, transfer->box.y, transfer->box.z,
|
||||
src, 0, &sbox)) {
|
||||
if (!rctx->b.dma_copy(ctx, dst, transfer->level,
|
||||
transfer->box.x, transfer->box.y, transfer->box.z,
|
||||
src, 0, &sbox)) {
|
||||
ctx->resource_copy_region(ctx, dst, transfer->level,
|
||||
transfer->box.x, transfer->box.y, transfer->box.z,
|
||||
src, 0, &sbox);
|
||||
|
|
|
@ -203,6 +203,16 @@ struct r600_common_context {
|
|||
|
||||
/* Additional context states. */
|
||||
unsigned flags; /* flush flags */
|
||||
|
||||
/* Copy one resource to another using async DMA.
|
||||
* False is returned if the copy couldn't be done. */
|
||||
boolean (*dma_copy)(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box);
|
||||
};
|
||||
|
||||
/* r600_common_pipe.c */
|
||||
|
|
|
@ -73,6 +73,7 @@ static void r600_copy_region_with_blit(struct pipe_context *pipe,
|
|||
/* Copy from a full GPU texture to a transfer's staging one. */
|
||||
static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer)
|
||||
{
|
||||
struct r600_context *rctx = (struct r600_context*)ctx;
|
||||
struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer;
|
||||
struct pipe_resource *dst = &rtransfer->staging->b.b;
|
||||
struct pipe_resource *src = transfer->resource;
|
||||
|
@ -83,13 +84,18 @@ static void r600_copy_to_staging_texture(struct pipe_context *ctx, struct r600_t
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->resource_copy_region(ctx, dst, 0, 0, 0, 0,
|
||||
src, transfer->level, &transfer->box);
|
||||
if (!rctx->b.dma_copy(ctx, dst, 0, 0, 0, 0,
|
||||
src, transfer->level,
|
||||
&transfer->box)) {
|
||||
ctx->resource_copy_region(ctx, dst, 0, 0, 0, 0,
|
||||
src, transfer->level, &transfer->box);
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy from a transfer's staging texture to a full GPU one. */
|
||||
static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer)
|
||||
{
|
||||
struct r600_context *rctx = (struct r600_context*)ctx;
|
||||
struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer;
|
||||
struct pipe_resource *dst = transfer->resource;
|
||||
struct pipe_resource *src = &rtransfer->staging->b.b;
|
||||
|
@ -104,9 +110,13 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->resource_copy_region(ctx, dst, transfer->level,
|
||||
transfer->box.x, transfer->box.y, transfer->box.z,
|
||||
src, 0, &sbox);
|
||||
if (!rctx->b.dma_copy(ctx, dst, transfer->level,
|
||||
transfer->box.x, transfer->box.y, transfer->box.z,
|
||||
src, 0, &sbox)) {
|
||||
ctx->resource_copy_region(ctx, dst, transfer->level,
|
||||
transfer->box.x, transfer->box.y, transfer->box.z,
|
||||
src, 0, &sbox);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned r600_texture_get_offset(struct r600_texture *rtex, unsigned level,
|
||||
|
|
|
@ -2955,6 +2955,18 @@ static void r600_surface_destroy(struct pipe_context *pipe,
|
|||
FREE(surface);
|
||||
}
|
||||
|
||||
static boolean si_dma_copy(struct pipe_context *ctx,
|
||||
struct pipe_resource *dst,
|
||||
unsigned dst_level,
|
||||
unsigned dst_x, unsigned dst_y, unsigned dst_z,
|
||||
struct pipe_resource *src,
|
||||
unsigned src_level,
|
||||
const struct pipe_box *src_box)
|
||||
{
|
||||
/* XXX implement this or share evergreen_dma_blit with r600g */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void si_init_state_functions(struct r600_context *rctx)
|
||||
{
|
||||
int i;
|
||||
|
@ -3018,6 +3030,7 @@ void si_init_state_functions(struct r600_context *rctx)
|
|||
rctx->b.b.set_polygon_stipple = si_set_polygon_stipple;
|
||||
rctx->b.b.create_surface = r600_create_surface;
|
||||
rctx->b.b.surface_destroy = r600_surface_destroy;
|
||||
rctx->b.dma_copy = si_dma_copy;
|
||||
|
||||
rctx->b.b.draw_vbo = si_draw_vbo;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue