aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2015-01-22 19:50:32 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-27 03:57:02 -0500
commitc6f95f279330aa24f486bff610fdc274b2bbfebb (patch)
tree1cd250ceb48691cca74b7a1eea9f804644bcb03b /drivers/gpu
parent5ee67f1cf9d009ff6522d264a05d78f082952a4f (diff)
drm/i915: Setup dummy atomic state for connectors (v3)
We want to enable/test plane updates via the atomic interface, but as soon as we flip DRIVER_ATOMIC on, the DRM core will take some atomic codepaths to lookup properties during drmModeGetConnector() and some of those codepaths unconditionally dereference connector->state (specifically when looking up the CRTC ID property in drm_atomic_connector_get_property()). Create a dummy connector state for each connector at init time to ensure the DRM core doesn't try to dereference a NULL connector->state. The actual connector properties will never be updated or contain useful information, but since we're doing this specifically for testing/debug of the plane operations (and only when a specific kernel module option is given), that shouldn't really matter. Once we start creating connector states, the DRM core will want to be able to clean them up for us. We also need to hook up the destruction entrypoint to the core's helper. v2: Squash in the patch to set the state destruction hook (Ander & Bob) v3: Only create dummy connector states when we're actually faking atomic support. (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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c32
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c2
-rw-r--r--drivers/gpu/drm/i915/intel_dp_mst.c2
-rw-r--r--drivers/gpu/drm/i915/intel_dsi.c2
-rw-r--r--drivers/gpu/drm/i915/intel_dvo.c2
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c2
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c2
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c2
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c2
10 files changed, 50 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index bb55368960e8..18ee41ef0f18 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -28,6 +28,7 @@
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <drm/drmP.h> 30#include <drm/drmP.h>
31#include <drm/drm_atomic_helper.h>
31#include <drm/drm_crtc.h> 32#include <drm/drm_crtc.h>
32#include <drm/drm_crtc_helper.h> 33#include <drm/drm_crtc_helper.h>
33#include <drm/drm_edid.h> 34#include <drm/drm_edid.h>
@@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
792 .fill_modes = drm_helper_probe_single_connector_modes, 793 .fill_modes = drm_helper_probe_single_connector_modes,
793 .destroy = intel_crt_destroy, 794 .destroy = intel_crt_destroy,
794 .set_property = intel_crt_set_property, 795 .set_property = intel_crt_set_property,
796 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
795}; 797};
796 798
797static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = { 799static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 75b7ca1488e9..b461f90698e3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12439,6 +12439,7 @@ static void intel_setup_outputs(struct drm_device *dev)
12439{ 12439{
12440 struct drm_i915_private *dev_priv = dev->dev_private; 12440 struct drm_i915_private *dev_priv = dev->dev_private;
12441 struct intel_encoder *encoder; 12441 struct intel_encoder *encoder;
12442 struct drm_connector *connector;
12442 bool dpd_is_edp = false; 12443 bool dpd_is_edp = false;
12443 12444
12444 intel_lvds_init(dev); 12445 intel_lvds_init(dev);
@@ -12569,6 +12570,37 @@ static void intel_setup_outputs(struct drm_device *dev)
12569 if (SUPPORTS_TV(dev)) 12570 if (SUPPORTS_TV(dev))
12570 intel_tv_init(dev); 12571 intel_tv_init(dev);
12571 12572
12573 /*
12574 * FIXME: We don't have full atomic support yet, but we want to be
12575 * able to enable/test plane updates via the atomic interface in the
12576 * meantime. However as soon as we flip DRIVER_ATOMIC on, the DRM core
12577 * will take some atomic codepaths to lookup properties during
12578 * drmModeGetConnector() that unconditionally dereference
12579 * connector->state.
12580 *
12581 * We create a dummy connector state here for each connector to ensure
12582 * the DRM core doesn't try to dereference a NULL connector->state.
12583 * The actual connector properties will never be updated or contain
12584 * useful information, but since we're doing this specifically for
12585 * testing/debug of the plane operations (and only when a specific
12586 * kernel module option is given), that shouldn't really matter.
12587 *
12588 * Once atomic support for crtc's + connectors lands, this loop should
12589 * be removed since we'll be setting up real connector state, which
12590 * will contain Intel-specific properties.
12591 */
12592 if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
12593 list_for_each_entry(connector,
12594 &dev->mode_config.connector_list,
12595 head) {
12596 if (!WARN_ON(connector->state)) {
12597 connector->state =
12598 kzalloc(sizeof(*connector->state),
12599 GFP_KERNEL);
12600 }
12601 }
12602 }
12603
12572 intel_psr_init(dev); 12604 intel_psr_init(dev);
12573 12605
12574 for_each_intel_encoder(dev, encoder) { 12606 for_each_intel_encoder(dev, encoder) {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index a2adfa36d83b..8bdaaaff35f3 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -31,6 +31,7 @@
31#include <linux/notifier.h> 31#include <linux/notifier.h>
32#include <linux/reboot.h> 32#include <linux/reboot.h>
33#include <drm/drmP.h> 33#include <drm/drmP.h>
34#include <drm/drm_atomic_helper.h>
34#include <drm/drm_crtc.h> 35#include <drm/drm_crtc.h>
35#include <drm/drm_crtc_helper.h> 36#include <drm/drm_crtc_helper.h>
36#include <drm/drm_edid.h> 37#include <drm/drm_edid.h>
@@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
4402 .fill_modes = drm_helper_probe_single_connector_modes, 4403 .fill_modes = drm_helper_probe_single_connector_modes,
4403 .set_property = intel_dp_set_property, 4404 .set_property = intel_dp_set_property,
4404 .destroy = intel_dp_connector_destroy, 4405 .destroy = intel_dp_connector_destroy,
4406 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
4405}; 4407};
4406 4408
4407static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = { 4409static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 0091a84fdd24..f86da0fad718 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -26,6 +26,7 @@
26#include <drm/drmP.h> 26#include <drm/drmP.h>
27#include "i915_drv.h" 27#include "i915_drv.h"
28#include "intel_drv.h" 28#include "intel_drv.h"
29#include <drm/drm_atomic_helper.h>
29#include <drm/drm_crtc_helper.h> 30#include <drm/drm_crtc_helper.h>
30#include <drm/drm_edid.h> 31#include <drm/drm_edid.h>
31 32
@@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
314 .fill_modes = drm_helper_probe_single_connector_modes, 315 .fill_modes = drm_helper_probe_single_connector_modes,
315 .set_property = intel_dp_mst_set_property, 316 .set_property = intel_dp_mst_set_property,
316 .destroy = intel_dp_mst_connector_destroy, 317 .destroy = intel_dp_mst_connector_destroy,
318 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
317}; 319};
318 320
319static int intel_dp_mst_get_modes(struct drm_connector *connector) 321static int intel_dp_mst_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index c56c4150fc13..e20bb1f8879c 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -24,6 +24,7 @@
24 */ 24 */
25 25
26#include <drm/drmP.h> 26#include <drm/drmP.h>
27#include <drm/drm_atomic_helper.h>
27#include <drm/drm_crtc.h> 28#include <drm/drm_crtc.h>
28#include <drm/drm_edid.h> 29#include <drm/drm_edid.h>
29#include <drm/i915_drm.h> 30#include <drm/i915_drm.h>
@@ -785,6 +786,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = {
785 .detect = intel_dsi_detect, 786 .detect = intel_dsi_detect,
786 .destroy = intel_dsi_destroy, 787 .destroy = intel_dsi_destroy,
787 .fill_modes = drm_helper_probe_single_connector_modes, 788 .fill_modes = drm_helper_probe_single_connector_modes,
789 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
788}; 790};
789 791
790void intel_dsi_init(struct drm_device *dev) 792void intel_dsi_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 706ab99ff4b6..1cf2e352ad1b 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -27,6 +27,7 @@
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <drm/drmP.h> 29#include <drm/drmP.h>
30#include <drm/drm_atomic_helper.h>
30#include <drm/drm_crtc.h> 31#include <drm/drm_crtc.h>
31#include "intel_drv.h" 32#include "intel_drv.h"
32#include <drm/i915_drm.h> 33#include <drm/i915_drm.h>
@@ -390,6 +391,7 @@ static const struct drm_connector_funcs intel_dvo_connector_funcs = {
390 .detect = intel_dvo_detect, 391 .detect = intel_dvo_detect,
391 .destroy = intel_dvo_destroy, 392 .destroy = intel_dvo_destroy,
392 .fill_modes = drm_helper_probe_single_connector_modes, 393 .fill_modes = drm_helper_probe_single_connector_modes,
394 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
393}; 395};
394 396
395static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcs = { 397static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 200a0e7f2a2d..b8fab8cb42bf 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -31,6 +31,7 @@
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/hdmi.h> 32#include <linux/hdmi.h>
33#include <drm/drmP.h> 33#include <drm/drmP.h>
34#include <drm/drm_atomic_helper.h>
34#include <drm/drm_crtc.h> 35#include <drm/drm_crtc.h>
35#include <drm/drm_edid.h> 36#include <drm/drm_edid.h>
36#include "intel_drv.h" 37#include "intel_drv.h"
@@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
1615 .fill_modes = drm_helper_probe_single_connector_modes, 1616 .fill_modes = drm_helper_probe_single_connector_modes,
1616 .set_property = intel_hdmi_set_property, 1617 .set_property = intel_hdmi_set_property,
1617 .destroy = intel_hdmi_destroy, 1618 .destroy = intel_hdmi_destroy,
1619 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
1618}; 1620};
1619 1621
1620static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = { 1622static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index c7c6414d9f8d..908bd42fac5d 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -32,6 +32,7 @@
32#include <linux/i2c.h> 32#include <linux/i2c.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <drm/drmP.h> 34#include <drm/drmP.h>
35#include <drm/drm_atomic_helper.h>
35#include <drm/drm_crtc.h> 36#include <drm/drm_crtc.h>
36#include <drm/drm_edid.h> 37#include <drm/drm_edid.h>
37#include "intel_drv.h" 38#include "intel_drv.h"
@@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
532 .fill_modes = drm_helper_probe_single_connector_modes, 533 .fill_modes = drm_helper_probe_single_connector_modes,
533 .set_property = intel_lvds_set_property, 534 .set_property = intel_lvds_set_property,
534 .destroy = intel_lvds_destroy, 535 .destroy = intel_lvds_destroy,
536 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
535}; 537};
536 538
537static const struct drm_encoder_funcs intel_lvds_enc_funcs = { 539static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 5b8275b04b9a..ae00bf9ce07a 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -30,6 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/export.h> 31#include <linux/export.h>
32#include <drm/drmP.h> 32#include <drm/drmP.h>
33#include <drm/drm_atomic_helper.h>
33#include <drm/drm_crtc.h> 34#include <drm/drm_crtc.h>
34#include <drm/drm_edid.h> 35#include <drm/drm_edid.h>
35#include "intel_drv.h" 36#include "intel_drv.h"
@@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
2191 .fill_modes = drm_helper_probe_single_connector_modes, 2192 .fill_modes = drm_helper_probe_single_connector_modes,
2192 .set_property = intel_sdvo_set_property, 2193 .set_property = intel_sdvo_set_property,
2193 .destroy = intel_sdvo_destroy, 2194 .destroy = intel_sdvo_destroy,
2195 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
2194}; 2196};
2195 2197
2196static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = { 2198static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 10e7ebd79f5a..d450054584a9 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -31,6 +31,7 @@
31 */ 31 */
32 32
33#include <drm/drmP.h> 33#include <drm/drmP.h>
34#include <drm/drm_atomic_helper.h>
34#include <drm/drm_crtc.h> 35#include <drm/drm_crtc.h>
35#include <drm/drm_edid.h> 36#include <drm/drm_edid.h>
36#include "intel_drv.h" 37#include "intel_drv.h"
@@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
1513 .destroy = intel_tv_destroy, 1514 .destroy = intel_tv_destroy,
1514 .set_property = intel_tv_set_property, 1515 .set_property = intel_tv_set_property,
1515 .fill_modes = drm_helper_probe_single_connector_modes, 1516 .fill_modes = drm_helper_probe_single_connector_modes,
1517 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
1516}; 1518};
1517 1519
1518static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = { 1520static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {