Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638300

[PATCH v2 2/8] drm: Add drm_crtc_mode_valid()

From Jose Abreu <Jose.Abreu@synopsys.com>
Newsgroups linux.kernel
Subject [PATCH v2 2/8] drm: Add drm_crtc_mode_valid()
Date 2017-05-09 19:10 +0200
Message-ID <tFgO6-4HS-29@gated-at.bofh.it> (permalink)
References <tFgO5-4HS-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add a new helper to call crtc->mode_valid callback.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: Carlos Palminha <palminha@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@linux.ie>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Archit Taneja <architt@codeaurora.org>
---
 drivers/gpu/drm/drm_crtc.c          | 22 ++++++++++++++++++++++
 drivers/gpu/drm/drm_crtc_internal.h |  3 +++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 5af25ce..07ae705 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -38,6 +38,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fourcc.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_modeset_lock.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_auth.h>
@@ -741,3 +742,24 @@ int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
 
 	return ret;
 }
+
+/**
+ * drm_crtc_mode_valid - call crtc->mode_valid callback, if any.
+ * @crtc: crtc
+ * @mode: mode to be validated
+ *
+ * If no mode_valid callback is available this will return MODE_OK.
+ *
+ * Returns: drm_mode_status Enum
+ */
+enum drm_mode_status drm_crtc_mode_valid(struct drm_crtc *crtc,
+					 const struct drm_display_mode *mode)
+{
+	const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
+
+	if (!crtc_funcs || !crtc_funcs->mode_valid)
+		return MODE_OK;
+
+	return crtc_funcs->mode_valid(crtc, mode);
+}
+EXPORT_SYMBOL(drm_crtc_mode_valid);
diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
index d077c54..3800abd 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -45,6 +45,9 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
 
 struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc);
 
+enum drm_mode_status drm_crtc_mode_valid(struct drm_crtc *crtc,
+					 const struct drm_display_mode *mode);
+
 /* IOCTLs */
 int drm_mode_getcrtc(struct drm_device *dev,
 		     void *data, struct drm_file *file_priv);
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/8] Introduce new mode validation callbacks Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
  [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
    Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Ville Syrjälä <ville.syrjala@linux.intel.com> - 2017-05-10 15:50 +0200
      Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 16:10 +0200
        Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 16:10 +0200
      Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 17:20 +0200
  [PATCH v2 4/8] drm: Add drm_connector_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
  [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
    Re: [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 10:10 +0200
      Re: [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 11:00 +0200
        Re: [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 17:20 +0200
  [PATCH v2 8/8] drm: arc: Use crtc->mode_valid() callback Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
  [PATCH v2 5/8] drm: Use new mode_valid() helpers in connector probe helper Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
    Re: [PATCH v2 5/8] drm: Use new mode_valid() helpers in connector  probe helper Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 10:10 +0200
      Re: [PATCH v2 5/8] drm: Use new mode_valid() helpers in connector  probe helper Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 11:10 +0200
  [PATCH v2 1/8] drm: Add crtc/encoder/bridge->mode_valid() callbacks Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
    Re: [PATCH v2 1/8] drm: Add crtc/encoder/bridge->mode_valid()  callbacks Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 10:10 +0200
      Re: [PATCH v2 1/8] drm: Add crtc/encoder/bridge->mode_valid()  callbacks Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 11:10 +0200
  [PATCH v2 3/8] drm: Add drm_encoder_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200

csiph-web