[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e0e2f5a85f2b050b5641b645f395c8bbf2436585.1494347165.git.joabreu@synopsys.com>
Date: Tue, 9 May 2017 18:00:11 +0100
From: Jose Abreu <Jose.Abreu@...opsys.com>
To: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc: Jose Abreu <Jose.Abreu@...opsys.com>,
Carlos Palminha <CARLOS.PALMINHA@...opsys.com>,
Alexey Brodkin <Alexey.Brodkin@...opsys.com>,
Ville Syrjälä
<ville.syrjala@...ux.intel.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Dave Airlie <airlied@...ux.ie>,
Andrzej Hajda <a.hajda@...sung.com>,
Archit Taneja <architt@...eaurora.org>
Subject: [PATCH v2 4/8] drm: Add drm_connector_mode_valid()
Add a new helper to call connector->mode_valid callback.
Suggested-by: Ville Syrjälä <ville.syrjala@...ux.intel.com>
Signed-off-by: Jose Abreu <joabreu@...opsys.com>
Cc: Carlos Palminha <palminha@...opsys.com>
Cc: Alexey Brodkin <abrodkin@...opsys.com>
Cc: Ville Syrjälä <ville.syrjala@...ux.intel.com>
Cc: Daniel Vetter <daniel.vetter@...ll.ch>
Cc: Dave Airlie <airlied@...ux.ie>
Cc: Andrzej Hajda <a.hajda@...sung.com>
Cc: Archit Taneja <architt@...eaurora.org>
---
TODO: function prototype should receive a const, but currently
mode_valid declaration is not const. In order to change this
I needed to touch *every* driver who uses this callback.
Postponed to when I have the time.
drivers/gpu/drm/drm_connector.c | 23 +++++++++++++++++++++++
drivers/gpu/drm/drm_crtc_internal.h | 2 ++
2 files changed, 25 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 9f84761..f2634a2 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -24,6 +24,7 @@
#include <drm/drm_connector.h>
#include <drm/drm_edid.h>
#include <drm/drm_encoder.h>
+#include <drm/drm_modeset_helper_vtables.h>
#include "drm_crtc_internal.h"
#include "drm_internal.h"
@@ -1418,3 +1419,25 @@ struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
return tg;
}
EXPORT_SYMBOL(drm_mode_create_tile_group);
+
+/**
+ * drm_connector_mode_valid - call connector->mode_valid callback, if any.
+ * @connector: connector
+ * @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_connector_mode_valid(struct drm_connector *connector,
+ struct drm_display_mode *mode)
+{
+ const struct drm_connector_helper_funcs *connector_funcs =
+ connector->helper_private;
+
+ if (!connector_funcs || !connector_funcs->mode_valid)
+ return MODE_OK;
+
+ return connector_funcs->mode_valid(connector, mode);
+}
+EXPORT_SYMBOL(drm_connector_mode_valid);
diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
index 6165bc9..018b154 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -146,6 +146,8 @@ int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,
uint64_t value);
int drm_connector_create_standard_properties(struct drm_device *dev);
const char *drm_get_connector_force_name(enum drm_connector_force force);
+enum drm_mode_status drm_connector_mode_valid(struct drm_connector *connector,
+ struct drm_display_mode *mode);
/* IOCTL */
int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
--
1.9.1
Powered by blists - more mailing lists