]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Add atomic_get_property entrypoint for connectors (v2)
authorMatt Roper <matthew.d.roper@intel.com>
Fri, 23 Jan 2015 00:51:27 +0000 (16:51 -0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 27 Jan 2015 08:57:10 +0000 (09:57 +0100)
Even though we only support atomic plane updates at the moment, we still
need to add an .atomic_get_property() entrypoint for connectors before
we allow the driver to flip on the DRIVER_ATOMIC bit.  As soon as that
bit gets set, the DRM core will start adding atomic connector properties
(in addition to the plane properties we care about at the moment), so we
need to be able to handle the new way the DRM core will interact with
us.

For simplicity, we just lookup driver-specific connector properties in
the usual shadow array maintained by the core.  Once we get real atomic
modeset support for crtc's and planes, this code should be re-written to
pull the data out of crtc/connector state structures.

v2: Fix intel_dvo and intel_dsi that I missed on the first pass (Ander)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_atomic.c
drivers/gpu/drm/i915/intel_crt.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_dp_mst.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_dsi.c
drivers/gpu/drm/i915/intel_dvo.c
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/i915/intel_tv.c

index 5c31f54a3711826d31e4190493323354f7d0b73b..52ef6f4abe457cebbb2c3ecf5a7a94ac20d3ac79 100644 (file)
@@ -162,3 +162,41 @@ int intel_atomic_commit(struct drm_device *dev,
 
        return 0;
 }
+
+/**
+ * intel_connector_atomic_get_property - fetch connector property value
+ * @connector: connector to fetch property for
+ * @state: state containing the property value
+ * @property: property to look up
+ * @val: pointer to write property value into
+ *
+ * The DRM core does not store shadow copies of properties for
+ * atomic-capable drivers.  This entrypoint is used to fetch
+ * the current value of a driver-specific connector property.
+ */
+int
+intel_connector_atomic_get_property(struct drm_connector *connector,
+                                   const struct drm_connector_state *state,
+                                   struct drm_property *property,
+                                   uint64_t *val)
+{
+       int i;
+
+       /*
+        * TODO: We only have atomic modeset for planes at the moment, so the
+        * crtc/connector code isn't quite ready yet.  Until it's ready,
+        * continue to look up all property values in the DRM's shadow copy
+        * in obj->properties->values[].
+        *
+        * When the crtc/connector state work matures, this function should
+        * be updated to read the values out of the state structure instead.
+        */
+       for (i = 0; i < connector->base.properties->count; i++) {
+               if (connector->base.properties->properties[i] == property) {
+                       *val = connector->base.properties->values[i];
+                       return 0;
+               }
+       }
+
+       return -EINVAL;
+}
index 18ee41ef0f18a389bf9418c47ae061a7c33ff988..e66e17af0a56a12243872704874ccfe2aa72929c 100644 (file)
@@ -794,6 +794,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
        .destroy = intel_crt_destroy,
        .set_property = intel_crt_set_property,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+       .atomic_get_property = intel_connector_atomic_get_property,
 };
 
 static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
index 8bdaaaff35f34a8a36484ee748c2868ce2a00bbe..eea9e366a109e3bf2170be7a7796d80c56adb769 100644 (file)
@@ -4402,6 +4402,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
        .force = intel_dp_force,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = intel_dp_set_property,
+       .atomic_get_property = intel_connector_atomic_get_property,
        .destroy = intel_dp_connector_destroy,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
index f86da0fad718ad5f36a0862efc7885a7c3fbb31e..2856b0bffd07c569d53dc0ac59286cb0db9ea2fa 100644 (file)
@@ -314,6 +314,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
        .detect = intel_dp_mst_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = intel_dp_mst_set_property,
+       .atomic_get_property = intel_connector_atomic_get_property,
        .destroy = intel_dp_mst_connector_destroy,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
index 18f167b49575f3709c01fa08d9fe0b76bb21b046..28b846e2e15a325dbb776bfe32bd441bfc7a5563 100644 (file)
@@ -1254,6 +1254,10 @@ int intel_atomic_check(struct drm_device *dev,
 int intel_atomic_commit(struct drm_device *dev,
                        struct drm_atomic_state *state,
                        bool async);
+int intel_connector_atomic_get_property(struct drm_connector *connector,
+                                       const struct drm_connector_state *state,
+                                       struct drm_property *property,
+                                       uint64_t *val);
 
 /* intel_atomic_plane.c */
 struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
index e20bb1f8879cc10a39dcba4e2385fc0ed0f78bb9..317e633960605a8a5321018cc5a1267390104646 100644 (file)
@@ -786,6 +786,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
        .detect = intel_dsi_detect,
        .destroy = intel_dsi_destroy,
        .fill_modes = drm_helper_probe_single_connector_modes,
+       .atomic_get_property = intel_connector_atomic_get_property,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
index 1cf2e352ad1be476c0af0437f10817e3eeca8977..d8579510beb018fc92ce0fb2a739b5b4a4d95b9b 100644 (file)
@@ -391,6 +391,7 @@ static const struct drm_connector_funcs intel_dvo_connector_funcs = {
        .detect = intel_dvo_detect,
        .destroy = intel_dvo_destroy,
        .fill_modes = drm_helper_probe_single_connector_modes,
+       .atomic_get_property = intel_connector_atomic_get_property,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
index b8fab8cb42bf195a513940ceddcaa85880d4fe7a..995c5b261f4f0f5cf295de8b08c95840a36ca0fe 100644 (file)
@@ -1615,6 +1615,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
        .force = intel_hdmi_force,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = intel_hdmi_set_property,
+       .atomic_get_property = intel_connector_atomic_get_property,
        .destroy = intel_hdmi_destroy,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
index 908bd42fac5da9a8841db16cf038d1fbf9886dd3..071b96d6e14642778f25a89e81b4ca908c0b64ea 100644 (file)
@@ -532,6 +532,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
        .detect = intel_lvds_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = intel_lvds_set_property,
+       .atomic_get_property = intel_connector_atomic_get_property,
        .destroy = intel_lvds_destroy,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
index ae00bf9ce07a85568e7339c4903655b03cc6df92..64ad2b40179f7d820133fab7532edc1fee848acf 100644 (file)
@@ -2191,6 +2191,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
        .detect = intel_sdvo_detect,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .set_property = intel_sdvo_set_property,
+       .atomic_get_property = intel_connector_atomic_get_property,
        .destroy = intel_sdvo_destroy,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
index d450054584a926c955bec79ca6b13d02c9330ea4..892d23c8479d30f7b6c283ba962c60220f68e3b0 100644 (file)
@@ -1513,6 +1513,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
        .detect = intel_tv_detect,
        .destroy = intel_tv_destroy,
        .set_property = intel_tv_set_property,
+       .atomic_get_property = intel_connector_atomic_get_property,
        .fill_modes = drm_helper_probe_single_connector_modes,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };