aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2017-06-15 16:24:01 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-09-26 17:21:35 -0400
commitd4e13b0db124345be93bc2ff39ecb48409da2c9b (patch)
tree7069fa7fb33b075b02df025e2d7e1dcd208926d7 /drivers/gpu/drm/amd
parent4e3133c79dc4b7dc0ff81eb884d6cfe736fc49b1 (diff)
drm/amd/display: decouple per-crtc-plane model
Current design has per-crtc-plane model. As a result, for asic's that support underlay, are unable to expose it to user space for modesetting. To enable this, the drm driver intialisation now runs for number of surfaces instead of stream/crtc. This patch plumbs surface capabilities to drm framework so that it can be effectively used by user space. Tests: (On Chromium OS for Stoney Only) * 'modetest -p' now shows additional plane with YUV capabilities in case of CZ and ST. * 'plane_test' fails with below error: [drm:amdgpu_dm_connector_atomic_set_property [amdgpu]] *ERROR* Unsupported screen depth 0 as ther is no support for YUYV * Checked multimonitor display works fine Signed-off-by: Shirish S <shirish.s@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h8
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c67
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c76
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h5
-rw-r--r--drivers/gpu/drm/amd/display/dc/dc.h1
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c2
10 files changed, 127 insertions, 40 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index e5d2ce48cb1e..362d9559f065 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -60,6 +60,7 @@ struct amdgpu_hpd;
60 60
61#define AMDGPU_MAX_HPD_PINS 6 61#define AMDGPU_MAX_HPD_PINS 6
62#define AMDGPU_MAX_CRTCS 6 62#define AMDGPU_MAX_CRTCS 6
63#define AMDGPU_MAX_PLANES 6
63#define AMDGPU_MAX_AFMT_BLOCKS 9 64#define AMDGPU_MAX_AFMT_BLOCKS 9
64 65
65enum amdgpu_rmx_type { 66enum amdgpu_rmx_type {
@@ -327,6 +328,7 @@ struct amdgpu_mode_info {
327 struct card_info *atom_card_info; 328 struct card_info *atom_card_info;
328 bool mode_config_initialized; 329 bool mode_config_initialized;
329 struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS]; 330 struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS];
331 struct amdgpu_plane *planes[AMDGPU_MAX_PLANES];
330 struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS]; 332 struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS];
331 /* DVI-I properties */ 333 /* DVI-I properties */
332 struct drm_property *coherent_mode_property; 334 struct drm_property *coherent_mode_property;
@@ -356,6 +358,7 @@ struct amdgpu_mode_info {
356 int num_dig; /* number of dig blocks */ 358 int num_dig; /* number of dig blocks */
357 int disp_priority; 359 int disp_priority;
358 const struct amdgpu_display_funcs *funcs; 360 const struct amdgpu_display_funcs *funcs;
361 enum drm_plane_type *plane_type;
359}; 362};
360 363
361#define AMDGPU_MAX_BL_LEVEL 0xFF 364#define AMDGPU_MAX_BL_LEVEL 0xFF
@@ -436,6 +439,11 @@ struct amdgpu_crtc {
436 struct drm_pending_vblank_event *event; 439 struct drm_pending_vblank_event *event;
437}; 440};
438 441
442struct amdgpu_plane {
443 struct drm_plane base;
444 enum drm_plane_type plane_type;
445};
446
439struct amdgpu_encoder_atom_dig { 447struct amdgpu_encoder_atom_dig {
440 bool linkb; 448 bool linkb;
441 /* atom dig */ 449 /* atom dig */
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index b08ec453b773..d76448d04423 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -49,6 +49,28 @@
49 49
50#include "modules/inc/mod_freesync.h" 50#include "modules/inc/mod_freesync.h"
51 51
52static enum drm_plane_type dm_surfaces_type_default[AMDGPU_MAX_PLANES] = {
53 DRM_PLANE_TYPE_PRIMARY,
54 DRM_PLANE_TYPE_PRIMARY,
55 DRM_PLANE_TYPE_PRIMARY,
56 DRM_PLANE_TYPE_PRIMARY,
57 DRM_PLANE_TYPE_PRIMARY,
58 DRM_PLANE_TYPE_PRIMARY,
59};
60
61static enum drm_plane_type dm_surfaces_type_carizzo[AMDGPU_MAX_PLANES] = {
62 DRM_PLANE_TYPE_PRIMARY,
63 DRM_PLANE_TYPE_PRIMARY,
64 DRM_PLANE_TYPE_PRIMARY,
65 DRM_PLANE_TYPE_OVERLAY,/* YUV Capable Underlay */
66};
67
68static enum drm_plane_type dm_surfaces_type_stoney[AMDGPU_MAX_PLANES] = {
69 DRM_PLANE_TYPE_PRIMARY,
70 DRM_PLANE_TYPE_PRIMARY,
71 DRM_PLANE_TYPE_OVERLAY, /* YUV Capable Underlay */
72};
73
52/* 74/*
53 * dm_vblank_get_counter 75 * dm_vblank_get_counter
54 * 76 *
@@ -1051,30 +1073,34 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
1051 uint32_t i; 1073 uint32_t i;
1052 struct amdgpu_connector *aconnector; 1074 struct amdgpu_connector *aconnector;
1053 struct amdgpu_encoder *aencoder; 1075 struct amdgpu_encoder *aencoder;
1054 struct amdgpu_crtc *acrtc; 1076 struct amdgpu_mode_info *mode_info = &adev->mode_info;
1055 uint32_t link_cnt; 1077 uint32_t link_cnt;
1056 1078
1057 link_cnt = dm->dc->caps.max_links; 1079 link_cnt = dm->dc->caps.max_links;
1058
1059 if (amdgpu_dm_mode_config_init(dm->adev)) { 1080 if (amdgpu_dm_mode_config_init(dm->adev)) {
1060 DRM_ERROR("DM: Failed to initialize mode config\n"); 1081 DRM_ERROR("DM: Failed to initialize mode config\n");
1061 return -1; 1082 goto fail;
1062 } 1083 }
1063 1084
1064 for (i = 0; i < dm->dc->caps.max_streams; i++) { 1085 for (i = 0; i < dm->dc->caps.max_surfaces; i++) {
1065 acrtc = kzalloc(sizeof(struct amdgpu_crtc), GFP_KERNEL); 1086 mode_info->planes[i] = kzalloc(sizeof(struct amdgpu_plane),
1066 if (!acrtc) 1087 GFP_KERNEL);
1067 goto fail; 1088 if (!mode_info->planes[i]) {
1089 DRM_ERROR("KMS: Failed to allocate surface\n");
1090 goto fail_free_planes;
1091 }
1092 mode_info->planes[i]->plane_type = mode_info->plane_type[i];
1093 if (amdgpu_dm_plane_init(dm, mode_info->planes[i], 1)) {
1094 DRM_ERROR("KMS: Failed to initialize plane\n");
1095 goto fail_free_planes;
1096 }
1097 }
1068 1098
1069 if (amdgpu_dm_crtc_init( 1099 for (i = 0; i < dm->dc->caps.max_streams; i++)
1070 dm, 1100 if (amdgpu_dm_crtc_init(dm, &mode_info->planes[i]->base, i)) {
1071 acrtc,
1072 i)) {
1073 DRM_ERROR("KMS: Failed to initialize crtc\n"); 1101 DRM_ERROR("KMS: Failed to initialize crtc\n");
1074 kfree(acrtc); 1102 goto fail_free_planes;
1075 goto fail;
1076 } 1103 }
1077 }
1078 1104
1079 dm->display_indexes_num = dm->dc->caps.max_streams; 1105 dm->display_indexes_num = dm->dc->caps.max_streams;
1080 1106
@@ -1125,12 +1151,12 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
1125 case CHIP_VEGA10: 1151 case CHIP_VEGA10:
1126 if (dce110_register_irq_handlers(dm->adev)) { 1152 if (dce110_register_irq_handlers(dm->adev)) {
1127 DRM_ERROR("DM: Failed to initialize IRQ\n"); 1153 DRM_ERROR("DM: Failed to initialize IRQ\n");
1128 return -1; 1154 goto fail_free_encoder;
1129 } 1155 }
1130 break; 1156 break;
1131 default: 1157 default:
1132 DRM_ERROR("Usupported ASIC type: 0x%X\n", adev->asic_type); 1158 DRM_ERROR("Usupported ASIC type: 0x%X\n", adev->asic_type);
1133 return -1; 1159 goto fail_free_encoder;
1134 } 1160 }
1135 1161
1136 drm_mode_config_reset(dm->ddev); 1162 drm_mode_config_reset(dm->ddev);
@@ -1140,6 +1166,9 @@ fail_free_encoder:
1140 kfree(aencoder); 1166 kfree(aencoder);
1141fail_free_connector: 1167fail_free_connector:
1142 kfree(aconnector); 1168 kfree(aconnector);
1169fail_free_planes:
1170 for (i = 0; i < dm->dc->caps.max_surfaces; i++)
1171 kfree(mode_info->planes[i]);
1143fail: 1172fail:
1144 return -1; 1173 return -1;
1145} 1174}
@@ -1361,33 +1390,39 @@ static int dm_early_init(void *handle)
1361 adev->mode_info.num_crtc = 6; 1390 adev->mode_info.num_crtc = 6;
1362 adev->mode_info.num_hpd = 6; 1391 adev->mode_info.num_hpd = 6;
1363 adev->mode_info.num_dig = 6; 1392 adev->mode_info.num_dig = 6;
1393 adev->mode_info.plane_type = dm_surfaces_type_default;
1364 break; 1394 break;
1365 case CHIP_FIJI: 1395 case CHIP_FIJI:
1366 case CHIP_TONGA: 1396 case CHIP_TONGA:
1367 adev->mode_info.num_crtc = 6; 1397 adev->mode_info.num_crtc = 6;
1368 adev->mode_info.num_hpd = 6; 1398 adev->mode_info.num_hpd = 6;
1369 adev->mode_info.num_dig = 7; 1399 adev->mode_info.num_dig = 7;
1400 adev->mode_info.plane_type = dm_surfaces_type_default;
1370 break; 1401 break;
1371 case CHIP_CARRIZO: 1402 case CHIP_CARRIZO:
1372 adev->mode_info.num_crtc = 3; 1403 adev->mode_info.num_crtc = 3;
1373 adev->mode_info.num_hpd = 6; 1404 adev->mode_info.num_hpd = 6;
1374 adev->mode_info.num_dig = 9; 1405 adev->mode_info.num_dig = 9;
1406 adev->mode_info.plane_type = dm_surfaces_type_carizzo;
1375 break; 1407 break;
1376 case CHIP_STONEY: 1408 case CHIP_STONEY:
1377 adev->mode_info.num_crtc = 2; 1409 adev->mode_info.num_crtc = 2;
1378 adev->mode_info.num_hpd = 6; 1410 adev->mode_info.num_hpd = 6;
1379 adev->mode_info.num_dig = 9; 1411 adev->mode_info.num_dig = 9;
1412 adev->mode_info.plane_type = dm_surfaces_type_stoney;
1380 break; 1413 break;
1381 case CHIP_POLARIS11: 1414 case CHIP_POLARIS11:
1382 case CHIP_POLARIS12: 1415 case CHIP_POLARIS12:
1383 adev->mode_info.num_crtc = 5; 1416 adev->mode_info.num_crtc = 5;
1384 adev->mode_info.num_hpd = 5; 1417 adev->mode_info.num_hpd = 5;
1385 adev->mode_info.num_dig = 5; 1418 adev->mode_info.num_dig = 5;
1419 adev->mode_info.plane_type = dm_surfaces_type_default;
1386 break; 1420 break;
1387 case CHIP_POLARIS10: 1421 case CHIP_POLARIS10:
1388 adev->mode_info.num_crtc = 6; 1422 adev->mode_info.num_crtc = 6;
1389 adev->mode_info.num_hpd = 6; 1423 adev->mode_info.num_hpd = 6;
1390 adev->mode_info.num_dig = 6; 1424 adev->mode_info.num_dig = 6;
1425 adev->mode_info.plane_type = dm_surfaces_type_default;
1391 break; 1426 break;
1392 case CHIP_VEGA10: 1427 case CHIP_VEGA10:
1393 adev->mode_info.num_crtc = 6; 1428 adev->mode_info.num_crtc = 6;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
index ee9239ab734c..1751f138c36a 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -1446,6 +1446,8 @@ const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs = {
1446}; 1446};
1447 1447
1448static const struct drm_plane_funcs dm_plane_funcs = { 1448static const struct drm_plane_funcs dm_plane_funcs = {
1449 .update_plane = drm_atomic_helper_update_plane,
1450 .disable_plane = drm_atomic_helper_disable_plane,
1449 .reset = drm_atomic_helper_plane_reset, 1451 .reset = drm_atomic_helper_plane_reset,
1450 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 1452 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
1451 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state 1453 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state
@@ -1577,38 +1579,67 @@ static uint32_t rgb_formats[] = {
1577 DRM_FORMAT_ABGR2101010, 1579 DRM_FORMAT_ABGR2101010,
1578}; 1580};
1579 1581
1580int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, 1582static uint32_t yuv_formats[] = {
1581 struct amdgpu_crtc *acrtc, 1583 DRM_FORMAT_YUYV,
1582 uint32_t crtc_index) 1584 DRM_FORMAT_YVYU,
1585 DRM_FORMAT_UYVY,
1586 DRM_FORMAT_VYUY,
1587};
1588
1589int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
1590 struct amdgpu_plane *aplane,
1591 unsigned long possible_crtcs)
1583{ 1592{
1584 int res = -ENOMEM; 1593 int res = -EPERM;
1585 1594
1586 struct drm_plane *primary_plane = 1595 switch (aplane->plane_type) {
1587 kzalloc(sizeof(*primary_plane), GFP_KERNEL); 1596 case DRM_PLANE_TYPE_PRIMARY:
1597 aplane->base.format_default = true;
1588 1598
1589 if (!primary_plane) 1599 res = drm_universal_plane_init(
1590 goto fail_plane; 1600 dm->adev->ddev,
1601 &aplane->base,
1602 possible_crtcs,
1603 &dm_plane_funcs,
1604 rgb_formats,
1605 ARRAY_SIZE(rgb_formats),
1606 NULL, aplane->plane_type, NULL);
1607 break;
1608 case DRM_PLANE_TYPE_OVERLAY:
1609 res = drm_universal_plane_init(
1610 dm->adev->ddev,
1611 &aplane->base,
1612 possible_crtcs,
1613 &dm_plane_funcs,
1614 yuv_formats,
1615 ARRAY_SIZE(yuv_formats),
1616 NULL, aplane->plane_type, NULL);
1617 break;
1618 case DRM_PLANE_TYPE_CURSOR:
1619 DRM_ERROR("KMS: Cursor plane not implemented.");
1620 break;
1621 }
1591 1622
1592 primary_plane->format_default = true; 1623 drm_plane_helper_add(&aplane->base, &dm_plane_helper_funcs);
1593 1624
1594 res = drm_universal_plane_init( 1625 return res;
1595 dm->adev->ddev, 1626}
1596 primary_plane,
1597 0,
1598 &dm_plane_funcs,
1599 rgb_formats,
1600 ARRAY_SIZE(rgb_formats),
1601 NULL,
1602 DRM_PLANE_TYPE_PRIMARY, NULL);
1603 1627
1604 primary_plane->crtc = &acrtc->base; 1628int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
1629 struct drm_plane *plane,
1630 uint32_t crtc_index)
1631{
1632 struct amdgpu_crtc *acrtc;
1633 int res = -ENOMEM;
1605 1634
1606 drm_plane_helper_add(primary_plane, &dm_plane_helper_funcs); 1635 acrtc = kzalloc(sizeof(struct amdgpu_crtc), GFP_KERNEL);
1636 if (!acrtc)
1637 goto fail;
1607 1638
1608 res = drm_crtc_init_with_planes( 1639 res = drm_crtc_init_with_planes(
1609 dm->ddev, 1640 dm->ddev,
1610 &acrtc->base, 1641 &acrtc->base,
1611 primary_plane, 1642 plane,
1612 NULL, 1643 NULL,
1613 &amdgpu_dm_crtc_funcs, NULL); 1644 &amdgpu_dm_crtc_funcs, NULL);
1614 1645
@@ -1628,8 +1659,7 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
1628 1659
1629 return 0; 1660 return 0;
1630fail: 1661fail:
1631 kfree(primary_plane); 1662 kfree(acrtc);
1632fail_plane:
1633 acrtc->crtc_id = -1; 1663 acrtc->crtc_id = -1;
1634 return res; 1664 return res;
1635} 1665}
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h
index 1bbeb87dc9d0..ab6d51dbbf4b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h
@@ -34,8 +34,11 @@ struct dc_validation_set;
34struct dc_surface; 34struct dc_surface;
35 35
36/*TODO Jodan Hersen use the one in amdgpu_dm*/ 36/*TODO Jodan Hersen use the one in amdgpu_dm*/
37int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
38 struct amdgpu_plane *aplane,
39 unsigned long possible_crtcs);
37int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, 40int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
38 struct amdgpu_crtc *amdgpu_crtc, 41 struct drm_plane *plane,
39 uint32_t link_index); 42 uint32_t link_index);
40int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, 43int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
41 struct amdgpu_connector *amdgpu_connector, 44 struct amdgpu_connector *amdgpu_connector,
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 0731045f6084..9dd8b2ad4c59 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -45,6 +45,7 @@ struct dc_caps {
45 uint32_t max_links; 45 uint32_t max_links;
46 uint32_t max_audios; 46 uint32_t max_audios;
47 uint32_t max_slave_planes; 47 uint32_t max_slave_planes;
48 uint32_t max_surfaces;
48 uint32_t max_downscale_ratio; 49 uint32_t max_downscale_ratio;
49 uint32_t i2c_speed_in_khz; 50 uint32_t i2c_speed_in_khz;
50 51
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
index b6f77f88be9c..d1685df09815 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
@@ -1035,6 +1035,8 @@ static bool construct(
1035 } 1035 }
1036 } 1036 }
1037 1037
1038 dc->public.caps.max_surfaces = pool->base.pipe_count;
1039
1038 if (!resource_construct(num_virtual_links, dc, &pool->base, 1040 if (!resource_construct(num_virtual_links, dc, &pool->base,
1039 &res_create_funcs)) 1041 &res_create_funcs))
1040 goto res_create_fail; 1042 goto res_create_fail;
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
index e3002031c40d..065a2986b666 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
@@ -1455,6 +1455,8 @@ static bool construct(
1455 if (!dce110_hw_sequencer_construct(dc)) 1455 if (!dce110_hw_sequencer_construct(dc))
1456 goto res_create_fail; 1456 goto res_create_fail;
1457 1457
1458 dc->public.caps.max_surfaces = pool->base.pipe_count;
1459
1458 bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id); 1460 bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
1459 1461
1460 bw_calcs_data_update_from_pplib(dc); 1462 bw_calcs_data_update_from_pplib(dc);
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
index 32aa1b5bf1f9..ece3ec72363d 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
@@ -1409,6 +1409,8 @@ static bool construct(
1409 &res_create_funcs)) 1409 &res_create_funcs))
1410 goto res_create_fail; 1410 goto res_create_fail;
1411 1411
1412 dc->public.caps.max_surfaces = pool->base.pipe_count;
1413
1412 /* Create hardware sequencer */ 1414 /* Create hardware sequencer */
1413 if (!dce112_hw_sequencer_construct(dc)) 1415 if (!dce112_hw_sequencer_construct(dc))
1414 goto res_create_fail; 1416 goto res_create_fail;
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
index efa58889058b..f677a77ca6e0 100644
--- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
@@ -1060,6 +1060,8 @@ static bool construct(
1060 if (!dce120_hw_sequencer_create(dc)) 1060 if (!dce120_hw_sequencer_create(dc))
1061 goto controller_create_fail; 1061 goto controller_create_fail;
1062 1062
1063 dc->public.caps.max_surfaces = pool->base.pipe_count;
1064
1063 bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id); 1065 bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
1064 1066
1065 bw_calcs_data_update_from_pplib(dc); 1067 bw_calcs_data_update_from_pplib(dc);
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index a3e8182885b2..752e0e7579b9 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -1043,6 +1043,8 @@ static bool construct(
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 dc->public.caps.max_surfaces = pool->base.pipe_count;
1047
1046 if (!resource_construct(num_virtual_links, dc, &pool->base, 1048 if (!resource_construct(num_virtual_links, dc, &pool->base,
1047 &res_create_funcs)) 1049 &res_create_funcs))
1048 goto res_create_fail; 1050 goto res_create_fail;