summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_blit.c
diff options
context:
space:
mode:
authorJerome Glisse <[email protected]>2012-01-30 17:22:13 -0500
committerJerome Glisse <[email protected]>2012-02-06 18:36:37 -0500
commitc0c979eebc076b95cc8d18a013ce2968fe6311ad (patch)
treee110e2b47c53457a813cb911fbdddc4ce7a9ff0c /src/gallium/drivers/r600/r600_blit.c
parent8937c166efaaae6e05d8c8cd30be220b577729b8 (diff)
r600g: add support for common surface allocator for tiling v13
Tiled surface have all kind of alignment constraint that needs to be met. Instead of having all this code duplicated btw ddx and mesa use common code in libdrm_radeon this also ensure that both ddx and mesa compute those alignment in the same way. v2 fix evergreen v3 fix compressed texture and workaround cube texture issue by disabling 2D array mode for cubemap (need to check if r7xx and newer are also affected by the issue) v4 fix texture array v5 fix evergreen and newer, split surface values computation from mipmap tree generation so that we can get them directly from the ddx v6 final fix to evergreen tile split value v7 fix mipmap offset to avoid to use random value, use color view depth view to address different layer as hardware is doing some magic rotation depending on the layer v8 fix COLOR_VIEW on r6xx for linear array mode, use COLOR_VIEW on evergreen, align bytes per pixel to a multiple of a dword v9 fix handling of stencil on evergreen, half fix for compressed texture v10 fix evergreen compressed texture proper support for stencil tile split. Fix stencil issue when array mode was clear by the kernel, always program stencil bo. On evergreen depth buffer bo need to be big enough to hold depth buffer + stencil buffer as even with stencil disabled things get written there. v11 rebase on top of mesa, fix pitch issue with 1d surface on evergreen, old ddx overestimate those. Fix linear case when pitch*height < 64. Fix r300g. v12 Fix linear case when pitch*height < 64 for old path, adapt to libdrm API change v13 add libdrm check Signed-off-by: Jerome Glisse <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_blit.c')
-rw-r--r--src/gallium/drivers/r600/r600_blit.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 93df1a2911d..ff720c9a028 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -202,7 +202,7 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers,
{
struct r600_context *rctx = (struct r600_context *)ctx;
struct pipe_framebuffer_state *fb = &rctx->framebuffer;
-
+
r600_blitter_begin(ctx, R600_CLEAR);
util_blitter_clear(rctx->blitter, fb->width, fb->height,
fb->nr_cbufs, buffers, fb->nr_cbufs ? fb->cbufs[0]->format : PIPE_FORMAT_NONE,
@@ -263,6 +263,10 @@ struct texture_orig_info {
unsigned format;
unsigned width0;
unsigned height0;
+ unsigned npix_x;
+ unsigned npix_y;
+ unsigned npix0_x;
+ unsigned npix0_y;
};
static void r600_compressed_to_blittable(struct pipe_resource *tex,
@@ -270,6 +274,7 @@ static void r600_compressed_to_blittable(struct pipe_resource *tex,
struct texture_orig_info *orig)
{
struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+ struct r600_screen *rscreen = (struct r600_screen *)tex->screen;
unsigned pixsize = util_format_get_blocksize(rtex->real_format);
int new_format;
int new_height, new_width;
@@ -277,6 +282,10 @@ static void r600_compressed_to_blittable(struct pipe_resource *tex,
orig->format = tex->format;
orig->width0 = tex->width0;
orig->height0 = tex->height0;
+ orig->npix0_x = rtex->surface.level[0].npix_x;
+ orig->npix0_y = rtex->surface.level[0].npix_y;
+ orig->npix_x = rtex->surface.level[level].npix_x;
+ orig->npix_y = rtex->surface.level[level].npix_y;
if (pixsize == 8)
new_format = PIPE_FORMAT_R16G16B16A16_UINT; /* 64-bit block */
@@ -289,14 +298,26 @@ static void r600_compressed_to_blittable(struct pipe_resource *tex,
tex->width0 = new_width;
tex->height0 = new_height;
tex->format = new_format;
+ rtex->surface.level[0].npix_x = util_format_get_nblocksx(orig->format, orig->npix0_x);
+ rtex->surface.level[0].npix_y = util_format_get_nblocksy(orig->format, orig->npix0_y);
+ rtex->surface.level[level].npix_x = util_format_get_nblocksx(orig->format, orig->npix_x);
+ rtex->surface.level[level].npix_y = util_format_get_nblocksy(orig->format, orig->npix_y);
}
static void r600_reset_blittable_to_compressed(struct pipe_resource *tex,
+ unsigned level,
struct texture_orig_info *orig)
{
+ struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+ struct r600_screen *rscreen = (struct r600_screen *)tex->screen;
+
tex->format = orig->format;
tex->width0 = orig->width0;
tex->height0 = orig->height0;
+ rtex->surface.level[0].npix_x = orig->npix0_x;
+ rtex->surface.level[0].npix_y = orig->npix0_y;
+ rtex->surface.level[level].npix_x = orig->npix_x;
+ rtex->surface.level[level].npix_y = orig->npix_y;
}
static void r600_resource_copy_region(struct pipe_context *ctx,
@@ -352,10 +373,10 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
src, src_level, psbox);
if (restore_orig[0])
- r600_reset_blittable_to_compressed(src, &orig_info[0]);
+ r600_reset_blittable_to_compressed(src, src_level, &orig_info[0]);
if (restore_orig[1])
- r600_reset_blittable_to_compressed(dst, &orig_info[1]);
+ r600_reset_blittable_to_compressed(dst, dst_level, &orig_info[1]);
}
void r600_init_blit_functions(struct r600_context *rctx)