Skip to contentSkip to conversation

drm/amd/display: enable S/G display for for recent APUs by default

PATCH Superseded Yifan Zhang 3 participants 4 messages Sep 27, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: enable S/G display for for recent APUs by default

With S/G display becomes stable, enable S/G display for recent APUs by default rather than white list.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 +++++--------------
 1 file changed, 10 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -33
index 7e6a693d6369..241fd8defdee 100644
@@ -1626,41 +1626,18 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 		break;
 	}
 
-	switch (adev->asic_type) {
-	case CHIP_CARRIZO:
-	case CHIP_STONEY:
+	if ((adev->asic_type == CHIP_CARRIZO ||
+		adev->asic_type == CHIP_STONEY ||
+		((adev->flags & AMD_IS_APU) &&
+		amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(1, 0, 0) &&
+		!(adev->apu_flags & AMD_APU_IS_RAVEN))) &&
+		amdgpu_sg_display != 0) {
 		init_data.flags.gpu_vm_support = true;
-		break;
-	default:
-		switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
-		case IP_VERSION(1, 0, 0):
-		case IP_VERSION(1, 0, 1):
-			/* enable S/G on PCO and RV2 */
-			if ((adev->apu_flags & AMD_APU_IS_RAVEN2) ||
-			    (adev->apu_flags & AMD_APU_IS_PICASSO))
-				init_data.flags.gpu_vm_support = true;
-			break;
-		case IP_VERSION(2, 1, 0):
-		case IP_VERSION(3, 0, 1):
-		case IP_VERSION(3, 1, 2):
-		case IP_VERSION(3, 1, 3):
-		case IP_VERSION(3, 1, 4):
-		case IP_VERSION(3, 1, 5):
-		case IP_VERSION(3, 1, 6):
-		case IP_VERSION(3, 5, 0):
-			init_data.flags.gpu_vm_support = true;
-			break;
-		default:
-			break;
-		}
-		break;
-	}
-	if (init_data.flags.gpu_vm_support &&
-	    (amdgpu_sg_display == 0))
-		init_data.flags.gpu_vm_support = false;
-
-	if (init_data.flags.gpu_vm_support)
 		adev->mode_info.gpu_vm_support = true;
+	} else {
+		init_data.flags.gpu_vm_support = false;
+		adev->mode_info.gpu_vm_support = false;
+	}
 
 	if (amdgpu_dc_feature_mask & DC_FBC_MASK)
 		init_data.flags.fbc_support = true;
Signature · 1 line
2.37.3
maintainer
#1 lore raw

Am 27.09.23 um 07:41 schrieb Yifan Zhang:

Quoted 15 lines

With S/G display becomes stable, enable S/G display for recent APUs by default rather than white list.

---
  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 +++++--------------
  1 file changed, 10 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 7e6a693d6369..241fd8defdee 100644
@@ -1626,41 +1626,18 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
  		break;
  	}

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 1634

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -3
 
-	switch (adev->asic_type) {
-	case CHIP_CARRIZO:
-	case CHIP_STONEY:
+	if ((adev->asic_type == CHIP_CARRIZO ||
+		adev->asic_type == CHIP_STONEY ||
+		((adev->flags & AMD_IS_APU) &&
+		amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(1, 0, 0) &&
+		!(adev->apu_flags & AMD_APU_IS_RAVEN))) &&
+		amdgpu_sg_display != 0) {

Looks like a good idea to me, but please double check your coding style settings. The second line of an "if (" should be indented so that it starts after the "(" of the previous line.

Additional to that this check actually looks quite messy to me and should probably be converted to always using the IP version instead of the asic_type.

Regards,
Christian.

Quoted 39 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -30
  		init_data.flags.gpu_vm_support = true;
-		break;
-	default:
-		switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
-		case IP_VERSION(1, 0, 0):
-		case IP_VERSION(1, 0, 1):
-			/* enable S/G on PCO and RV2 */
-			if ((adev->apu_flags & AMD_APU_IS_RAVEN2) ||
-			    (adev->apu_flags & AMD_APU_IS_PICASSO))
-				init_data.flags.gpu_vm_support = true;
-			break;
-		case IP_VERSION(2, 1, 0):
-		case IP_VERSION(3, 0, 1):
-		case IP_VERSION(3, 1, 2):
-		case IP_VERSION(3, 1, 3):
-		case IP_VERSION(3, 1, 4):
-		case IP_VERSION(3, 1, 5):
-		case IP_VERSION(3, 1, 6):
-		case IP_VERSION(3, 5, 0):
-			init_data.flags.gpu_vm_support = true;
-			break;
-		default:
-			break;
-		}
-		break;
-	}
-	if (init_data.flags.gpu_vm_support &&
-	    (amdgpu_sg_display == 0))
-		init_data.flags.gpu_vm_support = false;
-
-	if (init_data.flags.gpu_vm_support)
  		adev->mode_info.gpu_vm_support = true;
+	} else {
+		init_data.flags.gpu_vm_support = false;
+		adev->mode_info.gpu_vm_support = false;
+	}
 
  	if (amdgpu_dc_feature_mask & DC_FBC_MASK)
  		init_data.flags.fbc_support = true;
#2 lore raw
Quoted 32 lines · Christian König

Am 27.09.23 um 07:41 schrieb Yifan Zhang:

Quoted 15 lines

With S/G display becomes stable, enable S/G display for recent APUs by default rather than white list.

---
  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 +++++--------------
  1 file changed, 10 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 7e6a693d6369..241fd8defdee 100644
@@ -1626,41 +1626,18 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
              break;
      }

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 1634

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -3
 
-     switch (adev->asic_type) {
-     case CHIP_CARRIZO:
-     case CHIP_STONEY:
+     if ((adev->asic_type == CHIP_CARRIZO ||
+             adev->asic_type == CHIP_STONEY ||
+             ((adev->flags & AMD_IS_APU) &&
+             amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(1, 0, 0) &&
+             !(adev->apu_flags & AMD_APU_IS_RAVEN))) &&
+             amdgpu_sg_display != 0) {

Looks like a good idea to me, but please double check your coding style settings. The second line of an "if (" should be indented so that it starts after the "(" of the previous line.

Quoted 3 lines

Additional to that this check actually looks quite messy to me and should probably be converted to always using the IP version instead of the asic_type.

Or just explicitly disable it on the handful or pre-CZ chips that don't actually support it.
E.g.,

switch (asic_type) {
case CHIP_KAVERI:
case CHIP_KABINI:
case CHIP_MULLINS:
vm = false;
break;
case CHIP_RAVEN:
if (apu_flags & AMD_APU_IS_RAVEN)

       vm = false;
   else
       vm = amdgpu_sg_display != 0;

break;
default:
vm = (amdgpu_sg_display != 0) && (flags && AMD_IS_APU); break;

}

Quoted 44 lines

Regards,
Christian.

Quoted 39 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -30
              init_data.flags.gpu_vm_support = true;
-             break;
-     default:
-             switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
-             case IP_VERSION(1, 0, 0):
-             case IP_VERSION(1, 0, 1):
-                     /* enable S/G on PCO and RV2 */
-                     if ((adev->apu_flags & AMD_APU_IS_RAVEN2) ||
-                         (adev->apu_flags & AMD_APU_IS_PICASSO))
-                             init_data.flags.gpu_vm_support = true;
-                     break;
-             case IP_VERSION(2, 1, 0):
-             case IP_VERSION(3, 0, 1):
-             case IP_VERSION(3, 1, 2):
-             case IP_VERSION(3, 1, 3):
-             case IP_VERSION(3, 1, 4):
-             case IP_VERSION(3, 1, 5):
-             case IP_VERSION(3, 1, 6):
-             case IP_VERSION(3, 5, 0):
-                     init_data.flags.gpu_vm_support = true;
-                     break;
-             default:
-                     break;
-             }
-             break;
-     }
-     if (init_data.flags.gpu_vm_support &&
-         (amdgpu_sg_display == 0))
-             init_data.flags.gpu_vm_support = false;
-
-     if (init_data.flags.gpu_vm_support)
              adev->mode_info.gpu_vm_support = true;
+     } else {
+             init_data.flags.gpu_vm_support = false;
+             adev->mode_info.gpu_vm_support = false;
+     }
 
      if (amdgpu_dc_feature_mask & DC_FBC_MASK)
              init_data.flags.fbc_support = true;
#3 lore raw

[AMD Official Use Only - General]

Good idea ! Thanks.

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, September 27, 2023 9:13 PM
To: Koenig, Christian <[email protected]>
Cc: Zhang, Yifan <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>
Subject: Re: [PATCH] drm/amd/display: enable S/G display for for recent APUs by default

Quoted 33 lines · Christian König

Am 27.09.23 um 07:41 schrieb Yifan Zhang:

Quoted 16 lines

With S/G display becomes stable, enable S/G display for recent APUs by default rather than white list.

---
  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 +++++--------------
  1 file changed, 10 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 7e6a693d6369..241fd8defdee 100644
@@ -1626,41 +1626,18 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
              break;
      }

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 1634

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -3
 
-     switch (adev->asic_type) {
-     case CHIP_CARRIZO:
-     case CHIP_STONEY:
+     if ((adev->asic_type == CHIP_CARRIZO ||
+             adev->asic_type == CHIP_STONEY ||
+             ((adev->flags & AMD_IS_APU) &&
+             amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(1, 0, 0) &&
+             !(adev->apu_flags & AMD_APU_IS_RAVEN))) &&
+             amdgpu_sg_display != 0) {

Looks like a good idea to me, but please double check your coding style settings. The second line of an "if (" should be indented so that it starts after the "(" of the previous line.

Quoted 3 lines

Additional to that this check actually looks quite messy to me and should probably be converted to always using the IP version instead of the asic_type.

Or just explicitly disable it on the handful or pre-CZ chips that don't actually support it. E.g.,

switch (asic_type) {
case CHIP_KAVERI:
case CHIP_KABINI:
case CHIP_MULLINS:
vm = false;
break;
case CHIP_RAVEN:
if (apu_flags & AMD_APU_IS_RAVEN)

       vm = false;
   else
       vm = amdgpu_sg_display != 0;

break;
default:
vm = (amdgpu_sg_display != 0) && (flags && AMD_IS_APU); break;

}

Quoted 44 lines

Regards,
Christian.

Quoted 39 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -30
              init_data.flags.gpu_vm_support = true;
-             break;
-     default:
-             switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
-             case IP_VERSION(1, 0, 0):
-             case IP_VERSION(1, 0, 1):
-                     /* enable S/G on PCO and RV2 */
-                     if ((adev->apu_flags & AMD_APU_IS_RAVEN2) ||
-                         (adev->apu_flags & AMD_APU_IS_PICASSO))
-                             init_data.flags.gpu_vm_support = true;
-                     break;
-             case IP_VERSION(2, 1, 0):
-             case IP_VERSION(3, 0, 1):
-             case IP_VERSION(3, 1, 2):
-             case IP_VERSION(3, 1, 3):
-             case IP_VERSION(3, 1, 4):
-             case IP_VERSION(3, 1, 5):
-             case IP_VERSION(3, 1, 6):
-             case IP_VERSION(3, 5, 0):
-                     init_data.flags.gpu_vm_support = true;
-                     break;
-             default:
-                     break;
-             }
-             break;
-     }
-     if (init_data.flags.gpu_vm_support &&
-         (amdgpu_sg_display == 0))
-             init_data.flags.gpu_vm_support = false;
-
-     if (init_data.flags.gpu_vm_support)
              adev->mode_info.gpu_vm_support = true;
+     } else {
+             init_data.flags.gpu_vm_support = false;
+             adev->mode_info.gpu_vm_support = false;
+     }
 
      if (amdgpu_dc_feature_mask & DC_FBC_MASK)
              init_data.flags.fbc_support = true;