Re: [PATCH v2 0/5] drm: Reuse temporary memory for format conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/09/2023 16:24, Thomas Zimmermann wrote:
DRM's format-conversion helpers require temporary memory. Pass the
buffer from the caller and keep it allocated over several calls. Allow
the caller to preallocate the buffer memory.

The motivation for this patchset is the recent work on a DRM panic
handler. The panic handler requires format conversion to display an
error to the screen. But allocating memory during kernel panics is
fragile. The changes in this patchset enable the DRM panic handler to
preallocate buffer storage before the panic occurs.

As an additonal benefit, drivers can now keep the temporary storage
across multiple display updates. Avoiding memory allocation reduces
the CPU overhead of the format helpers.

Patch 1 adds struct drm_xfrm_buf, a simple interface to pass around
the buffer storage. Patch 2 moves the memory management from the format
helpers into their callers. Drivers release the temporary storage at
the end of their display-update functions.

Patches 3 to 8 update three drivers to keep the allocated memory for
all of a device's lifetime. Managed cleanup releases the buffer as part
of releaseing the device. As additional benefit, buffer allocation now
happens in atomic_check helpers. The driver thus detects OOM errors
before the display update begins.

Thanks for the patches.
I'm still experimenting with drm_panic, and it's not clear if it will use that or not yet. But it's already useful for other drivers, avoiding alloc/free for each frame, is a good thing.


Best regards,

--

Jocelyn



Tested with simpledrm.

v2:
	* reserve storage during probing in the drivers

Thomas Zimmermann (5):
   drm/format-helper: Add struct drm_xfrm_buf to cache format conversion
   drm/format-helper: Pass xfrm buffer to format-conversion helpers
   drm/simpledrm: Store xfrm buffer in device instance
   drm/ofdrm: Store xfrm buffer in device instance
   drm/ssd130x: Store xfrm buffer in device instance

  drivers/gpu/drm/drm_format_helper.c           | 204 +++++++++++++-----
  drivers/gpu/drm/drm_mipi_dbi.c                |   7 +-
  drivers/gpu/drm/gud/gud_pipe.c                |  21 +-
  drivers/gpu/drm/solomon/ssd130x.c             |  16 +-
  drivers/gpu/drm/solomon/ssd130x.h             |   3 +
  .../gpu/drm/tests/drm_format_helper_test.c    |  33 +--
  drivers/gpu/drm/tiny/cirrus.c                 |   5 +-
  drivers/gpu/drm/tiny/ofdrm.c                  |  11 +-
  drivers/gpu/drm/tiny/repaper.c                |   5 +-
  drivers/gpu/drm/tiny/simpledrm.c              |  11 +-
  drivers/gpu/drm/tiny/st7586.c                 |   5 +-
  include/drm/drm_format_helper.h               |  74 +++++--
  12 files changed, 300 insertions(+), 95 deletions(-)





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux