Re: [PATCH 2/2] drm: lcdif: force modeset when FB format changes

2023-06-02 Thread Ying Liu
On Thu, Jun 1, 2023 at 2:45 AM Lucas Stach  wrote:
>
> Force a modeset if the new FB has a different format than the
> currently active one. While it might be possible to change between
> compatible formats without a full modeset as the format control is
> also supposed to be double buffered, the colorspace conversion is
> not, so when the CSC changes we need a modeset.
>
> For now just always force a modeset when the FB format changes to
> properly reconfigure all parts of the device for the new format.
>
> Signed-off-by: Lucas Stach 
> ---
>  drivers/gpu/drm/mxsfb/lcdif_kms.c | 26 --
>  1 file changed, 20 insertions(+), 6 deletions(-)

Reviewed-by: Liu Ying 


Re: [PATCH 2/2] drm: lcdif: force modeset when FB format changes

2023-06-01 Thread Ying Liu
On Thu, Jun 1, 2023 at 6:33 PM Marek Vasut  wrote:
>
> On 6/1/23 08:24, Ying Liu wrote:
> > On Thu, Jun 1, 2023 at 2:45 AM Lucas Stach  wrote:
> >>
> >> Force a modeset if the new FB has a different format than the
> >> currently active one. While it might be possible to change between
> >> compatible formats without a full modeset as the format control is
> >> also supposed to be double buffered, the colorspace conversion is
> >> not, so when the CSC changes we need a modeset.
> >>
> >> For now just always force a modeset when the FB format changes to
> >> properly reconfigure all parts of the device for the new format.
> >>
> >> Signed-off-by: Lucas Stach 
> >> ---
> >>   drivers/gpu/drm/mxsfb/lcdif_kms.c | 26 --
> >>   1 file changed, 20 insertions(+), 6 deletions(-)
> >
> > LGTM. If the patch shows up in dri-devel patchwork, I can get it, test
> > it and provide my R-b tag if appropriate.
>
> Aren't these two patches the ones you are looking for ?
>
> https://patchwork.freedesktop.org/patch/540443/
> https://patchwork.freedesktop.org/patch/540444/

Yes, they are. Thanks for the links.

>
> Maybe PW didn't sync when you checked, it takes a bit of time for
> patches to show up.

I used https://patchwork.kernel.org/project/dri-devel/list/.  It turns out
the two patches are not synced at there yet.


Re: [PATCH 2/2] drm: lcdif: force modeset when FB format changes

2023-06-01 Thread Marek Vasut

On 6/1/23 08:24, Ying Liu wrote:

On Thu, Jun 1, 2023 at 2:45 AM Lucas Stach  wrote:


Force a modeset if the new FB has a different format than the
currently active one. While it might be possible to change between
compatible formats without a full modeset as the format control is
also supposed to be double buffered, the colorspace conversion is
not, so when the CSC changes we need a modeset.

For now just always force a modeset when the FB format changes to
properly reconfigure all parts of the device for the new format.

Signed-off-by: Lucas Stach 
---
  drivers/gpu/drm/mxsfb/lcdif_kms.c | 26 --
  1 file changed, 20 insertions(+), 6 deletions(-)


LGTM. If the patch shows up in dri-devel patchwork, I can get it, test
it and provide my R-b tag if appropriate.


Aren't these two patches the ones you are looking for ?

https://patchwork.freedesktop.org/patch/540443/
https://patchwork.freedesktop.org/patch/540444/

Maybe PW didn't sync when you checked, it takes a bit of time for 
patches to show up.


Re: [PATCH 2/2] drm: lcdif: force modeset when FB format changes

2023-05-31 Thread Ying Liu
On Thu, Jun 1, 2023 at 2:45 AM Lucas Stach  wrote:
>
> Force a modeset if the new FB has a different format than the
> currently active one. While it might be possible to change between
> compatible formats without a full modeset as the format control is
> also supposed to be double buffered, the colorspace conversion is
> not, so when the CSC changes we need a modeset.
>
> For now just always force a modeset when the FB format changes to
> properly reconfigure all parts of the device for the new format.
>
> Signed-off-by: Lucas Stach 
> ---
>  drivers/gpu/drm/mxsfb/lcdif_kms.c | 26 --
>  1 file changed, 20 insertions(+), 6 deletions(-)

LGTM. If the patch shows up in dri-devel patchwork, I can get it, test
it and provide my R-b tag if appropriate.

Regards,
Liu Ying


[PATCH 2/2] drm: lcdif: force modeset when FB format changes

2023-05-31 Thread Lucas Stach
Force a modeset if the new FB has a different format than the
currently active one. While it might be possible to change between
compatible formats without a full modeset as the format control is
also supposed to be double buffered, the colorspace conversion is
not, so when the CSC changes we need a modeset.

For now just always force a modeset when the FB format changes to
properly reconfigure all parts of the device for the new format.

Signed-off-by: Lucas Stach 
---
 drivers/gpu/drm/mxsfb/lcdif_kms.c | 26 --
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c 
b/drivers/gpu/drm/mxsfb/lcdif_kms.c
index bbea44ee7a66..aa2eecdecb28 100644
--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c
+++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c
@@ -573,18 +573,32 @@ static const struct drm_encoder_funcs lcdif_encoder_funcs 
= {
 static int lcdif_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_state *state)
 {
-   struct drm_plane_state *plane_state = 
drm_atomic_get_new_plane_state(state,
-
plane);
+   struct drm_plane_state *new_state = 
drm_atomic_get_new_plane_state(state,
+  
plane);
+   struct drm_plane_state *old_state = 
drm_atomic_get_old_plane_state(state,
+  
plane);
struct lcdif_drm_private *lcdif = to_lcdif_drm_private(plane->dev);
struct drm_crtc_state *crtc_state;
+   int ret;
+
+   /* always okay to disable the plane */
+   if (!new_state->fb)
+   return 0;
 
crtc_state = drm_atomic_get_new_crtc_state(state,
   &lcdif->crtc);
 
-   return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
-  DRM_PLANE_NO_SCALING,
-  DRM_PLANE_NO_SCALING,
-  false, true);
+   ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
+ DRM_PLANE_NO_SCALING,
+ DRM_PLANE_NO_SCALING,
+ false, true);
+   if (ret)
+   return ret;
+
+   if (old_state->fb && new_state->fb->format != old_state->fb->format)
+   crtc_state->mode_changed = true;
+
+   return 0;
 }
 
 static void lcdif_plane_primary_atomic_update(struct drm_plane *plane,
-- 
2.39.2