Skip to contentSkip to conversation

drm/amd/display: remove need of modeset flag for overlay planes

PATCH In review Shirish S 5 participants 9 messages Apr 27, 2018 – May 9, 2018 6 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 drm/amd/display: remove need of modeset flag for overlay planes

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.

After deferring, this patch eliminates the dependency on the flag for overlay planes.

This has to be done in stages as its a pretty complex and requires thorough testing before we free primary planes as well from dependency on modeset flag.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -3
index 1a63c04..87b661d 100644
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
 		}
 		spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 
-		if (!pflip_needed) {
+		if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {
 			WARN_ON(!dm_new_plane_state->dc_state);
 
 			plane_states_constructed[planes_count] = dm_new_plane_state->dc_state;
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc *dc,
 
 		/* Remove any changed/removed planes */
 		if (!enable) {
-			if (pflip_needed)
+			if (pflip_needed &&
+			    plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
 				continue;
 
 			if (!old_plane_crtc)
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc *dc,
 			if (!dm_new_crtc_state->stream)
 				continue;
 
-			if (pflip_needed)
+			if (pflip_needed &&
+			    plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
 				continue;
 
 			WARN_ON(dm_new_plane_state->dc_state);
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1524824823-24271-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 10 lines · Shirish S

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.

After deferring, this patch eliminates the dependency on the flag for overlay planes.

This has to be done in stages as its a pretty complex and requires

thorough

Review

Quoted 9 lines

testing before we free primary planes as well from dependency on modeset flag.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct

Quoted 4 lines

index 1a63c04..87b661d 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct

drm_atomic_state *state,

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,

Quoted 5 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
                 }
                 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 
-               if (!pflip_needed) {
+               if (!pflip_needed || plane->type ==

DRM_PLANE_TYPE_OVERLAY) {

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,

Quoted 3 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
                         WARN_ON(!dm_new_plane_state->dc_state);
 
                         plane_states_constructed[planes_count] =

dm_new_plane_state->dc_state;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4888

Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc *dc,
 
                 /* Remove any changed/removed planes */
                 if (!enable) {
-                       if (pflip_needed)
+                       if (pflip_needed &&
+                           plane && plane->type !=

DRM_PLANE_TYPE_OVERLAY)

nit: I don't think we need to check that plane is non-NULL

Stéphane

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4936

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
                                 continue;
 
                         if (!old_plane_crtc)
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc *dc,
                         if (!dm_new_crtc_state->stream)
                                 continue;
 
-                       if (pflip_needed)
+                       if (pflip_needed &&
+                           plane && plane->type !=

DRM_PLANE_TYPE_OVERLAY)

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -1
                                 continue;
 
                         WARN_ON(dm_new_plane_state->dc_state);
--

2.7.4

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

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

A message that is not in the archive (sent off-list or not yet received): CADMs+9a0R1dbWyfwK-rtcQ05oTJnUCYa51ZgRDQcUaDfj1znhg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 40 lines · Stéphane Marchesin
Quoted 8 lines · Shirish S

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.
After deferring, this patch eliminates the dependency on the flag for overlay planes.
This has to be done in stages as its a pretty complex and requires

thorough

Review

Quoted 7 lines

testing before we free primary planes as well from dependency on modeset flag.

---
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---
   1 file changed, 5 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct

Quoted 4 lines

index 1a63c04..87b661d 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct

drm_atomic_state *state,

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
                  }
                  spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
-               if (!pflip_needed) {
+               if (!pflip_needed || plane->type ==

DRM_PLANE_TYPE_OVERLAY) {

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct · line 4178

Quoted 2 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
                          WARN_ON(!dm_new_plane_state->dc_state);
                          plane_states_constructed[planes_count] =

dm_new_plane_state->dc_state;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4887

Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc *dc,
                  /* Remove any changed/removed planes */
                  if (!enable) {
-                       if (pflip_needed)
+                       if (pflip_needed &&
+                           plane && plane->type !=

DRM_PLANE_TYPE_OVERLAY)

Quoted 1 line

nit: I don't think we need to check that plane is non-NULL

Agree, was a bit over cautious.
Have removed it in V2.
Thanks.
Regards,
Shirish S

Quoted 19 lines

Stéphane

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4935

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
                                  continue;
                          if (!old_plane_crtc)
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc *dc,
                          if (!dm_new_crtc_state->stream)
                                  continue;
-                       if (pflip_needed)
+                       if (pflip_needed &&
+                           plane && plane->type !=

DRM_PLANE_TYPE_OVERLAY)

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -1
                                  continue;
                          WARN_ON(dm_new_plane_state->dc_state);
--

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

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

#5 lore raw
In reply to a message not in the archive
Quoted 9 lines · Shirish S

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.

After deferring, this patch eliminates the dependency on the flag for overlay planes.

Apologies for the late response. I had to think about this patch for a long time since I'm not quite comfortable with it.

Quoted 14 lines

This has to be done in stages as its a pretty complex and requires thorough testing before we free primary planes as well from dependency on modeset flag.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 1a63c04..87b661d 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · line 4177

Quoted 5 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
 		}
 		spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 
-		if (!pflip_needed) {
+		if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {

Does this mean that whenever we have an overlay plane we won't do amdgpu_dm_do_flip but commit_planes_to_stream instead? Is this really the behavior we want?

commit_planes_to_stream was intended to program a new surface on a modeset whereas amdgpu_dm_do_flip was intended for pageflips. If we use commit_planes_to_stream we end up losing things like the immediate_flip flag, as well as the wait for the right moment to program the flip that amdgpu_dm_do_flip does. Even more importantly we won't wait for fences (reservation_object_wait_timeout_rcu).

Harry

Quoted 15 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
 			WARN_ON(!dm_new_plane_state->dc_state);
 
 			plane_states_constructed[planes_count] = dm_new_plane_state->dc_state;
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc *dc,
 
 		/* Remove any changed/removed planes */
 		if (!enable) {
-			if (pflip_needed)
+			if (pflip_needed &&
+			    plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
 				continue;
 
 			if (!old_plane_crtc)

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4939

Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc *dc,
 			if (!dm_new_crtc_state->stream)
 				continue;
 
-			if (pflip_needed)
+			if (pflip_needed &&
+			    plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
 				continue;
 
 			WARN_ON(dm_new_plane_state->dc_state);

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

A message that is not in the archive (sent off-list or not yet received): b94fe6bd-5d9b-9f61-42d8-c47df54d9346-5C7GfCeVMHo@public.gmane.org

#7 lore raw
Quoted 29 lines · Harry Wentland
Quoted 9 lines · Shirish S

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.

After deferring, this patch eliminates the dependency on the flag for overlay planes.

Apologies for the late response. I had to think about this patch for a long time since I'm not quite comfortable with it.

Quoted 17 lines

This has to be done in stages as its a pretty complex and requires thorough testing before we free primary planes as well from dependency on modeset flag.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 1a63c04..87b661d 100644
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
  		}
  		spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 
Quoted 5 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · line 4177

Quoted 2 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
-		if (!pflip_needed) {
+		if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {

Does this mean that whenever we have an overlay plane we won't do amdgpu_dm_do_flip but commit_planes_to_stream instead? Is this really the behavior we want?

commit_planes_to_stream was intended to program a new surface on a modeset whereas amdgpu_dm_do_flip was intended for pageflips.

Need of "modeset" flag to program new surface is what we want to fix in this patch for underlay plane and in next stages, fix manifestations caused by this approach as and when seen. Since the user space doesn't send modeset flag for new surface, hence to program it, this patch checks the plane type to construct planes_count before calling commit_planes_to_stream().

If we use commit_planes_to_stream we end up losing things like the immediate_flip flag, as well as the wait for the right moment to program the flip that amdgpu_dm_do_flip does.

From the code, amdgpu_dm_do_flip does what you mentioned only for primary plane and hence either way its not set for underlay.

Regards,
Shirish S

Quoted 28 lines

Even more importantly we won't wait for fences (reservation_object_wait_timeout_rcu).

Harry

Quoted 24 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -2
  			WARN_ON(!dm_new_plane_state->dc_state);
 
  			plane_states_constructed[planes_count] = dm_new_plane_state->dc_state;
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc *dc,
 
  		/* Remove any changed/removed planes */
  		if (!enable) {
-			if (pflip_needed)
+			if (pflip_needed &&
+			    plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
  				continue;
 
  			if (!old_plane_crtc)
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc *dc,
  			if (!dm_new_crtc_state->stream)
  				continue;
 
-			if (pflip_needed)
+			if (pflip_needed &&
+			    plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
  				continue;
 
  			WARN_ON(dm_new_plane_state->dc_state);
Signature · 7 lines
Regards,
Shirish S

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

A message that is not in the archive (sent off-list or not yet received): 42b267f5-93c2-1682-af94-0cb9fc42ebb8-5C7GfCeVMHo@public.gmane.org

#9 lore raw
Quoted 35 lines · Shirish
Quoted 32 lines · Harry Wentland
Quoted 9 lines · Shirish S

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.

After deferring, this patch eliminates the dependency on the flag for overlay planes.

Apologies for the late response. I had to think about this patch for a long time since I'm not quite comfortable with it.

Quoted 14 lines

This has to be done in stages as its a pretty complex and requires thorough testing before we free primary planes as well from dependency on modeset flag.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---

  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 1a63c04..87b661d 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · line 4177

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
           }
           spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
   -        if (!pflip_needed) {
+        if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {

Does this mean that whenever we have an overlay plane we won't do amdgpu_dm_do_flip but commit_planes_to_stream instead? Is this really the behavior we want?

Quoted 4 lines
Quoted 1 line

commit_planes_to_stream was intended to program a new surface on a modeset whereas amdgpu_dm_do_flip was intended for pageflips.

Need of "modeset" flag to program new surface is what we want to fix in this patch for underlay plane and in next stages, fix manifestations caused by this approach as and when seen. Since the user space doesn't send modeset flag for new surface, hence to program it, this patch checks the plane type to construct planes_count before calling commit_planes_to_stream().

Looking at the allow_modeset flag was never quite right and we anticipated having to rework this when having to deal with things like multiple planes. What really has to happen is that we determine the surface_update_type in atomic_check and then use that in atomic_commit to either program the surface only (UPDATE_TYPE_FAST) without having to lock all pipes or to lock all pipes (see lock_and_validation_needed in amdgpu_dm_atomic_check) if we need to reprogram mode (UPDATE_TYPE_FULL). I don't remember exactly what UPDATE_TYPE_MED is used for.

I don't feel comfortable taking a shortcut for DRM_PLANE_TYPE_OVERLAY without first having a plan and patches for how to deal with the above-mentioned.

Bhawan and Andrey had a look at this before but it was never quite ready. The work was non-trivial and potentially impacts lots of configurations and scenarios if we don't get it right. If you're curious you can look at this change (apologies to everyone else for posting AMD-internal link): http://git.amd.com:8080/#/c/103931/11

Quoted 3 lines

 If we use commit_planes_to_stream we end up losing things like the immediate_flip flag, as well as the wait for the right moment to program the flip that amdgpu_dm_do_flip does.

From the code, amdgpu_dm_do_flip does what you mentioned only for primary plane and hence either way its not set for underlay.

The code wasn't designed with underlay in mind, so it will need work.

Harry

Quoted 18 lines

Regards,
Shirish S

Quoted 15 lines

  Even more importantly we won't wait for fences (reservation_object_wait_timeout_rcu).

Harry

Quoted 11 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
               WARN_ON(!dm_new_plane_state->dc_state);
                 plane_states_constructed[planes_count] = dm_new_plane_state->dc_state;
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc *dc,
             /* Remove any changed/removed planes */
           if (!enable) {
-            if (pflip_needed)
+            if (pflip_needed &&
+                plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
                   continue;
                 if (!old_plane_crtc)
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc *dc,
Quoted 9 lines
Quoted 8 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc,

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
               if (!dm_new_crtc_state->stream)
                   continue;
   -            if (pflip_needed)
+            if (pflip_needed &&
+                plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
                   continue;
                 WARN_ON(dm_new_plane_state->dc_state);
 

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

A message that is not in the archive (sent off-list or not yet received): 67135740-35e6-4090-8f07-a5247c09a4be-5C7GfCeVMHo@public.gmane.org

#11 lore raw
Quoted 43 lines · Harry Wentland
Quoted 34 lines · Shirish
Quoted 32 lines · Harry Wentland
Quoted 9 lines · Shirish S

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.

After deferring, this patch eliminates the dependency on the flag for overlay planes.

Apologies for the late response. I had to think about this patch for a long time since I'm not quite comfortable with it.

Quoted 14 lines

This has to be done in stages as its a pretty complex and requires thorough testing before we free primary planes as well from dependency on modeset flag.

---
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---
   1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 1a63c04..87b661d 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · line 4177

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
           }
           spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
   -        if (!pflip_needed) {
+        if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {

Does this mean that whenever we have an overlay plane we won't do amdgpu_dm_do_flip but commit_planes_to_stream instead? Is this really the behavior we want?

Quoted 4 lines
Quoted 1 line

commit_planes_to_stream was intended to program a new surface on a modeset whereas amdgpu_dm_do_flip was intended for pageflips.

Need of "modeset" flag to program new surface is what we want to fix in this patch for underlay plane and in next stages, fix manifestations caused by this approach as and when seen. Since the user space doesn't send modeset flag for new surface, hence to program it, this patch checks the plane type to construct planes_count before calling commit_planes_to_stream().

Looking at the allow_modeset flag was never quite right and we anticipated having to rework this when having to deal with things like multiple planes. What really has to happen is that we determine the surface_update_type in atomic_check and then use that in atomic_commit to either program the surface only (UPDATE_TYPE_FAST) without having to lock all pipes or to lock all pipes (see lock_and_validation_needed in amdgpu_dm_atomic_check) if we need to reprogram mode (UPDATE_TYPE_FULL). I don't remember exactly what UPDATE_TYPE_MED is used for.

I don't feel comfortable taking a shortcut for DRM_PLANE_TYPE_OVERLAY without first having a plan and patches for how to deal with the above-mentioned.

Quoted 8 lines

Bhawan and Andrey had a look at this before but it was never quite ready. The work was non-trivial and potentially impacts lots of configurations and scenarios if we don't get it right. If you're curious you can look at this change (apologies to everyone else for posting AMD-internal link): http://git.amd.com:8080/#/c/103931/11

Quoted 3 lines

 If we use commit_planes_to_stream we end up losing things like the immediate_flip flag, as well as the wait for the right moment to program the flip that amdgpu_dm_do_flip does.

From the code, amdgpu_dm_do_flip does what you mentioned only for primary plane and hence either way its not set for underlay.

The code wasn't designed with underlay in mind, so it will need work.

Harry

I support Harry's comments, we definitely need to strive to remove dependency on page_fleep needed flag, AFAIK we are the only ATOMIC KMS driver which makes a distinction between page fleep and other surface updates, but it's better to sit and create a general plan of how to address it for all type of planes instead of patching for overlay only.

Andrey

Quoted 18 lines
Quoted 18 lines

Regards,
Shirish S

Quoted 15 lines

  Even more importantly we won't wait for fences (reservation_object_wait_timeout_rcu).

Harry

Quoted 11 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
               WARN_ON(!dm_new_plane_state->dc_state);
                 plane_states_constructed[planes_count] = dm_new_plane_state->dc_state;
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc *dc,
             /* Remove any changed/removed planes */
           if (!enable) {
-            if (pflip_needed)
+            if (pflip_needed &&
+                plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
                   continue;
                 if (!old_plane_crtc)
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc *dc,
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4939

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
               if (!dm_new_crtc_state->stream)
                   continue;
   -            if (pflip_needed)
+            if (pflip_needed &&
+                plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
                   continue;
                 WARN_ON(dm_new_plane_state->dc_state);
 

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

A message that is not in the archive (sent off-list or not yet received): b3d563a3-31a9-45d1-492d-4d2a1ce9d7bb-5C7GfCeVMHo@public.gmane.org

#13 lore raw
Quoted 40 lines · Andrey Grodzovsky
Quoted 37 lines · Harry Wentland
Quoted 36 lines · Shirish
Quoted 34 lines · Harry Wentland
Quoted 9 lines · Shirish S

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.

After deferring, this patch eliminates the dependency on the flag for overlay planes.

Apologies for the late response. I had to think about this patch for a long time since I'm not quite comfortable with it.

Quoted 14 lines

This has to be done in stages as its a pretty complex and requires thorough testing before we free primary planes as well from dependency on modeset flag.

---
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---

   1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 1a63c04..87b661d 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct · line 4179

Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct 
 drm_atomic_state *state,
            }
 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
    -        if (!pflip_needed) {
+        if (!pflip_needed || plane->type == 
 DRM_PLANE_TYPE_OVERLAY) {

Does this mean that whenever we have an overlay plane we won't do amdgpu_dm_do_flip but commit_planes_to_stream instead? Is this really the behavior we want?

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

commit_planes_to_stream was intended to program a new surface on a modeset whereas amdgpu_dm_do_flip was intended for pageflips.

Need of "modeset" flag to program new surface is what we want to fix in this patch for underlay plane and in next stages, fix manifestations caused by this approach as and when seen. Since the user space doesn't send modeset flag for new surface, hence to program it, this patch checks the plane type to construct planes_count before calling commit_planes_to_stream().

Looking at the allow_modeset flag was never quite right and we anticipated having to rework this when having to deal with things like multiple planes. What really has to happen is that we determine the surface_update_type in atomic_check and then use that in atomic_commit to either program the surface only (UPDATE_TYPE_FAST) without having to lock all pipes or to lock all pipes (see lock_and_validation_needed in amdgpu_dm_atomic_check) if we need to reprogram mode (UPDATE_TYPE_FULL). I don't remember exactly what UPDATE_TYPE_MED is used for.

True, any suggestions on what needs to be check to decide if the surface update has  to be FAST? Like plane_count, format or dc_state etc?

Quoted 7 lines
Quoted 7 lines

I don't feel comfortable taking a shortcut for DRM_PLANE_TYPE_OVERLAY without first having a plan and patches for how to deal with the above-mentioned.

Bhawan and Andrey had a look at this before but it was never quite ready. The work was non-trivial and potentially impacts lots of configurations and scenarios if we don't get it right. If you're curious you can look at this change (apologies to everyone else for posting AMD-internal link): http://git.amd.com:8080/#/c/103931/11

Quoted 3 lines

  If we use commit_planes_to_stream we end up losing things like the immediate_flip flag, as well as the wait for the right moment to program the flip that amdgpu_dm_do_flip does.

 From the code, amdgpu_dm_do_flip does what you mentioned only for primary plane and hence either way its not set for underlay.

Quoted 9 lines
Quoted 3 lines

The code wasn't designed with underlay in mind, so it will need work.

Harry

I support Harry's comments, we definitely need to strive to remove dependency on page_fleep needed flag, AFAIK we are the only ATOMIC KMS driver which makes a distinction between page fleep and other surface updates, but it's better to sit and create a general plan of how to address it for all type of planes instead of patching for overlay only.

Andrey

Is anybody working on removing the dependency on page_flip_needed flag ?
Since am working on stoney for chrome os, i have limited visibility or knowledge of its implications on other asics, hence to avoid regressions to other users i patched only the overlay path of it.

Some one who knows its inter-dependency on dc would be right to do it.
If you think its a long shot please re-consider my proposal of doing it in stages, i.e., removing overlay planes from dependency and then the primary since cursor updates is a but tricky and tied to primary plane. Regards,
Shirish S

Quoted 29 lines
Quoted 28 lines
Quoted 28 lines

Regards,
Shirish S

Quoted 25 lines

   Even more importantly we won't wait for fences (reservation_object_wait_timeout_rcu).

Harry

Quoted 21 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
 WARN_ON(!dm_new_plane_state->dc_state);

                 plane_states_constructed[planes_count] = dm_new_plane_state->dc_state;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -1
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc 
 *dc,
              /* Remove any changed/removed planes */
            if (!enable) {
-            if (pflip_needed)
+            if (pflip_needed &&
+                plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
                    continue;
                  if (!old_plane_crtc)
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc 
 *dc,
                if (!dm_new_crtc_state->stream)
                    continue;
    -            if (pflip_needed)
+            if (pflip_needed &&
+                plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
                    continue;
                  WARN_ON(dm_new_plane_state->dc_state);
Signature · 7 lines
Regards,
Shirish S

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#14 lore raw
In reply to a message not in the archive
Quoted 6 lines · Shirish S

This patch is in continuation to the
"843e3c7 drm/amd/display: defer modeset check in dm_update_planes_state" where we started to eliminate the dependency on DRM_MODE_ATOMIC_ALLOW_MODESET to be set by the user space, which as such is not mandatory.

Quoted 8 lines

After deferring, this patch eliminates the dependency on the flag for overlay planes.

This has to be done in stages as its a pretty complex and requires thorough testing before we free primary planes as well from dependency on modeset flag.

After the offline discussion I'm okay to go ahead with this as it should be relatively self-contained and currently unblocks one use-case. We'll definitely need to address this code soon and find a good way to stop abusing the allow_modeset flag.

If this does cause unexpected fallout we can always revert and revisit.

Harry

Quoted 29 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -2
index 1a63c04..87b661d 100644
@@ -4174,7 +4174,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
 		}
 		spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 
-		if (!pflip_needed) {
+		if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {
 			WARN_ON(!dm_new_plane_state->dc_state);
 
 			plane_states_constructed[planes_count] = dm_new_plane_state->dc_state;
@@ -4884,7 +4884,8 @@ static int dm_update_planes_state(struct dc *dc,
 
 		/* Remove any changed/removed planes */
 		if (!enable) {
-			if (pflip_needed)
+			if (pflip_needed &&
+			    plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
 				continue;
 
 			if (!old_plane_crtc)

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_planes_state(struct dc *dc, · line 4939

Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4931,7 +4932,8 @@ static int dm_update_planes_state(struct dc *dc,
 			if (!dm_new_crtc_state->stream)
 				continue;
 
-			if (pflip_needed)
+			if (pflip_needed &&
+			    plane && plane->type != DRM_PLANE_TYPE_OVERLAY)
 				continue;
 
 			WARN_ON(dm_new_plane_state->dc_state);

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