]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/bochs: Use GEM SHMEM helpers for memory management
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 2 Sep 2024 10:53:46 +0000 (12:53 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 6 Sep 2024 12:41:37 +0000 (14:41 +0200)
commitc3ac343c1448599952829456bc2d65b6a4307c6c
tree24b1e1605a558100e6717a7c6606c70c64665c2d
parent2037174993c80c059c2cb58af2184157cb08039e
drm/bochs: Use GEM SHMEM helpers for memory management

Replace GEM VRAM with GEM SHMEM in bochs. The new memory manager
stores buffer objects in system memory. Makes the driver's memory
management more reliably.

Most of the changes are hidden in external helpers that allocate
buffers. Replacing DRM_GEM_VRAM_DRIVER with DRM_GEM_SHMEM_DRIVER_OPS
swaps these. With GEM VRAM, the video memory was updated directly by
the DRM client. The biggest change within bochs is in atomic_update,
which now updates video memory via memcpy() from the BO in system
memory. Shadow-plane helpers maintaining the pointers to the buffer's
data, so bochs doesn't have to. The update is triggered by each page
flip's call to the framebuffer's dirty helper. The driver supports
damage clipping to minimize memcpy() overhead.

The advantage of GEM SHMEM is that it makes memory management
more reliable. Given DRM's double buffering during page flips, the
minimum amount of video memory is three times the maximum consumption
in some pathological cases. For example, if the maximum size of a GEM
buffer is 1920x1080-32 (i.e., 32-bit FullHD), the buffer size is
8 MiB. Display hardware has to provide at lease 24 MiB to reliably
page flip such configurations. This cannot always be guaranteed and
bochs already contains code to rule out <4 MiB configurations. With
GEM SHMEM, only 8 MiB of video memory are required for the given
example. Unsupported modes can be sorted out easily.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240902105546.792625-9-tzimmermann@suse.de
drivers/gpu/drm/tiny/Kconfig
drivers/gpu/drm/tiny/bochs.c