Commit 2af10429 authored by Tomohito Esaki's avatar Tomohito Esaki Committed by Daniel Vetter
Browse files

drm: introduce fb_modifiers_not_supported flag in mode_config



If only linear modifier is advertised, since there are many drivers that
only linear supported, the DRM core should handle this rather than
open-coding in every driver. However, there are legacy drivers such as
radeon that do not support modifiers but infer the actual layout of the
underlying buffer. Therefore, a new flag fb_modifiers_not_supported is
introduced for these legacy drivers, and allow_fb_modifiers is replaced
with this new flag.

v3:
 - change the order as follows:
   1. add fb_modifiers_not_supported flag
   2. add default modifiers
   3. remove allow_fb_modifiers flag
 - add a conditional disable in amdgpu_dm_plane_init()

v4:
 - modify kernel docs

v5:
 - modify kernel docs

Signed-off-by: default avatarTomohito Esaki <etom@igel.co.jp>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220128060836.11216-2-etom@igel.co.jp
parent 9987151a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -956,7 +956,7 @@ static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
	int ret;
	unsigned int i, block_width, block_height, block_size_log2;

	if (!rfb->base.dev->mode_config.allow_fb_modifiers)
	if (rfb->base.dev->mode_config.fb_modifiers_not_supported)
		return 0;

	for (i = 0; i < format_info->num_planes; ++i) {
@@ -1143,7 +1143,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
	if (ret)
		return ret;

	if (!dev->mode_config.allow_fb_modifiers) {
	if (dev->mode_config.fb_modifiers_not_supported) {
		drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
			      "GFX9+ requires FB check based on format modifier\n");
		ret = check_tiling_flags_gfx6(rfb);
@@ -1151,7 +1151,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
			return ret;
	}

	if (dev->mode_config.allow_fb_modifiers &&
	if (!dev->mode_config.fb_modifiers_not_supported &&
	    !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
		ret = convert_tiling_flags_to_modifier(rfb);
		if (ret) {
+2 −0
Original line number Diff line number Diff line
@@ -2798,6 +2798,8 @@ static int dce_v10_0_sw_init(void *handle)
	adev_to_drm(adev)->mode_config.preferred_depth = 24;
	adev_to_drm(adev)->mode_config.prefer_shadow = 1;

	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;

	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;

	r = amdgpu_display_modeset_create_props(adev);
+2 −0
Original line number Diff line number Diff line
@@ -2916,6 +2916,8 @@ static int dce_v11_0_sw_init(void *handle)
	adev_to_drm(adev)->mode_config.preferred_depth = 24;
	adev_to_drm(adev)->mode_config.prefer_shadow = 1;

	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;

	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;

	r = amdgpu_display_modeset_create_props(adev);
+1 −0
Original line number Diff line number Diff line
@@ -2674,6 +2674,7 @@ static int dce_v6_0_sw_init(void *handle)
	adev_to_drm(adev)->mode_config.max_height = 16384;
	adev_to_drm(adev)->mode_config.preferred_depth = 24;
	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;

	r = amdgpu_display_modeset_create_props(adev);
+2 −0
Original line number Diff line number Diff line
@@ -2695,6 +2695,8 @@ static int dce_v8_0_sw_init(void *handle)
	adev_to_drm(adev)->mode_config.preferred_depth = 24;
	adev_to_drm(adev)->mode_config.prefer_shadow = 1;

	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;

	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;

	r = amdgpu_display_modeset_create_props(adev);
Loading