This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch overline-textgrid
in repository efl.
View the commit online.
commit 2fb70593c1d986e20a01b560e777d78c071ffd53
Author: Cedric BAIL <[email protected]>
AuthorDate: Fri Aug 7 19:15:48 2026 -0600
ecore_drm2: never hand back a zero depth or a bpp that is really a depth
ecore_drm2_device_preferred_depth_get() reports whatever
DRM_CAP_DUMB_PREFERRED_DEPTH says, and reports it twice - once as the
depth and once as the bpp. Both halves of that are wrong.
The cap is a hint, and one a driver has to opt into by setting
mode_config.preferred_depth. rockchip never does, so the query succeeds
and answers 0:
/dev/dri/card0 PREFERRED_DEPTH ret=0 val=0 (driver=rockchip)
There is no fallback, so the caller gets depth 0 and bpp 0 handed
straight through to ecore_drm2_fb_create(), whose DRM_IOCTL_MODE_CREATE_DUMB
starts with
if (!args->width || !args->height || !args->bpp) return -EINVAL;
and the software drm engine can never allocate a framebuffer at all.
The second half is wrong even where the cap is filled in. Depth and bpp
are separate parameters because they are different numbers: the usual
24bit depth lives in a 32bit pixel. Reporting bpp 24 for it produces a
dumb buffer with a w*3 pitch that drmModeAddFB2() then rejects for
XRGB8888. The hardcoded values this replaced in dc81e925c8 were 24 and
32, and that pairing was right.
Take the cap only when it says something, fall back to 24 otherwise, and
derive the bpp from the depth.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
---
src/lib/ecore_drm2/Ecore_Drm2.h | 3 +++
src/lib/ecore_drm2/ecore_drm2_device.c | 29 ++++++++++++++++++++++-------
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 4dde788355..751c408cf6 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -414,6 +414,9 @@ EAPI Eina_Bool ecore_drm2_device_prefer_shadow(Ecore_Drm2_Device *device);
/**
* Get the default depth & bpp from a given device
*
+ * Always returns a usable pair, falling back to 24bit depth at 32bpp when
+ * the driver expresses no preference of its own.
+ *
* @param device
* @param depth
* @param bpp
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index 77498d806e..d07ba81b59 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -887,20 +887,35 @@ ecore_drm2_device_prefer_shadow(Ecore_Drm2_Device *device)
return EINA_FALSE;
}
+/* Width a pixel of the given colour depth occupies in a dumb buffer. Not
+ * the same number as the depth - the usual 24bit case is stored 32bits
+ * wide, which is why the two are separate parameters in the first place. */
+static int
+_depth_bpp_get(int depth)
+{
+ if (depth <= 8) return 8;
+ if (depth <= 16) return 16;
+ return 32;
+}
+
EAPI void
ecore_drm2_device_preferred_depth_get(Ecore_Drm2_Device *device, int *depth, int *bpp)
{
uint64_t caps;
- int ret;
+ int d = 24;
EINA_SAFETY_ON_NULL_RETURN(device);
- ret = sym_drmGetCap(device->fd, DRM_CAP_DUMB_PREFERRED_DEPTH, &caps);
- if (ret == 0)
- {
- if (depth) *depth = caps;
- if (bpp) *bpp = caps;
- }
+ /* DRM_CAP_DUMB_PREFERRED_DEPTH is a hint, and one plenty of drivers do
+ * not bother filling in: anything that leaves mode_config.preferred_depth
+ * at zero - rockchip among them - answers this query successfully with 0.
+ * Only take the cap when it says something. */
+ if ((sym_drmGetCap(device->fd, DRM_CAP_DUMB_PREFERRED_DEPTH, &caps) == 0) &&
+ (caps > 0))
+ d = caps;
+
+ if (depth) *depth = d;
+ if (bpp) *bpp = _depth_bpp_get(d);
}
EAPI int
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.