Re: [Freedreno] [RFC PATCH v2 09/13] drm/msm/dpu: move pstate->pipe initialization to dpu_plane_atomic_check

2023-06-06 Thread Abhinav Kumar




On 5/24/2023 6:40 PM, Dmitry Baryshkov wrote:

On Thu, 25 May 2023 at 02:04, Abhinav Kumar  wrote:




On 5/24/2023 3:46 PM, Abhinav Kumar wrote:



On 3/20/2023 6:18 PM, Dmitry Baryshkov wrote:

In preparation to virtualized planes support, move pstate->pipe
initialization from dpu_plane_reset() to dpu_plane_atomic_check(). In
case of virtual planes the plane's pipe will not be known up to the
point of atomic_check() callback.

Signed-off-by: Dmitry Baryshkov 
---


Will legacy paths be broken with this? So lets say there is no
atomic_check we will not have a valid sspp anymore.


I think it should still work, even if goes through the modeset crtc, it
should still call drm_atomic_commit() internally which should have the
call to atomic_check, once you confirm this , i can ack this particular
change.


Can you please describe the scenario you have in mind? If I got you
correctly, you were asking about the non-commit IOCTLs. Because of the
atomic helpers being used (e.g. drm_atomic_helper_set_config()), they
will also result in a call to drm_atomic_commit(), which invokes
drm_atomic_check_only().



Yes, that was pretty much the scenario I was referring to, thanks for 
confirming.




Re: [Freedreno] [RFC PATCH v2 09/13] drm/msm/dpu: move pstate->pipe initialization to dpu_plane_atomic_check

2023-05-24 Thread Dmitry Baryshkov
On Thu, 25 May 2023 at 02:04, Abhinav Kumar  wrote:
>
>
>
> On 5/24/2023 3:46 PM, Abhinav Kumar wrote:
> >
> >
> > On 3/20/2023 6:18 PM, Dmitry Baryshkov wrote:
> >> In preparation to virtualized planes support, move pstate->pipe
> >> initialization from dpu_plane_reset() to dpu_plane_atomic_check(). In
> >> case of virtual planes the plane's pipe will not be known up to the
> >> point of atomic_check() callback.
> >>
> >> Signed-off-by: Dmitry Baryshkov 
> >> ---
> >
> > Will legacy paths be broken with this? So lets say there is no
> > atomic_check we will not have a valid sspp anymore.
>
> I think it should still work, even if goes through the modeset crtc, it
> should still call drm_atomic_commit() internally which should have the
> call to atomic_check, once you confirm this , i can ack this particular
> change.

Can you please describe the scenario you have in mind? If I got you
correctly, you were asking about the non-commit IOCTLs. Because of the
atomic helpers being used (e.g. drm_atomic_helper_set_config()), they
will also result in a call to drm_atomic_commit(), which invokes
drm_atomic_check_only().

-- 
With best wishes
Dmitry


Re: [Freedreno] [RFC PATCH v2 09/13] drm/msm/dpu: move pstate->pipe initialization to dpu_plane_atomic_check

2023-05-24 Thread Abhinav Kumar




On 5/24/2023 3:46 PM, Abhinav Kumar wrote:



On 3/20/2023 6:18 PM, Dmitry Baryshkov wrote:

In preparation to virtualized planes support, move pstate->pipe
initialization from dpu_plane_reset() to dpu_plane_atomic_check(). In
case of virtual planes the plane's pipe will not be known up to the
point of atomic_check() callback.

Signed-off-by: Dmitry Baryshkov 
---


Will legacy paths be broken with this? So lets say there is no 
atomic_check we will not have a valid sspp anymore.


I think it should still work, even if goes through the modeset crtc, it 
should still call drm_atomic_commit() internally which should have the 
call to atomic_check, once you confirm this , i can ack this particular 
change.


Re: [RFC PATCH v2 09/13] drm/msm/dpu: move pstate->pipe initialization to dpu_plane_atomic_check

2023-05-24 Thread Abhinav Kumar




On 3/20/2023 6:18 PM, Dmitry Baryshkov wrote:

In preparation to virtualized planes support, move pstate->pipe
initialization from dpu_plane_reset() to dpu_plane_atomic_check(). In
case of virtual planes the plane's pipe will not be known up to the
point of atomic_check() callback.

Signed-off-by: Dmitry Baryshkov 
---


Will legacy paths be broken with this? So lets say there is no 
atomic_check we will not have a valid sspp anymore.


[RFC PATCH v2 09/13] drm/msm/dpu: move pstate->pipe initialization to dpu_plane_atomic_check

2023-03-20 Thread Dmitry Baryshkov
In preparation to virtualized planes support, move pstate->pipe
initialization from dpu_plane_reset() to dpu_plane_atomic_check(). In
case of virtual planes the plane's pipe will not be known up to the
point of atomic_check() callback.

Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index d43e04fc4578..cf17075676d5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -845,6 +845,7 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
int ret = 0, min_scale;
struct dpu_plane *pdpu = to_dpu_plane(plane);
struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state);
+   struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane);
struct dpu_sw_pipe *pipe = >pipe;
struct dpu_sw_pipe *r_pipe = >r_pipe;
const struct drm_crtc_state *crtc_state = NULL;
@@ -855,13 +856,19 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
uint32_t max_linewidth;
unsigned int rotation;
uint32_t supported_rotations;
-   const struct dpu_sspp_cfg *pipe_hw_caps = pstate->pipe.sspp->cap;
-   const struct dpu_sspp_sub_blks *sblk = pstate->pipe.sspp->cap->sblk;
+   const struct dpu_sspp_cfg *pipe_hw_caps;
+   const struct dpu_sspp_sub_blks *sblk;
 
if (new_plane_state->crtc)
crtc_state = drm_atomic_get_new_crtc_state(state,
   
new_plane_state->crtc);
 
+   pipe->sspp = dpu_rm_get_sspp(_kms->rm, pdpu->pipe);
+   r_pipe->sspp = NULL;
+
+   pipe_hw_caps = pstate->pipe.sspp->cap;
+   sblk = pstate->pipe.sspp->cap->sblk;
+
min_scale = FRAC_16_16(1, sblk->maxupscale);
ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
  min_scale,
@@ -878,7 +885,6 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE;
r_pipe->multirect_index = DPU_SSPP_RECT_SOLO;
r_pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE;
-   r_pipe->sspp = NULL;
 
pstate->stage = DPU_STAGE_0 + pstate->base.normalized_zpos;
if (pstate->stage >= pdpu->catalog->caps->max_mixer_blendstages) {
@@ -1374,7 +1380,6 @@ static void dpu_plane_reset(struct drm_plane *plane)
 {
struct dpu_plane *pdpu;
struct dpu_plane_state *pstate;
-   struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane);
 
if (!plane) {
DPU_ERROR("invalid plane\n");
@@ -1396,16 +1401,6 @@ static void dpu_plane_reset(struct drm_plane *plane)
return;
}
 
-   /*
-* Set the SSPP here until we have proper virtualized DPU planes.
-* This is the place where the state is allocated, so fill it fully.
-*/
-   pstate->pipe.sspp = dpu_rm_get_sspp(_kms->rm, pdpu->pipe);
-   pstate->pipe.multirect_index = DPU_SSPP_RECT_SOLO;
-   pstate->pipe.multirect_mode = DPU_SSPP_MULTIRECT_NONE;
-
-   pstate->r_pipe.sspp = NULL;
-
__drm_atomic_helper_plane_reset(plane, >base);
 }
 
-- 
2.30.2