diff -u mesa-20.2.6/debian/changelog mesa-20.2.6/debian/changelog --- mesa-20.2.6/debian/changelog +++ mesa-20.2.6/debian/changelog @@ -1,3 +1,9 @@ +mesa (20.2.6-0ubuntu0.20.04.2) focal; urgency=medium + + * New upstream bugfix release. (LP: #1918855) + + -- Kai-Chuan Hsieh Fri, 26 Mar 2021 22:14:38 +0800 + mesa (20.2.6-0ubuntu0.20.04.1) focal; urgency=medium * New upstream bugfix release. (LP: #1908699) diff -u mesa-20.2.6/debian/patches/series mesa-20.2.6/debian/patches/series --- mesa-20.2.6/debian/patches/series +++ mesa-20.2.6/debian/patches/series @@ -3,3 +3,6 @@ path_max.diff src_glx_dri_common.h.diff ppc64el-ftbfs-fix-type-collisions.diff +0001-iris-add-support-for-fence-signal-capability.patch +0001-iris-add-a-iris_context-reference-to-iris_batch.patch +0001-iris-fix-in-fences-backend-for-ext_external_objects-.patch only in patch2: unchanged: --- mesa-20.2.6.orig/debian/patches/0001-iris-add-a-iris_context-reference-to-iris_batch.patch +++ mesa-20.2.6/debian/patches/0001-iris-add-a-iris_context-reference-to-iris_batch.patch @@ -0,0 +1,72 @@ +From b338bb70e0df3839718315140f217d173cc6d460 Mon Sep 17 00:00:00 2001 +From: Mark Janes +Date: Wed, 28 Oct 2020 14:13:48 -0700 +Subject: [PATCH] iris: add a iris_context reference to iris_batch + +This eliminates the need to use container_of in error handling code. +INTEL_MEASURE will need to access the iris context from each batch. + +suggested-by: Kenneth Graunke + +Acked-by: Kenneth Graunke +Part-of: +--- + src/gallium/drivers/iris/iris_batch.c | 1 + + src/gallium/drivers/iris/iris_batch.h | 1 + + src/gallium/drivers/iris/iris_context.c | 8 +------- + src/gallium/drivers/iris/iris_state.c | 2 +- + 4 files changed, 4 insertions(+), 8 deletions(-) + +--- a/src/gallium/drivers/iris/iris_batch.c ++++ b/src/gallium/drivers/iris/iris_batch.c +@@ -180,6 +180,7 @@ + batch->reset = &ice->reset; + batch->state_sizes = ice->state.sizes; + batch->name = name; ++ batch->ice = ice; + + batch->fine_fences.uploader = + u_upload_create(&ice->ctx, 4096, PIPE_BIND_CUSTOM, +--- a/src/gallium/drivers/iris/iris_batch.h ++++ b/src/gallium/drivers/iris/iris_batch.h +@@ -58,6 +58,7 @@ + #define IRIS_BATCH_COUNT 2 + + struct iris_batch { ++ struct iris_context *ice; + struct iris_screen *screen; + struct pipe_debug_callback *dbg; + struct pipe_device_reset_callback *reset; +--- a/src/gallium/drivers/iris/iris_context.c ++++ b/src/gallium/drivers/iris/iris_context.c +@@ -78,17 +78,11 @@ + * we do need to inform the context of batch catastrophe. We know the + * batch is one of our context's, so hackily claw our way back. + */ +- struct iris_context *ice = NULL; ++ struct iris_context *ice = batch->ice; + + if (batch->name == IRIS_BATCH_RENDER) { +- ice = container_of(batch, ice, batches[IRIS_BATCH_RENDER]); +- assert(&ice->batches[IRIS_BATCH_RENDER] == batch); +- + batch->screen->vtbl.init_render_context(batch); + } else if (batch->name == IRIS_BATCH_COMPUTE) { +- ice = container_of(batch, ice, batches[IRIS_BATCH_COMPUTE]); +- assert(&ice->batches[IRIS_BATCH_COMPUTE] == batch); +- + batch->screen->vtbl.init_compute_context(batch); + } else { + unreachable("unhandled batch reset"); +--- a/src/gallium/drivers/iris/iris_state.c ++++ b/src/gallium/drivers/iris/iris_state.c +@@ -811,8 +811,7 @@ + if (subslices_delta == 0) + return; + +- struct iris_context *ice = NULL; +- ice = container_of(batch, ice, batches[IRIS_BATCH_RENDER]); ++ struct iris_context *ice = batch->ice; + assert(&ice->batches[IRIS_BATCH_RENDER] == batch); + + unsigned size = GENX(SLICE_HASH_TABLE_length) * 4; only in patch2: unchanged: --- mesa-20.2.6.orig/debian/patches/0001-iris-add-support-for-fence-signal-capability.patch +++ mesa-20.2.6/debian/patches/0001-iris-add-support-for-fence-signal-capability.patch @@ -0,0 +1,90 @@ +From 06b41ca589913c7b64b70909a38164e4e269c749 Mon Sep 17 00:00:00 2001 +From: Eleni Maria Stea +Date: Thu, 26 Mar 2020 17:23:08 +0100 +Subject: [PATCH] iris: add support for fence signal capability +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This enables GL_EXT_semaphore feature. + +v2: +* reversed previous commit that was conditionally setting the signal + fence capability if the syncobj was present +* reversed previous commit that was introducing a bool has_syncobj that + is not necessary anymore + +v3: +* changed the signal function to use fence->seqno due to recent changes + to master + +v4: +* changed the signal callback to use the new structs of the fences + backend (iris_fine_fence) + +v5: +* removed check for ctx == NULL in iris_fence_signal and await functions + as at the time they are called we always have a context +* splitted a line to not exceed width + +v6: +* put back the if(ctx) check in iris_fence_await, if this is an error + the fix should be in a different MR + +Signed-off-by: Eleni Maria Stea +Reviewed-by: Rohan Garg +Reviewed-by: Tapani Pälli +Part-of: +--- + src/gallium/drivers/iris/iris_fence.c | 24 ++++++++++++++++++++++++ + src/gallium/drivers/iris/iris_screen.c | 1 + + 2 files changed, 25 insertions(+) + +--- a/src/gallium/drivers/iris/iris_fence.c ++++ b/src/gallium/drivers/iris/iris_fence.c +@@ -553,6 +553,29 @@ + *out = fence; + } + ++static void ++iris_fence_signal(struct pipe_context *ctx, ++ struct pipe_fence_handle *fence) ++{ ++ struct iris_context *ice = (struct iris_context *)ctx; ++ ++ if (ctx == fence->unflushed_ctx) ++ return; ++ ++ for (unsigned b = 0; b < IRIS_BATCH_COUNT; b++) { ++ for (unsigned i = 0; i < ARRAY_SIZE(fence->fine); i++) { ++ struct iris_fine_fence *fine = fence->fine[i]; ++ ++ /* already signaled fence skipped */ ++ if (iris_fine_fence_signaled(fine)) ++ continue; ++ ++ iris_batch_add_syncobj(&ice->batches[b], fine->syncobj, ++ I915_EXEC_FENCE_SIGNAL); ++ } ++ } ++} ++ + void + iris_init_screen_fence_functions(struct pipe_screen *screen) + { +@@ -567,4 +590,5 @@ + ctx->flush = iris_fence_flush; + ctx->create_fence_fd = iris_fence_create_fd; + ctx->fence_server_sync = iris_fence_await; ++ ctx->fence_server_signal = iris_fence_signal; + } +--- a/src/gallium/drivers/iris/iris_screen.c ++++ b/src/gallium/drivers/iris/iris_screen.c +@@ -212,6 +212,7 @@ + case PIPE_CAP_DEMOTE_TO_HELPER_INVOCATION: + case PIPE_CAP_NATIVE_FENCE_FD: + case PIPE_CAP_MIXED_COLOR_DEPTH_BITS: ++ case PIPE_CAP_FENCE_SIGNAL: + return true; + case PIPE_CAP_FBFETCH: + return BRW_MAX_DRAW_BUFFERS; only in patch2: unchanged: --- mesa-20.2.6.orig/debian/patches/0001-iris-fix-in-fences-backend-for-ext_external_objects-.patch +++ mesa-20.2.6/debian/patches/0001-iris-fix-in-fences-backend-for-ext_external_objects-.patch @@ -0,0 +1,92 @@ +From adc575dbf667f3f60ed1790bb4b6e4c21c1385db Mon Sep 17 00:00:00 2001 +From: Eleni Maria Stea +Date: Sun, 14 Feb 2021 20:28:02 +0200 +Subject: [PATCH] iris: fix in fences backend for ext_external_objects edge + case +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +EXT_external_objects require we call glSignalSemaphoreEXT followed by a +glFlush. If the rendering workload is small when Signal and Flush +take place the relevant batch buffers with the actual rendering might +have been submitted already. In that case the following condition is met: +(iris_batch_bytes_used(batch) == 0). This causes: +glFlush() --> iris_fence_flush() -> iris_batch_flush() -> +_iris_batch_flush() to no-op, and so the fence doesn't get submitted to the +kernel. Then when anv tries to submit an execuf2 that must wait on the +shared VkSempahore / drm_syncobj fence, there isn't one and the kernel +rejects the batchbuffer causing an -EINVAL return of the execbuf2 ioctl +and a VK_DEVICE_LOST error. Empty batch buffers do have typically one +fence attached, but the ones carrying the extra fence from a +glSignalSempahore() call do have at least 2. + +See also: the discussion in MR!4337. + +v2: Changed the batch struct to have a contains_fence_signal variable +that is set to true when i915_EXEC_FENCE_SIGNAL fence is added to the +batch and off when batch is reset (Tapani Pälli) + +Authored-by: Mario Kleiner +Reported-by: Mario Kleiner +Tested-by: Mario Kleiner +Signed-off-by: Eleni Maria Stea +Reviewed-by: Tapani Pälli +Reviewed-by: Mario Kleiner +Part-of: +--- + src/gallium/drivers/iris/iris_batch.c | 5 ++++- + src/gallium/drivers/iris/iris_batch.h | 3 +++ + src/gallium/drivers/iris/iris_fence.c | 1 + + 3 files changed, 8 insertions(+), 1 deletion(-) + +--- a/src/gallium/drivers/iris/iris_batch.c ++++ b/src/gallium/drivers/iris/iris_batch.c +@@ -181,6 +181,7 @@ + batch->state_sizes = ice->state.sizes; + batch->name = name; + batch->ice = ice; ++ batch->contains_fence_signal = false; + + batch->fine_fences.uploader = + u_upload_create(&ice->ctx, 4096, PIPE_BIND_CUSTOM, +@@ -391,6 +392,7 @@ + batch->primary_batch_size = 0; + batch->total_chained_batch_size = 0; + batch->contains_draw = false; ++ batch->contains_fence_signal = false; + batch->decoder.surface_base = batch->last_surface_base_address; + + create_batch(batch); +@@ -680,7 +682,8 @@ + { + struct iris_screen *screen = batch->screen; + +- if (iris_batch_bytes_used(batch) == 0) ++ /* If a fence signals we need to flush it. */ ++ if (iris_batch_bytes_used(batch) == 0 && !batch->contains_fence_signal) + return; + + iris_finish_batch(batch); +--- a/src/gallium/drivers/iris/iris_batch.h ++++ b/src/gallium/drivers/iris/iris_batch.h +@@ -162,6 +162,9 @@ + /** Have we emitted any draw calls with next_seqno? */ + bool contains_draw_with_next_seqno; + ++ /** Batch contains fence signal operation. */ ++ bool contains_fence_signal; ++ + /** + * Number of times iris_batch_sync_region_start() has been called without a + * matching iris_batch_sync_region_end() on this batch. +--- a/src/gallium/drivers/iris/iris_fence.c ++++ b/src/gallium/drivers/iris/iris_fence.c +@@ -570,6 +570,7 @@ + if (iris_fine_fence_signaled(fine)) + continue; + ++ ice->batches[b].contains_fence_signal = true; + iris_batch_add_syncobj(&ice->batches[b], fine->syncobj, + I915_EXEC_FENCE_SIGNAL); + }