diff options
author | Jerome Glisse <jglisse@redhat.com> | 2011-12-13 11:08:19 -0500 |
---|---|---|
committer | Jerome Glisse <jglisse@redhat.com> | 2012-02-06 19:00:37 -0500 |
commit | 615033f2b5e3817e335e9d022fc9fdcf8ac8b11a (patch) | |
tree | ce50a286a4e6b46beaa8c7f2e6ef0c667179aac7 /src/r6xx_accel.c | |
parent | 36c190671081967bac6fff48aaf66d67b639a48c (diff) |
r600-evergreen: use common surface allocator for tiling v11
Use libdrm common surface code so mesa,ddx have same idea
about tiling surface and what their pitch should be and
the alignment constraint.
v2 fix remaining issue add new option to conditionaly enable
v3 fix fbcon copy and r600 exa copy path
v4 fix non tiled path 2D tiling on GPU >= R600, set it to false
as default
v5 adapt to pixel/element size split of libdrm/radeon
v6 update to properly handle falling back to 1d tiled
v6 final fix to tile split value on evergreen and newer
v7 fix default array mode on r6xx, fix height alignment issue
on evergreen
v8 fix tile split value
v9 add stencil tile split support, simplify dri2 for stencil
with evergreen
v10 Try to fix xv path regarding tiling. Adapt to libdrm API
change. Try to fix case where there is no surface which
means non tiled bo.
v11 check for proper libdrm
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Diffstat (limited to 'src/r6xx_accel.c')
-rw-r--r-- | src/r6xx_accel.c | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/src/r6xx_accel.c b/src/r6xx_accel.c index d1a50858..8e6bffa7 100644 --- a/src/r6xx_accel.c +++ b/src/r6xx_accel.c @@ -223,12 +223,37 @@ void r600_set_render_target(ScrnInfoPtr pScrn, drmBufPtr ib, cb_config_t *cb_conf, uint32_t domain) { uint32_t cb_color_info, cb_color_control; - int pitch, slice, h; + unsigned pitch, slice, h, array_mode; RADEONInfoPtr info = RADEONPTR(pScrn); + +#if defined(XF86DRM_MODE) + if (cb_conf->surface) { + switch (cb_conf->surface->level[0].mode) { + case RADEON_SURF_MODE_1D: + array_mode = 2; + break; + case RADEON_SURF_MODE_2D: + array_mode = 4; + break; + default: + array_mode = 0; + break; + } + pitch = (cb_conf->surface->level[0].nblk_x >> 3) - 1; + slice = ((cb_conf->surface->level[0].nblk_x * cb_conf->surface->level[0].nblk_y) / 64) - 1; + } else +#endif + { + array_mode = cb_conf->array_mode; + pitch = (cb_conf->w / 8) - 1; + h = RADEON_ALIGN(cb_conf->h, 8); + slice = ((cb_conf->w * h) / 64) - 1; + } + cb_color_info = ((cb_conf->endian << ENDIAN_shift) | (cb_conf->format << CB_COLOR0_INFO__FORMAT_shift) | - (cb_conf->array_mode << CB_COLOR0_INFO__ARRAY_MODE_shift) | + (array_mode << CB_COLOR0_INFO__ARRAY_MODE_shift) | (cb_conf->number_type << NUMBER_TYPE_shift) | (cb_conf->comp_swap << COMP_SWAP_shift) | (cb_conf->tile_mode << CB_COLOR0_INFO__TILE_MODE_shift)); @@ -251,10 +276,6 @@ r600_set_render_target(ScrnInfoPtr pScrn, drmBufPtr ib, cb_config_t *cb_conf, ui if (cb_conf->source_format) cb_color_info |= SOURCE_FORMAT_bit; - pitch = (cb_conf->w / 8) - 1; - h = RADEON_ALIGN(cb_conf->h, 8); - slice = ((cb_conf->w * h) / 64) - 1; - BEGIN_BATCH(3 + 2); EREG(ib, (CB_COLOR0_BASE + (4 * cb_conf->id)), (cb_conf->base >> 8)); RELOC_BATCH(cb_conf->bo, 0, domain); @@ -602,12 +623,34 @@ r600_set_tex_resource(ScrnInfoPtr pScrn, drmBufPtr ib, tex_resource_t *tex_res, RADEONInfoPtr info = RADEONPTR(pScrn); uint32_t sq_tex_resource_word0, sq_tex_resource_word1, sq_tex_resource_word4; uint32_t sq_tex_resource_word5, sq_tex_resource_word6; + uint32_t array_mode, pitch; + +#if defined(XF86DRM_MODE) + if (tex_res->surface) { + switch (tex_res->surface->level[0].mode) { + case RADEON_SURF_MODE_1D: + array_mode = 2; + break; + case RADEON_SURF_MODE_2D: + array_mode = 4; + break; + default: + array_mode = 0; + break; + } + pitch = tex_res->surface->level[0].nblk_x >> 3; + } else +#endif + { + array_mode = tex_res->tile_mode; + pitch = (tex_res->pitch + 7) >> 3; + } sq_tex_resource_word0 = ((tex_res->dim << DIM_shift) | - (tex_res->tile_mode << SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift)); + (array_mode << SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift)); if (tex_res->w) - sq_tex_resource_word0 |= (((((tex_res->pitch + 7) >> 3) - 1) << PITCH_shift) | + sq_tex_resource_word0 |= (((pitch - 1) << PITCH_shift) | ((tex_res->w - 1) << TEX_WIDTH_shift)); if (tex_res->tile_type) |