drm/vram: Add helpers to validate a display mode's memory requirements
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 3 Feb 2020 15:52:55 +0000 (16:52 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Thu, 6 Feb 2020 09:32:54 +0000 (10:32 +0100)
commit80f7c3f77697159bafa259f92ac942f143326e90
tree8209ec73b500520b1a56cafa01f878f7752fea8b
parentfda157211432b8438668cd3e80e7b19fb7555691
drm/vram: Add helpers to validate a display mode's memory requirements

Devices with low amount of dedicated video memory may not be able
to use all possible display modes, as the framebuffers may not fit
into VRAM. The new helper function drm_vram_helper_mode_valid()
implements a simple test to sort out all display modes that can
not be used in any case. Drivers should call this function from
struct drm_mode_config_funcs.mode_valid.

The functionality was originally implemented by the ast driver, which
is being converted as well.

v2:
* WARN_ON if VRAM memory manager has not been initialized
* documentation fixes
* unexported drm_vram_helper_mode_valid_internal()

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200203155258.9346-2-tzimmermann@suse.de
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/drm_gem_vram_helper.c
include/drm/drm_gem_vram_helper.h