Draw on the GPU: the desktop with OpenGL ES, apps through linux-dmabuf
The host's rasteriser has a GPU half (raster_gpu.c): the same primitives, drawn the same way, on machines with a real GPU and OpenGL ES 3, straight into the display's buffers in a login session. EGL and GLES are loaded at run time; without them everything is drawn on the CPU as before (CHANDRA_GPU=0 does that too). zwp_linux_dmabuf_v1 lets apps draw on the GPU as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d81003f176
commit
cfb25fe699
26 files changed
+2485
-105
No files matched your search
@@ -353,6 +353,33 @@ pub fn surface_capture(_fd : Int, _offset : Int, _stride : Int, _width : Int, _h
|
||||
0U
|
||||
}
|
||||
|
||||
///| No GPU buffers on the native build, which draws on the CPU.
|
||||
pub fn dmabuf_support() -> (UInt64, Array[(UInt, UInt64)]) {
|
||||
(0UL, [])
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn dmabuf_import(
|
||||
_planes : Array[(Int, UInt, UInt)],
|
||||
_modifier : UInt64,
|
||||
_width : Int,
|
||||
_height : Int,
|
||||
_fourcc : UInt,
|
||||
_y_invert : Bool,
|
||||
) -> UInt {
|
||||
0U
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn dmabuf_capture(_id : UInt) -> UInt {
|
||||
0U
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn dmabuf_release(_id : UInt) -> Unit {
|
||||
()
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn surface_release(_id : UInt) -> Unit {
|
||||
()
|
||||
|
||||
@@ -255,6 +255,37 @@ pub fn surface_capture(fd : Int, offset : Int, stride : Int, width : Int, height
|
||||
@hostraster.capture(fd, offset, stride, width, height, format)
|
||||
}
|
||||
|
||||
///| The GPU clients should draw on (its dev_t) and the buffers (DRM fourcc, modifier) the host takes
|
||||
/// from it; none when the host draws on the CPU.
|
||||
pub fn dmabuf_support() -> (UInt64, Array[(UInt, UInt64)]) {
|
||||
let s = @hostraster.dmabufs()
|
||||
(s.device, s.formats.map(f => (f.fourcc, f.modifier)))
|
||||
}
|
||||
|
||||
///| Import a client's GPU buffer (planes: fd, offset, stride; the fds stay the caller's). 0 when the
|
||||
/// GPU can't read it.
|
||||
pub fn dmabuf_import(
|
||||
planes : Array[(Int, UInt, UInt)],
|
||||
modifier : UInt64,
|
||||
width : Int,
|
||||
height : Int,
|
||||
fourcc : UInt,
|
||||
y_invert : Bool,
|
||||
) -> UInt {
|
||||
let planes : Array[@hostraster.DmabufPlane] = planes.map(p => { fd: p.0, offset: p.1, stride: p.2 })
|
||||
@hostraster.import_dmabuf(planes, modifier, width, height, fourcc, y_invert)
|
||||
}
|
||||
|
||||
///| What an imported buffer holds now, as a surface (like `surface_capture`). 0 on failure.
|
||||
pub fn dmabuf_capture(id : UInt) -> UInt {
|
||||
@hostraster.capture_dmabuf(id)
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn dmabuf_release(id : UInt) -> Unit {
|
||||
@hostraster.release_dmabuf(id)
|
||||
}
|
||||
|
||||
///| Forget a captured surface.
|
||||
pub fn surface_release(id : UInt) -> Unit {
|
||||
@hostraster.release(id)
|
||||
|
||||
Reference in new issue
Block a user