1
0
Fork 0
forked from wry/wry

wl_shm: use udmabuf directly as texture on integrated GPUs

This commit is contained in:
Julian Orth 2025-10-02 17:18:09 +02:00
parent da33f26918
commit 9abfe88b05
8 changed files with 213 additions and 70 deletions

View file

@ -68,6 +68,7 @@ pub struct EglDisplay {
pub gbm: Rc<GbmDevice>,
pub dpy: EGLDisplay,
pub explicit_sync: bool,
pub fast_ram_access: bool,
}
impl EglDisplay {
@ -106,16 +107,20 @@ impl EglDisplay {
gbm: Rc::new(gbm),
dpy,
explicit_sync: false,
fast_ram_access: false,
};
let mut major = 0;
let mut minor = 0;
if (egl.eglInitialize)(dpy.dpy, &mut major, &mut minor) != EGL_TRUE {
return Err(RenderError::Initialize);
}
if !software && EXTS.contains(EXT_DEVICE_QUERY) {
if get_device_ext(procs, dpy.dpy)?.contains(MESA_DEVICE_SOFTWARE) {
if EXTS.contains(EXT_DEVICE_QUERY)
&& get_device_ext(procs, dpy.dpy)?.contains(MESA_DEVICE_SOFTWARE)
{
if !software {
return Err(RenderError::NoHardwareRenderer);
}
dpy.fast_ram_access = true;
}
dpy.exts = get_display_ext(dpy.dpy);
if !dpy.exts.intersects(KHR_IMAGE_BASE) {

View file

@ -257,6 +257,10 @@ impl GfxContext for GlRenderContext {
self.formats()
}
fn fast_ram_access(&self) -> bool {
self.ctx.dpy.fast_ram_access
}
fn dmabuf_fb(self: Rc<Self>, buf: &DmaBuf) -> Result<Rc<dyn GfxFramebuffer>, GfxError> {
(&self)
.dmabuf_fb(buf)