Re: [PATCH v5 10/10] drm: vc4: Use crtc->mode_valid() and encoder->mode_valid() callbacks

2017-06-20 Thread Daniel Vetter
On Fri, Jun 02, 2017 at 01:10:00PM -0700, Eric Anholt wrote:
> Jose Abreu  writes:
> 
> > Now that we have a callback to check if crtc and encoder supports a
> > given mode we can use it in vc4 so that we restrict the number of
> > probbed modes to the ones we can actually display.
> 
> "probed"
> 
> >
> > Also, remove the mode_fixup() calls as these are no longer needed
> > because mode_valid() will be called before.
> >
> > NOTE: Not even compiled tested
> 
> Compile-tested and Reviewed-by: Eric Anholt 

Pushed to drm-misc-next, thanks.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 10/10] drm: vc4: Use crtc->mode_valid() and encoder->mode_valid() callbacks

2017-06-02 Thread Eric Anholt
Jose Abreu  writes:

> Now that we have a callback to check if crtc and encoder supports a
> given mode we can use it in vc4 so that we restrict the number of
> probbed modes to the ones we can actually display.

"probed"

>
> Also, remove the mode_fixup() calls as these are no longer needed
> because mode_valid() will be called before.
>
> NOTE: Not even compiled tested

Compile-tested and Reviewed-by: Eric Anholt 


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


Re: [PATCH v5 10/10] drm: vc4: Use crtc->mode_valid() and encoder->mode_valid() callbacks

2017-05-30 Thread Neil Armstrong
On 05/25/2017 04:19 PM, Jose Abreu wrote:
> Now that we have a callback to check if crtc and encoder supports a
> given mode we can use it in vc4 so that we restrict the number of
> probbed modes to the ones we can actually display.
> 
> Also, remove the mode_fixup() calls as these are no longer needed
> because mode_valid() will be called before.
> 
> NOTE: Not even compiled tested
> 
> Signed-off-by: Jose Abreu 
> Cc: Carlos Palminha 
> Cc: Daniel Vetter 
> Cc: Eric Anholt 
> Cc: David Airlie 
> ---
>  drivers/gpu/drm/vc4/vc4_crtc.c | 13 ++---
>  drivers/gpu/drm/vc4/vc4_dpi.c  | 13 ++---
>  2 files changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index 1b4dbe9..20703c8 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -542,18 +542,17 @@ static void vc4_crtc_enable(struct drm_crtc *crtc)
>   drm_crtc_vblank_on(crtc);
>  }
>  
> -static bool vc4_crtc_mode_fixup(struct drm_crtc *crtc,
> - const struct drm_display_mode *mode,
> - struct drm_display_mode *adjusted_mode)
> +static enum drm_mode_status vc4_crtc_mode_valid(struct drm_crtc *crtc,
> + const struct drm_display_mode 
> *mode)
>  {
>   /* Do not allow doublescan modes from user space */
> - if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) {
> + if (mode->flags & DRM_MODE_FLAG_DBLSCAN) {
>   DRM_DEBUG_KMS("[CRTC:%d] Doublescan mode rejected.\n",
> crtc->base.id);
> - return false;
> + return MODE_NO_DBLESCAN;
>   }
>  
> - return true;
> + return MODE_OK;
>  }
>  
>  static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
> @@ -863,7 +862,7 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,
>   .mode_set_nofb = vc4_crtc_mode_set_nofb,
>   .disable = vc4_crtc_disable,
>   .enable = vc4_crtc_enable,
> - .mode_fixup = vc4_crtc_mode_fixup,
> + .mode_valid = vc4_crtc_mode_valid,
>   .atomic_check = vc4_crtc_atomic_check,
>   .atomic_flush = vc4_crtc_atomic_flush,
>  };
> diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
> index c6d7039..61958ab 100644
> --- a/drivers/gpu/drm/vc4/vc4_dpi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
> @@ -330,20 +330,19 @@ static void vc4_dpi_encoder_enable(struct drm_encoder 
> *encoder)
>   }
>  }
>  
> -static bool vc4_dpi_encoder_mode_fixup(struct drm_encoder *encoder,
> -const struct drm_display_mode *mode,
> -struct drm_display_mode *adjusted_mode)
> +static enum drm_mode_status vc4_dpi_encoder_mode_valid(struct drm_encoder 
> *encoder,
> +const struct 
> drm_display_mode *mode)
>  {
> - if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> - return false;
> + if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> + return MODE_NO_INTERLACE;
>  
> - return true;
> + return MODE_OK;
>  }
>  
>  static const struct drm_encoder_helper_funcs vc4_dpi_encoder_helper_funcs = {
>   .disable = vc4_dpi_encoder_disable,
>   .enable = vc4_dpi_encoder_enable,
> - .mode_fixup = vc4_dpi_encoder_mode_fixup,
> + .mode_valid = vc4_dpi_encoder_mode_valid,
>  };
>  
>  static const struct of_device_id vc4_dpi_dt_match[] = {
> 

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


[PATCH v5 10/10] drm: vc4: Use crtc->mode_valid() and encoder->mode_valid() callbacks

2017-05-25 Thread Jose Abreu
Now that we have a callback to check if crtc and encoder supports a
given mode we can use it in vc4 so that we restrict the number of
probbed modes to the ones we can actually display.

Also, remove the mode_fixup() calls as these are no longer needed
because mode_valid() will be called before.

NOTE: Not even compiled tested

Signed-off-by: Jose Abreu 
Cc: Carlos Palminha 
Cc: Daniel Vetter 
Cc: Eric Anholt 
Cc: David Airlie 
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 13 ++---
 drivers/gpu/drm/vc4/vc4_dpi.c  | 13 ++---
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 1b4dbe9..20703c8 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -542,18 +542,17 @@ static void vc4_crtc_enable(struct drm_crtc *crtc)
drm_crtc_vblank_on(crtc);
 }
 
-static bool vc4_crtc_mode_fixup(struct drm_crtc *crtc,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
+static enum drm_mode_status vc4_crtc_mode_valid(struct drm_crtc *crtc,
+   const struct drm_display_mode 
*mode)
 {
/* Do not allow doublescan modes from user space */
-   if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) {
+   if (mode->flags & DRM_MODE_FLAG_DBLSCAN) {
DRM_DEBUG_KMS("[CRTC:%d] Doublescan mode rejected.\n",
  crtc->base.id);
-   return false;
+   return MODE_NO_DBLESCAN;
}
 
-   return true;
+   return MODE_OK;
 }
 
 static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
@@ -863,7 +862,7 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,
.mode_set_nofb = vc4_crtc_mode_set_nofb,
.disable = vc4_crtc_disable,
.enable = vc4_crtc_enable,
-   .mode_fixup = vc4_crtc_mode_fixup,
+   .mode_valid = vc4_crtc_mode_valid,
.atomic_check = vc4_crtc_atomic_check,
.atomic_flush = vc4_crtc_atomic_flush,
 };
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index c6d7039..61958ab 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -330,20 +330,19 @@ static void vc4_dpi_encoder_enable(struct drm_encoder 
*encoder)
}
 }
 
-static bool vc4_dpi_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
+static enum drm_mode_status vc4_dpi_encoder_mode_valid(struct drm_encoder 
*encoder,
+  const struct 
drm_display_mode *mode)
 {
-   if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
-   return false;
+   if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+   return MODE_NO_INTERLACE;
 
-   return true;
+   return MODE_OK;
 }
 
 static const struct drm_encoder_helper_funcs vc4_dpi_encoder_helper_funcs = {
.disable = vc4_dpi_encoder_disable,
.enable = vc4_dpi_encoder_enable,
-   .mode_fixup = vc4_dpi_encoder_mode_fixup,
+   .mode_valid = vc4_dpi_encoder_mode_valid,
 };
 
 static const struct of_device_id vc4_dpi_dt_match[] = {
-- 
1.9.1


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