drm-uapi: Add AMD modifiers

Graphics / Mesa 3D Graphics Library / Mesa - Bas Nieuwenhuizen [basnieuwenhuizen.nl] - 13 November 2020 03:27 UTC

This adds modifiers for GFX9+ AMD GPUs.

As the modifiers need a lot of parameters I split things out in getters and setters.- Advantage: simplifies the code a lot- Disadvantage: Makes it harder to check that you're setting all the required fields.

The tiling modes seem to change every generatio, but the structure of what each tiling mode is good for stays really similar. As such the core of the modifier is- the tiling mode- a version. Not explicitly a GPU generation, but splitting out a new set of tiling equations.

Sometimes one or two tiling modes stay the same and for those we specify a canonical version.

Then we have a bunch of parameters on how the compression works. Different HW units have different requirements for these and we actually have some conflicts here.

e.g. the render backends need a specific alignment but the display unit only works with unaligned compression surfaces. To work around that we have a DCC_RETILE option where both an aligned and unaligned compression surface are allocated and a writer has to sync the aligned surface to the unaligned surface on handoff.

Finally there are some GPU parameters that participate in the tiling equations. These are constant for each GPU on the rendering/texturing side. The display unit is very flexible however and supports all of them :|

Some estimates:- Single GPU, render+texture: ~10 modifiers- All possible configs in a gen, display: ~1000 modifiers- Configs of actually existing GPUs in a gen: ~100 modifiers

For formats with a single plane everything gets put in a separate DRM plane. However, this doesn't fit for some YUV formats, so if the format has >1 plane, we let the driver pack the surfaces into 1 DRM plane per format plane.

This way we avoid X11 rendering onto the frontbuffer with DCC, but still fit into 4 DRM planes.

2cc2b456889 drm-uapi: Add AMD modifiers.
include/drm-uapi/drm_fourcc.h | 116 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 116 insertions(+)

Upstream: cgit.freedesktop.org

  • Share