[Intel-gfx] [PATCH] drm/i915: Make sure the base lives at offset 0 of all kms objects

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Wed Oct 12 11:33:11 UTC 2016


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

We occasionally depend on eg. to_intel_crtc(NULL) being NULL as
well. Sprinkle in some BUILD_BUG_ON()s to make sure we don't
accidentally change things in a way that would violate this
assumption.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e4bdd3a6a6e3..724a982bbb05 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -16331,6 +16331,15 @@ void intel_modeset_init(struct drm_device *dev)
 	enum pipe pipe;
 	struct intel_crtc *crtc;
 
+	BUILD_BUG_ON(to_intel_plane(NULL) != NULL);
+	BUILD_BUG_ON(to_intel_crtc(NULL) != NULL);
+	BUILD_BUG_ON(to_intel_encoder(NULL) != NULL);
+	BUILD_BUG_ON(to_intel_connector(NULL) != NULL);
+
+	BUILD_BUG_ON(to_intel_plane_state(NULL) != NULL);
+	BUILD_BUG_ON(to_intel_crtc_state(NULL) != NULL);
+	BUILD_BUG_ON(to_intel_atomic_state(NULL) != NULL);
+
 	drm_mode_config_init(dev);
 
 	dev->mode_config.min_width = 0;
-- 
2.7.4



More information about the Intel-gfx mailing list