summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorLucas Stach <[email protected]>2017-06-22 16:02:10 +0200
committerLucas Stach <[email protected]>2017-07-19 16:26:49 +0200
commit605007d5c796f0f754485d4f46cd370fcf7dfe87 (patch)
tree59b9e4c33509da1b393e1f83cdfbaf50da9b00b1 /src/gallium
parent836d22a2fb99a60e71fd2ccef6bc2d0df696d811 (diff)
etnaviv: also update textures from external resources
This reworks the logic in etna_update_sampler_source to select the newest resource view for updating the texture view. This should make the logic easier to follow and fixes texture updates from imported dma-bufs. Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Philipp Zabel <[email protected]> Reviewed-by: Wladimir J. van der Laan <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_texture.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c b/src/gallium/drivers/etnaviv/etnaviv_texture.c
index 05fc7da58f8..954daea7ba5 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
@@ -113,16 +113,24 @@ etna_delete_sampler_state(struct pipe_context *pctx, void *ss)
static void
etna_update_sampler_source(struct pipe_sampler_view *view)
{
- struct etna_resource *res = etna_resource(view->texture);
+ struct etna_resource *base = etna_resource(view->texture);
+ struct etna_resource *to = base, *from = base;
- if (res->texture && etna_resource_older(etna_resource(res->texture), res)) {
- /* Texture is older than render buffer, copy the texture using RS */
- etna_copy_resource(view->context, res->texture, view->texture, 0,
+ if (base->external && etna_resource_newer(etna_resource(base->external), base))
+ from = etna_resource(base->external);
+
+ if (base->texture)
+ to = etna_resource(base->texture);
+
+ if ((to != from) && etna_resource_older(to, from)) {
+ etna_copy_resource(view->context, &to->base, &from->base, 0,
+ view->texture->last_level);
+ to->seqno = from->seqno;
+ } else if ((to == from) && etna_resource_needs_flush(to)) {
+ /* Resolve TS if needed, remove when adding sampler TS */
+ etna_copy_resource(view->context, &to->base, &from->base, 0,
view->texture->last_level);
- etna_resource(res->texture)->seqno = res->seqno;
- } else if (etna_resource_needs_flush(res)) {
- etna_copy_resource(view->context, view->texture, view->texture, 0, 0);
- res->flush_seqno = res->seqno;
+ to->flush_seqno = from->seqno;
}
}