mbox series

[v3,0/7] drm/mgag200: Place cursor BOs at VRAM high-end

Message ID 20190927091301.10574-1-tzimmermann@suse.de (mailing list archive)
Headers show
Series drm/mgag200: Place cursor BOs at VRAM high-end | expand

Message

Thomas Zimmermann Sept. 27, 2019, 9:12 a.m. UTC
(was: drm/ast/mgag200: Place cursor BOs at VRAM high-end)

This patchset cleans up the memory management of HW cursors in mgag200. It
further moves the allocated cursor BOs to the of the video RAM to reduce
memory fragmentation.

The mgag200 driver manages cursor memory in dedicated GEM VRAM buffer
objects. It uses a double-buffering scheme of alternating between two GEM
BOs The code is convoluted and can lead to memory fragmentation if a BO
is stored the middle of VRAM. This is especially a problem as mgag200
devices only contain a small amount of video memory (e.g., 16 MiB).

With this patchset, the cursor handling in mgag200 is first split up into
separate functions for copying cursor images, managing buffer objects,
setting scanout addresses, and moving and hiding the cursor. Furthermore,
the driver dedicates a few KiB at the high end of a device's video memory
to storing the cursor's buffer objects. This prevents memory fragmentation.

The patchset has been tested on mgag200 hardware.

v3:
	* split-off mgag200 patches into separate series
v2:
	* remove VRAM buffers in favor of GEM BOs
	* manage BO placement with pin flag

Thomas Zimmermann (7):
  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: Move cursor BO swapping into mgag200_show_cursor()
  drm/mgag200: Reserve video memory for cursor plane
  drm/mgag200: Allocate cursor BOs at high end of video memory

 drivers/gpu/drm/mgag200/mgag200_cursor.c | 313 ++++++++++++++---------
 drivers/gpu/drm/mgag200/mgag200_drv.h    |  22 +-
 drivers/gpu/drm/mgag200/mgag200_main.c   |  20 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c   |   6 +-
 drivers/gpu/drm/mgag200/mgag200_ttm.c    |   4 +
 5 files changed, 216 insertions(+), 149 deletions(-)

--
2.23.0

Comments

Gerd Hoffmann Oct. 2, 2019, 9:02 a.m. UTC | #1
On Fri, Sep 27, 2019 at 11:12:54AM +0200, Thomas Zimmermann wrote:
> (was: drm/ast/mgag200: Place cursor BOs at VRAM high-end)
> 
> This patchset cleans up the memory management of HW cursors in mgag200. It
> further moves the allocated cursor BOs to the of the video RAM to reduce
> memory fragmentation.
> 
> The mgag200 driver manages cursor memory in dedicated GEM VRAM buffer
> objects. It uses a double-buffering scheme of alternating between two GEM
> BOs The code is convoluted and can lead to memory fragmentation if a BO
> is stored the middle of VRAM. This is especially a problem as mgag200
> devices only contain a small amount of video memory (e.g., 16 MiB).
> 
> With this patchset, the cursor handling in mgag200 is first split up into
> separate functions for copying cursor images, managing buffer objects,
> setting scanout addresses, and moving and hiding the cursor. Furthermore,
> the driver dedicates a few KiB at the high end of a device's video memory
> to storing the cursor's buffer objects. This prevents memory fragmentation.
> 
> The patchset has been tested on mgag200 hardware.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>

> 
> v3:
> 	* split-off mgag200 patches into separate series
> v2:
> 	* remove VRAM buffers in favor of GEM BOs
> 	* manage BO placement with pin flag
> 
> Thomas Zimmermann (7):
>   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: Move cursor BO swapping into mgag200_show_cursor()
>   drm/mgag200: Reserve video memory for cursor plane
>   drm/mgag200: Allocate cursor BOs at high end of video memory
> 
>  drivers/gpu/drm/mgag200/mgag200_cursor.c | 313 ++++++++++++++---------
>  drivers/gpu/drm/mgag200/mgag200_drv.h    |  22 +-
>  drivers/gpu/drm/mgag200/mgag200_main.c   |  20 +-
>  drivers/gpu/drm/mgag200/mgag200_mode.c   |   6 +-
>  drivers/gpu/drm/mgag200/mgag200_ttm.c    |   4 +
>  5 files changed, 216 insertions(+), 149 deletions(-)
> 
> --
> 2.23.0
>