Skip to content

drm: Reuse temporary memory for format conversion

Thomas Zimmermann dri-devel 4 versions – Applied

Status from this message: Pushed to drm-misc (drm-misc-next) because the offending commit is not

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest7 patches 8 repliesApplied
  2. v47 patches 26 repliesSuperseded
  3. v25 patches 11 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v18 patches2 repliesSuperseded

Changes in v5 from the cover letter

* fix repaper patch (Noralf)
* fix documentation (Javier, Noralf, kernel test robot)

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/7drm/format-helper: Cache buffers with struct drm_format_conv_statedrivers/gpu/drm/drm_format_helper.c include/drm/drm_format_helper.h+158 -110 replies
2/7drm/atomic-helper: Add format-conversion state to shadow-plane statedrivers/gpu/drm/drm_gem_atomic_helper.c include/drm/drm_gem_atomic_helper.h+19 -03 replies
3/7drm/format-helper: Pass format-conversion state to helpersdrivers/gpu/drm/drm_format_helper.c drivers/gpu/drm/drm_mipi_dbi.c drivers/gpu/drm/gud/gud_pipe.c +10 more+195 -1370 replies
4/7drm/ofdrm: Preallocate format-conversion buffer in atomic_checkdrivers/gpu/drm/tiny/ofdrm.c+14 -00 replies
5/7drm/simpledrm: Preallocate format-conversion buffer in atomic_checkdrivers/gpu/drm/tiny/simpledrm.c+40 -10 replies
6/7drm/ssd130x: Fix atomic_check for disabled planesdrivers/gpu/drm/solomon/ssd130x.c+9 -82 replies
7/7drm/ssd130x: Preallocate format-conversion buffer in atomic_checkdrivers/gpu/drm/solomon/ssd130x.c+11 -00 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchJavier Martinez CanillasNoralf Trønnes
1/7R-b T-b A-b
2/7R-b T-b A-b
3/7R-b T-b
4/7R-b
5/7R-b
6/7R-b T-b
7/7R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/7] drm: Reuse temporary memory for format conversion

DRM's format-conversion helpers require temporary memory. Pass the buffer from the caller to allow the caller to preallocate the buffer memory.

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

Patch 1 adds struct drm_format_conv_state, a simple interface to pass around the buffer storage. Patch 2 adds an instance of the struct to the shadow-plane state. Patch 3 moves the buffer's memory management from the format helpers into their callers within the DRM drivers. Most of the affected drivers use the state instance stored in their shadow- plane state. The shadow-plane code releases the buffer memory automatically.

Patches 4 to 7 update three drivers to pre-allocate the format-conversion buffer in their plane's atomic_check function. The drivers thus detect OOM errors before the display update begins.

Tested with simpledrm.

v5:
* fix repaper patch (Noralf)
* fix documentation (Javier, Noralf, kernel test robot)
v4:
* rename struct to drm_format_conv_state (Javier)
* replace ARRAY_SIZE() with sizeof() (Jani)
* store buffer in shadow-plane state (Javier, Maxime)
* prealloc in atomic_check in several drivers
v3:
* no changes
v2:
* reserve storage during probing in the drivers

[1] https://patchwork.freedesktop.org/series/122244/

Thomas Zimmermann (7):
drm/format-helper: Cache buffers with struct drm_format_conv_state drm/atomic-helper: Add format-conversion state to shadow-plane state drm/format-helper: Pass format-conversion state to helpers drm/ofdrm: Preallocate format-conversion buffer in atomic_check drm/simpledrm: Preallocate format-conversion buffer in atomic_check drm/ssd130x: Fix atomic_check for disabled planes drm/ssd130x: Preallocate format-conversion buffer in atomic_check

 drivers/gpu/drm/drm_format_helper.c           | 215 +++++++++++++-----
 drivers/gpu/drm/drm_gem_atomic_helper.c       |   9 +
 drivers/gpu/drm/drm_mipi_dbi.c                |  19 +-
 drivers/gpu/drm/gud/gud_pipe.c                |  30 ++-
 drivers/gpu/drm/solomon/ssd130x.c             |  36 ++-
 .../gpu/drm/tests/drm_format_helper_test.c    |  72 +++---
 drivers/gpu/drm/tiny/cirrus.c                 |   3 +-
 drivers/gpu/drm/tiny/ili9225.c                |  10 +-
 drivers/gpu/drm/tiny/ofdrm.c                  |  16 +-
 drivers/gpu/drm/tiny/repaper.c                |  10 +-
 drivers/gpu/drm/tiny/simpledrm.c              |  43 +++-
 drivers/gpu/drm/tiny/st7586.c                 |  19 +-
 include/drm/drm_format_helper.h               |  81 +++++--
 include/drm/drm_gem_atomic_helper.h           |  10 +
 include/drm/drm_mipi_dbi.h                    |   4 +-
 15 files changed, 433 insertions(+), 144 deletions(-)

base-commit: fe09b9f4c1435d9ce59b4729994b86a856db852f
prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
prerequisite-patch-id: cbc453ee02fae02af22fbfdce56ab732c7a88c36

Signature · 1 line
2.42.0