mbox series

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

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

Message

Thomas Zimmermann Sept. 27, 2019, 9:03 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 ast. It
further moves the allocated cursor BOs to the of the video RAM to reduce
memory fragmentation.

The ast driver manages cursor memory in a dedicated GEM VRAM buffer
object. It uses a double-buffering scheme of alternating between offsets
within the 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 as ast devices only have a small amount of video memory (e.g.,
8 MiB).

With this patchset, the cursor handling in ast 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 the device's video
memory to storing the cursor's buffer objects. This prevents memory
fragmentation.

The patchset has been tested on ast hardware.

v3:
	* split-off ast patches into separate series
	* move around ast_{show,hide}_cursor in a separate patch
	* fix space-before-tab error near AST_HWC_SIGNATURE_CHECKSUM
v2:
	* remove VRAM buffers in favor of GEM BOs
	* manage BO placement with pin flag


Thomas Zimmermann (5):
  drm/ast: Don't call ast_show_cursor() from ast_cursor_move()
  drm/ast: Move ast_{show,hide}_cursor() within source file
  drm/ast: Move cursor update code to ast_show_cursor()
  drm/ast: Move cursor offset swapping into ast_show_cursor()
  drm/ast: Allocate cursor BOs at high end of video memory

 drivers/gpu/drm/ast/ast_drv.h  |  43 +++---
 drivers/gpu/drm/ast/ast_mode.c | 235 +++++++++++++++++++--------------
 2 files changed, 158 insertions(+), 120 deletions(-)

--
2.23.0

Comments

Gerd Hoffmann Oct. 2, 2019, 8:59 a.m. UTC | #1
On Fri, Sep 27, 2019 at 11:03:04AM +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 ast. It
> further moves the allocated cursor BOs to the of the video RAM to reduce
> memory fragmentation.
> 
> The ast driver manages cursor memory in a dedicated GEM VRAM buffer
> object. It uses a double-buffering scheme of alternating between offsets
> within the 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 as ast devices only have a small amount of video memory (e.g.,
> 8 MiB).
> 
> With this patchset, the cursor handling in ast 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 the device's video
> memory to storing the cursor's buffer objects. This prevents memory
> fragmentation.
> 
> The patchset has been tested on ast hardware.
> 
> v3:
> 	* split-off ast patches into separate series
> 	* move around ast_{show,hide}_cursor in a separate patch
> 	* fix space-before-tab error near AST_HWC_SIGNATURE_CHECKSUM
> v2:
> 	* remove VRAM buffers in favor of GEM BOs
> 	* manage BO placement with pin flag

Looks all sane to me, series is
Acked-by: Gerd Hoffmann <kraxel@redhat.com>

> 
> 
> Thomas Zimmermann (5):
>   drm/ast: Don't call ast_show_cursor() from ast_cursor_move()
>   drm/ast: Move ast_{show,hide}_cursor() within source file
>   drm/ast: Move cursor update code to ast_show_cursor()
>   drm/ast: Move cursor offset swapping into ast_show_cursor()
>   drm/ast: Allocate cursor BOs at high end of video memory
> 
>  drivers/gpu/drm/ast/ast_drv.h  |  43 +++---
>  drivers/gpu/drm/ast/ast_mode.c | 235 +++++++++++++++++++--------------
>  2 files changed, 158 insertions(+), 120 deletions(-)
> 
> --
> 2.23.0
>
Thomas Zimmermann Oct. 2, 2019, 11:43 a.m. UTC | #2
Hi

Am 02.10.19 um 10:59 schrieb Gerd Hoffmann:
> On Fri, Sep 27, 2019 at 11:03:04AM +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 ast. It
>> further moves the allocated cursor BOs to the of the video RAM to reduce
>> memory fragmentation.
>>
>> The ast driver manages cursor memory in a dedicated GEM VRAM buffer
>> object. It uses a double-buffering scheme of alternating between offsets
>> within the 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 as ast devices only have a small amount of video memory (e.g.,
>> 8 MiB).
>>
>> With this patchset, the cursor handling in ast 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 the device's video
>> memory to storing the cursor's buffer objects. This prevents memory
>> fragmentation.
>>
>> The patchset has been tested on ast hardware.
>>
>> v3:
>> 	* split-off ast patches into separate series
>> 	* move around ast_{show,hide}_cursor in a separate patch
>> 	* fix space-before-tab error near AST_HWC_SIGNATURE_CHECKSUM
>> v2:
>> 	* remove VRAM buffers in favor of GEM BOs
>> 	* manage BO placement with pin flag
> 
> Looks all sane to me, series is
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>

Thanks for taking the time to review patches for this fairly obscure code.

Best regards
Thomas

> 
>>
>>
>> Thomas Zimmermann (5):
>>    drm/ast: Don't call ast_show_cursor() from ast_cursor_move()
>>    drm/ast: Move ast_{show,hide}_cursor() within source file
>>    drm/ast: Move cursor update code to ast_show_cursor()
>>    drm/ast: Move cursor offset swapping into ast_show_cursor()
>>    drm/ast: Allocate cursor BOs at high end of video memory
>>
>>   drivers/gpu/drm/ast/ast_drv.h  |  43 +++---
>>   drivers/gpu/drm/ast/ast_mode.c | 235 +++++++++++++++++++--------------
>>   2 files changed, 158 insertions(+), 120 deletions(-)
>>
>> --
>> 2.23.0
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>