Skip to content

drm/vram: Add VRAM buffers for HW cursors

Thomas Zimmermann dri-devel linux-doc 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11drm/vram: Add struct drm_vram_buffer to VRAM helpersDocumentation/gpu/drm-mm.rst drivers/gpu/drm/drm_vram_helper_common.c include/drm/drm_vram_helper.h+335 -72 replies
2/11drm/ast: Don't call ast_show_cursor() from ast_cursor_move()drivers/gpu/drm/ast/ast_mode.c+4 -10 replies
3/11drm/ast: Move cursor update code to ast_show_cursor()drivers/gpu/drm/ast/ast_mode.c+69 -510 replies
4/11drm/ast: Reserve space for double-buffered cursor imagedrivers/gpu/drm/ast/ast_ttm.c+10 -30 replies
5/11drm/ast: Store cursor in reserved memory areadrivers/gpu/drm/ast/ast_drv.h drivers/gpu/drm/ast/ast_mode.c+41 -670 replies
6/11drm/mgag200: Rename cursor functions to use mgag200_ prefixdrivers/gpu/drm/mgag200/mgag200_cursor.c drivers/gpu/drm/mgag200/mgag200_drv.h drivers/gpu/drm/mgag200/mgag200_mode.c+13 -170 replies
7/11drm/mgag200: Add init and fini functions for cursor handlingdrivers/gpu/drm/mgag200/mgag200_cursor.c drivers/gpu/drm/mgag200/mgag200_drv.h drivers/gpu/drm/mgag200/mgag200_main.c+35 -130 replies
8/11drm/mgag200: Add separate move-cursor functiondrivers/gpu/drm/mgag200/mgag200_cursor.c+20 -90 replies
9/11drm/mgag200: Move cursor-image update to mgag200_show_cursor()drivers/gpu/drm/mgag200/mgag200_cursor.c+126 -950 replies
10/11drm/mgag200: Reserve video memory for cursor planedrivers/gpu/drm/mgag200/mgag200_main.c drivers/gpu/drm/mgag200/mgag200_mode.c drivers/gpu/drm/mgag200/mgag200_ttm.c+16 -30 replies
11/11drm/mgag200: Implement cursor buffer with struct drm_vram_bufferdrivers/gpu/drm/mgag200/mgag200_cursor.c drivers/gpu/drm/mgag200/mgag200_drv.h+38 -1020 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/11] drm/vram: Add VRAM buffers for HW cursors

This patchset adds dedicated VRAM buffers and cleans up the memory management of HW cursors in ast and mgag200.

The ast and mgag200 drivers support HW cursors of uncommon pixel formats. Both drivers manage cursor memory in dedicated GEM VRAM buffer objects with a double buffering scheme; either by alternating between two GEM BOs, or by alternating between offsets within the same GEM BO. The code is convoluted and can lead to memory fragmentation if the BO is stored the middle of VRAM. This is especially a problem on devices with only a small amount of video memory.

This patchset introduces VRAM buffers, a simple data structure that manages dedicated areas of VRAM. The VRAM buffer supports double- buffering (or more) to allow for flicker-free updates. A typical use case is in managing small, static buffers, such as cursors or sprites.

The patchset then cleans up cursor memory management in ast and mgag200. To avoid the fragmentation issue, at the high end of each device's VRAM, a few KiB are reserved for the HW cursor. This memory is maintained by a double-buffered VRAM buffer. For updating the cursor image, each driver's cursor_set() functions fills the current back buffer and then makes it the front buffer.

The patchset has been tested on ast and mgag200 hardware.

Thomas Zimmermann (11):
drm/vram: Add struct drm_vram_buffer to VRAM helpers drm/ast: Don't call ast_show_cursor() from ast_cursor_move() drm/ast: Move cursor update code to ast_show_cursor() drm/ast: Reserve space for double-buffered cursor image drm/ast: Store cursor in reserved memory area drm/mgag200: Rename cursor functions to use mgag200_ prefix drm/mgag200: Add init and fini functions for cursor handling drm/mgag200: Add separate move-cursor function drm/mgag200: Move cursor-image update to mgag200_show_cursor() drm/mgag200: Reserve video memory for cursor plane drm/mgag200: Implement cursor buffer with struct drm_vram_buffer

 Documentation/gpu/drm-mm.rst             |  19 +-
 drivers/gpu/drm/ast/ast_drv.h            |   5 +-
 drivers/gpu/drm/ast/ast_mode.c           | 198 +++++++++--------
 drivers/gpu/drm/ast/ast_ttm.c            |  13 +-
 drivers/gpu/drm/drm_vram_helper_common.c | 259 ++++++++++++++++++++++-
 drivers/gpu/drm/mgag200/mgag200_cursor.c | 252 +++++++++++-----------
 drivers/gpu/drm/mgag200/mgag200_drv.h    |  24 +--
 drivers/gpu/drm/mgag200/mgag200_main.c   |  20 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c   |   6 +-
 drivers/gpu/drm/mgag200/mgag200_ttm.c    |  15 +-
 include/drm/drm_vram_helper.h            |  64 ++++++
 11 files changed, 607 insertions(+), 268 deletions(-)
 create mode 100644 include/drm/drm_vram_helper.h

--
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel