diff options
author | Andreas Müller <schnitzeltony@gmail.com> | 2021-04-07 22:00:18 +0200 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2021-04-20 12:10:12 -0300 |
commit | bfb9e6990f896772a8109818ff06a89325b4f484 (patch) | |
tree | feb56533e0f7eed403982b94673e20e36fb460c4 /recipes-graphics/mesa | |
parent | a8ee8f6d2703025a0549cf705e31d616d54fb5fb (diff) | |
download | meta-freescale-bfb9e6990f896772a8109818ff06a89325b4f484.tar.gz |
mesa/etnaviv: Add patches to fix redraw
Without this series mouse pointer was not visible and screen was updated only
when mouse was moved.
Patch series was suggested in [1]
[1] https://gitlab.freedesktop.org/mesa/mesa/-/issues/4584
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Diffstat (limited to 'recipes-graphics/mesa')
7 files changed, 450 insertions, 0 deletions
diff --git a/recipes-graphics/mesa/mesa/0001-frontend-dri-copy-image-use-in-dup_image.patch b/recipes-graphics/mesa/mesa/0001-frontend-dri-copy-image-use-in-dup_image.patch new file mode 100644 index 00000000..9e098310 --- /dev/null +++ b/recipes-graphics/mesa/mesa/0001-frontend-dri-copy-image-use-in-dup_image.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | From 96106df17897b862b87937d6222a3e6483f45480 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lucas Stach <l.stach@pengutronix.de> | ||
3 | Date: Fri, 13 Nov 2020 14:26:23 +0100 | ||
4 | Subject: [PATCH 1/6] frontend/dri: copy image use in dup_image | ||
5 | |||
6 | Don't lose the use flags when dup'ing an image. | ||
7 | |||
8 | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> | ||
9 | |||
10 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] | ||
11 | --- | ||
12 | src/gallium/frontends/dri/dri2.c | 1 + | ||
13 | 1 file changed, 1 insertion(+) | ||
14 | |||
15 | diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c | ||
16 | index 0c0168497a2..1cd42cd8114 100644 | ||
17 | --- a/src/gallium/frontends/dri/dri2.c | ||
18 | +++ b/src/gallium/frontends/dri/dri2.c | ||
19 | @@ -1312,6 +1312,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate) | ||
20 | img->dri_format = image->dri_format; | ||
21 | /* This should be 0 for sub images, but dup is also used for base images. */ | ||
22 | img->dri_components = image->dri_components; | ||
23 | + img->use = image->use; | ||
24 | img->loader_private = loaderPrivate; | ||
25 | img->sPriv = image->sPriv; | ||
26 | |||
diff --git a/recipes-graphics/mesa/mesa/0002-dri-bring-back-use-flags-for-createImageWithModifier.patch b/recipes-graphics/mesa/mesa/0002-dri-bring-back-use-flags-for-createImageWithModifier.patch new file mode 100644 index 00000000..9eee458e --- /dev/null +++ b/recipes-graphics/mesa/mesa/0002-dri-bring-back-use-flags-for-createImageWithModifier.patch | |||
@@ -0,0 +1,119 @@ | |||
1 | From 00add4be8620175ccc69869e22479962dacdce9d Mon Sep 17 00:00:00 2001 | ||
2 | From: Lucas Stach <l.stach@pengutronix.de> | ||
3 | Date: Fri, 13 Nov 2020 14:38:41 +0100 | ||
4 | Subject: [PATCH 2/6] dri: bring back use flags for createImageWithModifiers | ||
5 | |||
6 | createImageWithModifiers dropped the use flags that were present with | ||
7 | the createImage interface as it was believed at the time that all those | ||
8 | use flags could be expressed as a modifier. This turned out to be untrue, | ||
9 | as there are some use flags like SCANOUT and the BACKBUFFER hint that | ||
10 | won't ever get a eqivalent modifier expression. | ||
11 | |||
12 | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> | ||
13 | |||
14 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] | ||
15 | --- | ||
16 | include/GL/internal/dri_interface.h | 1 + | ||
17 | src/egl/drivers/dri2/platform_wayland.c | 4 ++-- | ||
18 | src/gallium/frontends/dri/dri2.c | 5 ++--- | ||
19 | src/gbm/backends/dri/gbm_dri.c | 2 +- | ||
20 | src/loader/loader_dri3_helper.c | 3 +++ | ||
21 | src/mesa/drivers/dri/i965/intel_screen.c | 2 +- | ||
22 | 6 files changed, 10 insertions(+), 7 deletions(-) | ||
23 | |||
24 | diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h | ||
25 | index 39d5dd07533..222821428d0 100644 | ||
26 | --- a/include/GL/internal/dri_interface.h | ||
27 | +++ b/include/GL/internal/dri_interface.h | ||
28 | @@ -1678,6 +1678,7 @@ struct __DRIimageExtensionRec { | ||
29 | int width, int height, int format, | ||
30 | const uint64_t *modifiers, | ||
31 | const unsigned int modifier_count, | ||
32 | + unsigned int use, | ||
33 | void *loaderPrivate); | ||
34 | |||
35 | /* | ||
36 | diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c | ||
37 | index c0b26c4b623..bb508cbe421 100644 | ||
38 | --- a/src/egl/drivers/dri2/platform_wayland.c | ||
39 | +++ b/src/egl/drivers/dri2/platform_wayland.c | ||
40 | @@ -595,7 +595,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf) | ||
41 | dri2_surf->base.Height, | ||
42 | linear_dri_image_format, | ||
43 | &linear_mod, | ||
44 | - 1, | ||
45 | + 1, use_flags, | ||
46 | NULL); | ||
47 | } else { | ||
48 | dri2_surf->back->linear_copy = | ||
49 | @@ -624,7 +624,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf) | ||
50 | dri2_surf->base.Height, | ||
51 | dri_image_format, | ||
52 | modifiers, | ||
53 | - num_modifiers, | ||
54 | + num_modifiers, use_flags, | ||
55 | NULL); | ||
56 | } else { | ||
57 | dri2_surf->back->dri_image = | ||
58 | diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c | ||
59 | index 1cd42cd8114..1f1e7a9a65e 100644 | ||
60 | --- a/src/gallium/frontends/dri/dri2.c | ||
61 | +++ b/src/gallium/frontends/dri/dri2.c | ||
62 | @@ -1074,12 +1074,11 @@ static __DRIimage * | ||
63 | dri2_create_image_with_modifiers(__DRIscreen *dri_screen, | ||
64 | int width, int height, int format, | ||
65 | const uint64_t *modifiers, | ||
66 | - const unsigned count, | ||
67 | + const unsigned count, unsigned int use, | ||
68 | void *loaderPrivate) | ||
69 | { | ||
70 | return dri2_create_image_common(dri_screen, width, height, format, | ||
71 | - __DRI_IMAGE_USE_SHARE, modifiers, count, | ||
72 | - loaderPrivate); | ||
73 | + use, modifiers, count, loaderPrivate); | ||
74 | } | ||
75 | |||
76 | static bool | ||
77 | diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c | ||
78 | index b5634741554..aff3a107e7d 100644 | ||
79 | --- a/src/gbm/backends/dri/gbm_dri.c | ||
80 | +++ b/src/gbm/backends/dri/gbm_dri.c | ||
81 | @@ -1173,7 +1173,7 @@ gbm_dri_bo_create(struct gbm_device *gbm, | ||
82 | width, height, | ||
83 | dri_format, | ||
84 | modifiers, count, | ||
85 | - bo); | ||
86 | + dri_use, bo); | ||
87 | |||
88 | if (bo->image) { | ||
89 | /* The client passed in a list of invalid modifiers */ | ||
90 | diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c | ||
91 | index ccf8d1795e7..6fc6a2b705a 100644 | ||
92 | --- a/src/loader/loader_dri3_helper.c | ||
93 | +++ b/src/loader/loader_dri3_helper.c | ||
94 | @@ -1407,6 +1407,9 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format, | ||
95 | format, | ||
96 | modifiers, | ||
97 | count, | ||
98 | + __DRI_IMAGE_USE_SHARE | | ||
99 | + __DRI_IMAGE_USE_SCANOUT | | ||
100 | + __DRI_IMAGE_USE_BACKBUFFER, | ||
101 | buffer); | ||
102 | } | ||
103 | |||
104 | diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c | ||
105 | index 4492d43c040..4511b962eef 100644 | ||
106 | --- a/src/mesa/drivers/dri/i965/intel_screen.c | ||
107 | +++ b/src/mesa/drivers/dri/i965/intel_screen.c | ||
108 | @@ -893,7 +893,7 @@ static __DRIimage * | ||
109 | intel_create_image_with_modifiers(__DRIscreen *dri_screen, | ||
110 | int width, int height, int format, | ||
111 | const uint64_t *modifiers, | ||
112 | - const unsigned count, | ||
113 | + const unsigned count, unsigned int use, | ||
114 | void *loaderPrivate) | ||
115 | { | ||
116 | return intel_create_image_common(dri_screen, width, height, format, 0, | ||
117 | -- | ||
118 | 2.26.2 | ||
119 | |||
diff --git a/recipes-graphics/mesa/mesa/0003-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch b/recipes-graphics/mesa/mesa/0003-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch new file mode 100644 index 00000000..544c132b --- /dev/null +++ b/recipes-graphics/mesa/mesa/0003-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | From 587aac46dbadf2aca1489aadd4216e592e11e17b Mon Sep 17 00:00:00 2001 | ||
2 | From: Lucas Stach <l.stach@pengutronix.de> | ||
3 | Date: Fri, 13 Nov 2020 14:59:52 +0100 | ||
4 | Subject: [PATCH 3/6] frontend/dri: add EXPLICIT_FLUSH hint in | ||
5 | dri2_resource_get_param | ||
6 | |||
7 | dri2_resource_get_param() is called from two different places right now. | ||
8 | Only one of them adds the EXPLICIT_FLUSH hint to the handle usage, which | ||
9 | may disable the optimizations provided by this hint without a reason. | ||
10 | |||
11 | Make sure to always add this hint when appropriate. | ||
12 | |||
13 | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> | ||
14 | |||
15 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] | ||
16 | --- | ||
17 | src/gallium/frontends/dri/dri2.c | 6 +++--- | ||
18 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
19 | |||
20 | diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c | ||
21 | index 1f1e7a9a65e..7851ebceb3e 100644 | ||
22 | --- a/src/gallium/frontends/dri/dri2.c | ||
23 | +++ b/src/gallium/frontends/dri/dri2.c | ||
24 | @@ -1198,6 +1198,9 @@ dri2_resource_get_param(__DRIimage *image, enum pipe_resource_param param, | ||
25 | if (!pscreen->resource_get_param) | ||
26 | return false; | ||
27 | |||
28 | + if (image->use & __DRI_IMAGE_USE_BACKBUFFER) | ||
29 | + handle_usage |= PIPE_HANDLE_USAGE_EXPLICIT_FLUSH; | ||
30 | + | ||
31 | return pscreen->resource_get_param(pscreen, NULL, image->texture, | ||
32 | image->plane, 0, 0, param, handle_usage, | ||
33 | value); | ||
34 | @@ -1242,9 +1245,6 @@ dri2_query_image_by_resource_param(__DRIimage *image, int attrib, int *value) | ||
35 | |||
36 | handle_usage = PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE; | ||
37 | |||
38 | - if (image->use & __DRI_IMAGE_USE_BACKBUFFER) | ||
39 | - handle_usage |= PIPE_HANDLE_USAGE_EXPLICIT_FLUSH; | ||
40 | - | ||
41 | if (!dri2_resource_get_param(image, param, handle_usage, &res_param)) | ||
42 | return false; | ||
43 | |||
44 | -- | ||
45 | 2.26.2 | ||
46 | |||
diff --git a/recipes-graphics/mesa/mesa/0004-etnaviv-remove-double-assigment-of-surface-texture.patch b/recipes-graphics/mesa/mesa/0004-etnaviv-remove-double-assigment-of-surface-texture.patch new file mode 100644 index 00000000..3865dbc9 --- /dev/null +++ b/recipes-graphics/mesa/mesa/0004-etnaviv-remove-double-assigment-of-surface-texture.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 59f74212bbb5e28badd0775929e42856c9a01d35 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lucas Stach <l.stach@pengutronix.de> | ||
3 | Date: Fri, 13 Nov 2020 15:03:37 +0100 | ||
4 | Subject: [PATCH 4/6] etnaviv: remove double assigment of surface->texture | ||
5 | |||
6 | surf->base.texture is already assigned earlier via a proper | ||
7 | pipe_resource_reference call. Remove the superfluous assignement. | ||
8 | |||
9 | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> | ||
10 | Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> | ||
11 | |||
12 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] | ||
13 | --- | ||
14 | src/gallium/drivers/etnaviv/etnaviv_surface.c | 1 - | ||
15 | 1 file changed, 1 deletion(-) | ||
16 | |||
17 | diff --git a/src/gallium/drivers/etnaviv/etnaviv_surface.c b/src/gallium/drivers/etnaviv/etnaviv_surface.c | ||
18 | index c78973bdb09..52a937652d2 100644 | ||
19 | --- a/src/gallium/drivers/etnaviv/etnaviv_surface.c | ||
20 | +++ b/src/gallium/drivers/etnaviv/etnaviv_surface.c | ||
21 | @@ -112,7 +112,6 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc, | ||
22 | etna_screen_resource_alloc_ts(pctx->screen, rsc); | ||
23 | } | ||
24 | |||
25 | - surf->base.texture = &rsc->base; | ||
26 | surf->base.format = templat->format; | ||
27 | surf->base.width = rsc->levels[level].width; | ||
28 | surf->base.height = rsc->levels[level].height; | ||
29 | -- | ||
30 | 2.26.2 | ||
31 | |||
diff --git a/recipes-graphics/mesa/mesa/0005-etnaviv-compact-etna_state_updates.patch b/recipes-graphics/mesa/mesa/0005-etnaviv-compact-etna_state_updates.patch new file mode 100644 index 00000000..d9cca38f --- /dev/null +++ b/recipes-graphics/mesa/mesa/0005-etnaviv-compact-etna_state_updates.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From 570908323e02c4558f5a9abc2d82621056cd65ab Mon Sep 17 00:00:00 2001 | ||
2 | From: Lucas Stach <l.stach@pengutronix.de> | ||
3 | Date: Tue, 17 Nov 2020 12:08:13 +0100 | ||
4 | Subject: [PATCH 5/6] etnaviv: compact etna_state_updates | ||
5 | |||
6 | Just reclaim a bit of screen real estate, purely cosmetic change. | ||
7 | |||
8 | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> | ||
9 | |||
10 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] | ||
11 | --- | ||
12 | src/gallium/drivers/etnaviv/etnaviv_state.c | 18 ++++++------------ | ||
13 | 1 file changed, 6 insertions(+), 12 deletions(-) | ||
14 | |||
15 | diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c | ||
16 | index 1b4a7040b50..84fea58ecb5 100644 | ||
17 | --- a/src/gallium/drivers/etnaviv/etnaviv_state.c | ||
18 | +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c | ||
19 | @@ -749,24 +749,18 @@ struct etna_state_updater { | ||
20 | static const struct etna_state_updater etna_state_updates[] = { | ||
21 | { | ||
22 | etna_shader_update_vertex, ETNA_DIRTY_SHADER | ETNA_DIRTY_VERTEX_ELEMENTS, | ||
23 | - }, | ||
24 | - { | ||
25 | + }, { | ||
26 | etna_shader_link, ETNA_DIRTY_SHADER, | ||
27 | - }, | ||
28 | - { | ||
29 | + }, { | ||
30 | etna_update_blend, ETNA_DIRTY_BLEND | ETNA_DIRTY_FRAMEBUFFER | ||
31 | - }, | ||
32 | - { | ||
33 | + }, { | ||
34 | etna_update_blend_color, ETNA_DIRTY_BLEND_COLOR | ETNA_DIRTY_FRAMEBUFFER, | ||
35 | - }, | ||
36 | - { | ||
37 | + }, { | ||
38 | etna_update_ts_config, ETNA_DIRTY_DERIVE_TS, | ||
39 | - }, | ||
40 | - { | ||
41 | + }, { | ||
42 | etna_update_clipping, ETNA_DIRTY_SCISSOR | ETNA_DIRTY_FRAMEBUFFER | | ||
43 | ETNA_DIRTY_RASTERIZER | ETNA_DIRTY_VIEWPORT, | ||
44 | - }, | ||
45 | - { | ||
46 | + }, { | ||
47 | etna_update_zsa, ETNA_DIRTY_ZSA | ETNA_DIRTY_SHADER, | ||
48 | } | ||
49 | }; | ||
50 | -- | ||
51 | 2.26.2 | ||
52 | |||
diff --git a/recipes-graphics/mesa/mesa/0006-etnaviv-flush-used-render-buffers-on-context-flush-w.patch b/recipes-graphics/mesa/mesa/0006-etnaviv-flush-used-render-buffers-on-context-flush-w.patch new file mode 100644 index 00000000..ea658a03 --- /dev/null +++ b/recipes-graphics/mesa/mesa/0006-etnaviv-flush-used-render-buffers-on-context-flush-w.patch | |||
@@ -0,0 +1,166 @@ | |||
1 | From 537c7a6ea3fd2e5a6433e52b406ba39b89f520d9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lucas Stach <l.stach@pengutronix.de> | ||
3 | Date: Fri, 13 Nov 2020 15:05:55 +0100 | ||
4 | Subject: [PATCH 6/6] etnaviv: flush used render buffers on context flush when | ||
5 | neccessary | ||
6 | |||
7 | Some resources like backbuffers are explicitly flushed by the frontend | ||
8 | at the appropriate time, others however won't get flushed explicitly. | ||
9 | Remember those resources when they get emitted as a render buffer and | ||
10 | flush them on a context flush to make their content visible to other | ||
11 | entities sharing the buffer. | ||
12 | |||
13 | We still keep the optimized path for most resources where the frontend | ||
14 | promises to do the flushing for us and only enable implicit flushing | ||
15 | when a buffer handle is exported/imported without the | ||
16 | PIPE_HANDLE_USAGE_EXPLICIT_FLUSH flag set. | ||
17 | |||
18 | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> | ||
19 | |||
20 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] | ||
21 | --- | ||
22 | src/gallium/drivers/etnaviv/etnaviv_context.c | 16 ++++++++++++++++ | ||
23 | src/gallium/drivers/etnaviv/etnaviv_context.h | 3 +++ | ||
24 | src/gallium/drivers/etnaviv/etnaviv_resource.c | 7 +++++++ | ||
25 | src/gallium/drivers/etnaviv/etnaviv_resource.h | 2 ++ | ||
26 | src/gallium/drivers/etnaviv/etnaviv_state.c | 17 +++++++++++++++++ | ||
27 | 5 files changed, 45 insertions(+) | ||
28 | |||
29 | diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c | ||
30 | index 9c334a450c6..80c5d430419 100644 | ||
31 | --- a/src/gallium/drivers/etnaviv/etnaviv_context.c | ||
32 | +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c | ||
33 | @@ -128,6 +128,9 @@ etna_context_destroy(struct pipe_context *pctx) | ||
34 | _mesa_set_destroy(ctx->used_resources_write, NULL); | ||
35 | |||
36 | } | ||
37 | + if (ctx->flush_resources) | ||
38 | + _mesa_set_destroy(ctx->flush_resources, NULL); | ||
39 | + | ||
40 | mtx_unlock(&ctx->lock); | ||
41 | |||
42 | if (ctx->dummy_desc_bo) | ||
43 | @@ -475,6 +478,14 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, | ||
44 | list_for_each_entry(struct etna_acc_query, aq, &ctx->active_acc_queries, node) | ||
45 | etna_acc_query_suspend(aq, ctx); | ||
46 | |||
47 | + /* flush all resources that need an implicit flush */ | ||
48 | + set_foreach(ctx->flush_resources, entry) { | ||
49 | + struct pipe_resource *prsc = (struct pipe_resource *)entry->key; | ||
50 | + | ||
51 | + pctx->flush_resource(pctx, prsc); | ||
52 | + } | ||
53 | + _mesa_set_clear(ctx->flush_resources, NULL); | ||
54 | + | ||
55 | etna_cmd_stream_flush(ctx->stream, ctx->in_fence_fd, | ||
56 | (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : NULL); | ||
57 | |||
58 | @@ -581,6 +592,11 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) | ||
59 | if (!ctx->used_resources_write) | ||
60 | goto fail; | ||
61 | |||
62 | + ctx->flush_resources = _mesa_set_create(NULL, _mesa_hash_pointer, | ||
63 | + _mesa_key_pointer_equal); | ||
64 | + if (!ctx->flush_resources) | ||
65 | + goto fail; | ||
66 | + | ||
67 | mtx_init(&ctx->lock, mtx_recursive); | ||
68 | |||
69 | /* context ctxate setup */ | ||
70 | diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h | ||
71 | index dd6af3d93e6..112902aac8a 100644 | ||
72 | --- a/src/gallium/drivers/etnaviv/etnaviv_context.h | ||
73 | +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h | ||
74 | @@ -206,6 +206,9 @@ struct etna_context { | ||
75 | struct set *used_resources_read; | ||
76 | struct set *used_resources_write; | ||
77 | |||
78 | + /* resources that must be flushed implicitly at the context flush time */ | ||
79 | + struct set *flush_resources; | ||
80 | + | ||
81 | mtx_t lock; | ||
82 | }; | ||
83 | |||
84 | diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c | ||
85 | index ae4f24b9b44..0c8c28e66aa 100644 | ||
86 | --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c | ||
87 | +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c | ||
88 | @@ -265,6 +265,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout, | ||
89 | rsc->base.nr_samples = nr_samples; | ||
90 | rsc->layout = layout; | ||
91 | rsc->halign = halign; | ||
92 | + rsc->explicit_flush = true; | ||
93 | |||
94 | pipe_reference_init(&rsc->base.reference, 1); | ||
95 | util_range_init(&rsc->valid_buffer_range); | ||
96 | @@ -519,6 +520,9 @@ etna_resource_from_handle(struct pipe_screen *pscreen, | ||
97 | rsc->layout = modifier_to_layout(handle->modifier); | ||
98 | rsc->halign = TEXTURE_HALIGN_FOUR; | ||
99 | |||
100 | + if (usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH) | ||
101 | + rsc->explicit_flush = true; | ||
102 | + | ||
103 | level->width = tmpl->width0; | ||
104 | level->height = tmpl->height0; | ||
105 | level->depth = tmpl->depth0; | ||
106 | @@ -584,6 +588,9 @@ etna_resource_get_handle(struct pipe_screen *pscreen, | ||
107 | handle->offset = rsc->levels[0].offset; | ||
108 | handle->modifier = layout_to_modifier(rsc->layout); | ||
109 | |||
110 | + if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH)) | ||
111 | + rsc->explicit_flush = false; | ||
112 | + | ||
113 | if (handle->type == WINSYS_HANDLE_TYPE_SHARED) { | ||
114 | return etna_bo_get_name(rsc->bo, &handle->handle) == 0; | ||
115 | } else if (handle->type == WINSYS_HANDLE_TYPE_KMS) { | ||
116 | diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h b/src/gallium/drivers/etnaviv/etnaviv_resource.h | ||
117 | index cb83e891d34..167cf4ed069 100644 | ||
118 | --- a/src/gallium/drivers/etnaviv/etnaviv_resource.h | ||
119 | +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h | ||
120 | @@ -93,6 +93,8 @@ struct etna_resource { | ||
121 | struct pipe_resource *texture; | ||
122 | /* for when PE doesn't support the base layout */ | ||
123 | struct pipe_resource *render; | ||
124 | + /* frontend flushes resource via an explicit call to flush_resource */ | ||
125 | + bool explicit_flush; | ||
126 | |||
127 | enum etna_resource_status status; | ||
128 | |||
129 | diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c | ||
130 | index 84fea58ecb5..5848735ab14 100644 | ||
131 | --- a/src/gallium/drivers/etnaviv/etnaviv_state.c | ||
132 | +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c | ||
133 | @@ -741,6 +741,21 @@ etna_update_zsa(struct etna_context *ctx) | ||
134 | return true; | ||
135 | } | ||
136 | |||
137 | +static bool | ||
138 | +etna_record_flush_resources(struct etna_context *ctx) | ||
139 | +{ | ||
140 | + struct pipe_framebuffer_state *fb = &ctx->framebuffer_s; | ||
141 | + | ||
142 | + if (fb->nr_cbufs > 0) { | ||
143 | + struct etna_surface *surf = etna_surface(fb->cbufs[0]); | ||
144 | + | ||
145 | + if (!etna_resource(surf->prsc)->explicit_flush) | ||
146 | + _mesa_set_add(ctx->flush_resources, surf->prsc); | ||
147 | + } | ||
148 | + | ||
149 | + return true; | ||
150 | +} | ||
151 | + | ||
152 | struct etna_state_updater { | ||
153 | bool (*update)(struct etna_context *ctx); | ||
154 | uint32_t dirty; | ||
155 | @@ -762,6 +777,8 @@ static const struct etna_state_updater etna_state_updates[] = { | ||
156 | ETNA_DIRTY_RASTERIZER | ETNA_DIRTY_VIEWPORT, | ||
157 | }, { | ||
158 | etna_update_zsa, ETNA_DIRTY_ZSA | ETNA_DIRTY_SHADER, | ||
159 | + }, { | ||
160 | + etna_record_flush_resources, ETNA_DIRTY_FRAMEBUFFER, | ||
161 | } | ||
162 | }; | ||
163 | |||
164 | -- | ||
165 | 2.26.2 | ||
166 | |||
diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend index 738f02c8..c532e51e 100644 --- a/recipes-graphics/mesa/mesa_%.bbappend +++ b/recipes-graphics/mesa/mesa_%.bbappend | |||
@@ -1,3 +1,13 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" | ||
2 | SRC_URI_append_use-mainline-bsp = " \ | ||
3 | file://0001-frontend-dri-copy-image-use-in-dup_image.patch \ | ||
4 | file://0002-dri-bring-back-use-flags-for-createImageWithModifier.patch \ | ||
5 | file://0003-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch \ | ||
6 | file://0004-etnaviv-remove-double-assigment-of-surface-texture.patch \ | ||
7 | file://0005-etnaviv-compact-etna_state_updates.patch \ | ||
8 | file://0006-etnaviv-flush-used-render-buffers-on-context-flush-w.patch \ | ||
9 | " | ||
10 | |||
1 | PROVIDES_remove_imxgpu = "virtual/egl" | 11 | PROVIDES_remove_imxgpu = "virtual/egl" |
2 | PROVIDES_remove_imxgpu3d = "virtual/libgl virtual/libgles1 virtual/libgles2" | 12 | PROVIDES_remove_imxgpu3d = "virtual/libgl virtual/libgles1 virtual/libgles2" |
3 | 13 | ||