Files
RedBear-OS/local/patches/mesa/P5-gbm-dumb-prime-export.patch
T
vasilito 295a100f10 feat: add Mesa EGL hardware GPU probe with virgl support
P5: Enable PRIME export for GBM dumb buffers so virgl can import scanout\nbuffers via fd-to-handle.

P6: Add redox_probe_device_hw() that opens /scheme/drm/card0, resolves the\nDRI driver via PCI ID lookup (loader_get_driver_for_fd), and initializes the\nhardware path through dri2_load_driver_dri3 with __DRIimageLoaderExtension.\nIncludes fprintf(stderr) debug logging tagged [REDOX-EGL] for tracing the\nHW init sequence. Falls back to software rendering if HW probe fails.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-15 07:24:31 +01:00

33 lines
985 B
Diff

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 91fcc1fd2..af26e20d6 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -578,8 +578,11 @@ gbm_dri_bo_get_fd(struct gbm_bo *_bo)
struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
int fd;
- if (bo->image == NULL)
- return -1;
+ if (bo->image == NULL) {
+ if (drmPrimeHandleToFD(dri->base.v0.fd, bo->handle, DRM_CLOEXEC | DRM_RDWR, &fd) != 0)
+ return -1;
+ return fd;
+ }
if (!dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_FD, &fd))
return -1;
@@ -663,8 +666,11 @@ gbm_dri_bo_get_plane_fd(struct gbm_bo *_bo, int plane)
/* dumb BOs can only utilize non-planar formats */
if (!bo->image) {
- errno = EINVAL;
- return -1;
+ if (plane != 0) {
+ errno = EINVAL;
+ return -1;
+ }
+ return gbm_dri_bo_get_fd(_bo);
}
if (plane >= get_number_planes(dri, bo->image)) {