Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

cl: fix DRM struct offsets (verified with gcc offsetof on Fedora 43)

All field offsets were wrong — caused memory fault at 0x3 on boot.
Verified correct offsets for drmModeRes, drmModeConnector,
drmModeEncoder, and drmModeModeInfo using a C test program.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+14 -12
+14 -12
fedac/native/cl/drm-display.lisp
··· 24 24 ;;; ── Helper: read struct fields from libdrm opaque pointers ── 25 25 ;;; drmModeRes fields (offsets determined by libdrm ABI) 26 26 27 + ;;; Offsets verified with gcc offsetof() on Fedora 43 libdrm 27 28 (defun res-count-connectors (res) 28 - (cffi:mem-ref (cffi:inc-pointer res 24) :int32)) 29 + (cffi:mem-ref (cffi:inc-pointer res 32) :int32)) 29 30 30 31 (defun res-connectors (res) 31 - (cffi:mem-ref (cffi:inc-pointer res 16) :pointer)) 32 + (cffi:mem-ref (cffi:inc-pointer res 40) :pointer)) 32 33 33 34 (defun res-count-crtcs (res) 34 - (cffi:mem-ref (cffi:inc-pointer res 40) :int32)) 35 + (cffi:mem-ref (cffi:inc-pointer res 16) :int32)) 35 36 36 37 (defun res-crtcs (res) 37 - (cffi:mem-ref (cffi:inc-pointer res 32) :pointer)) 38 + (cffi:mem-ref (cffi:inc-pointer res 24) :pointer)) 38 39 39 40 ;;; drmModeConnector fields 40 41 (defun conn-status (conn) 41 - (cffi:mem-ref (cffi:inc-pointer conn 4) :uint32)) 42 + "connection field at offset 16 (1=connected)." 43 + (cffi:mem-ref (cffi:inc-pointer conn 16) :uint32)) 42 44 43 45 (defun conn-connector-id (conn) 44 46 (cffi:mem-ref conn :uint32)) 45 47 46 48 (defun conn-encoder-id (conn) 47 - (cffi:mem-ref (cffi:inc-pointer conn 8) :uint32)) 49 + (cffi:mem-ref (cffi:inc-pointer conn 4) :uint32)) 48 50 49 51 (defun conn-count-modes (conn) 50 - (cffi:mem-ref (cffi:inc-pointer conn 36) :int32)) 52 + (cffi:mem-ref (cffi:inc-pointer conn 32) :int32)) 51 53 52 54 (defun conn-modes (conn) 53 55 "Pointer to array of drmModeModeInfo structs." 54 - (cffi:mem-ref (cffi:inc-pointer conn 28) :pointer)) 56 + (cffi:mem-ref (cffi:inc-pointer conn 40) :pointer)) 55 57 56 58 ;;; drmModeEncoder fields 57 59 (defun enc-crtc-id (enc) 58 - (cffi:mem-ref (cffi:inc-pointer enc 4) :uint32)) 60 + (cffi:mem-ref (cffi:inc-pointer enc 8) :uint32)) 59 61 60 - ;;; drmModeModeInfo: hdisplay at offset 8, vdisplay at offset 10 62 + ;;; drmModeModeInfo: hdisplay at offset 4, vdisplay at offset 14 61 63 (defun mode-hdisplay (mode-ptr) 62 - (cffi:mem-ref (cffi:inc-pointer mode-ptr 8) :uint16)) 64 + (cffi:mem-ref (cffi:inc-pointer mode-ptr 4) :uint16)) 63 65 64 66 (defun mode-vdisplay (mode-ptr) 65 - (cffi:mem-ref (cffi:inc-pointer mode-ptr 10) :uint16)) 67 + (cffi:mem-ref (cffi:inc-pointer mode-ptr 14) :uint16)) 66 68 67 69 (defconstant +mode-info-size+ 68 "sizeof(drmModeModeInfo)") 68 70