diff options
author | Marek Olšák <[email protected]> | 2016-10-23 13:08:46 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-03-30 14:44:33 +0200 |
commit | ba2e7c68ce8d37ebd666614a47abb33502b38ce5 (patch) | |
tree | 383f02c8864eccdcb98416ae65beb00f455717d0 /src/gallium/drivers/radeon | |
parent | 641b79774ae5f094cf6268b298cbc40d2718e9e8 (diff) |
gallium/radeon: move pre-GFX9 radeon_surf.* members to radeon_surf.u.legacy.*
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_test_dma.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 156 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_uvd.c | 20 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_vce.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_vce_40_2_2.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_vce_50.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_vce_52.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_video.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_winsys.h | 59 |
9 files changed, 157 insertions, 146 deletions
diff --git a/src/gallium/drivers/radeon/r600_test_dma.c b/src/gallium/drivers/radeon/r600_test_dma.c index 3c23b093294..60294fff924 100644 --- a/src/gallium/drivers/radeon/r600_test_dma.c +++ b/src/gallium/drivers/radeon/r600_test_dma.c @@ -277,9 +277,9 @@ void r600_test_dma(struct r600_common_screen *rscreen) printf("%4u: dst = (%5u x %5u x %u, %s), " " src = (%5u x %5u x %u, %s), bpp = %2u, ", i, tdst.width0, tdst.height0, tdst.array_size, - array_mode_to_string(rdst->surface.level[0].mode), + array_mode_to_string(rdst->surface.u.legacy.level[0].mode), tsrc.width0, tsrc.height0, tsrc.array_size, - array_mode_to_string(rsrc->surface.level[0].mode), bpp); + array_mode_to_string(rsrc->surface.u.legacy.level[0].mode), bpp); fflush(stdout); /* set src pixels */ diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index b81dbb7c2f6..ece1e806e3e 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -180,10 +180,10 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600 static unsigned r600_texture_get_offset(struct r600_texture *rtex, unsigned level, const struct pipe_box *box) { - return rtex->surface.level[level].offset + - box->z * rtex->surface.level[level].slice_size + + return rtex->surface.u.legacy.level[level].offset + + box->z * rtex->surface.u.legacy.level[level].slice_size + (box->y / rtex->surface.blk_h * - rtex->surface.level[level].nblk_x + + rtex->surface.u.legacy.level[level].nblk_x + box->x / rtex->surface.blk_w) * rtex->surface.bpe; } @@ -266,17 +266,17 @@ static int r600_init_surface(struct r600_common_screen *rscreen, } if (pitch_in_bytes_override && - pitch_in_bytes_override != surface->level[0].nblk_x * bpe) { + pitch_in_bytes_override != surface->u.legacy.level[0].nblk_x * bpe) { /* old ddx on evergreen over estimate alignment for 1d, only 1 level * for those */ - surface->level[0].nblk_x = pitch_in_bytes_override / bpe; - surface->level[0].slice_size = pitch_in_bytes_override * surface->level[0].nblk_y; + surface->u.legacy.level[0].nblk_x = pitch_in_bytes_override / bpe; + surface->u.legacy.level[0].slice_size = pitch_in_bytes_override * surface->u.legacy.level[0].nblk_y; } if (offset) { - for (i = 0; i < ARRAY_SIZE(surface->level); ++i) - surface->level[i].offset += offset; + for (i = 0; i < ARRAY_SIZE(surface->u.legacy.level); ++i) + surface->u.legacy.level[i].offset += offset; } return 0; } @@ -287,17 +287,17 @@ static void r600_texture_init_metadata(struct r600_texture *rtex, struct radeon_surf *surface = &rtex->surface; memset(metadata, 0, sizeof(*metadata)); - metadata->microtile = surface->level[0].mode >= RADEON_SURF_MODE_1D ? + metadata->microtile = surface->u.legacy.level[0].mode >= RADEON_SURF_MODE_1D ? RADEON_LAYOUT_TILED : RADEON_LAYOUT_LINEAR; - metadata->macrotile = surface->level[0].mode >= RADEON_SURF_MODE_2D ? + metadata->macrotile = surface->u.legacy.level[0].mode >= RADEON_SURF_MODE_2D ? RADEON_LAYOUT_TILED : RADEON_LAYOUT_LINEAR; - metadata->pipe_config = surface->pipe_config; - metadata->bankw = surface->bankw; - metadata->bankh = surface->bankh; - metadata->tile_split = surface->tile_split; - metadata->mtilea = surface->mtilea; - metadata->num_banks = surface->num_banks; - metadata->stride = surface->level[0].nblk_x * surface->bpe; + metadata->pipe_config = surface->u.legacy.pipe_config; + metadata->bankw = surface->u.legacy.bankw; + metadata->bankh = surface->u.legacy.bankh; + metadata->tile_split = surface->u.legacy.tile_split; + metadata->mtilea = surface->u.legacy.mtilea; + metadata->num_banks = surface->u.legacy.num_banks; + metadata->stride = surface->u.legacy.level[0].nblk_x * surface->bpe; metadata->scanout = (surface->flags & RADEON_SURF_SCANOUT) != 0; } @@ -548,10 +548,10 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, } return rscreen->ws->buffer_get_handle(res->buf, - rtex->surface.level[0].nblk_x * + rtex->surface.u.legacy.level[0].nblk_x * rtex->surface.bpe, - rtex->surface.level[0].offset, - rtex->surface.level[0].slice_size, + rtex->surface.u.legacy.level[0].offset, + rtex->surface.u.legacy.level[0].slice_size, whandle); } @@ -593,13 +593,13 @@ void r600_texture_get_fmask_info(struct r600_common_screen *rscreen, if (rscreen->chip_class <= CAYMAN) { /* Use the same parameters and tile mode. */ - fmask.bankw = rtex->surface.bankw; - fmask.bankh = rtex->surface.bankh; - fmask.mtilea = rtex->surface.mtilea; - fmask.tile_split = rtex->surface.tile_split; + fmask.u.legacy.bankw = rtex->surface.u.legacy.bankw; + fmask.u.legacy.bankh = rtex->surface.u.legacy.bankh; + fmask.u.legacy.mtilea = rtex->surface.u.legacy.mtilea; + fmask.u.legacy.tile_split = rtex->surface.u.legacy.tile_split; if (nr_samples <= 4) - fmask.bankh = 4; + fmask.u.legacy.bankh = 4; } switch (nr_samples) { @@ -628,15 +628,15 @@ void r600_texture_get_fmask_info(struct r600_common_screen *rscreen, return; } - assert(fmask.level[0].mode == RADEON_SURF_MODE_2D); + assert(fmask.u.legacy.level[0].mode == RADEON_SURF_MODE_2D); - out->slice_tile_max = (fmask.level[0].nblk_x * fmask.level[0].nblk_y) / 64; + out->slice_tile_max = (fmask.u.legacy.level[0].nblk_x * fmask.u.legacy.level[0].nblk_y) / 64; if (out->slice_tile_max) out->slice_tile_max -= 1; - out->tile_mode_index = fmask.tiling_index[0]; - out->pitch_in_pixels = fmask.level[0].nblk_x; - out->bank_height = fmask.bankh; + out->tile_mode_index = fmask.u.legacy.tiling_index[0]; + out->pitch_in_pixels = fmask.u.legacy.level[0].nblk_x; + out->bank_height = fmask.u.legacy.bankh; out->alignment = MAX2(256, fmask.surf_alignment); out->size = fmask.surf_size; } @@ -808,7 +808,7 @@ static void r600_texture_get_htile_size(struct r600_common_screen *rscreen, /* HTILE is broken with 1D tiling on old kernels and CIK. */ if (rscreen->chip_class >= CIK && - rtex->surface.level[0].mode == RADEON_SURF_MODE_1D && + rtex->surface.u.legacy.level[0].mode == RADEON_SURF_MODE_1D && rscreen->info.drm_major == 2 && rscreen->info.drm_minor < 38) return; @@ -911,9 +911,9 @@ void r600_print_texture_info(struct r600_texture *rtex, FILE *f) fprintf(f, " Layout: size=%"PRIu64", alignment=%u, bankw=%u, " "bankh=%u, nbanks=%u, mtilea=%u, tilesplit=%u, pipeconfig=%u, scanout=%u\n", - rtex->surface.surf_size, rtex->surface.surf_alignment, rtex->surface.bankw, - rtex->surface.bankh, rtex->surface.num_banks, rtex->surface.mtilea, - rtex->surface.tile_split, rtex->surface.pipe_config, + rtex->surface.surf_size, rtex->surface.surf_alignment, rtex->surface.u.legacy.bankw, + rtex->surface.u.legacy.bankh, rtex->surface.u.legacy.num_banks, rtex->surface.u.legacy.mtilea, + rtex->surface.u.legacy.tile_split, rtex->surface.u.legacy.pipe_config, (rtex->surface.flags & RADEON_SURF_SCANOUT) != 0); if (rtex->fmask.size) @@ -943,41 +943,41 @@ void r600_print_texture_info(struct r600_texture *rtex, FILE *f) fprintf(f, " DCCLevel[%i]: enabled=%u, offset=%"PRIu64", " "fast_clear_size=%"PRIu64"\n", i, i < rtex->surface.num_dcc_levels, - rtex->surface.level[i].dcc_offset, - rtex->surface.level[i].dcc_fast_clear_size); + rtex->surface.u.legacy.level[i].dcc_offset, + rtex->surface.u.legacy.level[i].dcc_fast_clear_size); } for (i = 0; i <= rtex->resource.b.b.last_level; i++) fprintf(f, " Level[%i]: offset=%"PRIu64", slice_size=%"PRIu64", " "npix_x=%u, npix_y=%u, npix_z=%u, nblk_x=%u, nblk_y=%u, " "mode=%u, tiling_index = %u\n", - i, rtex->surface.level[i].offset, - rtex->surface.level[i].slice_size, + i, rtex->surface.u.legacy.level[i].offset, + rtex->surface.u.legacy.level[i].slice_size, u_minify(rtex->resource.b.b.width0, i), u_minify(rtex->resource.b.b.height0, i), u_minify(rtex->resource.b.b.depth0, i), - rtex->surface.level[i].nblk_x, - rtex->surface.level[i].nblk_y, - rtex->surface.level[i].mode, - rtex->surface.tiling_index[i]); + rtex->surface.u.legacy.level[i].nblk_x, + rtex->surface.u.legacy.level[i].nblk_y, + rtex->surface.u.legacy.level[i].mode, + rtex->surface.u.legacy.tiling_index[i]); if (rtex->surface.flags & RADEON_SURF_SBUFFER) { fprintf(f, " StencilLayout: tilesplit=%u\n", - rtex->surface.stencil_tile_split); + rtex->surface.u.legacy.stencil_tile_split); for (i = 0; i <= rtex->resource.b.b.last_level; i++) { fprintf(f, " StencilLevel[%i]: offset=%"PRIu64", " "slice_size=%"PRIu64", npix_x=%u, " "npix_y=%u, npix_z=%u, nblk_x=%u, nblk_y=%u, " "mode=%u, tiling_index = %u\n", - i, rtex->surface.stencil_level[i].offset, - rtex->surface.stencil_level[i].slice_size, + i, rtex->surface.u.legacy.stencil_level[i].offset, + rtex->surface.u.legacy.stencil_level[i].slice_size, u_minify(rtex->resource.b.b.width0, i), u_minify(rtex->resource.b.b.height0, i), u_minify(rtex->resource.b.b.depth0, i), - rtex->surface.stencil_level[i].nblk_x, - rtex->surface.stencil_level[i].nblk_y, - rtex->surface.stencil_level[i].mode, - rtex->surface.stencil_tiling_index[i]); + rtex->surface.u.legacy.stencil_level[i].nblk_x, + rtex->surface.u.legacy.stencil_level[i].nblk_y, + rtex->surface.u.legacy.stencil_level[i].mode, + rtex->surface.u.legacy.stencil_tiling_index[i]); } } } @@ -1030,7 +1030,7 @@ r600_texture_create_object(struct pipe_screen *screen, /* Tiled depth textures utilize the non-displayable tile order. * This must be done after r600_setup_surface. * Applies to R600-Cayman. */ - rtex->non_disp_tiling = rtex->is_depth && rtex->surface.level[0].mode >= RADEON_SURF_MODE_1D; + rtex->non_disp_tiling = rtex->is_depth && rtex->surface.u.legacy.level[0].mode >= RADEON_SURF_MODE_1D; /* Applies to GCN. */ rtex->last_msaa_resolve_target_micro_mode = rtex->surface.micro_tile_mode; @@ -1044,8 +1044,8 @@ r600_texture_create_object(struct pipe_screen *screen, if (base->flags & (R600_RESOURCE_FLAG_TRANSFER | R600_RESOURCE_FLAG_FLUSHED_DEPTH) || rscreen->chip_class >= EVERGREEN) { - rtex->can_sample_z = !rtex->surface.depth_adjusted; - rtex->can_sample_s = !rtex->surface.stencil_adjusted; + rtex->can_sample_z = !rtex->surface.u.legacy.depth_adjusted; + rtex->can_sample_s = !rtex->surface.u.legacy.stencil_adjusted; } else { if (rtex->resource.b.b.nr_samples <= 1 && (rtex->resource.b.b.format == PIPE_FORMAT_Z16_UNORM || @@ -1265,12 +1265,12 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen rscreen->ws->buffer_get_metadata(buf, &metadata); - surface.pipe_config = metadata.pipe_config; - surface.bankw = metadata.bankw; - surface.bankh = metadata.bankh; - surface.tile_split = metadata.tile_split; - surface.mtilea = metadata.mtilea; - surface.num_banks = metadata.num_banks; + surface.u.legacy.pipe_config = metadata.pipe_config; + surface.u.legacy.bankw = metadata.bankw; + surface.u.legacy.bankh = metadata.bankh; + surface.u.legacy.tile_split = metadata.tile_split; + surface.u.legacy.mtilea = metadata.mtilea; + surface.u.legacy.num_banks = metadata.num_banks; if (metadata.macrotile == RADEON_LAYOUT_TILED) array_mode = RADEON_SURF_MODE_2D; @@ -1560,9 +1560,9 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, offset = r600_texture_get_offset(staging_depth, level, box); } - trans->transfer.stride = staging_depth->surface.level[level].nblk_x * + trans->transfer.stride = staging_depth->surface.u.legacy.level[level].nblk_x * staging_depth->surface.bpe; - trans->transfer.layer_stride = staging_depth->surface.level[level].slice_size; + trans->transfer.layer_stride = staging_depth->surface.u.legacy.level[level].slice_size; trans->staging = (struct r600_resource*)staging_depth; buf = trans->staging; } else if (use_staging_texture) { @@ -1582,9 +1582,9 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, return NULL; } trans->staging = &staging->resource; - trans->transfer.stride = staging->surface.level[0].nblk_x * + trans->transfer.stride = staging->surface.u.legacy.level[0].nblk_x * staging->surface.bpe; - trans->transfer.layer_stride = staging->surface.level[0].slice_size; + trans->transfer.layer_stride = staging->surface.u.legacy.level[0].slice_size; if (usage & PIPE_TRANSFER_READ) r600_copy_to_staging_texture(ctx, trans); @@ -1594,9 +1594,9 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, buf = trans->staging; } else { /* the resource is mapped directly */ - trans->transfer.stride = rtex->surface.level[level].nblk_x * + trans->transfer.stride = rtex->surface.u.legacy.level[level].nblk_x * rtex->surface.bpe; - trans->transfer.layer_stride = rtex->surface.level[level].slice_size; + trans->transfer.layer_stride = rtex->surface.u.legacy.level[level].slice_size; offset = r600_texture_get_offset(rtex, level, box); buf = &rtex->resource; } @@ -2334,10 +2334,10 @@ void vi_dcc_clear_level(struct r600_common_context *rctx, dcc_offset = rtex->dcc_offset; } - dcc_offset += rtex->surface.level[level].dcc_offset; + dcc_offset += rtex->surface.u.legacy.level[level].dcc_offset; rctx->clear_buffer(&rctx->b, dcc_buffer, dcc_offset, - rtex->surface.level[level].dcc_fast_clear_size, + rtex->surface.u.legacy.level[level].dcc_fast_clear_size, clear_value, R600_COHERENCY_CB_META); } @@ -2353,7 +2353,7 @@ static void si_set_optimal_micro_tile_mode(struct r600_common_screen *rscreen, rtex->surface.micro_tile_mode == rtex->last_msaa_resolve_target_micro_mode) return; - assert(rtex->surface.level[0].mode == RADEON_SURF_MODE_2D); + assert(rtex->surface.u.legacy.level[0].mode == RADEON_SURF_MODE_2D); assert(rtex->resource.b.b.last_level == 0); /* These magic numbers were copied from addrlib. It doesn't use any @@ -2363,13 +2363,13 @@ static void si_set_optimal_micro_tile_mode(struct r600_common_screen *rscreen, if (rscreen->chip_class >= CIK) { switch (rtex->last_msaa_resolve_target_micro_mode) { case RADEON_MICRO_MODE_DISPLAY: - rtex->surface.tiling_index[0] = 10; + rtex->surface.u.legacy.tiling_index[0] = 10; break; case RADEON_MICRO_MODE_THIN: - rtex->surface.tiling_index[0] = 14; + rtex->surface.u.legacy.tiling_index[0] = 14; break; case RADEON_MICRO_MODE_ROTATED: - rtex->surface.tiling_index[0] = 28; + rtex->surface.u.legacy.tiling_index[0] = 28; break; default: /* depth, thick */ assert(!"unexpected micro mode"); @@ -2380,29 +2380,29 @@ static void si_set_optimal_micro_tile_mode(struct r600_common_screen *rscreen, case RADEON_MICRO_MODE_DISPLAY: switch (rtex->surface.bpe) { case 1: - rtex->surface.tiling_index[0] = 10; + rtex->surface.u.legacy.tiling_index[0] = 10; break; case 2: - rtex->surface.tiling_index[0] = 11; + rtex->surface.u.legacy.tiling_index[0] = 11; break; default: /* 4, 8 */ - rtex->surface.tiling_index[0] = 12; + rtex->surface.u.legacy.tiling_index[0] = 12; break; } break; case RADEON_MICRO_MODE_THIN: switch (rtex->surface.bpe) { case 1: - rtex->surface.tiling_index[0] = 14; + rtex->surface.u.legacy.tiling_index[0] = 14; break; case 2: - rtex->surface.tiling_index[0] = 15; + rtex->surface.u.legacy.tiling_index[0] = 15; break; case 4: - rtex->surface.tiling_index[0] = 16; + rtex->surface.u.legacy.tiling_index[0] = 16; break; default: /* 8, 16 */ - rtex->surface.tiling_index[0] = 17; + rtex->surface.u.legacy.tiling_index[0] = 17; break; } break; @@ -2472,7 +2472,7 @@ void evergreen_do_fast_color_clear(struct r600_common_context *rctx, /* fast color clear with 1D tiling doesn't work on old kernels and CIK */ if (rctx->chip_class == CIK && - tex->surface.level[0].mode == RADEON_SURF_MODE_1D && + tex->surface.u.legacy.level[0].mode == RADEON_SURF_MODE_1D && rctx->screen->info.drm_major == 2 && rctx->screen->info.drm_minor < 38) { continue; diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c index 610416be4d7..c1746f8325f 100644 --- a/src/gallium/drivers/radeon/radeon_uvd.c +++ b/src/gallium/drivers/radeon/radeon_uvd.c @@ -1321,8 +1321,8 @@ error: /* calculate top/bottom offset */ static unsigned texture_offset(struct radeon_surf *surface, unsigned layer) { - return surface->level[0].offset + - layer * surface->level[0].slice_size; + return surface->u.legacy.level[0].offset + + layer * surface->u.legacy.level[0].slice_size; } /* hw encode the aspect of macro tiles */ @@ -1357,8 +1357,8 @@ static unsigned bank_wh(unsigned bankwh) void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct radeon_surf *luma, struct radeon_surf *chroma) { - msg->body.decode.dt_pitch = luma->level[0].nblk_x; - switch (luma->level[0].mode) { + msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x; + switch (luma->u.legacy.level[0].mode) { case RADEON_SURF_MODE_LINEAR_ALIGNED: msg->body.decode.dt_tiling_mode = RUVD_TILE_LINEAR; msg->body.decode.dt_array_mode = RUVD_ARRAY_MODE_LINEAR; @@ -1386,11 +1386,11 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct radeon_surf *luma, msg->body.decode.dt_chroma_bottom_offset = msg->body.decode.dt_chroma_top_offset; } - assert(luma->bankw == chroma->bankw); - assert(luma->bankh == chroma->bankh); - assert(luma->mtilea == chroma->mtilea); + assert(luma->u.legacy.bankw == chroma->u.legacy.bankw); + assert(luma->u.legacy.bankh == chroma->u.legacy.bankh); + assert(luma->u.legacy.mtilea == chroma->u.legacy.mtilea); - msg->body.decode.dt_surf_tile_config |= RUVD_BANK_WIDTH(bank_wh(luma->bankw)); - msg->body.decode.dt_surf_tile_config |= RUVD_BANK_HEIGHT(bank_wh(luma->bankh)); - msg->body.decode.dt_surf_tile_config |= RUVD_MACRO_TILE_ASPECT_RATIO(macro_tile_aspect(luma->mtilea)); + msg->body.decode.dt_surf_tile_config |= RUVD_BANK_WIDTH(bank_wh(luma->u.legacy.bankw)); + msg->body.decode.dt_surf_tile_config |= RUVD_BANK_HEIGHT(bank_wh(luma->u.legacy.bankh)); + msg->body.decode.dt_surf_tile_config |= RUVD_MACRO_TILE_ASPECT_RATIO(macro_tile_aspect(luma->u.legacy.mtilea)); } diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c index dcd56eaffb1..0ff66f48fba 100644 --- a/src/gallium/drivers/radeon/radeon_vce.c +++ b/src/gallium/drivers/radeon/radeon_vce.c @@ -224,8 +224,8 @@ struct rvce_cpb_slot *l1_slot(struct rvce_encoder *enc) void rvce_frame_offset(struct rvce_encoder *enc, struct rvce_cpb_slot *slot, signed *luma_offset, signed *chroma_offset) { - unsigned pitch = align(enc->luma->level[0].nblk_x * enc->luma->bpe, 128); - unsigned vpitch = align(enc->luma->level[0].nblk_y, 16); + unsigned pitch = align(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe, 128); + unsigned vpitch = align(enc->luma->u.legacy.level[0].nblk_y, 16); unsigned fsize = pitch * (vpitch + vpitch / 2); *luma_offset = slot->index * fsize; @@ -456,8 +456,8 @@ struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context, goto error; get_buffer(((struct vl_video_buffer *)tmp_buf)->resources[0], NULL, &tmp_surf); - cpb_size = align(tmp_surf->level[0].nblk_x * tmp_surf->bpe, 128); - cpb_size = cpb_size * align(tmp_surf->level[0].nblk_y, 32); + cpb_size = align(tmp_surf->u.legacy.level[0].nblk_x * tmp_surf->bpe, 128); + cpb_size = cpb_size * align(tmp_surf->u.legacy.level[0].nblk_y, 32); cpb_size = cpb_size * 3 / 2; cpb_size = cpb_size * enc->cpb_num; if (enc->dual_pipe) diff --git a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c index 358c0fcf9df..b9afd089af8 100644 --- a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c +++ b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c @@ -94,9 +94,9 @@ static void create(struct rvce_encoder *enc) RVCE_CS(0x00000000); // encPicStructRestriction RVCE_CS(enc->base.width); // encImageWidth RVCE_CS(enc->base.height); // encImageHeight - RVCE_CS(enc->luma->level[0].nblk_x * enc->luma->bpe); // encRefPicLumaPitch - RVCE_CS(enc->chroma->level[0].nblk_x * enc->chroma->bpe); // encRefPicChromaPitch - RVCE_CS(align(enc->luma->level[0].nblk_y, 16) / 8); // encRefYHeightInQw + RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe); // encRefPicLumaPitch + RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encRefPicChromaPitch + RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16) / 8); // encRefYHeightInQw RVCE_CS(0x00000000); // encRefPic(Addr|Array)Mode, encPicStructRestriction, disableRDO RVCE_END(); } @@ -320,12 +320,12 @@ static void encode(struct rvce_encoder *enc) RVCE_CS(0x00000000); // endOfSequence RVCE_CS(0x00000000); // endOfStream RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM, - enc->luma->level[0].offset); // inputPictureLumaAddressHi/Lo + enc->luma->u.legacy.level[0].offset); // inputPictureLumaAddressHi/Lo RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM, - enc->chroma->level[0].offset); // inputPictureChromaAddressHi/Lo - RVCE_CS(align(enc->luma->level[0].nblk_y, 16)); // encInputFrameYPitch - RVCE_CS(enc->luma->level[0].nblk_x * enc->luma->bpe); // encInputPicLumaPitch - RVCE_CS(enc->chroma->level[0].nblk_x * enc->chroma->bpe); // encInputPicChromaPitch + enc->chroma->u.legacy.level[0].offset); // inputPictureChromaAddressHi/Lo + RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16)); // encInputFrameYPitch + RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe); // encInputPicLumaPitch + RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encInputPicChromaPitch RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode RVCE_CS(0x00000000); // encInputPicTileConfig RVCE_CS(enc->pic.picture_type); // encPicType diff --git a/src/gallium/drivers/radeon/radeon_vce_50.c b/src/gallium/drivers/radeon/radeon_vce_50.c index f19202e1db3..0d11814515d 100644 --- a/src/gallium/drivers/radeon/radeon_vce_50.c +++ b/src/gallium/drivers/radeon/radeon_vce_50.c @@ -127,12 +127,12 @@ static void encode(struct rvce_encoder *enc) RVCE_CS(0x00000000); // endOfSequence RVCE_CS(0x00000000); // endOfStream RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM, - enc->luma->level[0].offset); // inputPictureLumaAddressHi/Lo + enc->luma->u.legacy.level[0].offset); // inputPictureLumaAddressHi/Lo RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM, - enc->chroma->level[0].offset); // inputPictureChromaAddressHi/Lo - RVCE_CS(align(enc->luma->level[0].nblk_y, 16)); // encInputFrameYPitch - RVCE_CS(enc->luma->level[0].nblk_x * enc->luma->bpe); // encInputPicLumaPitch - RVCE_CS(enc->chroma->level[0].nblk_x * enc->chroma->bpe); // encInputPicChromaPitch + enc->chroma->u.legacy.level[0].offset); // inputPictureChromaAddressHi/Lo + RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16)); // encInputFrameYPitch + RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe); // encInputPicLumaPitch + RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encInputPicChromaPitch if (enc->dual_pipe) RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading) else diff --git a/src/gallium/drivers/radeon/radeon_vce_52.c b/src/gallium/drivers/radeon/radeon_vce_52.c index e8a961fee07..6f9194c1cf8 100644 --- a/src/gallium/drivers/radeon/radeon_vce_52.c +++ b/src/gallium/drivers/radeon/radeon_vce_52.c @@ -177,9 +177,9 @@ static void create(struct rvce_encoder *enc) RVCE_CS(enc->enc_pic.ec.enc_pic_struct_restriction); RVCE_CS(enc->base.width); // encImageWidth RVCE_CS(enc->base.height); // encImageHeight - RVCE_CS(enc->luma->level[0].nblk_x * enc->luma->bpe); // encRefPicLumaPitch - RVCE_CS(enc->chroma->level[0].nblk_x * enc->chroma->bpe); // encRefPicChromaPitch - RVCE_CS(align(enc->luma->level[0].nblk_y, 16) / 8); // encRefYHeightInQw + RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe); // encRefPicLumaPitch + RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encRefPicChromaPitch + RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16) / 8); // encRefYHeightInQw RVCE_CS(enc->enc_pic.addrmode_arraymode_disrdo_distwoinstants); RVCE_CS(enc->enc_pic.ec.enc_pre_encode_context_buffer_offset); @@ -240,12 +240,12 @@ static void encode(struct rvce_encoder *enc) RVCE_CS(enc->enc_pic.eo.end_of_sequence); RVCE_CS(enc->enc_pic.eo.end_of_stream); RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM, - enc->luma->level[0].offset); // inputPictureLumaAddressHi/Lo + enc->luma->u.legacy.level[0].offset); // inputPictureLumaAddressHi/Lo RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM, - enc->chroma->level[0].offset); // inputPictureChromaAddressHi/Lo - RVCE_CS(align(enc->luma->level[0].nblk_y, 16)); // encInputFrameYPitch - RVCE_CS(enc->luma->level[0].nblk_x * enc->luma->bpe); // encInputPicLumaPitch - RVCE_CS(enc->chroma->level[0].nblk_x * enc->chroma->bpe); // encInputPicChromaPitch + enc->chroma->u.legacy.level[0].offset); // inputPictureChromaAddressHi/Lo + RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16)); // encInputFrameYPitch + RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe); // encInputPicLumaPitch + RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encInputPicChromaPitch if (enc->dual_pipe) enc->enc_pic.eo.enc_input_pic_addr_array_disable2pipe_disablemboffload = 0x00000000; else diff --git a/src/gallium/drivers/radeon/radeon_video.c b/src/gallium/drivers/radeon/radeon_video.c index 605a2c74ecf..0c795fd848e 100644 --- a/src/gallium/drivers/radeon/radeon_video.c +++ b/src/gallium/drivers/radeon/radeon_video.c @@ -154,7 +154,7 @@ void rvid_join_surfaces(struct radeon_winsys* ws, continue; /* choose the smallest bank w/h for now */ - wh = surfaces[i]->bankw * surfaces[i]->bankh; + wh = surfaces[i]->u.legacy.bankw * surfaces[i]->u.legacy.bankh; if (wh < best_wh) { best_wh = wh; best_tiling = i; @@ -166,15 +166,15 @@ void rvid_join_surfaces(struct radeon_winsys* ws, continue; /* copy the tiling parameters */ - surfaces[i]->bankw = surfaces[best_tiling]->bankw; - surfaces[i]->bankh = surfaces[best_tiling]->bankh; - surfaces[i]->mtilea = surfaces[best_tiling]->mtilea; - surfaces[i]->tile_split = surfaces[best_tiling]->tile_split; + surfaces[i]->u.legacy.bankw = surfaces[best_tiling]->u.legacy.bankw; + surfaces[i]->u.legacy.bankh = surfaces[best_tiling]->u.legacy.bankh; + surfaces[i]->u.legacy.mtilea = surfaces[best_tiling]->u.legacy.mtilea; + surfaces[i]->u.legacy.tile_split = surfaces[best_tiling]->u.legacy.tile_split; /* adjust the texture layer offsets */ off = align(off, surfaces[i]->surf_alignment); - for (j = 0; j < ARRAY_SIZE(surfaces[i]->level); ++j) - surfaces[i]->level[j].offset += off; + for (j = 0; j < ARRAY_SIZE(surfaces[i]->u.legacy.level); ++j) + surfaces[i]->u.legacy.level[j].offset += off; off += surfaces[i]->surf_size; } diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 812c0362afc..3dec92cefe5 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -289,7 +289,7 @@ enum radeon_micro_mode { #define RADEON_SURF_IMPORTED (1 << 24) #define RADEON_SURF_OPTIMIZE_FOR_SPACE (1 << 25) -struct radeon_surf_level { +struct legacy_surf_level { uint64_t offset; uint64_t slice_size; uint64_t dcc_offset; @@ -299,6 +299,30 @@ struct radeon_surf_level { enum radeon_surf_mode mode; }; +struct legacy_surf_layout { + unsigned bankw:4; /* max 8 */ + unsigned bankh:4; /* max 8 */ + unsigned mtilea:4; /* max 8 */ + unsigned tile_split:13; /* max 4K */ + unsigned stencil_tile_split:13; /* max 4K */ + unsigned pipe_config:5; /* max 17 */ + unsigned num_banks:5; /* max 16 */ + unsigned macro_tile_index:4; /* max 15 */ + + /* Whether the depth miptree or stencil miptree as used by the DB are + * adjusted from their TC compatible form to ensure depth/stencil + * compatibility. If either is true, the corresponding plane cannot be + * sampled from. + */ + unsigned depth_adjusted:1; + unsigned stencil_adjusted:1; + + struct legacy_surf_level level[RADEON_SURF_MAX_LEVELS]; + struct legacy_surf_level stencil_level[RADEON_SURF_MAX_LEVELS]; + uint8_t tiling_index[RADEON_SURF_MAX_LEVELS]; + uint8_t stencil_tiling_index[RADEON_SURF_MAX_LEVELS]; +}; + struct radeon_surf { /* Format properties. */ unsigned blk_w:4; @@ -310,6 +334,8 @@ struct radeon_surf { */ unsigned num_dcc_levels:4; unsigned is_linear:1; + /* Displayable, thin, depth, rotated. AKA D,S,Z,R swizzle modes. */ + unsigned micro_tile_mode:3; uint32_t flags; /* These are return values. Some of them can be set by the caller, but @@ -324,29 +350,14 @@ struct radeon_surf { uint32_t dcc_alignment; uint32_t htile_alignment; - /* This applies to EG and later. */ - unsigned bankw:4; /* max 8 */ - unsigned bankh:4; /* max 8 */ - unsigned mtilea:4; /* max 8 */ - unsigned tile_split:13; /* max 4K */ - unsigned stencil_tile_split:13; /* max 4K */ - unsigned pipe_config:5; /* max 17 */ - unsigned num_banks:5; /* max 16 */ - unsigned macro_tile_index:4; /* max 15 */ - unsigned micro_tile_mode:3; /* displayable, thin, depth, rotated */ - - /* Whether the depth miptree or stencil miptree as used by the DB are - * adjusted from their TC compatible form to ensure depth/stencil - * compatibility. If either is true, the corresponding plane cannot be - * sampled from. - */ - unsigned depth_adjusted:1; - unsigned stencil_adjusted:1; - - struct radeon_surf_level level[RADEON_SURF_MAX_LEVELS]; - struct radeon_surf_level stencil_level[RADEON_SURF_MAX_LEVELS]; - uint8_t tiling_index[RADEON_SURF_MAX_LEVELS]; - uint8_t stencil_tiling_index[RADEON_SURF_MAX_LEVELS]; + union { + /* R600-VI return values. + * + * Some of them can be set by the caller if certain parameters are + * desirable. The allocator will try to obey them. + */ + struct legacy_surf_layout legacy; + } u; }; struct radeon_bo_list_item { |