Commit b2fddb13 authored by Nicholas Kazlauskas's avatar Nicholas Kazlauskas Committed by Alex Deucher

drm/amd/display: Drop underlay plane support

[Why]
Primary and underlay planes were previously exposed to DRM by using
max_planes and max_slave_planes.

The value for max_planes was always pipe_count + has_underlay.
If there was an underlay pipe, then max_slave_planes = 1.

Raven has pipe_count = 4, max_planes = 4, and max_slave_planes = 1.
So during plane initialziation it was actually "creating"
1 overlay plane and 3 primary planes... or it would be, had its
plane_type array not been dm_plane_type_default, which will only create
DRM_PLANE_TYPE_PRIMARY planes.

We can expose primary planes as supporting more than one CRTC at a time
to more closely resemble plane behavior on DCN but userspace doesn't
really expect planes to be used in this manner and will either
ignore the planes or crash.

Planes with index greater than max_streams are marked as supporting
all CRTCs. No ASIC currently has primary plane count greater than the
stream count but we shouldn't expose more than necessary.

[How]
Drop support for underlay planes. They aren't well tested and don't
fully work right at the moment.

Only create one primary plane per CRTC so we're not creating overlays.

Initialize plane types directly instead of referencing a misleading
array of plane types.
Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e5c41970
...@@ -137,30 +137,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -137,30 +137,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
static void handle_cursor_update(struct drm_plane *plane, static void handle_cursor_update(struct drm_plane *plane,
struct drm_plane_state *old_plane_state); struct drm_plane_state *old_plane_state);
static const enum drm_plane_type dm_plane_type_default[AMDGPU_MAX_PLANES] = {
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY,
};
static const enum drm_plane_type dm_plane_type_carizzo[AMDGPU_MAX_PLANES] = {
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_OVERLAY,/* YUV Capable Underlay */
};
static const enum drm_plane_type dm_plane_type_stoney[AMDGPU_MAX_PLANES] = {
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_OVERLAY, /* YUV Capable Underlay */
};
/* /*
* dm_vblank_get_counter * dm_vblank_get_counter
* *
...@@ -1840,8 +1816,8 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm) ...@@ -1840,8 +1816,8 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)
#endif #endif
static int initialize_plane(struct amdgpu_display_manager *dm, static int initialize_plane(struct amdgpu_display_manager *dm,
struct amdgpu_mode_info *mode_info, struct amdgpu_mode_info *mode_info, int plane_id,
int plane_id) enum drm_plane_type plane_type)
{ {
struct drm_plane *plane; struct drm_plane *plane;
unsigned long possible_crtcs; unsigned long possible_crtcs;
...@@ -1854,13 +1830,13 @@ static int initialize_plane(struct amdgpu_display_manager *dm, ...@@ -1854,13 +1830,13 @@ static int initialize_plane(struct amdgpu_display_manager *dm,
DRM_ERROR("KMS: Failed to allocate plane\n"); DRM_ERROR("KMS: Failed to allocate plane\n");
return -ENOMEM; return -ENOMEM;
} }
plane->type = mode_info->plane_type[plane_id]; plane->type = plane_type;
/* /*
* HACK: IGT tests expect that each plane can only have * HACK: IGT tests expect that the primary plane for a CRTC
* one possible CRTC. For now, set one CRTC for each * can only have one possible CRTC. Only expose support for
* plane that is not an underlay, but still allow multiple * any CRTC if they're not going to be used as a primary plane
* CRTCs for underlay planes. * for a CRTC - like overlay or underlay planes.
*/ */
possible_crtcs = 1 << plane_id; possible_crtcs = 1 << plane_id;
if (plane_id >= dm->dc->caps.max_streams) if (plane_id >= dm->dc->caps.max_streams)
...@@ -1915,7 +1891,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) ...@@ -1915,7 +1891,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
struct amdgpu_encoder *aencoder = NULL; struct amdgpu_encoder *aencoder = NULL;
struct amdgpu_mode_info *mode_info = &adev->mode_info; struct amdgpu_mode_info *mode_info = &adev->mode_info;
uint32_t link_cnt; uint32_t link_cnt;
int32_t total_overlay_planes, total_primary_planes; int32_t primary_planes;
enum dc_connection_type new_connection_type = dc_connection_none; enum dc_connection_type new_connection_type = dc_connection_none;
link_cnt = dm->dc->caps.max_links; link_cnt = dm->dc->caps.max_links;
...@@ -1924,21 +1900,17 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) ...@@ -1924,21 +1900,17 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
return -EINVAL; return -EINVAL;
} }
/* Identify the number of planes to be initialized */ /* There is one primary plane per CRTC */
total_overlay_planes = dm->dc->caps.max_slave_planes; primary_planes = dm->dc->caps.max_streams;
total_primary_planes = dm->dc->caps.max_planes - dm->dc->caps.max_slave_planes; ASSERT(primary_planes < AMDGPU_MAX_PLANES);
/* First initialize overlay planes, index starting after primary planes */ /*
for (i = (total_overlay_planes - 1); i >= 0; i--) { * Initialize primary planes, implicit planes for legacy IOCTLS.
if (initialize_plane(dm, mode_info, (total_primary_planes + i))) { * Order is reversed to match iteration order in atomic check.
DRM_ERROR("KMS: Failed to initialize overlay plane\n"); */
goto fail; for (i = (primary_planes - 1); i >= 0; i--) {
} if (initialize_plane(dm, mode_info, i,
} DRM_PLANE_TYPE_PRIMARY)) {
/* Initialize primary planes */
for (i = (total_primary_planes - 1); i >= 0; i--) {
if (initialize_plane(dm, mode_info, i)) {
DRM_ERROR("KMS: Failed to initialize primary plane\n"); DRM_ERROR("KMS: Failed to initialize primary plane\n");
goto fail; goto fail;
} }
...@@ -2041,7 +2013,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) ...@@ -2041,7 +2013,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
fail: fail:
kfree(aencoder); kfree(aencoder);
kfree(aconnector); kfree(aconnector);
for (i = 0; i < dm->dc->caps.max_planes; i++) for (i = 0; i < primary_planes; i++)
kfree(mode_info->planes[i]); kfree(mode_info->planes[i]);
return -EINVAL; return -EINVAL;
} }
...@@ -2123,53 +2095,45 @@ static int dm_early_init(void *handle) ...@@ -2123,53 +2095,45 @@ static int dm_early_init(void *handle)
adev->mode_info.num_crtc = 6; adev->mode_info.num_crtc = 6;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 6; adev->mode_info.num_dig = 6;
adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_KAVERI: case CHIP_KAVERI:
adev->mode_info.num_crtc = 4; adev->mode_info.num_crtc = 4;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 7; adev->mode_info.num_dig = 7;
adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_KABINI: case CHIP_KABINI:
case CHIP_MULLINS: case CHIP_MULLINS:
adev->mode_info.num_crtc = 2; adev->mode_info.num_crtc = 2;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 6; adev->mode_info.num_dig = 6;
adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_FIJI: case CHIP_FIJI:
case CHIP_TONGA: case CHIP_TONGA:
adev->mode_info.num_crtc = 6; adev->mode_info.num_crtc = 6;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 7; adev->mode_info.num_dig = 7;
adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_CARRIZO: case CHIP_CARRIZO:
adev->mode_info.num_crtc = 3; adev->mode_info.num_crtc = 3;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 9; adev->mode_info.num_dig = 9;
adev->mode_info.plane_type = dm_plane_type_carizzo;
break; break;
case CHIP_STONEY: case CHIP_STONEY:
adev->mode_info.num_crtc = 2; adev->mode_info.num_crtc = 2;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 9; adev->mode_info.num_dig = 9;
adev->mode_info.plane_type = dm_plane_type_stoney;
break; break;
case CHIP_POLARIS11: case CHIP_POLARIS11:
case CHIP_POLARIS12: case CHIP_POLARIS12:
adev->mode_info.num_crtc = 5; adev->mode_info.num_crtc = 5;
adev->mode_info.num_hpd = 5; adev->mode_info.num_hpd = 5;
adev->mode_info.num_dig = 5; adev->mode_info.num_dig = 5;
adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_POLARIS10: case CHIP_POLARIS10:
case CHIP_VEGAM: case CHIP_VEGAM:
adev->mode_info.num_crtc = 6; adev->mode_info.num_crtc = 6;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 6; adev->mode_info.num_dig = 6;
adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_VEGA10: case CHIP_VEGA10:
case CHIP_VEGA12: case CHIP_VEGA12:
...@@ -2177,14 +2141,12 @@ static int dm_early_init(void *handle) ...@@ -2177,14 +2141,12 @@ static int dm_early_init(void *handle)
adev->mode_info.num_crtc = 6; adev->mode_info.num_crtc = 6;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 6; adev->mode_info.num_dig = 6;
adev->mode_info.plane_type = dm_plane_type_default;
break; break;
#if defined(CONFIG_DRM_AMD_DC_DCN1_0) #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
case CHIP_RAVEN: case CHIP_RAVEN:
adev->mode_info.num_crtc = 4; adev->mode_info.num_crtc = 4;
adev->mode_info.num_hpd = 4; adev->mode_info.num_hpd = 4;
adev->mode_info.num_dig = 4; adev->mode_info.num_dig = 4;
adev->mode_info.plane_type = dm_plane_type_default;
break; break;
#endif #endif
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment