linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jose Abreu <Jose.Abreu@synopsys.com>
To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Jose Abreu <Jose.Abreu@synopsys.com>,
	Carlos Palminha <CARLOS.PALMINHA@synopsys.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Eric Anholt <eric@anholt.net>, David Airlie <airlied@linux.ie>
Subject: [PATCH v5 10/10] drm: vc4: Use crtc->mode_valid() and encoder->mode_valid() callbacks
Date: Thu, 25 May 2017 15:19:22 +0100	[thread overview]
Message-ID: <5bea792f91074688c88a2dab8b0a90eec6e98fdf.1495720737.git.joabreu@synopsys.com> (raw)
In-Reply-To: <cover.1495720737.git.joabreu@synopsys.com>
In-Reply-To: <cover.1495720737.git.joabreu@synopsys.com>

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 <joabreu@synopsys.com>
Cc: Carlos Palminha <palminha@synopsys.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Eric Anholt <eric@anholt.net>
Cc: David Airlie <airlied@linux.ie>
---
 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

  parent reply	other threads:[~2017-05-25 14:21 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 14:19 [PATCH v5 00/10] Introduce new mode validation callbacks Jose Abreu
2017-05-25 14:19 ` [PATCH v5 01/10] drm: Add drm_{crtc/encoder/connector}_mode_valid() Jose Abreu
2017-05-30  6:38   ` Daniel Vetter
2017-05-30  7:26   ` Neil Armstrong
2017-05-25 14:19 ` [PATCH v5 02/10] drm: Introduce drm_bridge_mode_valid() Jose Abreu
2017-05-26  4:25   ` Archit Taneja
2017-05-30  7:27   ` Neil Armstrong
2017-05-25 14:19 ` [PATCH v5 03/10] drm: Use new mode_valid() helpers in connector probe helper Jose Abreu
2017-05-30  7:27   ` Neil Armstrong
2017-05-25 14:19 ` [PATCH v5 04/10] drm: Use mode_valid() in atomic modeset Jose Abreu
2017-05-29 19:38   ` Daniel Vetter
2017-05-30  7:27   ` Neil Armstrong
2017-05-25 14:19 ` [PATCH v5 05/10] drm: arcpgu: Use crtc->mode_valid() callback Jose Abreu
2017-05-30  7:28   ` Neil Armstrong
2017-06-21  9:38   ` Jose Abreu
2017-06-22  8:46     ` Daniel Vetter
2017-05-25 14:19 ` [PATCH v5 06/10] drm/bridge: analogix-anx78xx: Use bridge->mode_valid() callback Jose Abreu
2017-05-26  4:27   ` Archit Taneja
2017-05-30  7:28   ` Neil Armstrong
2017-05-30 10:35     ` Archit Taneja
2017-05-25 14:19 ` [PATCH v5 07/10] drm/bridge/synopsys: dw-hdmi: " Jose Abreu
2017-05-29  9:45   ` Neil Armstrong
2017-05-30 10:24   ` Archit Taneja
2017-05-30 10:29     ` Philipp Zabel
2017-06-05  7:53       ` Archit Taneja
2017-05-25 14:19 ` [PATCH v5 08/10] drm/arm: malidp: Use crtc->mode_valid() callback Jose Abreu
2017-05-30  7:29   ` Neil Armstrong
2017-05-30  9:37     ` Liviu Dudau
2017-05-31  8:20       ` Daniel Vetter
2017-05-31 10:48         ` Liviu Dudau
2017-05-31 10:56           ` Daniel Vetter
2017-05-31 11:09             ` Liviu Dudau
2017-05-25 14:19 ` [PATCH v5 09/10] drm/atmel-hlcdc: " Jose Abreu
2017-05-30  7:30   ` Neil Armstrong
2017-06-02  9:35   ` Boris Brezillon
2017-05-25 14:19 ` Jose Abreu [this message]
2017-05-30  7:30   ` [PATCH v5 10/10] drm: vc4: Use crtc->mode_valid() and encoder->mode_valid() callbacks Neil Armstrong
2017-06-02 20:10   ` Eric Anholt
2017-06-20  8:47     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5bea792f91074688c88a2dab8b0a90eec6e98fdf.1495720737.git.joabreu@synopsys.com \
    --to=jose.abreu@synopsys.com \
    --cc=CARLOS.PALMINHA@synopsys.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).