#include "si_pipe.h"
#include "si_query.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "util/u_log.h"
#include "util/u_memory.h"
#include "util/u_pack_color.h"
unsigned src_level,
const struct pipe_box *src_box)
{
- if (!sctx->dma_cs)
+ if (!sctx->sdma_cs)
return false;
if (dst->surface.bpe != src->surface.bpe)
/* Each texture is an array of slices. Each slice is an array
* of mipmap levels. */
- return box->z * tex->surface.u.gfx9.surf_slice_size +
+ return tex->surface.u.gfx9.surf_offset +
+ box->z * tex->surface.u.gfx9.surf_slice_size +
tex->surface.u.gfx9.offset[level] +
(box->y / tex->surface.blk_h *
tex->surface.u.gfx9.surf_pitch +
/* GFX9: DCC clear for 4x and 8x MSAA textures unimplemented. */
if (sscreen->info.chip_class == GFX9 &&
- ptex->nr_storage_samples >= 4)
+ (ptex->nr_storage_samples >= 4 ||
+ (sscreen->info.family == CHIP_RAVEN &&
+ ptex->nr_storage_samples >= 2 && bpe < 4)))
flags |= RADEON_SURF_DISABLE_DCC;
/* TODO: GFX10: DCC causes corruption with MSAA. */
if (!is_imported && (sscreen->debug_flags & DBG(NO_DCC)))
flags |= RADEON_SURF_DISABLE_DCC;
- if (ptex->bind & PIPE_BIND_SCANOUT || is_scanout) {
+ if (is_scanout) {
/* This should catch bugs in gallium users setting incorrect flags. */
assert(ptex->nr_samples <= 1 &&
ptex->array_size == 1 &&
if (sscreen->debug_flags & DBG(NO_FMASK))
flags |= RADEON_SURF_NO_FMASK;
+ if (sscreen->info.chip_class == GFX9 &&
+ (ptex->flags & SI_RESOURCE_FLAG_FORCE_MICRO_TILE_MODE)) {
+ flags |= RADEON_SURF_FORCE_MICRO_TILE_MODE;
+ surface->micro_tile_mode = SI_RESOURCE_FLAG_MICRO_TILE_MODE_GET(ptex->flags);
+ }
+
if (sscreen->info.chip_class >= GFX10 &&
(ptex->flags & SI_RESOURCE_FLAG_FORCE_MSAA_TILING)) {
flags |= RADEON_SURF_FORCE_SWIZZLE_MODE;
else
*array_mode = RADEON_SURF_MODE_LINEAR_ALIGNED;
- *is_scanout = metadata->u.gfx9.swizzle_mode == 0 ||
- metadata->u.gfx9.swizzle_mode % 4 == 2;
-
surf->u.gfx9.surf.swizzle_mode = metadata->u.gfx9.swizzle_mode;
+ *is_scanout = metadata->u.gfx9.scanout;
if (metadata->u.gfx9.dcc_offset_256B) {
surf->u.gfx9.display_dcc_pitch_max = metadata->u.gfx9.dcc_pitch_max;
static bool si_texture_discard_dcc(struct si_screen *sscreen,
struct si_texture *tex)
{
- if (!si_can_disable_dcc(tex)) {
- assert(tex->surface.display_dcc_offset == 0);
+ if (!si_can_disable_dcc(tex))
return false;
- }
assert(tex->dcc_separate_buffer == NULL);
tex->can_sample_s = new_tex->can_sample_s;
tex->separate_dcc_dirty = new_tex->separate_dcc_dirty;
+ tex->displayable_dcc_dirty = new_tex->displayable_dcc_dirty;
tex->dcc_gather_statistics = new_tex->dcc_gather_statistics;
si_resource_reference(&tex->dcc_separate_buffer,
new_tex->dcc_separate_buffer);
if (sscreen->info.chip_class >= GFX9) {
md.u.gfx9.swizzle_mode = surface->u.gfx9.surf.swizzle_mode;
+ md.u.gfx9.scanout = (surface->flags & RADEON_SURF_SCANOUT) != 0;
if (tex->surface.dcc_offset && !tex->dcc_separate_buffer) {
uint64_t dcc_offset =
if (sscreen->info.chip_class >= GFX8 &&
G_008F28_COMPRESSION_EN(desc[6])) {
- /* Read DCC information.
- *
- * Some state trackers don't set the SCANOUT flag when
- * importing displayable images, which affects PIPE_ALIGNED
- * and RB_ALIGNED, so we need to recover them here.
- */
+ /* Read DCC information. */
switch (sscreen->info.chip_class) {
case GFX8:
tex->surface.dcc_offset = (uint64_t)desc[7] << 8;
/* If DCC is unaligned, this can only be a displayable image. */
if (!tex->surface.u.gfx9.dcc.pipe_aligned &&
!tex->surface.u.gfx9.dcc.rb_aligned)
- tex->surface.is_displayable = true;
+ assert(tex->surface.is_displayable);
break;
case GFX10:
/* Copy the staging buffer to the buffer backing the texture. */
struct si_context *sctx = (struct si_context*)sscreen->aux_context;
- struct pipe_box box;
- u_box_1d(0, buf->b.b.width0, &box);
assert(tex->surface.dcc_retile_map_offset <= UINT_MAX);
simple_mtx_lock(&sscreen->aux_context_lock);
- sctx->dma_copy(&sctx->b, &tex->buffer.b.b, 0,
- tex->surface.dcc_retile_map_offset, 0, 0,
- &buf->b.b, 0, &box);
+ si_sdma_copy_buffer(sctx, &tex->buffer.b.b, &buf->b.b,
+ tex->surface.dcc_retile_map_offset,
+ 0, buf->b.b.width0);
sscreen->aux_context->flush(sscreen->aux_context, NULL, 0);
simple_mtx_unlock(&sscreen->aux_context_lock);
plane_templ[i].bind |= PIPE_BIND_SHARED;
if (si_init_surface(sscreen, &surface[i], &plane_templ[i],
- tile_mode, 0, false, false,
+ tile_mode, 0, false,
+ plane_templ[i].bind & PIPE_BIND_SCANOUT,
is_flushed_depth, tc_compatible_htile))
return NULL;
tex->plane_index = i;
tex->num_planes = num_planes;
- if (!last_plane)
+ if (!plane0) {
plane0 = last_plane = tex;
- else
+ } else {
last_plane->buffer.b.b.next = &tex->buffer.b.b;
+ last_plane = tex;
+ }
}
return (struct pipe_resource *)plane0;