etnaviv: get addressing mode from tiling layout
Remove the "addressing_mode" state, which is currently set incorrectly, and instead deduce the addressing mode from the tiling layout. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
This commit is contained in:
@@ -204,8 +204,7 @@ static bool is_rs_align(struct etna_screen *screen,
|
|||||||
/* Create a new resource object, using the given template info */
|
/* Create a new resource object, using the given template info */
|
||||||
struct pipe_resource *
|
struct pipe_resource *
|
||||||
etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
|
etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
|
||||||
enum etna_resource_addressing_mode mode, uint64_t modifier,
|
uint64_t modifier, const struct pipe_resource *templat)
|
||||||
const struct pipe_resource *templat)
|
|
||||||
{
|
{
|
||||||
struct etna_screen *screen = etna_screen(pscreen);
|
struct etna_screen *screen = etna_screen(pscreen);
|
||||||
struct etna_resource *rsc;
|
struct etna_resource *rsc;
|
||||||
@@ -299,7 +298,6 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
|
|||||||
rsc->base.nr_samples = nr_samples;
|
rsc->base.nr_samples = nr_samples;
|
||||||
rsc->layout = layout;
|
rsc->layout = layout;
|
||||||
rsc->halign = halign;
|
rsc->halign = halign;
|
||||||
rsc->addressing_mode = mode;
|
|
||||||
|
|
||||||
pipe_reference_init(&rsc->base.reference, 1);
|
pipe_reference_init(&rsc->base.reference, 1);
|
||||||
|
|
||||||
@@ -340,13 +338,11 @@ etna_resource_create(struct pipe_screen *pscreen,
|
|||||||
{
|
{
|
||||||
struct etna_screen *screen = etna_screen(pscreen);
|
struct etna_screen *screen = etna_screen(pscreen);
|
||||||
|
|
||||||
/* Figure out what tiling and address mode to use -- for now, assume that
|
/* Figure out what tiling to use -- we always use tiled layouts,
|
||||||
* texture cannot be linear. there is a capability LINEAR_TEXTURE_SUPPORT
|
* except for scanout/dmabuf (which don't go through this path)
|
||||||
* (supported on gc880 and gc2000 at least), but not sure how it works.
|
|
||||||
* Buffers always have LINEAR layout.
|
* Buffers always have LINEAR layout.
|
||||||
*/
|
*/
|
||||||
unsigned layout = ETNA_LAYOUT_LINEAR;
|
unsigned layout = ETNA_LAYOUT_LINEAR;
|
||||||
enum etna_resource_addressing_mode mode = ETNA_ADDRESSING_MODE_TILED;
|
|
||||||
|
|
||||||
if (etna_resource_sampler_only(templat)) {
|
if (etna_resource_sampler_only(templat)) {
|
||||||
/* The buffer is only used for texturing, so create something
|
/* The buffer is only used for texturing, so create something
|
||||||
@@ -390,7 +386,7 @@ etna_resource_create(struct pipe_screen *pscreen,
|
|||||||
layout = ETNA_LAYOUT_LINEAR;
|
layout = ETNA_LAYOUT_LINEAR;
|
||||||
|
|
||||||
/* modifier is only used for scanout surfaces, so safe to use LINEAR here */
|
/* modifier is only used for scanout surfaces, so safe to use LINEAR here */
|
||||||
return etna_resource_alloc(pscreen, layout, mode, DRM_FORMAT_MOD_LINEAR, templat);
|
return etna_resource_alloc(pscreen, layout, DRM_FORMAT_MOD_LINEAR, templat);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum modifier_priority {
|
enum modifier_priority {
|
||||||
@@ -470,8 +466,7 @@ etna_resource_create_modifiers(struct pipe_screen *pscreen,
|
|||||||
*/
|
*/
|
||||||
tmpl.bind |= PIPE_BIND_SCANOUT;
|
tmpl.bind |= PIPE_BIND_SCANOUT;
|
||||||
|
|
||||||
return etna_resource_alloc(pscreen, modifier_to_layout(modifier),
|
return etna_resource_alloc(pscreen, modifier_to_layout(modifier), modifier, &tmpl);
|
||||||
ETNA_ADDRESSING_MODE_TILED, modifier, &tmpl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -550,8 +545,6 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
|
|||||||
rsc->seqno = 1;
|
rsc->seqno = 1;
|
||||||
rsc->layout = modifier_to_layout(handle->modifier);
|
rsc->layout = modifier_to_layout(handle->modifier);
|
||||||
rsc->halign = TEXTURE_HALIGN_FOUR;
|
rsc->halign = TEXTURE_HALIGN_FOUR;
|
||||||
rsc->addressing_mode = ETNA_ADDRESSING_MODE_TILED;
|
|
||||||
|
|
||||||
|
|
||||||
level->width = tmpl->width0;
|
level->width = tmpl->width0;
|
||||||
level->height = tmpl->height0;
|
level->height = tmpl->height0;
|
||||||
|
@@ -60,11 +60,6 @@ struct etna_resource_level {
|
|||||||
struct util_dynarray *patch_offsets;
|
struct util_dynarray *patch_offsets;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum etna_resource_addressing_mode {
|
|
||||||
ETNA_ADDRESSING_MODE_TILED = 0,
|
|
||||||
ETNA_ADDRESSING_MODE_LINEAR,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* status of queued up but not flushed reads and write operations.
|
/* status of queued up but not flushed reads and write operations.
|
||||||
* In _transfer_map() we need to know if queued up rendering needs
|
* In _transfer_map() we need to know if queued up rendering needs
|
||||||
* to be flushed to preserve the order of cpu and gpu access. */
|
* to be flushed to preserve the order of cpu and gpu access. */
|
||||||
@@ -82,7 +77,6 @@ struct etna_resource {
|
|||||||
/* only lod 0 used for non-texture buffers */
|
/* only lod 0 used for non-texture buffers */
|
||||||
/* Layout for surface (tiled, multitiled, split tiled, ...) */
|
/* Layout for surface (tiled, multitiled, split tiled, ...) */
|
||||||
enum etna_surface_layout layout;
|
enum etna_surface_layout layout;
|
||||||
enum etna_resource_addressing_mode addressing_mode;
|
|
||||||
/* Horizontal alignment for texture unit (TEXTURE_HALIGN_*) */
|
/* Horizontal alignment for texture unit (TEXTURE_HALIGN_*) */
|
||||||
unsigned halign;
|
unsigned halign;
|
||||||
struct etna_bo *bo; /* Surface video memory */
|
struct etna_bo *bo; /* Surface video memory */
|
||||||
@@ -169,8 +163,7 @@ etna_screen_resource_alloc_ts(struct pipe_screen *pscreen,
|
|||||||
|
|
||||||
struct pipe_resource *
|
struct pipe_resource *
|
||||||
etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
|
etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
|
||||||
enum etna_resource_addressing_mode mode, uint64_t modifier,
|
uint64_t modifier, const struct pipe_resource *templat);
|
||||||
const struct pipe_resource *templat);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
etna_resource_screen_init(struct pipe_screen *pscreen);
|
etna_resource_screen_init(struct pipe_screen *pscreen);
|
||||||
|
@@ -224,7 +224,6 @@ etna_texture_handle_incompatible(struct pipe_context *pctx, struct pipe_resource
|
|||||||
PIPE_BIND_BLENDABLE);
|
PIPE_BIND_BLENDABLE);
|
||||||
res->texture =
|
res->texture =
|
||||||
etna_resource_alloc(pctx->screen, ETNA_LAYOUT_TILED,
|
etna_resource_alloc(pctx->screen, ETNA_LAYOUT_TILED,
|
||||||
ETNA_ADDRESSING_MODE_TILED,
|
|
||||||
DRM_FORMAT_MOD_LINEAR, &templat);
|
DRM_FORMAT_MOD_LINEAR, &templat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -161,7 +161,7 @@ etna_create_sampler_view_state(struct pipe_context *pctx, struct pipe_resource *
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res->addressing_mode == ETNA_ADDRESSING_MODE_LINEAR) {
|
if (res->layout == ETNA_LAYOUT_LINEAR && !util_format_is_compressed(so->format)) {
|
||||||
sv->TE_SAMPLER_CONFIG0 |= VIVS_TE_SAMPLER_CONFIG0_ADDRESSING_MODE(TEXTURE_ADDRESSING_MODE_LINEAR);
|
sv->TE_SAMPLER_CONFIG0 |= VIVS_TE_SAMPLER_CONFIG0_ADDRESSING_MODE(TEXTURE_ADDRESSING_MODE_LINEAR);
|
||||||
|
|
||||||
for (int lod = 0; lod <= res->base.last_level; ++lod)
|
for (int lod = 0; lod <= res->base.last_level; ++lod)
|
||||||
|
@@ -254,8 +254,7 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
|
|||||||
templ.bind = PIPE_BIND_RENDER_TARGET;
|
templ.bind = PIPE_BIND_RENDER_TARGET;
|
||||||
|
|
||||||
trans->rsc = etna_resource_alloc(pctx->screen, ETNA_LAYOUT_LINEAR,
|
trans->rsc = etna_resource_alloc(pctx->screen, ETNA_LAYOUT_LINEAR,
|
||||||
ETNA_ADDRESSING_MODE_TILED, DRM_FORMAT_MOD_LINEAR,
|
DRM_FORMAT_MOD_LINEAR, &templ);
|
||||||
&templ);
|
|
||||||
if (!trans->rsc) {
|
if (!trans->rsc) {
|
||||||
slab_free(&ctx->transfer_pool, trans);
|
slab_free(&ctx->transfer_pool, trans);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user