This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch fix-release-build
in repository efl.
View the commit online.
commit 492e701ec014ac2a5b1aa6d2931faf5f1c6918b6
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Aug 6 22:48:15 2026 -0600
ecore_wl2: map the dmabuf itself rather than a gbm staging copy
ecore_wl2_buffer_map() maps a buffer once and caches the pointer for the
buffer's lifetime; each frame is then bracketed with nothing but
DMA_BUF_IOCTL_SYNC. That only works if the mapping aliases the buffer.
gbm_bo_map() makes no such promise. On iris it returns a staging copy
that is blitted into the BO by gbm_bo_unmap(), which never runs between
frames, so every frame evas rendered was discarded and the compositor
imported an untouched buffer - EFL clients came up black. It happened to
work on panfrost because there gbm_bo_map() hands out a pointer straight
into the BO.
mmap() the exported dmabuf instead, which does alias it, and for which
DMA_BUF_IOCTL_SYNC is the bracket it was designed to be. Keep
gbm_bo_map() as a fallback for drivers that export the dmabuf read-only
(panfrost among them) and so cannot be mapped this way - those are the
same drivers whose mapping is direct, so caching it stays correct.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
---
src/lib/ecore_wl2/ecore_wl2_buffer.c | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/src/lib/ecore_wl2/ecore_wl2_buffer.c b/src/lib/ecore_wl2/ecore_wl2_buffer.c
index 9d3a1543b7..9e8fd8a982 100644
--- a/src/lib/ecore_wl2/ecore_wl2_buffer.c
+++ b/src/lib/ecore_wl2/ecore_wl2_buffer.c
@@ -495,12 +495,23 @@ _gbm_map(Ecore_Wl2_Buffer *buf)
void *ptr;
bo = (struct gbm_bo *)buf->bh;
-
- /* NB: mapping the exported dmabuf fd is not an option - Mesa exports it
- * read-only on several drivers (panfrost among them), so a writable
- * mmap() comes back EACCES. gbm_bo_map() goes through the GEM mapping
- * instead and can hand us a writable pointer. */
buf->map_data = NULL;
+
+ /* Map the exported dmabuf if we can. ecore_wl2_buffer_map() caches this
+ * pointer for the buffer's lifetime and brackets each frame with nothing
+ * but DMA_BUF_IOCTL_SYNC, so the mapping has to *be* the buffer.
+ * gbm_bo_map() does not promise that: on iris it hands back a staging
+ * copy that only reaches the BO when gbm_bo_unmap() runs, and that never
+ * happens between frames - every frame is dropped and the surface stays
+ * black. */
+ ptr = mmap(NULL, buf->stride * buf->h, PROT_READ | PROT_WRITE, MAP_SHARED,
+ buf->fd, 0);
+ if (ptr != MAP_FAILED) return ptr;
+
+ /* Some drivers (panfrost among them) export the dmabuf read-only, so the
+ * mmap above comes back EACCES. Those are also the ones whose gbm_bo_map()
+ * returns a pointer straight into the BO rather than a staging copy, so a
+ * cached mapping remains correct there. */
ptr = sym_gbm_bo_map(bo, 0, 0, buf->w, buf->h, ECORE_GBM_BO_TRANSFER_RW,
&map_stride, &buf->map_data);
if (!ptr) return NULL;
@@ -526,9 +537,16 @@ _gbm_unmap(Ecore_Wl2_Buffer *buf)
struct gbm_bo *bo;
bo = (struct gbm_bo *)buf->bh;
- if (!buf->map_data) return;
- sym_gbm_bo_unmap(bo, buf->map_data);
- buf->map_data = NULL;
+
+ /* map_data is only set on the gbm_bo_map() fallback path; otherwise the
+ * mapping came from mmap() on the dmabuf fd. */
+ if (buf->map_data)
+ {
+ sym_gbm_bo_unmap(bo, buf->map_data);
+ buf->map_data = NULL;
+ }
+ else if (buf->mapping)
+ munmap(buf->mapping, buf->stride * buf->h);
}
static void
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.