Skip to contentSkip to conversation

drm/amdgpu/display: drop the reduction loop when setting the sync groups

PATCH In review Alex Deucher 2 participants 4 messages May 28, 2020 – May 29, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/display: drop the reduction loop when setting the sync groups

The logic for blanked is not the same as having a plane_state. Technically you can drive an OTG without anything connected in the front end and it'll just draw out the back color which is distinct from having the OTG be blanked. If we add planes or unblank the OTG later then we'll still want the synchronization.

Fixes 5fc0cbfad45648 ("drm/amd/display: determine if a pipe is synced by plane state")
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -8
index 04c3d9f7e323..6279520f7873 100644
@@ -1040,14 +1040,6 @@ static void program_timing_sync(
 				status->timing_sync_info.master = false;
 
 		}
-		/* remove any other pipes with plane as they have already been synced */
-		for (j = j + 1; j < group_size; j++) {
-			if (pipe_set[j]->plane_state) {
-				group_size--;
-				pipe_set[j] = pipe_set[group_size];
-				j--;
-			}
-		}
 
 		if (group_size > 1) {
 			dc->hwss.enable_timing_synchronization(
Signature · 6 lines
2.25.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw
Quoted 19 lines · Alex Deucher

The logic for blanked is not the same as having a plane_state. Technically you can drive an OTG without anything connected in the front end and it'll just draw out the back color which is distinct from having the OTG be blanked. If we add planes or unblank the OTG later then we'll still want the synchronization.

Fixes 5fc0cbfad45648 ("drm/amd/display: determine if a pipe is synced by plane state")
  drivers/gpu/drm/amd/display/dc/core/dc.c | 8 --------
  1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -0
index 04c3d9f7e323..6279520f7873 100644
@@ -1040,14 +1040,6 @@ static void program_timing_sync(
  				status->timing_sync_info.master = false;

drivers/gpu/drm/amd/display/dc/core/dc.c static void program_timing_sync( · line 1050

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -8
 
  		}
-		/* remove any other pipes with plane as they have already been synced */
-		for (j = j + 1; j < group_size; j++) {
-			if (pipe_set[j]->plane_state) {
-				group_size--;
-				pipe_set[j] = pipe_set[group_size];
-				j--;
-			}
-		}

Looking at this again, I think I may understand the issue this was trying to work around.

If we try to force timing synchronization on displays that are currently active then this is going to force reset the vertical position, resulting in screen corruption.

So what this logic was attempting to do was ensure that timing synchronization only happens when committing two streams at a time without any image on the screen.

Maybe it'd be best to just blank these streams out first, but for now, let's actually go back to fixing this by applying the actual dpg/tg check that Wenjing suggests, something like:

if (pool->opps[i]->funcs->dpg_is_blanked)
s.blank_enabled =

pool->opps[i]->funcs->dpg_is_blanked(pool->opps[i]);
           else
                s.blank_enabled = tg->funcs->is_blanked(tg);

The reason why we have this issue in the first place is because amdgpu_dm usually commits a dc_state with the planes already in it instead of committing them later, so plane_state not being NULL is typically true.

Regards,
Nicholas Kazlauskas

drivers/gpu/drm/amd/display/dc/core/dc.c static void program_timing_sync(

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -0
  		if (group_size > 1) {
  			dc->hwss.enable_timing_synchronization(
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
Quoted 48 lines · Nicholas
Quoted 19 lines · Alex Deucher

The logic for blanked is not the same as having a plane_state. Technically you can drive an OTG without anything connected in the front end and it'll just draw out the back color which is distinct from having the OTG be blanked. If we add planes or unblank the OTG later then we'll still want the synchronization.

Fixes 5fc0cbfad45648 ("drm/amd/display: determine if a pipe is synced by plane state")
  drivers/gpu/drm/amd/display/dc/core/dc.c | 8 --------
  1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -0
index 04c3d9f7e323..6279520f7873 100644
@@ -1040,14 +1040,6 @@ static void program_timing_sync(
                              status->timing_sync_info.master = false;

drivers/gpu/drm/amd/display/dc/core/dc.c static void program_timing_sync( · line 1050

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -8
 
              }
-             /* remove any other pipes with plane as they have already been synced */
-             for (j = j + 1; j < group_size; j++) {
-                     if (pipe_set[j]->plane_state) {
-                             group_size--;
-                             pipe_set[j] = pipe_set[group_size];
-                             j--;
-                     }
-             }

Looking at this again, I think I may understand the issue this was trying to work around.

If we try to force timing synchronization on displays that are currently active then this is going to force reset the vertical position, resulting in screen corruption.

So what this logic was attempting to do was ensure that timing synchronization only happens when committing two streams at a time without any image on the screen.

Maybe it'd be best to just blank these streams out first, but for now, let's actually go back to fixing this by applying the actual dpg/tg check that Wenjing suggests, something like:

Quoted 6 lines
    if (pool->opps[i]->funcs->dpg_is_blanked)
                 s.blank_enabled =
pool->opps[i]->funcs->dpg_is_blanked(pool->opps[i]);
            else
                 s.blank_enabled = tg->funcs->is_blanked(tg);

Hmm, it's not clear to me where this code needs to go. Can you point me in the right direction or provide a quick patch?

Thanks,

Alex

Quoted 15 lines

The reason why we have this issue in the first place is because amdgpu_dm usually commits a dc_state with the planes already in it instead of committing them later, so plane_state not being NULL is typically true.

Regards,
Nicholas Kazlauskas

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -0
              if (group_size > 1) {
                      dc->hwss.enable_timing_synchronization(
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
Quoted 57 lines · Alex Deucher
Quoted 48 lines · Nicholas
Quoted 19 lines · Alex Deucher

The logic for blanked is not the same as having a plane_state. Technically you can drive an OTG without anything connected in the front end and it'll just draw out the back color which is distinct from having the OTG be blanked. If we add planes or unblank the OTG later then we'll still want the synchronization.

Fixes 5fc0cbfad45648 ("drm/amd/display: determine if a pipe is synced by plane state")
   drivers/gpu/drm/amd/display/dc/core/dc.c | 8 --------
   1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -0
index 04c3d9f7e323..6279520f7873 100644
@@ -1040,14 +1040,6 @@ static void program_timing_sync(
                               status->timing_sync_info.master = false;

drivers/gpu/drm/amd/display/dc/core/dc.c static void program_timing_sync( · line 1050

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -8
 
               }
-             /* remove any other pipes with plane as they have already been synced */
-             for (j = j + 1; j < group_size; j++) {
-                     if (pipe_set[j]->plane_state) {
-                             group_size--;
-                             pipe_set[j] = pipe_set[group_size];
-                             j--;
-                     }
-             }

Looking at this again, I think I may understand the issue this was trying to work around.

If we try to force timing synchronization on displays that are currently active then this is going to force reset the vertical position, resulting in screen corruption.

So what this logic was attempting to do was ensure that timing synchronization only happens when committing two streams at a time without any image on the screen.

Maybe it'd be best to just blank these streams out first, but for now, let's actually go back to fixing this by applying the actual dpg/tg check that Wenjing suggests, something like:

Quoted 6 lines
     if (pool->opps[i]->funcs->dpg_is_blanked)
                  s.blank_enabled =
pool->opps[i]->funcs->dpg_is_blanked(pool->opps[i]);
             else
                  s.blank_enabled = tg->funcs->is_blanked(tg);
Quoted 6 lines

Hmm, it's not clear to me where this code needs to go. Can you point me in the right direction or provide a quick patch?

Thanks,

Alex

The old code used to check !tg->funcs->is_blanked(tg) ie. to drop the pipe from the group if it's currently active.

The issue was that on newer ASIC it's now the DPG that's the indicator from the hardware side, so we should replace the !plane_state check with a check first for !dpg_is_blanked and then !is_blanked if the DPG doesn't exist.

Regards,
Nicholas Kazlauskas

Quoted 8 lines
Quoted 8 lines

The reason why we have this issue in the first place is because amdgpu_dm usually commits a dc_state with the planes already in it instead of committing them later, so plane_state not being NULL is typically true.

Quoted 8 lines
Quoted 8 lines

Regards,
Nicholas Kazlauskas

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -0
               if (group_size > 1) {
                       dc->hwss.enable_timing_synchronization(
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx