diff mbox series

[v2,14/22] drm/msm/dpu: Require modeset if clone mode status changes

Message ID 20240924-concurrent-wb-v2-14-7849f900e863@quicinc.com (mailing list archive)
State Superseded
Headers show
Series drm/msm/dpu: Add Concurrent Writeback Support for DPU 10.x+ | expand

Commit Message

Jessica Zhang Sept. 24, 2024, 10:59 p.m. UTC
If the clone mode enabled status is changing, a modeset needs to happen
so that the resources can be reassigned

Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Dmitry Baryshkov Sept. 24, 2024, 11:25 p.m. UTC | #1
On Tue, Sep 24, 2024 at 03:59:30PM GMT, Jessica Zhang wrote:
> If the clone mode enabled status is changing, a modeset needs to happen
> so that the resources can be reassigned

Sima's comment regarding crtc_state->mode_changed seems to be ignored...

> 
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index a7850bf844db..f20e44e9fc05 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -1268,6 +1268,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>  {
>  	struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
>  									  crtc);
> +	struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
> +									      crtc);
>  	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
>  	struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc_state);
>  
> @@ -1279,6 +1281,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>  	int rc = 0;
>  
>  	bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
> +	bool clone_mode_requested = drm_crtc_in_clone_mode(old_crtc_state);
> +	bool clone_mode_enabled = drm_crtc_in_clone_mode(crtc_state);
>  
>  	/* there might be cases where encoder needs a modeset too */
>  	drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask) {
> @@ -1286,6 +1290,10 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>  			crtc_state->mode_changed = true;
>  	}
>  
> +	if ((clone_mode_requested && !clone_mode_enabled) ||
> +	    (!clone_mode_requested && clone_mode_enabled))
> +		crtc_state->mode_changed = true;
> +
>  	if (drm_atomic_crtc_needs_modeset(crtc_state)) {
>  		rc = dpu_crtc_assign_resources(crtc, crtc_state);
>  		if (rc < 0)
> 
> -- 
> 2.34.1
>
Abhinav Kumar Sept. 25, 2024, 12:05 a.m. UTC | #2
On 9/24/2024 4:25 PM, Dmitry Baryshkov wrote:
> On Tue, Sep 24, 2024 at 03:59:30PM GMT, Jessica Zhang wrote:
>> If the clone mode enabled status is changing, a modeset needs to happen
>> so that the resources can be reassigned
> 
> Sima's comment regarding crtc_state->mode_changed seems to be ignored...
> 

Not ignored. One of us has to take that up. There is a broader cleanup 
required for that.

We can sync up on how to tackle this : whether it needs to be in this 
series or push another one cleaning up all the instances.

>>
>> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
>> ---
>>   drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
>> index a7850bf844db..f20e44e9fc05 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
>> @@ -1268,6 +1268,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>>   {
>>   	struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
>>   									  crtc);
>> +	struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
>> +									      crtc);
>>   	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
>>   	struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc_state);
>>   
>> @@ -1279,6 +1281,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>>   	int rc = 0;
>>   
>>   	bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
>> +	bool clone_mode_requested = drm_crtc_in_clone_mode(old_crtc_state);
>> +	bool clone_mode_enabled = drm_crtc_in_clone_mode(crtc_state);
>>   
>>   	/* there might be cases where encoder needs a modeset too */
>>   	drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask) {
>> @@ -1286,6 +1290,10 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>>   			crtc_state->mode_changed = true;
>>   	}
>>   
>> +	if ((clone_mode_requested && !clone_mode_enabled) ||
>> +	    (!clone_mode_requested && clone_mode_enabled))
>> +		crtc_state->mode_changed = true;
>> +
>>   	if (drm_atomic_crtc_needs_modeset(crtc_state)) {
>>   		rc = dpu_crtc_assign_resources(crtc, crtc_state);
>>   		if (rc < 0)
>>
>> -- 
>> 2.34.1
>>
>
Dmitry Baryshkov Sept. 25, 2024, 8:28 a.m. UTC | #3
On Tue, Sep 24, 2024 at 05:05:43PM GMT, Abhinav Kumar wrote:
> 
> 
> On 9/24/2024 4:25 PM, Dmitry Baryshkov wrote:
> > On Tue, Sep 24, 2024 at 03:59:30PM GMT, Jessica Zhang wrote:
> > > If the clone mode enabled status is changing, a modeset needs to happen
> > > so that the resources can be reassigned
> > 
> > Sima's comment regarding crtc_state->mode_changed seems to be ignored...
> > 
> 
> Not ignored. One of us has to take that up. There is a broader cleanup
> required for that.

At least then it should be mentioned in the commit message or under the
commit message.

> 
> We can sync up on how to tackle this : whether it needs to be in this series
> or push another one cleaning up all the instances.


Yes, let's sync separately.

> 
> > > 
> > > Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> > > ---
> > >   drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 8 ++++++++
> > >   1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > > index a7850bf844db..f20e44e9fc05 100644
> > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > > @@ -1268,6 +1268,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
> > >   {
> > >   	struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
> > >   									  crtc);
> > > +	struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
> > > +									      crtc);
> > >   	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
> > >   	struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc_state);
> > > @@ -1279,6 +1281,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
> > >   	int rc = 0;
> > >   	bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
> > > +	bool clone_mode_requested = drm_crtc_in_clone_mode(old_crtc_state);
> > > +	bool clone_mode_enabled = drm_crtc_in_clone_mode(crtc_state);
> > >   	/* there might be cases where encoder needs a modeset too */
> > >   	drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask) {
> > > @@ -1286,6 +1290,10 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
> > >   			crtc_state->mode_changed = true;
> > >   	}
> > > +	if ((clone_mode_requested && !clone_mode_enabled) ||
> > > +	    (!clone_mode_requested && clone_mode_enabled))
> > > +		crtc_state->mode_changed = true;
> > > +
> > >   	if (drm_atomic_crtc_needs_modeset(crtc_state)) {
> > >   		rc = dpu_crtc_assign_resources(crtc, crtc_state);
> > >   		if (rc < 0)
> > > 
> > > -- 
> > > 2.34.1
> > > 
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index a7850bf844db..f20e44e9fc05 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1268,6 +1268,8 @@  static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
 {
 	struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
 									  crtc);
+	struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
+									      crtc);
 	struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
 	struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc_state);
 
@@ -1279,6 +1281,8 @@  static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
 	int rc = 0;
 
 	bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
+	bool clone_mode_requested = drm_crtc_in_clone_mode(old_crtc_state);
+	bool clone_mode_enabled = drm_crtc_in_clone_mode(crtc_state);
 
 	/* there might be cases where encoder needs a modeset too */
 	drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask) {
@@ -1286,6 +1290,10 @@  static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
 			crtc_state->mode_changed = true;
 	}
 
+	if ((clone_mode_requested && !clone_mode_enabled) ||
+	    (!clone_mode_requested && clone_mode_enabled))
+		crtc_state->mode_changed = true;
+
 	if (drm_atomic_crtc_needs_modeset(crtc_state)) {
 		rc = dpu_crtc_assign_resources(crtc, crtc_state);
 		if (rc < 0)