diff options
author | Christian Gmeiner <[email protected]> | 2019-01-18 10:54:07 +0100 |
---|---|---|
committer | Christian Gmeiner <[email protected]> | 2019-01-28 07:36:05 +0100 |
commit | 5b4a155d2ba1a2bf070b8c539a6f3bf9b1086e2f (patch) | |
tree | 02e63a99f4c0488d3b1f799d068f4c19f5802d7a /src/gallium/drivers/etnaviv/etnaviv_resource.c | |
parent | d1d2bb8c07d1e20d654f558ea4750aeb09d34ff9 (diff) |
etnaviv: extend etna_resource with an addressing mode
Defines how sampler (and pixel pipes) needs to access the data
represented with a resource. The used default is mode is
ETNA_ADDRESSING_MODE_TILED.
Signed-off-by: Christian Gmeiner <[email protected]>
Reviewed-by: Lucas Stach <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_resource.c')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_resource.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c index c0091288030..9a7ebf3064e 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c @@ -188,7 +188,8 @@ static bool is_rs_align(struct etna_screen *screen, /* Create a new resource object, using the given template info */ struct pipe_resource * etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout, - uint64_t modifier, const struct pipe_resource *templat) + enum etna_resource_addressing_mode mode, uint64_t modifier, + const struct pipe_resource *templat) { struct etna_screen *screen = etna_screen(pscreen); struct etna_resource *rsc; @@ -280,6 +281,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout, rsc->base.nr_samples = nr_samples; rsc->layout = layout; rsc->halign = halign; + rsc->addressing_mode = mode; pipe_reference_init(&rsc->base.reference, 1); list_inithead(&rsc->list); @@ -316,12 +318,14 @@ etna_resource_create(struct pipe_screen *pscreen, { struct etna_screen *screen = etna_screen(pscreen); - /* Figure out what tiling to use -- for now, assume that texture cannot be linear. - * there is a capability LINEAR_TEXTURE_SUPPORT (supported on gc880 and - * gc2000 at least), but not sure how it works. + /* Figure out what tiling and address mode to use -- for now, assume that + * texture cannot be linear. there is a capability LINEAR_TEXTURE_SUPPORT + * (supported on gc880 and gc2000 at least), but not sure how it works. * Buffers always have LINEAR layout. */ unsigned layout = ETNA_LAYOUT_LINEAR; + enum etna_resource_addressing_mode mode = ETNA_ADDRESSING_MODE_TILED; + if (etna_resource_sampler_only(templat)) { /* The buffer is only used for texturing, so create something * directly compatible with the sampler. Such a buffer can @@ -364,7 +368,7 @@ etna_resource_create(struct pipe_screen *pscreen, layout = ETNA_LAYOUT_LINEAR; /* modifier is only used for scanout surfaces, so safe to use LINEAR here */ - return etna_resource_alloc(pscreen, layout, DRM_FORMAT_MOD_LINEAR, templat); + return etna_resource_alloc(pscreen, layout, mode, DRM_FORMAT_MOD_LINEAR, templat); } enum modifier_priority { @@ -445,7 +449,7 @@ etna_resource_create_modifiers(struct pipe_screen *pscreen, tmpl.bind |= PIPE_BIND_SCANOUT; return etna_resource_alloc(pscreen, modifier_to_layout(modifier), - modifier, &tmpl); + ETNA_ADDRESSING_MODE_TILED, modifier, &tmpl); } static void @@ -518,6 +522,7 @@ etna_resource_from_handle(struct pipe_screen *pscreen, rsc->seqno = 1; rsc->layout = modifier_to_layout(handle->modifier); rsc->halign = TEXTURE_HALIGN_FOUR; + rsc->addressing_mode = ETNA_ADDRESSING_MODE_TILED; level->width = tmpl->width0; |