Re: [PATCH 22/29] drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation

2019-02-11 Thread Sebastian Reichel
Hi,

ping & actually add the cc :)

-- Sebastian

On Tue, Dec 11, 2018 at 10:06:07AM +0200, Laurent Pinchart wrote:
>> The problem is, that DISPC timings for DSI are not directly
>> calculated from mode. Instead DSI code does some modifications
>> before applying the DISPC settings.
> 
> I wonder what the best way to fix this would be. DSI isn't so special in this 
> regard, any encoder can modify modes, resulting in the CRTC outputting a mode 
> significantly different than the mode being displayed. This is handled by the 
> DRM helpers through the .mode_fixup() operations, which can mangle modes 
> along 
> the pipeline.
> 
> At atomic commit time the atomic helpers call .mode_valid() first, followed 
> by 
> .mode_fixup(). An easy fix would be to remove our .mode_valid() handlers 
> completely and perform both fixup and validation in the .mode_fixup() 
> handlers.
> 
> However, the .mode_valid() operations are also used in 
> drm_helper_probe_single_connector_modes(), where no mode fixup is performed. 
> We can't drop .mode_valid() for that code path (at least not as anything else 
> than a hack). Daniel, what's the expected way to handle this ?
> 
> -- 
> Regards,
> 
> Laurent Pinchart


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 22/29] drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation

2018-12-11 Thread Sebastian Reichel
Hi,

On Mon, Dec 10, 2018 at 02:14:01PM +0100, Sebastian Reichel wrote:
> On Mon, Dec 10, 2018 at 09:50:08AM +0200, Laurent Pinchart wrote:
> > Hi Sebastian,
> > 
> > On Monday, 10 December 2018 00:07:55 EET Sebastian Reichel wrote:
> > > On Wed, Dec 05, 2018 at 05:00:15PM +0200, Laurent Pinchart wrote:
> > > > The DISPC timings checks relate to the CRTC, but they're performed in
> > > > the encoder and connector .atomic_check() and .mode_valid() operations.
> > > > Move them to the CRTC .mode_valid() operation.
> > > > 
> > > > Signed-off-by: Laurent Pinchart 
> > > > ---
> > > 
> > > Reviewed-by: Sebastian Reichel 
> > > 
> > > This should also fix the issue with DSI in a less ugly way:
> > > 
> > > https://lists.freedesktop.org/archives/dri-devel/2018-November/196622.html
> > 
> > Should I add the
> > 
> > Fixes: 7c27fa57ef31 ("drm/omap: Call dispc timings check operation 
> > directly")
> > 
> > tag to this patch ?
> 
> I plan to test this series in combination with my DSI patches today
> or tomorrow evening. If it works, probably the following should be
> added to the patch description:
> 
> 
> As a side-effect this fixes DSI, which uses slightly different mode
> configuration for the DSI encoder and the DISPC.
> 
> Fixes: 7c27fa57ef31 ("drm/omap: Call dispc timings check operation directly")
> 

I merged this series with my remaining DSI command mode patches
(btw. this series does not apply cleanly to master due to a recent
patch from Tomi). Unfortunately this patch does not fix the issue.
After this patch the mgr_check_timings() call in omap_crtc_mode_valid()
will fail.

The good news: The Droid 4 display worked again after dropping the
mgr_check_timings call as a quick hack. So the other patches from
this set are

Tested-by: Sebastian Reichel 

The problem is, that DISPC timings for DSI are not directly
calculated from mode. Instead DSI code does some modifications
before applying the DISPC settings.

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 22/29] drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation

2018-12-11 Thread Sebastian Reichel
Hi,

On Mon, Dec 10, 2018 at 09:50:08AM +0200, Laurent Pinchart wrote:
> Hi Sebastian,
> 
> On Monday, 10 December 2018 00:07:55 EET Sebastian Reichel wrote:
> > On Wed, Dec 05, 2018 at 05:00:15PM +0200, Laurent Pinchart wrote:
> > > The DISPC timings checks relate to the CRTC, but they're performed in
> > > the encoder and connector .atomic_check() and .mode_valid() operations.
> > > Move them to the CRTC .mode_valid() operation.
> > > 
> > > Signed-off-by: Laurent Pinchart 
> > > ---
> > 
> > Reviewed-by: Sebastian Reichel 
> > 
> > This should also fix the issue with DSI in a less ugly way:
> > 
> > https://lists.freedesktop.org/archives/dri-devel/2018-November/196622.html
> 
> Should I add the
> 
> Fixes: 7c27fa57ef31 ("drm/omap: Call dispc timings check operation directly")
> 
> tag to this patch ?

I plan to test this series in combination with my DSI patches today
or tomorrow evening. If it works, probably the following should be
added to the patch description:


As a side-effect this fixes DSI, which uses slightly different mode
configuration for the DSI encoder and the DISPC.

Fixes: 7c27fa57ef31 ("drm/omap: Call dispc timings check operation directly")


-- Sebastian

> > >  drivers/gpu/drm/omapdrm/omap_connector.c | 6 --
> > >  drivers/gpu/drm/omapdrm/omap_crtc.c  | 9 +
> > >  drivers/gpu/drm/omapdrm/omap_encoder.c   | 6 --
> > >  3 files changed, 9 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c
> > > b/drivers/gpu/drm/omapdrm/omap_connector.c index
> > > 8db1f2fbcf43..dd1e0f2e8ffc 100644
> > > --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> > > +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> > > @@ -245,8 +245,6 @@ static int omap_connector_mode_valid(struct
> > > drm_connector *connector,> 
> > >struct drm_display_mode *mode)
> > >  
> > >  {
> > >  
> > >   struct omap_connector *omap_connector = to_omap_connector(connector);
> > > 
> > > - enum omap_channel channel = omap_connector->output->dispc_channel;
> > > - struct omap_drm_private *priv = connector->dev->dev_private;
> > > 
> > >   struct omap_dss_device *dssdev;
> > >   struct videomode vm = {0};
> > >   struct drm_device *dev = connector->dev;
> > > 
> > > @@ -256,10 +254,6 @@ static int omap_connector_mode_valid(struct
> > > drm_connector *connector,> 
> > >   drm_display_mode_to_videomode(mode, );
> > >   mode->vrefresh = drm_mode_vrefresh(mode);
> > > 
> > > - r = priv->dispc_ops->mgr_check_timings(priv->dispc, channel, );
> > > - if (r)
> > > - goto done;
> > > -
> > > 
> > >   for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) {
> > >   
> > >   if (!dssdev->ops->check_timings)
> > >   
> > >   continue;
> > > 
> > > diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c
> > > b/drivers/gpu/drm/omapdrm/omap_crtc.c index caffc547ef97..51036e6fca1c
> > > 100644
> > > --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> > > +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> > > @@ -391,6 +391,15 @@ static enum drm_mode_status
> > > omap_crtc_mode_valid(struct drm_crtc *crtc,> 
> > >   const struct drm_display_mode *mode)
> > >  
> > >  {
> > >  
> > >   struct omap_drm_private *priv = crtc->dev->dev_private;
> > > 
> > > + struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> > > + struct videomode vm = {0};
> > > + int r;
> > > +
> > > + drm_display_mode_to_videomode(mode, );
> > > + r = priv->dispc_ops->mgr_check_timings(priv->dispc, omap_crtc->channel,
> > > +);
> > > + if (r)
> > > + return r;
> > > 
> > >   /* Check for bandwidth limit */
> > >   if (priv->max_bandwidth) {
> > > 
> > > diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c
> > > b/drivers/gpu/drm/omapdrm/omap_encoder.c index 79ee927cd905..7d01df6fa723
> > > 100644
> > > --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> > > +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> > > @@ -198,19 +198,13 @@ static int omap_encoder_atomic_check(struct
> > > drm_encoder *encoder,> 
> > >struct drm_connector_state *conn_state)
> > >  
> > >  {
> > >  
> > >   struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> > > 
> > > - enum omap_channel channel = omap_encoder->output->dispc_channel;
> > > 
> > >   struct drm_device *dev = encoder->dev;
> > > 
> > > - struct omap_drm_private *priv = dev->dev_private;
> > > 
> > >   struct omap_dss_device *dssdev;
> > >   struct videomode vm = { 0 };
> > >   int ret;
> > >   
> > >   drm_display_mode_to_videomode(_state->mode, );
> > > 
> > > - ret = priv->dispc_ops->mgr_check_timings(priv->dispc, channel, );
> > > - if (ret)
> > > - goto done;
> > > -
> > > 
> > >   for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) {
> > >   
> > >   if (!dssdev->ops->check_timings)
> > >   
> > >   continue;
> 

Re: [PATCH 22/29] drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation

2018-12-11 Thread Laurent Pinchart
Hi Sebastian,

(CC'ing Daniel)

On Tuesday, 11 December 2018 03:07:45 EET Sebastian Reichel wrote:
> On Mon, Dec 10, 2018 at 02:14:01PM +0100, Sebastian Reichel wrote:
> > On Mon, Dec 10, 2018 at 09:50:08AM +0200, Laurent Pinchart wrote:
> >> On Monday, 10 December 2018 00:07:55 EET Sebastian Reichel wrote:
> >>> On Wed, Dec 05, 2018 at 05:00:15PM +0200, Laurent Pinchart wrote:
>  The DISPC timings checks relate to the CRTC, but they're performed
>  in the encoder and connector .atomic_check() and .mode_valid()
>  operations. Move them to the CRTC .mode_valid() operation.
>  
>  Signed-off-by: Laurent Pinchart 
>  ---
> >>> 
> >>> Reviewed-by: Sebastian Reichel 
> >>> 
> >>> This should also fix the issue with DSI in a less ugly way:
> >>> 
> >>> https://lists.freedesktop.org/archives/dri-devel/2018-November/196622.
> >>> html
> >> 
> >> Should I add the
> >> 
> >> Fixes: 7c27fa57ef31 ("drm/omap: Call dispc timings check operation
> >> directly")
> >> 
> >> tag to this patch ?
> > 
> > I plan to test this series in combination with my DSI patches today
> > or tomorrow evening. If it works, probably the following should be
> > added to the patch description:
> > 
> > 
> > As a side-effect this fixes DSI, which uses slightly different mode
> > configuration for the DSI encoder and the DISPC.
> > 
> > Fixes: 7c27fa57ef31 ("drm/omap: Call dispc timings check operation
> > directly")
> > 
> 
> I merged this series with my remaining DSI command mode patches
> (btw. this series does not apply cleanly to master due to a recent
> patch from Tomi).

I'll fix that, thank you for the notice.

> Unfortunately this patch does not fix the issue. After this patch the
> mgr_check_timings() call in omap_crtc_mode_valid() will fail.
> 
> The good news: The Droid 4 display worked again after dropping the
> mgr_check_timings call as a quick hack. So the other patches from
> this set are
> 
> Tested-by: Sebastian Reichel 

Thank you for testing this.

> The problem is, that DISPC timings for DSI are not directly
> calculated from mode. Instead DSI code does some modifications
> before applying the DISPC settings.

I wonder what the best way to fix this would be. DSI isn't so special in this 
regard, any encoder can modify modes, resulting in the CRTC outputting a mode 
significantly different than the mode being displayed. This is handled by the 
DRM helpers through the .mode_fixup() operations, which can mangle modes along 
the pipeline.

At atomic commit time the atomic helpers call .mode_valid() first, followed by 
.mode_fixup(). An easy fix would be to remove our .mode_valid() handlers 
completely and perform both fixup and validation in the .mode_fixup() 
handlers.

However, the .mode_valid() operations are also used in 
drm_helper_probe_single_connector_modes(), where no mode fixup is performed. 
We can't drop .mode_valid() for that code path (at least not as anything else 
than a hack). Daniel, what's the expected way to handle this ?

-- 
Regards,

Laurent Pinchart



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 22/29] drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation

2018-12-10 Thread Sebastian Reichel
Hi,

On Wed, Dec 05, 2018 at 05:00:15PM +0200, Laurent Pinchart wrote:
> The DISPC timings checks relate to the CRTC, but they're performed in
> the encoder and connector .atomic_check() and .mode_valid() operations.
> Move them to the CRTC .mode_valid() operation.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

This should also fix the issue with DSI in a less ugly way:

https://lists.freedesktop.org/archives/dri-devel/2018-November/196622.html

-- Sebastian

>  drivers/gpu/drm/omapdrm/omap_connector.c | 6 --
>  drivers/gpu/drm/omapdrm/omap_crtc.c  | 9 +
>  drivers/gpu/drm/omapdrm/omap_encoder.c   | 6 --
>  3 files changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
> b/drivers/gpu/drm/omapdrm/omap_connector.c
> index 8db1f2fbcf43..dd1e0f2e8ffc 100644
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> @@ -245,8 +245,6 @@ static int omap_connector_mode_valid(struct drm_connector 
> *connector,
>struct drm_display_mode *mode)
>  {
>   struct omap_connector *omap_connector = to_omap_connector(connector);
> - enum omap_channel channel = omap_connector->output->dispc_channel;
> - struct omap_drm_private *priv = connector->dev->dev_private;
>   struct omap_dss_device *dssdev;
>   struct videomode vm = {0};
>   struct drm_device *dev = connector->dev;
> @@ -256,10 +254,6 @@ static int omap_connector_mode_valid(struct 
> drm_connector *connector,
>   drm_display_mode_to_videomode(mode, );
>   mode->vrefresh = drm_mode_vrefresh(mode);
>  
> - r = priv->dispc_ops->mgr_check_timings(priv->dispc, channel, );
> - if (r)
> - goto done;
> -
>   for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) {
>   if (!dssdev->ops->check_timings)
>   continue;
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
> b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index caffc547ef97..51036e6fca1c 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -391,6 +391,15 @@ static enum drm_mode_status omap_crtc_mode_valid(struct 
> drm_crtc *crtc,
>   const struct drm_display_mode *mode)
>  {
>   struct omap_drm_private *priv = crtc->dev->dev_private;
> + struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> + struct videomode vm = {0};
> + int r;
> +
> + drm_display_mode_to_videomode(mode, );
> + r = priv->dispc_ops->mgr_check_timings(priv->dispc, omap_crtc->channel,
> +);
> + if (r)
> + return r;
>  
>   /* Check for bandwidth limit */
>   if (priv->max_bandwidth) {
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
> b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 79ee927cd905..7d01df6fa723 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -198,19 +198,13 @@ static int omap_encoder_atomic_check(struct drm_encoder 
> *encoder,
>struct drm_connector_state *conn_state)
>  {
>   struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> - enum omap_channel channel = omap_encoder->output->dispc_channel;
>   struct drm_device *dev = encoder->dev;
> - struct omap_drm_private *priv = dev->dev_private;
>   struct omap_dss_device *dssdev;
>   struct videomode vm = { 0 };
>   int ret;
>  
>   drm_display_mode_to_videomode(_state->mode, );
>  
> - ret = priv->dispc_ops->mgr_check_timings(priv->dispc, channel, );
> - if (ret)
> - goto done;
> -
>   for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) {
>   if (!dssdev->ops->check_timings)
>   continue;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 22/29] drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation

2018-12-09 Thread Laurent Pinchart
Hi Sebastian,

On Monday, 10 December 2018 00:07:55 EET Sebastian Reichel wrote:
> On Wed, Dec 05, 2018 at 05:00:15PM +0200, Laurent Pinchart wrote:
> > The DISPC timings checks relate to the CRTC, but they're performed in
> > the encoder and connector .atomic_check() and .mode_valid() operations.
> > Move them to the CRTC .mode_valid() operation.
> > 
> > Signed-off-by: Laurent Pinchart 
> > ---
> 
> Reviewed-by: Sebastian Reichel 
> 
> This should also fix the issue with DSI in a less ugly way:
> 
> https://lists.freedesktop.org/archives/dri-devel/2018-November/196622.html

Should I add the

Fixes: 7c27fa57ef31 ("drm/omap: Call dispc timings check operation directly")

tag to this patch ?

> >  drivers/gpu/drm/omapdrm/omap_connector.c | 6 --
> >  drivers/gpu/drm/omapdrm/omap_crtc.c  | 9 +
> >  drivers/gpu/drm/omapdrm/omap_encoder.c   | 6 --
> >  3 files changed, 9 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c
> > b/drivers/gpu/drm/omapdrm/omap_connector.c index
> > 8db1f2fbcf43..dd1e0f2e8ffc 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_connector.c
> > @@ -245,8 +245,6 @@ static int omap_connector_mode_valid(struct
> > drm_connector *connector,> 
> >  struct drm_display_mode *mode)
> >  
> >  {
> >  
> > struct omap_connector *omap_connector = to_omap_connector(connector);
> > 
> > -   enum omap_channel channel = omap_connector->output->dispc_channel;
> > -   struct omap_drm_private *priv = connector->dev->dev_private;
> > 
> > struct omap_dss_device *dssdev;
> > struct videomode vm = {0};
> > struct drm_device *dev = connector->dev;
> > 
> > @@ -256,10 +254,6 @@ static int omap_connector_mode_valid(struct
> > drm_connector *connector,> 
> > drm_display_mode_to_videomode(mode, );
> > mode->vrefresh = drm_mode_vrefresh(mode);
> > 
> > -   r = priv->dispc_ops->mgr_check_timings(priv->dispc, channel, );
> > -   if (r)
> > -   goto done;
> > -
> > 
> > for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) {
> > 
> > if (!dssdev->ops->check_timings)
> > 
> > continue;
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c
> > b/drivers/gpu/drm/omapdrm/omap_crtc.c index caffc547ef97..51036e6fca1c
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> > @@ -391,6 +391,15 @@ static enum drm_mode_status
> > omap_crtc_mode_valid(struct drm_crtc *crtc,> 
> > const struct drm_display_mode *mode)
> >  
> >  {
> >  
> > struct omap_drm_private *priv = crtc->dev->dev_private;
> > 
> > +   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> > +   struct videomode vm = {0};
> > +   int r;
> > +
> > +   drm_display_mode_to_videomode(mode, );
> > +   r = priv->dispc_ops->mgr_check_timings(priv->dispc, omap_crtc->channel,
> > +  );
> > +   if (r)
> > +   return r;
> > 
> > /* Check for bandwidth limit */
> > if (priv->max_bandwidth) {
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c
> > b/drivers/gpu/drm/omapdrm/omap_encoder.c index 79ee927cd905..7d01df6fa723
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> > @@ -198,19 +198,13 @@ static int omap_encoder_atomic_check(struct
> > drm_encoder *encoder,> 
> >  struct drm_connector_state *conn_state)
> >  
> >  {
> >  
> > struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> > 
> > -   enum omap_channel channel = omap_encoder->output->dispc_channel;
> > 
> > struct drm_device *dev = encoder->dev;
> > 
> > -   struct omap_drm_private *priv = dev->dev_private;
> > 
> > struct omap_dss_device *dssdev;
> > struct videomode vm = { 0 };
> > int ret;
> > 
> > drm_display_mode_to_videomode(_state->mode, );
> > 
> > -   ret = priv->dispc_ops->mgr_check_timings(priv->dispc, channel, );
> > -   if (ret)
> > -   goto done;
> > -
> > 
> > for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) {
> > 
> > if (!dssdev->ops->check_timings)
> > 
> > continue;


-- 
Regards,

Laurent Pinchart



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel