diff options
Diffstat (limited to 'lib/mesa/src/gallium/drivers/etnaviv/etnaviv_resource.c')
-rw-r--r-- | lib/mesa/src/gallium/drivers/etnaviv/etnaviv_resource.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/lib/mesa/src/gallium/drivers/etnaviv/etnaviv_resource.c b/lib/mesa/src/gallium/drivers/etnaviv/etnaviv_resource.c index 3808c293e..9a7ebf306 100644 --- a/lib/mesa/src/gallium/drivers/etnaviv/etnaviv_resource.c +++ b/lib/mesa/src/gallium/drivers/etnaviv/etnaviv_resource.c @@ -176,10 +176,20 @@ setup_miptree(struct etna_resource *rsc, unsigned paddingX, unsigned paddingY, return size; } +/* Is rs alignment needed? */ +static bool is_rs_align(struct etna_screen *screen, + const struct pipe_resource *tmpl) +{ + return screen->specs.use_blt ? false : ( + VIV_FEATURE(screen, chipMinorFeatures1, TEXTURE_HALIGN) || + !etna_resource_sampler_only(tmpl)); +} + /* 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; @@ -217,11 +227,9 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout, * resolve engine's width. If not, we must not align resources used * only for textures. If this GPU uses the BLT engine, never do RS align. */ - bool rs_align = screen->specs.use_blt ? false : ( - VIV_FEATURE(screen, chipMinorFeatures1, TEXTURE_HALIGN) || - !etna_resource_sampler_only(templat)); - etna_layout_multiple(layout, screen->specs.pixel_pipes, rs_align, &paddingX, - &paddingY, &halign); + etna_layout_multiple(layout, screen->specs.pixel_pipes, + is_rs_align (screen, templat), + &paddingX, &paddingY, &halign); assert(paddingX && paddingY); } else { /* Compressed textures are padded to their block size, but we don't have @@ -273,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); @@ -309,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 @@ -357,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 { @@ -438,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 @@ -511,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; @@ -519,7 +531,7 @@ etna_resource_from_handle(struct pipe_screen *pscreen, /* Determine padding of the imported resource. */ unsigned paddingX = 0, paddingY = 0; etna_layout_multiple(rsc->layout, screen->specs.pixel_pipes, - VIV_FEATURE(screen, chipMinorFeatures1, TEXTURE_HALIGN), + is_rs_align(screen, tmpl), &paddingX, &paddingY, &rsc->halign); if (!screen->specs.use_blt) |