All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] i915 nuclear pageflip (v2)
@ 2015-01-22  0:35 Matt Roper
  2015-01-22  0:35 ` [PATCH 01/10] drm: Add rotation value to plane state Matt Roper
                   ` (9 more replies)
  0 siblings, 10 replies; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

Previous version of this series was here:
        http://lists.freedesktop.org/archives/intel-gfx/2015-January/058631.html

This round incorporates feedback from Daniel, Ander, and Bob.  The biggest
change here is that Daniel convinced me that the transitional helper for
property updates wouldn't really be useful for other drivers, so I dropped that
helper completely and instead just move i915 straight to the full atomic helper
a little bit later in the series.

Matt Roper (10):
  drm: Add rotation value to plane state
  drm/i915: Move rotation from intel_plane to drm_plane_state
  drm/i915: Consolidate plane handler vtables
  drm/i915: Add .atomic_{get,set}_property() entrypoints to planes
  drm/i915: Add main atomic entrypoints (v2)
  drm/i915: Setup dummy atomic state for connectors (v2)
  drm/i915: Add atomic_get_property entrypoint for connectors
  drm/i915: Add crtc state duplication/destruction functions
  drm/i915: Switch plane properties to full atomic helper.
  drm/i915: Add i915.nuclear_pageflip command line param to force atomic
    (v3)

 drivers/gpu/drm/drm_atomic.c              |   2 +
 drivers/gpu/drm/i915/Makefile             |   1 +
 drivers/gpu/drm/i915/i915_drv.c           |   8 +
 drivers/gpu/drm/i915/i915_drv.h           |   1 +
 drivers/gpu/drm/i915/i915_params.c        |   5 +
 drivers/gpu/drm/i915/intel_atomic.c       | 237 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_atomic_plane.c | 112 ++++++++++++--
 drivers/gpu/drm/i915/intel_crt.c          |   3 +
 drivers/gpu/drm/i915/intel_display.c      |  83 +++++++----
 drivers/gpu/drm/i915/intel_dp.c           |   3 +
 drivers/gpu/drm/i915/intel_dp_mst.c       |   3 +
 drivers/gpu/drm/i915/intel_drv.h          |  31 +++-
 drivers/gpu/drm/i915/intel_dsi.c          |   2 +
 drivers/gpu/drm/i915/intel_dvo.c          |   2 +
 drivers/gpu/drm/i915/intel_fbc.c          |   2 +-
 drivers/gpu/drm/i915/intel_hdmi.c         |   3 +
 drivers/gpu/drm/i915/intel_lvds.c         |   3 +
 drivers/gpu/drm/i915/intel_sdvo.c         |   3 +
 drivers/gpu/drm/i915/intel_sprite.c       |  60 ++------
 drivers/gpu/drm/i915/intel_tv.c           |   3 +
 include/drm/drm_crtc.h                    |   3 +
 21 files changed, 483 insertions(+), 87 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_atomic.c

-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/10] drm: Add rotation value to plane state
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22  0:35 ` [PATCH 02/10] drm/i915: Move rotation from intel_plane to drm_plane_state Matt Roper
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx; +Cc: dri-devel

The rotation property is shared by multiple drivers, so it makes sense
to store the rotation value (for atomic-converted drivers) in the common
plane state so that core code can eventually access it as well.

Cc: dri-devel@lists.freedesktop.org
Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/drm_atomic.c | 2 ++
 include/drm/drm_crtc.h       | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index af3f3df..4c5c9c3 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -387,6 +387,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
 		state->src_w = val;
 	} else if (property == config->prop_src_h) {
 		state->src_h = val;
+	} else if (property == config->rotation_property) {
+		state->rotation = val;
 	} else if (plane->funcs->atomic_set_property) {
 		return plane->funcs->atomic_set_property(plane, state,
 				property, val);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 65da9fb..c6f3d81d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -760,6 +760,9 @@ struct drm_plane_state {
 	uint32_t src_x, src_y;
 	uint32_t src_h, src_w;
 
+	/* Plane rotation */
+	unsigned int rotation;
+
 	struct drm_atomic_state *state;
 };
 
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 02/10] drm/i915: Move rotation from intel_plane to drm_plane_state
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
  2015-01-22  0:35 ` [PATCH 01/10] drm: Add rotation value to plane state Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22 10:54   ` Ander Conselvan de Oliveira
  2015-01-22  0:35 ` [PATCH 03/10] drm/i915: Consolidate plane handler vtables Matt Roper
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

Runtime state that can be manipulated via properties should now go in
intel_plane_state/drm_plane_state so that it can be tracked as part of
an atomic transaction.

We add a new 'intel_create_plane_state' function so that the proper
initial value for this property (and future properties) doesn't have to
be repeated at each plane initialization site.

v2:
 - Stick rotation in common drm_plane_state rather than
   intel_plane_state. (Daniel)
 - Add intel_create_plane_state() to consolidate the places where we
   have to set initial state values.  (Ander)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic_plane.c | 45 ++++++++++++++++++++++++-------
 drivers/gpu/drm/i915/intel_display.c      | 31 ++++++++++-----------
 drivers/gpu/drm/i915/intel_drv.h          |  8 +++++-
 drivers/gpu/drm/i915/intel_fbc.c          |  2 +-
 drivers/gpu/drm/i915/intel_sprite.c       | 31 +++++++++++----------
 5 files changed, 75 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 4027fc0..d9d4306 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -37,31 +37,58 @@
 #include "intel_drv.h"
 
 /**
+ * intel_create_plane_state - create plane state object
+ * @plane: drm plane
+ *
+ * Allocates a fresh plane state for the given plane and sets some of
+ * the state values to sensible initial values.
+ *
+ * Returns: A newly allocated plane state, or NULL on failure
+ */
+struct intel_plane_state *
+intel_create_plane_state(struct drm_plane *plane)
+{
+	struct intel_plane_state *state;
+
+	state = kzalloc(sizeof(*state), GFP_KERNEL);
+	if (!state)
+		return NULL;
+
+	state->base.plane = plane;
+	state->base.rotation = BIT(DRM_ROTATE_0);
+
+	return state;
+}
+
+/**
  * intel_plane_duplicate_state - duplicate plane state
  * @plane: drm plane
  *
  * Allocates and returns a copy of the plane state (both common and
  * Intel-specific) for the specified plane.
  *
- * Returns: The newly allocated plane state, or NULL or failure.
+ * Returns: The newly allocated plane state, or NULL on failure.
  */
 struct drm_plane_state *
 intel_plane_duplicate_state(struct drm_plane *plane)
 {
-	struct intel_plane_state *state;
+	struct drm_plane_state *state;
+	struct intel_plane_state *intel_state;
 
-	if (plane->state)
-		state = kmemdup(plane->state, sizeof(*state), GFP_KERNEL);
+	if (WARN_ON(!plane->state))
+		intel_state = intel_create_plane_state(plane);
 	else
-		state = kzalloc(sizeof(*state), GFP_KERNEL);
+		intel_state = kmemdup(plane->state, sizeof(*intel_state),
+				      GFP_KERNEL);
 
-	if (!state)
+	if (!intel_state)
 		return NULL;
 
-	if (state->base.fb)
-		drm_framebuffer_reference(state->base.fb);
+	state = &intel_state->base;
+	if (state->fb)
+		drm_framebuffer_reference(state->fb);
 
-	return &state->base;
+	return state;
 }
 
 /**
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 01dc80b..db42824 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2560,7 +2560,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
 		intel_crtc->dspaddr_offset = linear_offset;
 	}
 
-	if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180)) {
+	if (crtc->primary->state->rotation == BIT(DRM_ROTATE_180)) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		x += (intel_crtc->config->pipe_src_w - 1);
@@ -2662,7 +2662,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
 					       pixel_size,
 					       fb->pitches[0]);
 	linear_offset -= intel_crtc->dspaddr_offset;
-	if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180)) {
+	if (crtc->primary->state->rotation == BIT(DRM_ROTATE_180)) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
@@ -2759,7 +2759,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
 	}
 
 	plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE;
-	if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180))
+	if (crtc->primary->state->rotation == BIT(DRM_ROTATE_180))
 		plane_ctl |= PLANE_CTL_ROTATE_180;
 
 	I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl);
@@ -8332,7 +8332,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
 			cntl |= CURSOR_PIPE_CSC_ENABLE;
 	}
 
-	if (to_intel_plane(crtc->cursor)->rotation == BIT(DRM_ROTATE_180))
+	if (crtc->cursor->state->rotation == BIT(DRM_ROTATE_180))
 		cntl |= CURSOR_ROTATE_180;
 
 	if (intel_crtc->cursor_cntl != cntl) {
@@ -8394,7 +8394,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 
 	/* ILK+ do this automagically */
 	if (HAS_GMCH_DISPLAY(dev) &&
-		to_intel_plane(crtc->cursor)->rotation == BIT(DRM_ROTATE_180)) {
+	    crtc->cursor->state->rotation == BIT(DRM_ROTATE_180)) {
 		base += (intel_crtc->cursor_height *
 			intel_crtc->cursor_width - 1) * 4;
 	}
@@ -11846,7 +11846,6 @@ intel_check_primary_plane(struct drm_plane *plane,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_crtc *crtc = state->base.crtc;
 	struct intel_crtc *intel_crtc;
-	struct intel_plane *intel_plane = to_intel_plane(plane);
 	struct drm_framebuffer *fb = state->base.fb;
 	struct drm_rect *dest = &state->dst;
 	struct drm_rect *src = &state->src;
@@ -11880,7 +11879,7 @@ intel_check_primary_plane(struct drm_plane *plane,
 		if (intel_crtc->primary_enabled &&
 		    INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
 		    dev_priv->fbc.plane == intel_crtc->plane &&
-		    intel_plane->rotation != BIT(DRM_ROTATE_0)) {
+		    state->base.rotation != BIT(DRM_ROTATE_0)) {
 			intel_crtc->atomic.disable_fbc = true;
 		}
 
@@ -12064,6 +12063,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 						    int pipe)
 {
 	struct intel_plane *primary;
+	struct intel_plane_state *state;
 	const uint32_t *intel_primary_formats;
 	int num_formats;
 
@@ -12071,17 +12071,17 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 	if (primary == NULL)
 		return NULL;
 
-	primary->base.state = intel_plane_duplicate_state(&primary->base);
-	if (primary->base.state == NULL) {
+	state = intel_create_plane_state(&primary->base);
+	if (!state) {
 		kfree(primary);
 		return NULL;
 	}
+	primary->base.state = &state->base;
 
 	primary->can_scale = false;
 	primary->max_downscale = 1;
 	primary->pipe = pipe;
 	primary->plane = pipe;
-	primary->rotation = BIT(DRM_ROTATE_0);
 	primary->check_plane = intel_check_primary_plane;
 	primary->commit_plane = intel_commit_primary_plane;
 	if (HAS_FBC(dev) && INTEL_INFO(dev)->gen < 4)
@@ -12109,7 +12109,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 		if (dev->mode_config.rotation_property)
 			drm_object_attach_property(&primary->base.base,
 				dev->mode_config.rotation_property,
-				primary->rotation);
+				state->base.rotation);
 	}
 
 	drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
@@ -12237,22 +12237,23 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 						   int pipe)
 {
 	struct intel_plane *cursor;
+	struct intel_plane_state *state;
 
 	cursor = kzalloc(sizeof(*cursor), GFP_KERNEL);
 	if (cursor == NULL)
 		return NULL;
 
-	cursor->base.state = intel_plane_duplicate_state(&cursor->base);
-	if (cursor->base.state == NULL) {
+	state = intel_create_plane_state(&cursor->base);
+	if (!state) {
 		kfree(cursor);
 		return NULL;
 	}
+	cursor->base.state = &state->base;
 
 	cursor->can_scale = false;
 	cursor->max_downscale = 1;
 	cursor->pipe = pipe;
 	cursor->plane = pipe;
-	cursor->rotation = BIT(DRM_ROTATE_0);
 	cursor->check_plane = intel_check_cursor_plane;
 	cursor->commit_plane = intel_commit_cursor_plane;
 
@@ -12271,7 +12272,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 		if (dev->mode_config.rotation_property)
 			drm_object_attach_property(&cursor->base.base,
 				dev->mode_config.rotation_property,
-				cursor->rotation);
+				state->base.rotation);
 	}
 
 	drm_plane_helper_add(&cursor->base, &intel_plane_helper_funcs);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e957d4d..b0562e4 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -509,7 +509,6 @@ struct intel_plane {
 	struct drm_i915_gem_object *obj;
 	bool can_scale;
 	int max_downscale;
-	unsigned int rotation;
 
 	/* Since we need to change the watermarks before/after
 	 * enabling/disabling the planes, we need to store the parameters here
@@ -518,6 +517,12 @@ struct intel_plane {
 	 */
 	struct intel_plane_wm_parameters wm;
 
+	/*
+	 * NOTE: Do not place new plane state fields here (e.g., when adding
+	 * new plane properties).  New runtime state should now be placed in
+	 * the intel_plane_state structure and accessed via drm_plane->state.
+	 */
+
 	void (*update_plane)(struct drm_plane *plane,
 			     struct drm_crtc *crtc,
 			     struct drm_framebuffer *fb,
@@ -1230,6 +1235,7 @@ void intel_pre_disable_primary(struct drm_crtc *crtc);
 void intel_tv_init(struct drm_device *dev);
 
 /* intel_atomic.c */
+struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
 struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
 void intel_plane_destroy_state(struct drm_plane *plane,
 			       struct drm_plane_state *state);
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index ed9a012..624d1d9 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -595,7 +595,7 @@ void intel_fbc_update(struct drm_device *dev)
 		goto out_disable;
 	}
 	if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
-	    to_intel_plane(crtc->primary)->rotation != BIT(DRM_ROTATE_0)) {
+	    crtc->primary->state->rotation != BIT(DRM_ROTATE_0)) {
 		if (set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE))
 			DRM_DEBUG_KMS("Rotation unsupported, disabling\n");
 		goto out_disable;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 0a6094e..ba85439 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -256,7 +256,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
 	default:
 		BUG();
 	}
-	if (intel_plane->rotation == BIT(DRM_ROTATE_180))
+	if (drm_plane->state->rotation == BIT(DRM_ROTATE_180))
 		plane_ctl |= PLANE_CTL_ROTATE_180;
 
 	plane_ctl |= PLANE_CTL_ENABLE;
@@ -493,7 +493,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
 							fb->pitches[0]);
 	linear_offset -= sprsurf_offset;
 
-	if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+	if (dplane->state->rotation == BIT(DRM_ROTATE_180)) {
 		sprctl |= SP_ROTATE_180;
 
 		x += src_w;
@@ -684,7 +684,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 					       pixel_size, fb->pitches[0]);
 	linear_offset -= sprsurf_offset;
 
-	if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+	if (plane->state->rotation == BIT(DRM_ROTATE_180)) {
 		sprctl |= SPRITE_ROTATE_180;
 
 		/* HSW and BDW does this automagically in hardware */
@@ -884,7 +884,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 					       pixel_size, fb->pitches[0]);
 	linear_offset -= dvssurf_offset;
 
-	if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
+	if (plane->state->rotation == BIT(DRM_ROTATE_180)) {
 		dvscntr |= DVS_ROTATE_180;
 
 		x += src_w;
@@ -1125,7 +1125,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	min_scale = intel_plane->can_scale ? 1 : (1 << 16);
 
 	drm_rect_rotate(src, fb->width << 16, fb->height << 16,
-			intel_plane->rotation);
+			state->base.rotation);
 
 	hscale = drm_rect_calc_hscale_relaxed(src, dst, min_scale, max_scale);
 	BUG_ON(hscale < 0);
@@ -1166,7 +1166,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 				     drm_rect_height(dst) * vscale - drm_rect_height(src));
 
 		drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16,
-				    intel_plane->rotation);
+				    state->base.rotation);
 
 		/* sanity check to make sure the src viewport wasn't enlarged */
 		WARN_ON(src->x1 < (int) state->base.src_x ||
@@ -1367,7 +1367,6 @@ int intel_plane_set_property(struct drm_plane *plane,
 			     uint64_t val)
 {
 	struct drm_device *dev = plane->dev;
-	struct intel_plane *intel_plane = to_intel_plane(plane);
 	uint64_t old_val;
 	int ret = -ENOENT;
 
@@ -1376,14 +1375,14 @@ int intel_plane_set_property(struct drm_plane *plane,
 		if (hweight32(val & 0xf) != 1)
 			return -EINVAL;
 
-		if (intel_plane->rotation == val)
+		if (plane->state->rotation == val)
 			return 0;
 
-		old_val = intel_plane->rotation;
-		intel_plane->rotation = val;
+		old_val = plane->state->rotation;
+		plane->state->rotation = val;
 		ret = intel_plane_restore(plane);
 		if (ret)
-			intel_plane->rotation = old_val;
+			plane->state->rotation = old_val;
 	}
 
 	return ret;
@@ -1457,6 +1456,7 @@ int
 intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 {
 	struct intel_plane *intel_plane;
+	struct intel_plane_state *state;
 	unsigned long possible_crtcs;
 	const uint32_t *plane_formats;
 	int num_plane_formats;
@@ -1469,12 +1469,12 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 	if (!intel_plane)
 		return -ENOMEM;
 
-	intel_plane->base.state =
-		intel_plane_duplicate_state(&intel_plane->base);
-	if (intel_plane->base.state == NULL) {
+	state = intel_create_plane_state(&intel_plane->base);
+	if (!state) {
 		kfree(intel_plane);
 		return -ENOMEM;
 	}
+	intel_plane->base.state = &state->base;
 
 	switch (INTEL_INFO(dev)->gen) {
 	case 5:
@@ -1545,7 +1545,6 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 
 	intel_plane->pipe = pipe;
 	intel_plane->plane = plane;
-	intel_plane->rotation = BIT(DRM_ROTATE_0);
 	intel_plane->check_plane = intel_check_sprite_plane;
 	intel_plane->commit_plane = intel_commit_sprite_plane;
 	possible_crtcs = (1 << pipe);
@@ -1567,7 +1566,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 	if (dev->mode_config.rotation_property)
 		drm_object_attach_property(&intel_plane->base.base,
 					   dev->mode_config.rotation_property,
-					   intel_plane->rotation);
+					   state->base.rotation);
 
 	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
 
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/10] drm/i915: Consolidate plane handler vtables
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
  2015-01-22  0:35 ` [PATCH 01/10] drm: Add rotation value to plane state Matt Roper
  2015-01-22  0:35 ` [PATCH 02/10] drm/i915: Move rotation from intel_plane to drm_plane_state Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22  0:35 ` [PATCH 04/10] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes Matt Roper
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

All of the previous refactoring/consolidation of plane code has resulted
in intel_primary_plane_funcs, intel_cursor_plane_funcs, and
intel_sprite_plane_funcs being identical.  Replace all of these with a
single 'intel_plane_funcs' vtable for simplicity.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
---
 drivers/gpu/drm/i915/intel_display.c | 15 +++------------
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_sprite.c  | 11 +----------
 3 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index db42824..e0ffb14 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12049,7 +12049,7 @@ void intel_plane_destroy(struct drm_plane *plane)
 	kfree(intel_plane);
 }
 
-static const struct drm_plane_funcs intel_primary_plane_funcs = {
+const struct drm_plane_funcs intel_plane_funcs = {
 	.update_plane = drm_plane_helper_update,
 	.disable_plane = drm_plane_helper_disable,
 	.destroy = intel_plane_destroy,
@@ -12096,7 +12096,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 	}
 
 	drm_universal_plane_init(dev, &primary->base, 0,
-				 &intel_primary_plane_funcs,
+				 &intel_plane_funcs,
 				 intel_primary_formats, num_formats,
 				 DRM_PLANE_TYPE_PRIMARY);
 
@@ -12224,15 +12224,6 @@ update:
 		intel_crtc_update_cursor(crtc, state->visible);
 }
 
-static const struct drm_plane_funcs intel_cursor_plane_funcs = {
-	.update_plane = drm_plane_helper_update,
-	.disable_plane = drm_plane_helper_disable,
-	.destroy = intel_plane_destroy,
-	.set_property = intel_plane_set_property,
-	.atomic_duplicate_state = intel_plane_duplicate_state,
-	.atomic_destroy_state = intel_plane_destroy_state,
-};
-
 static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 						   int pipe)
 {
@@ -12258,7 +12249,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 	cursor->commit_plane = intel_commit_cursor_plane;
 
 	drm_universal_plane_init(dev, &cursor->base, 0,
-				 &intel_cursor_plane_funcs,
+				 &intel_plane_funcs,
 				 intel_cursor_formats,
 				 ARRAY_SIZE(intel_cursor_formats),
 				 DRM_PLANE_TYPE_CURSOR);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index b0562e4..3b88ecc 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -890,6 +890,7 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv);
 void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
 
 /* intel_display.c */
+extern const struct drm_plane_funcs intel_plane_funcs;
 bool intel_has_pending_fb_unpin(struct drm_device *dev);
 int intel_pch_rawclk(struct drm_device *dev);
 void intel_mark_busy(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index ba85439..50683d4 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1400,15 +1400,6 @@ int intel_plane_restore(struct drm_plane *plane)
 				  plane->state->src_w, plane->state->src_h);
 }
 
-static const struct drm_plane_funcs intel_sprite_plane_funcs = {
-	.update_plane = drm_plane_helper_update,
-	.disable_plane = drm_plane_helper_disable,
-	.destroy = intel_plane_destroy,
-	.set_property = intel_plane_set_property,
-	.atomic_duplicate_state = intel_plane_duplicate_state,
-	.atomic_destroy_state = intel_plane_destroy_state,
-};
-
 static uint32_t ilk_plane_formats[] = {
 	DRM_FORMAT_XRGB8888,
 	DRM_FORMAT_YUYV,
@@ -1549,7 +1540,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 	intel_plane->commit_plane = intel_commit_sprite_plane;
 	possible_crtcs = (1 << pipe);
 	ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs,
-				       &intel_sprite_plane_funcs,
+				       &intel_plane_funcs,
 				       plane_formats, num_plane_formats,
 				       DRM_PLANE_TYPE_OVERLAY);
 	if (ret) {
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 04/10] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
                   ` (2 preceding siblings ...)
  2015-01-22  0:35 ` [PATCH 03/10] drm/i915: Consolidate plane handler vtables Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22 11:09   ` Ander Conselvan de Oliveira
  2015-01-22  0:35 ` [PATCH 05/10] drm/i915: Add main atomic entrypoints (v2) Matt Roper
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

When we flip on the DRIVER_ATOMIC bit, the DRM core will start calling
this entrypoint to set and lookup driver-specific plane property values,
rather than maintaining a shadow copy in object->properties.

Note that although we add these functions to the plane vtable, they will
not yet be called.  Future patches that switch our .set_property()
handler and/or enable full atomic functionality are required before
these code paths will be executed.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic_plane.c | 58 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c      |  2 ++
 drivers/gpu/drm/i915/intel_drv.h          |  8 +++++
 3 files changed, 68 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index d9d4306..4a3914f 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -177,3 +177,61 @@ const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
 	.atomic_update = intel_plane_atomic_update,
 };
 
+/**
+ * intel_plane_atomic_get_property - fetch plane property value
+ * @plane: plane 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 plane property.
+ */
+int
+intel_plane_atomic_get_property(struct drm_plane *plane,
+				const struct drm_plane_state *state,
+				struct drm_property *property,
+				uint64_t *val)
+{
+	struct drm_mode_config *config = &plane->dev->mode_config;
+
+	if (property == config->rotation_property) {
+		*val = state->rotation;
+	} else {
+		DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/**
+ * intel_plane_atomic_set_property - set plane property value
+ * @plane: plane to set property for
+ * @state: state to update property value in
+ * @property: property to set
+ * @val: value to set property to
+ *
+ * Writes the specified property value for a plane into the provided atomic
+ * state object.
+ *
+ * Returns 0 on success, -EINVAL on unrecognized properties
+ */
+int
+intel_plane_atomic_set_property(struct drm_plane *plane,
+				struct drm_plane_state *state,
+				struct drm_property *property,
+				uint64_t val)
+{
+	struct drm_mode_config *config = &plane->dev->mode_config;
+
+	if (property == config->rotation_property) {
+		state->rotation = val;
+	} else {
+		DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
+		return -EINVAL;
+	}
+
+	return 0;
+}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e0ffb14..047c77e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12054,6 +12054,8 @@ const struct drm_plane_funcs intel_plane_funcs = {
 	.disable_plane = drm_plane_helper_disable,
 	.destroy = intel_plane_destroy,
 	.set_property = intel_plane_set_property,
+	.atomic_get_property = intel_plane_atomic_get_property,
+	.atomic_set_property = intel_plane_atomic_set_property,
 	.atomic_duplicate_state = intel_plane_duplicate_state,
 	.atomic_destroy_state = intel_plane_destroy_state,
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3b88ecc..24c63fb 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -945,6 +945,14 @@ int intel_prepare_plane_fb(struct drm_plane *plane,
 			   struct drm_framebuffer *fb);
 void intel_cleanup_plane_fb(struct drm_plane *plane,
 			    struct drm_framebuffer *fb);
+int intel_plane_atomic_get_property(struct drm_plane *plane,
+				    const struct drm_plane_state *state,
+				    struct drm_property *property,
+				    uint64_t *val);
+int intel_plane_atomic_set_property(struct drm_plane *plane,
+				    struct drm_plane_state *state,
+				    struct drm_property *property,
+				    uint64_t val);
 
 /* shared dpll functions */
 struct intel_shared_dpll *intel_crtc_to_shared_dpll(struct intel_crtc *crtc);
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/10] drm/i915: Add main atomic entrypoints (v2)
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
                   ` (3 preceding siblings ...)
  2015-01-22  0:35 ` [PATCH 04/10] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22 12:52   ` Ander Conselvan de Oliveira
  2015-01-22  0:35 ` [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v2) Matt Roper
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

Add the top-level atomic entrypoints for check/commit.  These won't get
called yet; we still need to either enable the atomic ioctl or switch to
using the non-transitional atomic helpers for legacy operations.

v2:
 - Use plane->pipe rather than plane->possible_crtcs while ensuring that
   only a single CRTC is in use.  Either way will work fine since i915
   drm_plane's are always tied to a single CRTC, but plane->pipe is
   slightly more intuitive. (Ander)
 - Simplify crtc/connector checking logic. (Ander)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/Makefile        |   1 +
 drivers/gpu/drm/i915/intel_atomic.c  | 164 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |   2 +
 drivers/gpu/drm/i915/intel_drv.h     |   7 ++
 4 files changed, 174 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/intel_atomic.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 16e3dc3..c7e2ab5 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -66,6 +66,7 @@ i915-y += dvo_ch7017.o \
 	  dvo_ns2501.o \
 	  dvo_sil164.o \
 	  dvo_tfp410.o \
+	  intel_atomic.o \
 	  intel_atomic_plane.o \
 	  intel_crt.o \
 	  intel_ddi.o \
diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
new file mode 100644
index 0000000..5c31f54
--- /dev/null
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -0,0 +1,164 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * DOC: atomic modeset support
+ *
+ * The functions here implement the state management and hardware programming
+ * dispatch required by the atomic modeset infrastructure.
+ * See intel_atomic_plane.c for the plane-specific atomic functionality.
+ */
+
+#include <drm/drmP.h>
+#include <drm/drm_atomic.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_plane_helper.h>
+#include "intel_drv.h"
+
+
+/**
+ * intel_atomic_check - validate state object
+ * @dev: drm device
+ * @state: state to validate
+ */
+int intel_atomic_check(struct drm_device *dev,
+		       struct drm_atomic_state *state)
+{
+	int nplanes = dev->mode_config.num_total_plane;
+	int ncrtcs = dev->mode_config.num_crtc;
+	int nconnectors = dev->mode_config.num_connector;
+	enum pipe nuclear_pipe = INVALID_PIPE;
+	int ret;
+	int i;
+	bool not_nuclear = false;
+
+	/*
+	 * FIXME:  At the moment, we only support "nuclear pageflip" on a
+	 * single CRTC.  Cross-crtc updates will be added later.
+	 */
+	for (i = 0; i < nplanes; i++) {
+		struct intel_plane *plane = to_intel_plane(state->planes[i]);
+		if (!plane)
+			continue;
+
+		if (nuclear_pipe == INVALID_PIPE) {
+			nuclear_pipe = plane->pipe;
+		} else if (nuclear_pipe != plane->pipe) {
+			DRM_DEBUG_KMS("i915 only support atomic plane operations on a single CRTC at the moment\n");
+			return -EINVAL;
+		}
+	}
+
+	/*
+	 * FIXME:  We only handle planes for now; make sure there are no CRTC's
+	 * or connectors involved.
+	 */
+	state->allow_modeset = false;
+	for (i = 0; i < ncrtcs; i++) {
+		struct intel_crtc *crtc = to_intel_crtc(state->crtcs[i]);
+		if (crtc && crtc->pipe != nuclear_pipe)
+			not_nuclear = true;
+	}
+	for (i = 0; i < nconnectors; i++)
+		if (state->connectors[i] != NULL)
+			not_nuclear = true;
+
+	if (not_nuclear) {
+		DRM_DEBUG_KMS("i915 only supports atomic plane operations at the moment\n");
+		return -EINVAL;
+	}
+
+	ret = drm_atomic_helper_check_planes(dev, state);
+	if (ret)
+		return ret;
+
+	return ret;
+}
+
+
+/**
+ * intel_atomic_commit - commit validated state object
+ * @dev: DRM device
+ * @state: the top-level driver state object
+ * @async: asynchronous commit
+ *
+ * This function commits a top-level state object that has been validated
+ * with drm_atomic_helper_check().
+ *
+ * FIXME:  Atomic modeset support for i915 is not yet complete.  At the moment
+ * we can only handle plane-related operations and do not yet support
+ * asynchronous commit.
+ *
+ * RETURNS
+ * Zero for success or -errno.
+ */
+int intel_atomic_commit(struct drm_device *dev,
+			struct drm_atomic_state *state,
+			bool async)
+{
+	int ret;
+	int i;
+
+	if (async) {
+		DRM_DEBUG_KMS("i915 does not yet support async commit\n");
+		return -EINVAL;
+	}
+
+	ret = drm_atomic_helper_prepare_planes(dev, state);
+	if (ret)
+		return ret;
+
+	/* Point of no return */
+
+	/*
+	 * FIXME:  The proper sequence here will eventually be:
+	 *
+	 * drm_atomic_helper_swap_state(dev, state)
+	 * drm_atomic_helper_commit_pre_planes(dev, state);
+	 * drm_atomic_helper_commit_planes(dev, state);
+	 * drm_atomic_helper_commit_post_planes(dev, state);
+	 * drm_atomic_helper_wait_for_vblanks(dev, state);
+	 * drm_atomic_helper_cleanup_planes(dev, state);
+	 * drm_atomic_state_free(state);
+	 *
+	 * once we have full atomic modeset.  For now, just manually update
+	 * plane states to avoid clobbering good states with dummy states
+	 * while nuclear pageflipping.
+	 */
+	for (i = 0; i < dev->mode_config.num_total_plane; i++) {
+		struct drm_plane *plane = state->planes[i];
+
+		if (!plane)
+			continue;
+
+		plane->state->state = state;
+		swap(state->plane_states[i], plane->state);
+		plane->state->state = NULL;
+	}
+	drm_atomic_helper_commit_planes(dev, state);
+	drm_atomic_helper_wait_for_vblanks(dev, state);
+	drm_atomic_helper_cleanup_planes(dev, state);
+	drm_atomic_state_free(state);
+
+	return 0;
+}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 047c77e..f557f2d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12752,6 +12752,8 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
 static const struct drm_mode_config_funcs intel_mode_funcs = {
 	.fb_create = intel_user_framebuffer_create,
 	.output_poll_changed = intel_fbdev_output_poll_changed,
+	.atomic_check = intel_atomic_check,
+	.atomic_commit = intel_atomic_commit,
 };
 
 /* Set up chip specific display functions */
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 24c63fb..833f44c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1244,6 +1244,13 @@ void intel_pre_disable_primary(struct drm_crtc *crtc);
 void intel_tv_init(struct drm_device *dev);
 
 /* intel_atomic.c */
+int intel_atomic_check(struct drm_device *dev,
+		       struct drm_atomic_state *state);
+int intel_atomic_commit(struct drm_device *dev,
+			struct drm_atomic_state *state,
+			bool async);
+
+/* intel_atomic_plane.c */
 struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
 struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
 void intel_plane_destroy_state(struct drm_plane *plane,
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v2)
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
                   ` (4 preceding siblings ...)
  2015-01-22  0:35 ` [PATCH 05/10] drm/i915: Add main atomic entrypoints (v2) Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22 16:00   ` Ander Conselvan de Oliveira
  2015-01-22  0:35 ` [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors Matt Roper
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

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)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c     |  2 ++
 drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c      |  2 ++
 drivers/gpu/drm/i915/intel_dp_mst.c  |  2 ++
 drivers/gpu/drm/i915/intel_dsi.c     |  2 ++
 drivers/gpu/drm/i915/intel_dvo.c     |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c    |  2 ++
 drivers/gpu/drm/i915/intel_lvds.c    |  2 ++
 drivers/gpu/drm/i915/intel_sdvo.c    |  2 ++
 drivers/gpu/drm/i915/intel_tv.c      |  2 ++
 10 files changed, 46 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index bb55368..18ee41e 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -28,6 +28,7 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
@@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = intel_crt_destroy,
 	.set_property = intel_crt_set_property,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 f557f2d..86b66c4 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)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_encoder *encoder;
+	struct drm_connector *connector;
 	bool dpd_is_edp = false;
 
 	intel_lvds_init(dev);
@@ -12569,6 +12570,33 @@ static void intel_setup_outputs(struct drm_device *dev)
 	if (SUPPORTS_TV(dev))
 		intel_tv_init(dev);
 
+	/*
+	 * FIXME:  We don't have full atomic support yet, but we want to be
+	 * able to enable/test plane updates via the atomic interface in the
+	 * meantime.  However as soon as we flip DRIVER_ATOMIC on, the DRM core
+	 * will take some atomic codepaths to lookup properties during
+	 * drmModeGetConnector() that unconditionally dereference
+	 * connector->state.
+	 *
+	 * We create a dummy connector state here for each connector 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 atomic support for crtc's + connectors lands, this loop should
+	 * be removed since we'll be setting up real connector state, which
+	 * will contain Intel-specific properties.
+	 */
+	list_for_each_entry(connector,
+			    &dev->mode_config.connector_list,
+			    head) {
+		if (!WARN_ON(connector->state))
+			connector->state = kzalloc(sizeof(*connector->state),
+						   GFP_KERNEL);
+	}
+
 	intel_psr_init(dev);
 
 	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 b38d737..1b1917b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -31,6 +31,7 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
@@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_dp_set_property,
 	.destroy = intel_dp_connector_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 0091a84..f86da0f 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -26,6 +26,7 @@
 #include <drm/drmP.h>
 #include "i915_drv.h"
 #include "intel_drv.h"
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
 
@@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_dp_mst_set_property,
 	.destroy = intel_dp_mst_connector_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 6620124..e9226ac 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -24,6 +24,7 @@
  */
 
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
@@ -791,6 +792,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_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 void 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 706ab99..1cf2e352 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -27,6 +27,7 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include "intel_drv.h"
 #include <drm/i915_drm.h>
@@ -390,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_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 200a0e7..b8fab8c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -31,6 +31,7 @@
 #include <linux/delay.h>
 #include <linux/hdmi.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
@@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_hdmi_set_property,
 	.destroy = intel_hdmi_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 c7c6414..908bd42 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -32,6 +32,7 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
@@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_lvds_set_property,
 	.destroy = intel_lvds_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 5b8275b..ae00bf9 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -30,6 +30,7 @@
 #include <linux/delay.h>
 #include <linux/export.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
@@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_sdvo_set_property,
 	.destroy = intel_sdvo_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 10e7ebd..d450054 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -31,6 +31,7 @@
  */
 
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
@@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
 	.destroy = intel_tv_destroy,
 	.set_property = intel_tv_set_property,
 	.fill_modes = drm_helper_probe_single_connector_modes,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
                   ` (5 preceding siblings ...)
  2015-01-22  0:35 ` [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v2) Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22 16:55   ` Ander Conselvan de Oliveira
  2015-01-22  0:35 ` [PATCH 08/10] drm/i915: Add crtc state duplication/destruction functions Matt Roper
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

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.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic.c | 38 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_crt.c    |  1 +
 drivers/gpu/drm/i915/intel_dp.c     |  1 +
 drivers/gpu/drm/i915/intel_dp_mst.c |  1 +
 drivers/gpu/drm/i915/intel_drv.h    |  4 ++++
 drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
 drivers/gpu/drm/i915/intel_lvds.c   |  1 +
 drivers/gpu/drm/i915/intel_sdvo.c   |  1 +
 drivers/gpu/drm/i915/intel_tv.c     |  1 +
 9 files changed, 49 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index 5c31f54..52ef6f4 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -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;
+}
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 18ee41e..e66e17a 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -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 = {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1b1917b..bac55dd 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index f86da0f..2856b0b 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 833f44c..b068d7a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1249,6 +1249,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);
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index b8fab8c..995c5b2 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 908bd42..071b96d 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index ae00bf9..64ad2b4 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index d450054..892d23c 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -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,
 };
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/10] drm/i915: Add crtc state duplication/destruction functions
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
                   ` (6 preceding siblings ...)
  2015-01-22  0:35 ` [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22 17:08   ` Ander Conselvan de Oliveira
  2015-01-22  0:35 ` [PATCH 09/10] drm/i915: Switch plane properties to full atomic helper Matt Roper
  2015-01-22  0:35 ` [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v3) Matt Roper
  9 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

The atomic helpers need these to prepare a new state object when
starting a new atomic operation.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic.c  | 35 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |  2 ++
 drivers/gpu/drm/i915/intel_drv.h     |  3 +++
 3 files changed, 40 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index 52ef6f4..19a9dd5 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -200,3 +200,38 @@ intel_connector_atomic_get_property(struct drm_connector *connector,
 
 	return -EINVAL;
 }
+
+/*
+ * intel_crtc_duplicate_state - duplicate crtc state
+ * @crtc: drm crtc
+ *
+ * Allocates and returns a copy of the crtc state (both common and
+ * Intel-specific) for the specified crtc.
+ *
+ * Returns: The newly allocated crtc state, or NULL on failure.
+ */
+struct drm_crtc_state *
+intel_crtc_duplicate_state(struct drm_crtc *crtc)
+{
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+	if (WARN_ON(!intel_crtc->config))
+		return kzalloc(sizeof(*intel_crtc->config), GFP_KERNEL);
+
+	return kmemdup(intel_crtc->config, sizeof(*intel_crtc->config),
+		       GFP_KERNEL);
+}
+
+/**
+ * intel_crtc_destroy_state - destroy crtc state
+ * @crtc: drm crtc
+ *
+ * Destroys the crtc state (both common and Intel-specific) for the
+ * specified crtc.
+ */
+void
+intel_crtc_destroy_state(struct drm_crtc *crtc,
+			  struct drm_crtc_state *state)
+{
+	drm_atomic_helper_crtc_destroy_state(crtc, state);
+}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 86b66c4..db20773 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11652,6 +11652,8 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
 	.set_config = intel_crtc_set_config,
 	.destroy = intel_crtc_destroy,
 	.page_flip = intel_crtc_page_flip,
+	.atomic_duplicate_state = intel_crtc_duplicate_state,
+	.atomic_destroy_state = intel_crtc_destroy_state,
 };
 
 static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index b068d7a..60da153 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1253,6 +1253,9 @@ int intel_connector_atomic_get_property(struct drm_connector *connector,
 					const struct drm_connector_state *state,
 					struct drm_property *property,
 					uint64_t *val);
+struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
+void intel_crtc_destroy_state(struct drm_crtc *crtc,
+			       struct drm_crtc_state *state);
 
 /* intel_atomic_plane.c */
 struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/10] drm/i915: Switch plane properties to full atomic helper.
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
                   ` (7 preceding siblings ...)
  2015-01-22  0:35 ` [PATCH 08/10] drm/i915: Add crtc state duplication/destruction functions Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22 17:16   ` Ander Conselvan de Oliveira
  2015-01-22  0:35 ` [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v3) Matt Roper
  9 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

This will exercise our atomic pipeline for legacy property updates.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_atomic_plane.c |  9 +++++++++
 drivers/gpu/drm/i915/intel_display.c      |  3 ++-
 drivers/gpu/drm/i915/intel_sprite.c       | 26 --------------------------
 3 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 4a3914f..9e6f727 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -118,6 +118,15 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
 	intel_crtc = to_intel_crtc(crtc);
 
 	/*
+	 * Both crtc and plane->crtc could be NULL if we're updating a
+	 * property while the plane is disabled.  We don't actually have
+	 * anything driver-specific we need to test in that case, so
+	 * just return success.
+	 */
+	if (!crtc)
+		return 0;
+
+	/*
 	 * The original src/dest coordinates are stored in state->base, but
 	 * we want to keep another copy internal to our driver that we can
 	 * clip/modify ourselves.
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index db20773..90b788a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -37,6 +37,7 @@
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_trace.h"
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_plane_helper.h>
@@ -12055,7 +12056,7 @@ const struct drm_plane_funcs intel_plane_funcs = {
 	.update_plane = drm_plane_helper_update,
 	.disable_plane = drm_plane_helper_disable,
 	.destroy = intel_plane_destroy,
-	.set_property = intel_plane_set_property,
+	.set_property = drm_atomic_helper_plane_set_property,
 	.atomic_get_property = intel_plane_atomic_get_property,
 	.atomic_set_property = intel_plane_atomic_set_property,
 	.atomic_duplicate_state = intel_plane_duplicate_state,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 50683d4..0a52c44 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1362,32 +1362,6 @@ out_unlock:
 	return ret;
 }
 
-int intel_plane_set_property(struct drm_plane *plane,
-			     struct drm_property *prop,
-			     uint64_t val)
-{
-	struct drm_device *dev = plane->dev;
-	uint64_t old_val;
-	int ret = -ENOENT;
-
-	if (prop == dev->mode_config.rotation_property) {
-		/* exactly one rotation angle please */
-		if (hweight32(val & 0xf) != 1)
-			return -EINVAL;
-
-		if (plane->state->rotation == val)
-			return 0;
-
-		old_val = plane->state->rotation;
-		plane->state->rotation = val;
-		ret = intel_plane_restore(plane);
-		if (ret)
-			plane->state->rotation = old_val;
-	}
-
-	return ret;
-}
-
 int intel_plane_restore(struct drm_plane *plane)
 {
 	if (!plane->crtc || !plane->fb)
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v3)
  2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
                   ` (8 preceding siblings ...)
  2015-01-22  0:35 ` [PATCH 09/10] drm/i915: Switch plane properties to full atomic helper Matt Roper
@ 2015-01-22  0:35 ` Matt Roper
  2015-01-22 17:32   ` Ander Conselvan de Oliveira
  9 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-22  0:35 UTC (permalink / raw)
  To: intel-gfx

We don't have full atomic modeset support yet, but the "nuclear
pageflip" subset of functionality (i.e., plane operations only) should
be ready.  Allow the user to force atomic on for debug purposes, or for
fixed-purpose embedded devices that will only use atomic for plane
updates.

The term 'nuclear' is used here instead of 'atomic' to make it clear
that this doesn't allow full atomic modeset support, just a (very
useful) subset of the atomic functionality.

We'll drop the kernel parameter and unconditionally enable atomic in a
future patch once all of the necessary pieces are in.

v2:
 - Use module_param_named_unsafe() (Daniel)
 - Simplify comment on DRIVER_ATOMIC guard (Daniel)

v3:
 - Make the parameter "nuclear_pageflip" rather than just "nuclear"
   for clarity. (Ander)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c    | 8 ++++++++
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 5 +++++
 3 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 66c72bd..9a86e2c 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1637,6 +1637,14 @@ static int __init i915_init(void)
 #endif
 	}
 
+	/*
+	 * FIXME: Note that we're lying to the DRM core here so that we can get access
+	 * to the atomic ioctl and the atomic properties.  Only plane operations on
+	 * a single CRTC will actually work.
+	 */
+	if (i915.nuclear)
+		driver.driver_features |= DRIVER_ATOMIC;
+
 	return drm_pci_init(&driver, &i915_pci_driver);
 }
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0d67b17..ff3dca7 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2526,6 +2526,7 @@ struct i915_params {
 	int use_mmio_flip;
 	bool mmio_debug;
 	bool verbose_state_checks;
+	bool nuclear;
 };
 extern struct i915_params i915 __read_mostly;
 
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 07252d8..2bccaf9 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = {
 	.use_mmio_flip = 0,
 	.mmio_debug = 0,
 	.verbose_state_checks = 1,
+	.nuclear = 0,
 };
 
 module_param_named(modeset, i915.modeset, int, 0400);
@@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,
 module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
 MODULE_PARM_DESC(verbose_state_checks,
 	"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
+
+module_param_named_unsafe(nuclear_pageflip, i915.nuclear, bool, 0600);
+MODULE_PARM_DESC(nuclear_pageflip,
+		 "Force atomic modeset functionality; only planes work for now (default: false).");
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 02/10] drm/i915: Move rotation from intel_plane to drm_plane_state
  2015-01-22  0:35 ` [PATCH 02/10] drm/i915: Move rotation from intel_plane to drm_plane_state Matt Roper
@ 2015-01-22 10:54   ` Ander Conselvan de Oliveira
  0 siblings, 0 replies; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-22 10:54 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

On 01/22/2015 02:35 AM, Matt Roper wrote:
> Runtime state that can be manipulated via properties should now go in
> intel_plane_state/drm_plane_state so that it can be tracked as part of
> an atomic transaction.
> 
> We add a new 'intel_create_plane_state' function so that the proper
> initial value for this property (and future properties) doesn't have to
> be repeated at each plane initialization site.
> 
> v2:
>   - Stick rotation in common drm_plane_state rather than
>     intel_plane_state. (Daniel)
>   - Add intel_create_plane_state() to consolidate the places where we
>     have to set initial state values.  (Ander)
> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_atomic_plane.c | 45 ++++++++++++++++++++++++-------
>   drivers/gpu/drm/i915/intel_display.c      | 31 ++++++++++-----------
>   drivers/gpu/drm/i915/intel_drv.h          |  8 +++++-
>   drivers/gpu/drm/i915/intel_fbc.c          |  2 +-
>   drivers/gpu/drm/i915/intel_sprite.c       | 31 +++++++++++----------
>   5 files changed, 75 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 4027fc0..d9d4306 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -37,31 +37,58 @@
>   #include "intel_drv.h"
>   
>   /**
> + * intel_create_plane_state - create plane state object
> + * @plane: drm plane
> + *
> + * Allocates a fresh plane state for the given plane and sets some of
> + * the state values to sensible initial values.
> + *
> + * Returns: A newly allocated plane state, or NULL on failure
> + */
> +struct intel_plane_state *
> +intel_create_plane_state(struct drm_plane *plane)
> +{
> +	struct intel_plane_state *state;
> +
> +	state = kzalloc(sizeof(*state), GFP_KERNEL);
> +	if (!state)
> +		return NULL;
> +
> +	state->base.plane = plane;
> +	state->base.rotation = BIT(DRM_ROTATE_0);
> +
> +	return state;
> +}
> +
> +/**
>    * intel_plane_duplicate_state - duplicate plane state
>    * @plane: drm plane
>    *
>    * Allocates and returns a copy of the plane state (both common and
>    * Intel-specific) for the specified plane.
>    *
> - * Returns: The newly allocated plane state, or NULL or failure.
> + * Returns: The newly allocated plane state, or NULL on failure.
>    */
>   struct drm_plane_state *
>   intel_plane_duplicate_state(struct drm_plane *plane)
>   {
> -	struct intel_plane_state *state;
> +	struct drm_plane_state *state;
> +	struct intel_plane_state *intel_state;
>   
> -	if (plane->state)
> -		state = kmemdup(plane->state, sizeof(*state), GFP_KERNEL);
> +	if (WARN_ON(!plane->state))
> +		intel_state = intel_create_plane_state(plane);
>   	else
> -		state = kzalloc(sizeof(*state), GFP_KERNEL);
> +		intel_state = kmemdup(plane->state, sizeof(*intel_state),
> +				      GFP_KERNEL);
>   
> -	if (!state)
> +	if (!intel_state)
>   		return NULL;
>   
> -	if (state->base.fb)
> -		drm_framebuffer_reference(state->base.fb);
> +	state = &intel_state->base;
> +	if (state->fb)
> +		drm_framebuffer_reference(state->fb);
>   
> -	return &state->base;
> +	return state;
>   }
>   
>   /**
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 01dc80b..db42824 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2560,7 +2560,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
>   		intel_crtc->dspaddr_offset = linear_offset;
>   	}
>   
> -	if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180)) {
> +	if (crtc->primary->state->rotation == BIT(DRM_ROTATE_180)) {
>   		dspcntr |= DISPPLANE_ROTATE_180;
>   
>   		x += (intel_crtc->config->pipe_src_w - 1);
> @@ -2662,7 +2662,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
>   					       pixel_size,
>   					       fb->pitches[0]);
>   	linear_offset -= intel_crtc->dspaddr_offset;
> -	if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180)) {
> +	if (crtc->primary->state->rotation == BIT(DRM_ROTATE_180)) {
>   		dspcntr |= DISPPLANE_ROTATE_180;
>   
>   		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
> @@ -2759,7 +2759,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
>   	}
>   
>   	plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE;
> -	if (to_intel_plane(crtc->primary)->rotation == BIT(DRM_ROTATE_180))
> +	if (crtc->primary->state->rotation == BIT(DRM_ROTATE_180))
>   		plane_ctl |= PLANE_CTL_ROTATE_180;
>   
>   	I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl);
> @@ -8332,7 +8332,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
>   			cntl |= CURSOR_PIPE_CSC_ENABLE;
>   	}
>   
> -	if (to_intel_plane(crtc->cursor)->rotation == BIT(DRM_ROTATE_180))
> +	if (crtc->cursor->state->rotation == BIT(DRM_ROTATE_180))
>   		cntl |= CURSOR_ROTATE_180;
>   
>   	if (intel_crtc->cursor_cntl != cntl) {
> @@ -8394,7 +8394,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
>   
>   	/* ILK+ do this automagically */
>   	if (HAS_GMCH_DISPLAY(dev) &&
> -		to_intel_plane(crtc->cursor)->rotation == BIT(DRM_ROTATE_180)) {
> +	    crtc->cursor->state->rotation == BIT(DRM_ROTATE_180)) {
>   		base += (intel_crtc->cursor_height *
>   			intel_crtc->cursor_width - 1) * 4;
>   	}
> @@ -11846,7 +11846,6 @@ intel_check_primary_plane(struct drm_plane *plane,
>   	struct drm_i915_private *dev_priv = dev->dev_private;
>   	struct drm_crtc *crtc = state->base.crtc;
>   	struct intel_crtc *intel_crtc;
> -	struct intel_plane *intel_plane = to_intel_plane(plane);
>   	struct drm_framebuffer *fb = state->base.fb;
>   	struct drm_rect *dest = &state->dst;
>   	struct drm_rect *src = &state->src;
> @@ -11880,7 +11879,7 @@ intel_check_primary_plane(struct drm_plane *plane,
>   		if (intel_crtc->primary_enabled &&
>   		    INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
>   		    dev_priv->fbc.plane == intel_crtc->plane &&
> -		    intel_plane->rotation != BIT(DRM_ROTATE_0)) {
> +		    state->base.rotation != BIT(DRM_ROTATE_0)) {
>   			intel_crtc->atomic.disable_fbc = true;
>   		}
>   
> @@ -12064,6 +12063,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
>   						    int pipe)
>   {
>   	struct intel_plane *primary;
> +	struct intel_plane_state *state;
>   	const uint32_t *intel_primary_formats;
>   	int num_formats;
>   
> @@ -12071,17 +12071,17 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
>   	if (primary == NULL)
>   		return NULL;
>   
> -	primary->base.state = intel_plane_duplicate_state(&primary->base);
> -	if (primary->base.state == NULL) {
> +	state = intel_create_plane_state(&primary->base);
> +	if (!state) {
>   		kfree(primary);
>   		return NULL;
>   	}
> +	primary->base.state = &state->base;
>   
>   	primary->can_scale = false;
>   	primary->max_downscale = 1;
>   	primary->pipe = pipe;
>   	primary->plane = pipe;
> -	primary->rotation = BIT(DRM_ROTATE_0);
>   	primary->check_plane = intel_check_primary_plane;
>   	primary->commit_plane = intel_commit_primary_plane;
>   	if (HAS_FBC(dev) && INTEL_INFO(dev)->gen < 4)
> @@ -12109,7 +12109,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
>   		if (dev->mode_config.rotation_property)
>   			drm_object_attach_property(&primary->base.base,
>   				dev->mode_config.rotation_property,
> -				primary->rotation);
> +				state->base.rotation);
>   	}
>   
>   	drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
> @@ -12237,22 +12237,23 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
>   						   int pipe)
>   {
>   	struct intel_plane *cursor;
> +	struct intel_plane_state *state;
>   
>   	cursor = kzalloc(sizeof(*cursor), GFP_KERNEL);
>   	if (cursor == NULL)
>   		return NULL;
>   
> -	cursor->base.state = intel_plane_duplicate_state(&cursor->base);
> -	if (cursor->base.state == NULL) {
> +	state = intel_create_plane_state(&cursor->base);
> +	if (!state) {
>   		kfree(cursor);
>   		return NULL;
>   	}
> +	cursor->base.state = &state->base;
>   
>   	cursor->can_scale = false;
>   	cursor->max_downscale = 1;
>   	cursor->pipe = pipe;
>   	cursor->plane = pipe;
> -	cursor->rotation = BIT(DRM_ROTATE_0);
>   	cursor->check_plane = intel_check_cursor_plane;
>   	cursor->commit_plane = intel_commit_cursor_plane;
>   
> @@ -12271,7 +12272,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
>   		if (dev->mode_config.rotation_property)
>   			drm_object_attach_property(&cursor->base.base,
>   				dev->mode_config.rotation_property,
> -				cursor->rotation);
> +				state->base.rotation);
>   	}
>   
>   	drm_plane_helper_add(&cursor->base, &intel_plane_helper_funcs);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e957d4d..b0562e4 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -509,7 +509,6 @@ struct intel_plane {
>   	struct drm_i915_gem_object *obj;
>   	bool can_scale;
>   	int max_downscale;
> -	unsigned int rotation;
>   
>   	/* Since we need to change the watermarks before/after
>   	 * enabling/disabling the planes, we need to store the parameters here
> @@ -518,6 +517,12 @@ struct intel_plane {
>   	 */
>   	struct intel_plane_wm_parameters wm;
>   
> +	/*
> +	 * NOTE: Do not place new plane state fields here (e.g., when adding
> +	 * new plane properties).  New runtime state should now be placed in
> +	 * the intel_plane_state structure and accessed via drm_plane->state.
> +	 */
> +
>   	void (*update_plane)(struct drm_plane *plane,
>   			     struct drm_crtc *crtc,
>   			     struct drm_framebuffer *fb,
> @@ -1230,6 +1235,7 @@ void intel_pre_disable_primary(struct drm_crtc *crtc);
>   void intel_tv_init(struct drm_device *dev);
>   
>   /* intel_atomic.c */
> +struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
>   struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
>   void intel_plane_destroy_state(struct drm_plane *plane,
>   			       struct drm_plane_state *state);
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> index ed9a012..624d1d9 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -595,7 +595,7 @@ void intel_fbc_update(struct drm_device *dev)
>   		goto out_disable;
>   	}
>   	if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
> -	    to_intel_plane(crtc->primary)->rotation != BIT(DRM_ROTATE_0)) {
> +	    crtc->primary->state->rotation != BIT(DRM_ROTATE_0)) {
>   		if (set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE))
>   			DRM_DEBUG_KMS("Rotation unsupported, disabling\n");
>   		goto out_disable;
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0a6094e..ba85439 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -256,7 +256,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
>   	default:
>   		BUG();
>   	}
> -	if (intel_plane->rotation == BIT(DRM_ROTATE_180))
> +	if (drm_plane->state->rotation == BIT(DRM_ROTATE_180))
>   		plane_ctl |= PLANE_CTL_ROTATE_180;
>   
>   	plane_ctl |= PLANE_CTL_ENABLE;
> @@ -493,7 +493,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
>   							fb->pitches[0]);
>   	linear_offset -= sprsurf_offset;
>   
> -	if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
> +	if (dplane->state->rotation == BIT(DRM_ROTATE_180)) {
>   		sprctl |= SP_ROTATE_180;
>   
>   		x += src_w;
> @@ -684,7 +684,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
>   					       pixel_size, fb->pitches[0]);
>   	linear_offset -= sprsurf_offset;
>   
> -	if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
> +	if (plane->state->rotation == BIT(DRM_ROTATE_180)) {
>   		sprctl |= SPRITE_ROTATE_180;
>   
>   		/* HSW and BDW does this automagically in hardware */
> @@ -884,7 +884,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
>   					       pixel_size, fb->pitches[0]);
>   	linear_offset -= dvssurf_offset;
>   
> -	if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
> +	if (plane->state->rotation == BIT(DRM_ROTATE_180)) {
>   		dvscntr |= DVS_ROTATE_180;
>   
>   		x += src_w;
> @@ -1125,7 +1125,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
>   	min_scale = intel_plane->can_scale ? 1 : (1 << 16);
>   
>   	drm_rect_rotate(src, fb->width << 16, fb->height << 16,
> -			intel_plane->rotation);
> +			state->base.rotation);
>   
>   	hscale = drm_rect_calc_hscale_relaxed(src, dst, min_scale, max_scale);
>   	BUG_ON(hscale < 0);
> @@ -1166,7 +1166,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
>   				     drm_rect_height(dst) * vscale - drm_rect_height(src));
>   
>   		drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16,
> -				    intel_plane->rotation);
> +				    state->base.rotation);
>   
>   		/* sanity check to make sure the src viewport wasn't enlarged */
>   		WARN_ON(src->x1 < (int) state->base.src_x ||
> @@ -1367,7 +1367,6 @@ int intel_plane_set_property(struct drm_plane *plane,
>   			     uint64_t val)
>   {
>   	struct drm_device *dev = plane->dev;
> -	struct intel_plane *intel_plane = to_intel_plane(plane);
>   	uint64_t old_val;
>   	int ret = -ENOENT;
>   
> @@ -1376,14 +1375,14 @@ int intel_plane_set_property(struct drm_plane *plane,
>   		if (hweight32(val & 0xf) != 1)
>   			return -EINVAL;
>   
> -		if (intel_plane->rotation == val)
> +		if (plane->state->rotation == val)
>   			return 0;
>   
> -		old_val = intel_plane->rotation;
> -		intel_plane->rotation = val;
> +		old_val = plane->state->rotation;
> +		plane->state->rotation = val;
>   		ret = intel_plane_restore(plane);
>   		if (ret)
> -			intel_plane->rotation = old_val;
> +			plane->state->rotation = old_val;
>   	}
>   
>   	return ret;
> @@ -1457,6 +1456,7 @@ int
>   intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
>   {
>   	struct intel_plane *intel_plane;
> +	struct intel_plane_state *state;
>   	unsigned long possible_crtcs;
>   	const uint32_t *plane_formats;
>   	int num_plane_formats;
> @@ -1469,12 +1469,12 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
>   	if (!intel_plane)
>   		return -ENOMEM;
>   
> -	intel_plane->base.state =
> -		intel_plane_duplicate_state(&intel_plane->base);
> -	if (intel_plane->base.state == NULL) {
> +	state = intel_create_plane_state(&intel_plane->base);
> +	if (!state) {
>   		kfree(intel_plane);
>   		return -ENOMEM;
>   	}
> +	intel_plane->base.state = &state->base;
>   
>   	switch (INTEL_INFO(dev)->gen) {
>   	case 5:
> @@ -1545,7 +1545,6 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
>   
>   	intel_plane->pipe = pipe;
>   	intel_plane->plane = plane;
> -	intel_plane->rotation = BIT(DRM_ROTATE_0);
>   	intel_plane->check_plane = intel_check_sprite_plane;
>   	intel_plane->commit_plane = intel_commit_sprite_plane;
>   	possible_crtcs = (1 << pipe);
> @@ -1567,7 +1566,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
>   	if (dev->mode_config.rotation_property)
>   		drm_object_attach_property(&intel_plane->base.base,
>   					   dev->mode_config.rotation_property,
> -					   intel_plane->rotation);
> +					   state->base.rotation);
>   
>   	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
>   
> 

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 04/10] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes
  2015-01-22  0:35 ` [PATCH 04/10] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes Matt Roper
@ 2015-01-22 11:09   ` Ander Conselvan de Oliveira
  0 siblings, 0 replies; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-22 11:09 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

On 01/22/2015 02:35 AM, Matt Roper wrote:
> When we flip on the DRIVER_ATOMIC bit, the DRM core will start calling
> this entrypoint to set and lookup driver-specific plane property values,
> rather than maintaining a shadow copy in object->properties.
>
> Note that although we add these functions to the plane vtable, they will
> not yet be called.  Future patches that switch our .set_property()
> handler and/or enable full atomic functionality are required before
> these code paths will be executed.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_atomic_plane.c | 58 +++++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/intel_display.c      |  2 ++
>   drivers/gpu/drm/i915/intel_drv.h          |  8 +++++
>   3 files changed, 68 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index d9d4306..4a3914f 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -177,3 +177,61 @@ const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
>   	.atomic_update = intel_plane_atomic_update,
>   };
>
> +/**
> + * intel_plane_atomic_get_property - fetch plane property value
> + * @plane: plane 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 plane property.
> + */
> +int
> +intel_plane_atomic_get_property(struct drm_plane *plane,
> +				const struct drm_plane_state *state,
> +				struct drm_property *property,
> +				uint64_t *val)
> +{
> +	struct drm_mode_config *config = &plane->dev->mode_config;
> +
> +	if (property == config->rotation_property) {
> +		*val = state->rotation;
> +	} else {
> +		DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
> +/**
> + * intel_plane_atomic_set_property - set plane property value
> + * @plane: plane to set property for
> + * @state: state to update property value in
> + * @property: property to set
> + * @val: value to set property to
> + *
> + * Writes the specified property value for a plane into the provided atomic
> + * state object.
> + *
> + * Returns 0 on success, -EINVAL on unrecognized properties
> + */
> +int
> +intel_plane_atomic_set_property(struct drm_plane *plane,
> +				struct drm_plane_state *state,
> +				struct drm_property *property,
> +				uint64_t val)
> +{
> +	struct drm_mode_config *config = &plane->dev->mode_config;
> +
> +	if (property == config->rotation_property) {
> +		state->rotation = val;
> +	} else {
> +		DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index e0ffb14..047c77e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12054,6 +12054,8 @@ const struct drm_plane_funcs intel_plane_funcs = {
>   	.disable_plane = drm_plane_helper_disable,
>   	.destroy = intel_plane_destroy,
>   	.set_property = intel_plane_set_property,
> +	.atomic_get_property = intel_plane_atomic_get_property,
> +	.atomic_set_property = intel_plane_atomic_set_property,
>   	.atomic_duplicate_state = intel_plane_duplicate_state,
>   	.atomic_destroy_state = intel_plane_destroy_state,
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 3b88ecc..24c63fb 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -945,6 +945,14 @@ int intel_prepare_plane_fb(struct drm_plane *plane,
>   			   struct drm_framebuffer *fb);
>   void intel_cleanup_plane_fb(struct drm_plane *plane,
>   			    struct drm_framebuffer *fb);
> +int intel_plane_atomic_get_property(struct drm_plane *plane,
> +				    const struct drm_plane_state *state,
> +				    struct drm_property *property,
> +				    uint64_t *val);
> +int intel_plane_atomic_set_property(struct drm_plane *plane,
> +				    struct drm_plane_state *state,
> +				    struct drm_property *property,
> +				    uint64_t val);
>
>   /* shared dpll functions */
>   struct intel_shared_dpll *intel_crtc_to_shared_dpll(struct intel_crtc *crtc);
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 05/10] drm/i915: Add main atomic entrypoints (v2)
  2015-01-22  0:35 ` [PATCH 05/10] drm/i915: Add main atomic entrypoints (v2) Matt Roper
@ 2015-01-22 12:52   ` Ander Conselvan de Oliveira
  0 siblings, 0 replies; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-22 12:52 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

On 01/22/2015 02:35 AM, Matt Roper wrote:
> Add the top-level atomic entrypoints for check/commit.  These won't get
> called yet; we still need to either enable the atomic ioctl or switch to
> using the non-transitional atomic helpers for legacy operations.
>
> v2:
>   - Use plane->pipe rather than plane->possible_crtcs while ensuring that
>     only a single CRTC is in use.  Either way will work fine since i915
>     drm_plane's are always tied to a single CRTC, but plane->pipe is
>     slightly more intuitive. (Ander)
>   - Simplify crtc/connector checking logic. (Ander)
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/Makefile        |   1 +
>   drivers/gpu/drm/i915/intel_atomic.c  | 164 +++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/intel_display.c |   2 +
>   drivers/gpu/drm/i915/intel_drv.h     |   7 ++
>   4 files changed, 174 insertions(+)
>   create mode 100644 drivers/gpu/drm/i915/intel_atomic.c
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 16e3dc3..c7e2ab5 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -66,6 +66,7 @@ i915-y += dvo_ch7017.o \
>   	  dvo_ns2501.o \
>   	  dvo_sil164.o \
>   	  dvo_tfp410.o \
> +	  intel_atomic.o \
>   	  intel_atomic_plane.o \
>   	  intel_crt.o \
>   	  intel_ddi.o \
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> new file mode 100644
> index 0000000..5c31f54
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -0,0 +1,164 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * DOC: atomic modeset support
> + *
> + * The functions here implement the state management and hardware programming
> + * dispatch required by the atomic modeset infrastructure.
> + * See intel_atomic_plane.c for the plane-specific atomic functionality.
> + */
> +
> +#include <drm/drmP.h>
> +#include <drm/drm_atomic.h>
> +#include <drm/drm_atomic_helper.h>
> +#include <drm/drm_plane_helper.h>
> +#include "intel_drv.h"
> +
> +
> +/**
> + * intel_atomic_check - validate state object
> + * @dev: drm device
> + * @state: state to validate
> + */
> +int intel_atomic_check(struct drm_device *dev,
> +		       struct drm_atomic_state *state)
> +{
> +	int nplanes = dev->mode_config.num_total_plane;
> +	int ncrtcs = dev->mode_config.num_crtc;
> +	int nconnectors = dev->mode_config.num_connector;
> +	enum pipe nuclear_pipe = INVALID_PIPE;
> +	int ret;
> +	int i;
> +	bool not_nuclear = false;
> +
> +	/*
> +	 * FIXME:  At the moment, we only support "nuclear pageflip" on a
> +	 * single CRTC.  Cross-crtc updates will be added later.
> +	 */
> +	for (i = 0; i < nplanes; i++) {
> +		struct intel_plane *plane = to_intel_plane(state->planes[i]);
> +		if (!plane)
> +			continue;
> +
> +		if (nuclear_pipe == INVALID_PIPE) {
> +			nuclear_pipe = plane->pipe;
> +		} else if (nuclear_pipe != plane->pipe) {
> +			DRM_DEBUG_KMS("i915 only support atomic plane operations on a single CRTC at the moment\n");
> +			return -EINVAL;
> +		}
> +	}
> +
> +	/*
> +	 * FIXME:  We only handle planes for now; make sure there are no CRTC's
> +	 * or connectors involved.
> +	 */
> +	state->allow_modeset = false;
> +	for (i = 0; i < ncrtcs; i++) {
> +		struct intel_crtc *crtc = to_intel_crtc(state->crtcs[i]);
> +		if (crtc && crtc->pipe != nuclear_pipe)
> +			not_nuclear = true;
> +	}
> +	for (i = 0; i < nconnectors; i++)
> +		if (state->connectors[i] != NULL)
> +			not_nuclear = true;
> +
> +	if (not_nuclear) {
> +		DRM_DEBUG_KMS("i915 only supports atomic plane operations at the moment\n");
> +		return -EINVAL;
> +	}
> +
> +	ret = drm_atomic_helper_check_planes(dev, state);
> +	if (ret)
> +		return ret;
> +
> +	return ret;
> +}
> +
> +
> +/**
> + * intel_atomic_commit - commit validated state object
> + * @dev: DRM device
> + * @state: the top-level driver state object
> + * @async: asynchronous commit
> + *
> + * This function commits a top-level state object that has been validated
> + * with drm_atomic_helper_check().
> + *
> + * FIXME:  Atomic modeset support for i915 is not yet complete.  At the moment
> + * we can only handle plane-related operations and do not yet support
> + * asynchronous commit.
> + *
> + * RETURNS
> + * Zero for success or -errno.
> + */
> +int intel_atomic_commit(struct drm_device *dev,
> +			struct drm_atomic_state *state,
> +			bool async)
> +{
> +	int ret;
> +	int i;
> +
> +	if (async) {
> +		DRM_DEBUG_KMS("i915 does not yet support async commit\n");
> +		return -EINVAL;
> +	}
> +
> +	ret = drm_atomic_helper_prepare_planes(dev, state);
> +	if (ret)
> +		return ret;
> +
> +	/* Point of no return */
> +
> +	/*
> +	 * FIXME:  The proper sequence here will eventually be:
> +	 *
> +	 * drm_atomic_helper_swap_state(dev, state)
> +	 * drm_atomic_helper_commit_pre_planes(dev, state);
> +	 * drm_atomic_helper_commit_planes(dev, state);
> +	 * drm_atomic_helper_commit_post_planes(dev, state);
> +	 * drm_atomic_helper_wait_for_vblanks(dev, state);
> +	 * drm_atomic_helper_cleanup_planes(dev, state);
> +	 * drm_atomic_state_free(state);
> +	 *
> +	 * once we have full atomic modeset.  For now, just manually update
> +	 * plane states to avoid clobbering good states with dummy states
> +	 * while nuclear pageflipping.
> +	 */
> +	for (i = 0; i < dev->mode_config.num_total_plane; i++) {
> +		struct drm_plane *plane = state->planes[i];
> +
> +		if (!plane)
> +			continue;
> +
> +		plane->state->state = state;
> +		swap(state->plane_states[i], plane->state);
> +		plane->state->state = NULL;
> +	}
> +	drm_atomic_helper_commit_planes(dev, state);
> +	drm_atomic_helper_wait_for_vblanks(dev, state);

Isn't it possible that we wait for two vblanks here? One in 
intel_finish_crtc_commit() and then again in 
drm_atomic_helper_wait_for_vblanks().

That would happen when disabling planes, or enabling the primary plane 
in BDW. The former will be solved by fixing the watermark code and, if I 
understand correctly, the wait in drm_atomic_helper_wait_for_vblanks()
will always cover the BDW case. So I guess we can leave it this way for 
now, and fix this with a follow up patch once we're completely atomic.

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>


> +	drm_atomic_helper_cleanup_planes(dev, state);
> +	drm_atomic_state_free(state);
> +
> +	return 0;
> +}
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 047c77e..f557f2d 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12752,6 +12752,8 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)
>   static const struct drm_mode_config_funcs intel_mode_funcs = {
>   	.fb_create = intel_user_framebuffer_create,
>   	.output_poll_changed = intel_fbdev_output_poll_changed,
> +	.atomic_check = intel_atomic_check,
> +	.atomic_commit = intel_atomic_commit,
>   };
>
>   /* Set up chip specific display functions */
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 24c63fb..833f44c 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1244,6 +1244,13 @@ void intel_pre_disable_primary(struct drm_crtc *crtc);
>   void intel_tv_init(struct drm_device *dev);
>
>   /* intel_atomic.c */
> +int intel_atomic_check(struct drm_device *dev,
> +		       struct drm_atomic_state *state);
> +int intel_atomic_commit(struct drm_device *dev,
> +			struct drm_atomic_state *state,
> +			bool async);
> +
> +/* intel_atomic_plane.c */
>   struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
>   struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
>   void intel_plane_destroy_state(struct drm_plane *plane,
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v2)
  2015-01-22  0:35 ` [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v2) Matt Roper
@ 2015-01-22 16:00   ` Ander Conselvan de Oliveira
  2015-01-23  0:50     ` [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v3) Matt Roper
  0 siblings, 1 reply; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-22 16:00 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

On 01/22/2015 02:35 AM, Matt Roper wrote:
> 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)
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_crt.c     |  2 ++
>   drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/intel_dp.c      |  2 ++
>   drivers/gpu/drm/i915/intel_dp_mst.c  |  2 ++
>   drivers/gpu/drm/i915/intel_dsi.c     |  2 ++
>   drivers/gpu/drm/i915/intel_dvo.c     |  2 ++
>   drivers/gpu/drm/i915/intel_hdmi.c    |  2 ++
>   drivers/gpu/drm/i915/intel_lvds.c    |  2 ++
>   drivers/gpu/drm/i915/intel_sdvo.c    |  2 ++
>   drivers/gpu/drm/i915/intel_tv.c      |  2 ++
>   10 files changed, 46 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index bb55368..18ee41e 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -28,6 +28,7 @@
>   #include <linux/i2c.h>
>   #include <linux/slab.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_crtc_helper.h>
>   #include <drm/drm_edid.h>
> @@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.destroy = intel_crt_destroy,
>   	.set_property = intel_crt_set_property,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 f557f2d..86b66c4 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)
>   {
>   	struct drm_i915_private *dev_priv = dev->dev_private;
>   	struct intel_encoder *encoder;
> +	struct drm_connector *connector;
>   	bool dpd_is_edp = false;
>
>   	intel_lvds_init(dev);
> @@ -12569,6 +12570,33 @@ static void intel_setup_outputs(struct drm_device *dev)
>   	if (SUPPORTS_TV(dev))
>   		intel_tv_init(dev);
>
> +	/*
> +	 * FIXME:  We don't have full atomic support yet, but we want to be
> +	 * able to enable/test plane updates via the atomic interface in the
> +	 * meantime.  However as soon as we flip DRIVER_ATOMIC on, the DRM core
> +	 * will take some atomic codepaths to lookup properties during
> +	 * drmModeGetConnector() that unconditionally dereference
> +	 * connector->state.
> +	 *
> +	 * We create a dummy connector state here for each connector 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 atomic support for crtc's + connectors lands, this loop should
> +	 * be removed since we'll be setting up real connector state, which
> +	 * will contain Intel-specific properties.
> +	 */
> +	list_for_each_entry(connector,
> +			    &dev->mode_config.connector_list,
> +			    head) {
> +		if (!WARN_ON(connector->state))
> +			connector->state = kzalloc(sizeof(*connector->state),
> +						   GFP_KERNEL);
> +	}
> +

We need to at least protect this with a check for DRIVER_ATOMIC, 
otherwise the encoder field of the get connector ioctl response will 
always be NULL, even if i915.nuclear_pageflip is not set.

Ander

>   	intel_psr_init(dev);
>
>   	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 b38d737..1b1917b 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -31,6 +31,7 @@
>   #include <linux/notifier.h>
>   #include <linux/reboot.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_crtc_helper.h>
>   #include <drm/drm_edid.h>
> @@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_dp_set_property,
>   	.destroy = intel_dp_connector_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 0091a84..f86da0f 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -26,6 +26,7 @@
>   #include <drm/drmP.h>
>   #include "i915_drv.h"
>   #include "intel_drv.h"
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc_helper.h>
>   #include <drm/drm_edid.h>
>
> @@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_dp_mst_set_property,
>   	.destroy = intel_dp_mst_connector_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 6620124..e9226ac 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -24,6 +24,7 @@
>    */
>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include <drm/i915_drm.h>
> @@ -791,6 +792,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_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   void 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 706ab99..1cf2e352 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -27,6 +27,7 @@
>   #include <linux/i2c.h>
>   #include <linux/slab.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include "intel_drv.h"
>   #include <drm/i915_drm.h>
> @@ -390,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_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 200a0e7..b8fab8c 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -31,6 +31,7 @@
>   #include <linux/delay.h>
>   #include <linux/hdmi.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include "intel_drv.h"
> @@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_hdmi_set_property,
>   	.destroy = intel_hdmi_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 c7c6414..908bd42 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -32,6 +32,7 @@
>   #include <linux/i2c.h>
>   #include <linux/slab.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include "intel_drv.h"
> @@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_lvds_set_property,
>   	.destroy = intel_lvds_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 5b8275b..ae00bf9 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -30,6 +30,7 @@
>   #include <linux/delay.h>
>   #include <linux/export.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include "intel_drv.h"
> @@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_sdvo_set_property,
>   	.destroy = intel_sdvo_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 10e7ebd..d450054 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -31,6 +31,7 @@
>    */
>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include "intel_drv.h"
> @@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
>   	.destroy = intel_tv_destroy,
>   	.set_property = intel_tv_set_property,
>   	.fill_modes = drm_helper_probe_single_connector_modes,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors
  2015-01-22  0:35 ` [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors Matt Roper
@ 2015-01-22 16:55   ` Ander Conselvan de Oliveira
  2015-01-23  0:51     ` [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors (v2) Matt Roper
  0 siblings, 1 reply; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-22 16:55 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

On 01/22/2015 02:35 AM, Matt Roper wrote:
> 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.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_atomic.c | 38 +++++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/intel_crt.c    |  1 +
>   drivers/gpu/drm/i915/intel_dp.c     |  1 +
>   drivers/gpu/drm/i915/intel_dp_mst.c |  1 +
>   drivers/gpu/drm/i915/intel_drv.h    |  4 ++++
>   drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
>   drivers/gpu/drm/i915/intel_lvds.c   |  1 +
>   drivers/gpu/drm/i915/intel_sdvo.c   |  1 +
>   drivers/gpu/drm/i915/intel_tv.c     |  1 +
>   9 files changed, 49 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index 5c31f54..52ef6f4 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -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;
> +}
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 18ee41e..e66e17a 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -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 = {
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 1b1917b..bac55dd 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index f86da0f..2856b0b 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 833f44c..b068d7a 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1249,6 +1249,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);
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index b8fab8c..995c5b2 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 908bd42..071b96d 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index ae00bf9..64ad2b4 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index d450054..892d23c 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -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,
>   };
>

Don't we need the same change in intel_dvo.c and intel_dsi.c?

Ander

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 08/10] drm/i915: Add crtc state duplication/destruction functions
  2015-01-22  0:35 ` [PATCH 08/10] drm/i915: Add crtc state duplication/destruction functions Matt Roper
@ 2015-01-22 17:08   ` Ander Conselvan de Oliveira
  0 siblings, 0 replies; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-22 17:08 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

On 01/22/2015 02:35 AM, Matt Roper wrote:
> The atomic helpers need these to prepare a new state object when
> starting a new atomic operation.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_atomic.c  | 35 +++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/intel_display.c |  2 ++
>   drivers/gpu/drm/i915/intel_drv.h     |  3 +++
>   3 files changed, 40 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index 52ef6f4..19a9dd5 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -200,3 +200,38 @@ intel_connector_atomic_get_property(struct drm_connector *connector,
>
>   	return -EINVAL;
>   }
> +
> +/*
> + * intel_crtc_duplicate_state - duplicate crtc state
> + * @crtc: drm crtc
> + *
> + * Allocates and returns a copy of the crtc state (both common and
> + * Intel-specific) for the specified crtc.
> + *
> + * Returns: The newly allocated crtc state, or NULL on failure.
> + */
> +struct drm_crtc_state *
> +intel_crtc_duplicate_state(struct drm_crtc *crtc)
> +{
> +	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> +
> +	if (WARN_ON(!intel_crtc->config))
> +		return kzalloc(sizeof(*intel_crtc->config), GFP_KERNEL);
> +
> +	return kmemdup(intel_crtc->config, sizeof(*intel_crtc->config),
> +		       GFP_KERNEL);
> +}
> +
> +/**
> + * intel_crtc_destroy_state - destroy crtc state
> + * @crtc: drm crtc
> + *
> + * Destroys the crtc state (both common and Intel-specific) for the
> + * specified crtc.
> + */
> +void
> +intel_crtc_destroy_state(struct drm_crtc *crtc,
> +			  struct drm_crtc_state *state)
> +{
> +	drm_atomic_helper_crtc_destroy_state(crtc, state);
> +}
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 86b66c4..db20773 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11652,6 +11652,8 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
>   	.set_config = intel_crtc_set_config,
>   	.destroy = intel_crtc_destroy,
>   	.page_flip = intel_crtc_page_flip,
> +	.atomic_duplicate_state = intel_crtc_duplicate_state,
> +	.atomic_destroy_state = intel_crtc_destroy_state,
>   };
>
>   static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index b068d7a..60da153 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1253,6 +1253,9 @@ int intel_connector_atomic_get_property(struct drm_connector *connector,
>   					const struct drm_connector_state *state,
>   					struct drm_property *property,
>   					uint64_t *val);
> +struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
> +void intel_crtc_destroy_state(struct drm_crtc *crtc,
> +			       struct drm_crtc_state *state);
>
>   /* intel_atomic_plane.c */
>   struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane);
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 09/10] drm/i915: Switch plane properties to full atomic helper.
  2015-01-22  0:35 ` [PATCH 09/10] drm/i915: Switch plane properties to full atomic helper Matt Roper
@ 2015-01-22 17:16   ` Ander Conselvan de Oliveira
  0 siblings, 0 replies; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-22 17:16 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

On 01/22/2015 02:35 AM, Matt Roper wrote:
> This will exercise our atomic pipeline for legacy property updates.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_atomic_plane.c |  9 +++++++++
>   drivers/gpu/drm/i915/intel_display.c      |  3 ++-
>   drivers/gpu/drm/i915/intel_sprite.c       | 26 --------------------------
>   3 files changed, 11 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 4a3914f..9e6f727 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -118,6 +118,15 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
>   	intel_crtc = to_intel_crtc(crtc);
>
>   	/*
> +	 * Both crtc and plane->crtc could be NULL if we're updating a
> +	 * property while the plane is disabled.  We don't actually have
> +	 * anything driver-specific we need to test in that case, so
> +	 * just return success.
> +	 */
> +	if (!crtc)
> +		return 0;
> +
> +	/*
>   	 * The original src/dest coordinates are stored in state->base, but
>   	 * we want to keep another copy internal to our driver that we can
>   	 * clip/modify ourselves.
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index db20773..90b788a 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -37,6 +37,7 @@
>   #include <drm/i915_drm.h>
>   #include "i915_drv.h"
>   #include "i915_trace.h"
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_dp_helper.h>
>   #include <drm/drm_crtc_helper.h>
>   #include <drm/drm_plane_helper.h>
> @@ -12055,7 +12056,7 @@ const struct drm_plane_funcs intel_plane_funcs = {
>   	.update_plane = drm_plane_helper_update,
>   	.disable_plane = drm_plane_helper_disable,
>   	.destroy = intel_plane_destroy,
> -	.set_property = intel_plane_set_property,
> +	.set_property = drm_atomic_helper_plane_set_property,
>   	.atomic_get_property = intel_plane_atomic_get_property,
>   	.atomic_set_property = intel_plane_atomic_set_property,
>   	.atomic_duplicate_state = intel_plane_duplicate_state,
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 50683d4..0a52c44 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1362,32 +1362,6 @@ out_unlock:
>   	return ret;
>   }
>
> -int intel_plane_set_property(struct drm_plane *plane,
> -			     struct drm_property *prop,
> -			     uint64_t val)
> -{
> -	struct drm_device *dev = plane->dev;
> -	uint64_t old_val;
> -	int ret = -ENOENT;
> -
> -	if (prop == dev->mode_config.rotation_property) {
> -		/* exactly one rotation angle please */
> -		if (hweight32(val & 0xf) != 1)
> -			return -EINVAL;
> -
> -		if (plane->state->rotation == val)
> -			return 0;
> -
> -		old_val = plane->state->rotation;
> -		plane->state->rotation = val;
> -		ret = intel_plane_restore(plane);
> -		if (ret)
> -			plane->state->rotation = old_val;
> -	}
> -
> -	return ret;
> -}
> -
>   int intel_plane_restore(struct drm_plane *plane)
>   {
>   	if (!plane->crtc || !plane->fb)
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v3)
  2015-01-22  0:35 ` [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v3) Matt Roper
@ 2015-01-22 17:32   ` Ander Conselvan de Oliveira
  2015-01-23  0:53     ` [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v4) Matt Roper
  0 siblings, 1 reply; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-22 17:32 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

On 01/22/2015 02:35 AM, Matt Roper wrote:
> We don't have full atomic modeset support yet, but the "nuclear
> pageflip" subset of functionality (i.e., plane operations only) should
> be ready.  Allow the user to force atomic on for debug purposes, or for
> fixed-purpose embedded devices that will only use atomic for plane
> updates.
>
> The term 'nuclear' is used here instead of 'atomic' to make it clear
> that this doesn't allow full atomic modeset support, just a (very
> useful) subset of the atomic functionality.
>
> We'll drop the kernel parameter and unconditionally enable atomic in a
> future patch once all of the necessary pieces are in.
>
> v2:
>   - Use module_param_named_unsafe() (Daniel)
>   - Simplify comment on DRIVER_ATOMIC guard (Daniel)
>
> v3:
>   - Make the parameter "nuclear_pageflip" rather than just "nuclear"
>     for clarity. (Ander)
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_drv.c    | 8 ++++++++
>   drivers/gpu/drm/i915/i915_drv.h    | 1 +
>   drivers/gpu/drm/i915/i915_params.c | 5 +++++
>   3 files changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 66c72bd..9a86e2c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1637,6 +1637,14 @@ static int __init i915_init(void)
>   #endif
>   	}
>
> +	/*
> +	 * FIXME: Note that we're lying to the DRM core here so that we can get access
> +	 * to the atomic ioctl and the atomic properties.  Only plane operations on
> +	 * a single CRTC will actually work.
> +	 */
> +	if (i915.nuclear)
> +		driver.driver_features |= DRIVER_ATOMIC;
> +
>   	return drm_pci_init(&driver, &i915_pci_driver);
>   }
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 0d67b17..ff3dca7 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2526,6 +2526,7 @@ struct i915_params {
>   	int use_mmio_flip;
>   	bool mmio_debug;
>   	bool verbose_state_checks;
> +	bool nuclear;
>   };
>   extern struct i915_params i915 __read_mostly;
>
> diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> index 07252d8..2bccaf9 100644
> --- a/drivers/gpu/drm/i915/i915_params.c
> +++ b/drivers/gpu/drm/i915/i915_params.c
> @@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = {
>   	.use_mmio_flip = 0,
>   	.mmio_debug = 0,
>   	.verbose_state_checks = 1,
> +	.nuclear = 0,
>   };
>
>   module_param_named(modeset, i915.modeset, int, 0400);
> @@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,
>   module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
>   MODULE_PARM_DESC(verbose_state_checks,
>   	"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
> +
> +module_param_named_unsafe(nuclear_pageflip, i915.nuclear, bool, 0600);
> +MODULE_PARM_DESC(nuclear_pageflip,
> +		 "Force atomic modeset functionality; only planes work for now (default: false).");
>

I'd prefer if the field in i915_params was renamed too (so it matches 
with the cmd line param name), but anyway

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v3)
  2015-01-22 16:00   ` Ander Conselvan de Oliveira
@ 2015-01-23  0:50     ` Matt Roper
  2015-01-23  5:42       ` Ander Conselvan de Oliveira
  0 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-23  0:50 UTC (permalink / raw)
  To: intel-gfx

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>
---
 drivers/gpu/drm/i915/intel_crt.c     |  2 ++
 drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c      |  2 ++
 drivers/gpu/drm/i915/intel_dp_mst.c  |  2 ++
 drivers/gpu/drm/i915/intel_dsi.c     |  2 ++
 drivers/gpu/drm/i915/intel_dvo.c     |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c    |  2 ++
 drivers/gpu/drm/i915/intel_lvds.c    |  2 ++
 drivers/gpu/drm/i915/intel_sdvo.c    |  2 ++
 drivers/gpu/drm/i915/intel_tv.c      |  2 ++
 10 files changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index bb55368..18ee41e 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -28,6 +28,7 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
@@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = intel_crt_destroy,
 	.set_property = intel_crt_set_property,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 75b7ca1..b461f90 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)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_encoder *encoder;
+	struct drm_connector *connector;
 	bool dpd_is_edp = false;
 
 	intel_lvds_init(dev);
@@ -12569,6 +12570,37 @@ static void intel_setup_outputs(struct drm_device *dev)
 	if (SUPPORTS_TV(dev))
 		intel_tv_init(dev);
 
+	/*
+	 * FIXME:  We don't have full atomic support yet, but we want to be
+	 * able to enable/test plane updates via the atomic interface in the
+	 * meantime.  However as soon as we flip DRIVER_ATOMIC on, the DRM core
+	 * will take some atomic codepaths to lookup properties during
+	 * drmModeGetConnector() that unconditionally dereference
+	 * connector->state.
+	 *
+	 * We create a dummy connector state here for each connector 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 atomic support for crtc's + connectors lands, this loop should
+	 * be removed since we'll be setting up real connector state, which
+	 * will contain Intel-specific properties.
+	 */
+	if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
+		list_for_each_entry(connector,
+				    &dev->mode_config.connector_list,
+				    head) {
+			if (!WARN_ON(connector->state)) {
+				connector->state =
+					kzalloc(sizeof(*connector->state),
+						GFP_KERNEL);
+			}
+		}
+	}
+
 	intel_psr_init(dev);
 
 	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 b38d737..1b1917b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -31,6 +31,7 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
@@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_dp_set_property,
 	.destroy = intel_dp_connector_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 0091a84..f86da0f 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -26,6 +26,7 @@
 #include <drm/drmP.h>
 #include "i915_drv.h"
 #include "intel_drv.h"
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_edid.h>
 
@@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_dp_mst_set_property,
 	.destroy = intel_dp_mst_connector_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 6620124..e9226ac 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -24,6 +24,7 @@
  */
 
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
@@ -791,6 +792,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_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 void 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 706ab99..1cf2e352 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -27,6 +27,7 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include "intel_drv.h"
 #include <drm/i915_drm.h>
@@ -390,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_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 200a0e7..b8fab8c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -31,6 +31,7 @@
 #include <linux/delay.h>
 #include <linux/hdmi.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
@@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_hdmi_set_property,
 	.destroy = intel_hdmi_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 c7c6414..908bd42 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -32,6 +32,7 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
@@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_lvds_set_property,
 	.destroy = intel_lvds_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 5b8275b..ae00bf9 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -30,6 +30,7 @@
 #include <linux/delay.h>
 #include <linux/export.h>
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
@@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_sdvo_set_property,
 	.destroy = intel_sdvo_destroy,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static 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 10e7ebd..d450054 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -31,6 +31,7 @@
  */
 
 #include <drm/drmP.h>
+#include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include "intel_drv.h"
@@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
 	.destroy = intel_tv_destroy,
 	.set_property = intel_tv_set_property,
 	.fill_modes = drm_helper_probe_single_connector_modes,
+	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
 static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors (v2)
  2015-01-22 16:55   ` Ander Conselvan de Oliveira
@ 2015-01-23  0:51     ` Matt Roper
  2015-01-23  5:43       ` Ander Conselvan de Oliveira
  0 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-23  0:51 UTC (permalink / raw)
  To: intel-gfx

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>
---
 drivers/gpu/drm/i915/intel_atomic.c | 38 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_crt.c    |  1 +
 drivers/gpu/drm/i915/intel_dp.c     |  1 +
 drivers/gpu/drm/i915/intel_dp_mst.c |  1 +
 drivers/gpu/drm/i915/intel_drv.h    |  4 ++++
 drivers/gpu/drm/i915/intel_dsi.c    |  1 +
 drivers/gpu/drm/i915/intel_dvo.c    |  1 +
 drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
 drivers/gpu/drm/i915/intel_lvds.c   |  1 +
 drivers/gpu/drm/i915/intel_sdvo.c   |  1 +
 drivers/gpu/drm/i915/intel_tv.c     |  1 +
 11 files changed, 51 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index 5c31f54..52ef6f4 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -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;
+}
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 18ee41e..e66e17a 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -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 = {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1b1917b..bac55dd 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index f86da0f..2856b0b 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 833f44c..b068d7a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1249,6 +1249,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);
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index e9226ac..6271d24 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -792,6 +792,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,
 };
 
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 1cf2e352..d857951 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -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,
 };
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index b8fab8c..995c5b2 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 908bd42..071b96d 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index ae00bf9..64ad2b4 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -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,
 };
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index d450054..892d23c 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -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,
 };
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v4)
  2015-01-22 17:32   ` Ander Conselvan de Oliveira
@ 2015-01-23  0:53     ` Matt Roper
  2015-01-27  9:22       ` Daniel Vetter
  0 siblings, 1 reply; 25+ messages in thread
From: Matt Roper @ 2015-01-23  0:53 UTC (permalink / raw)
  To: intel-gfx

We don't have full atomic modeset support yet, but the "nuclear
pageflip" subset of functionality (i.e., plane operations only) should
be ready.  Allow the user to force atomic on for debug purposes, or for
fixed-purpose embedded devices that will only use atomic for plane
updates.

The term 'nuclear' is used here instead of 'atomic' to make it clear
that this doesn't allow full atomic modeset support, just a (very
useful) subset of the atomic functionality.

We'll drop the kernel parameter and unconditionally enable atomic in a
future patch once all of the necessary pieces are in.

v2:
 - Use module_param_named_unsafe() (Daniel)
 - Simplify comment on DRIVER_ATOMIC guard (Daniel)

v3:
 - Make the parameter "nuclear_pageflip" rather than just "nuclear"
   for clarity. (Ander)

v4:
 - Make the internal variable "nuclear_pageflip" as well as the
   command-line option. (Ander)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
---
 drivers/gpu/drm/i915/i915_drv.c    | 8 ++++++++
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 5 +++++
 3 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 66c72bd..2a96656 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1637,6 +1637,14 @@ static int __init i915_init(void)
 #endif
 	}
 
+	/*
+	 * FIXME: Note that we're lying to the DRM core here so that we can get access
+	 * to the atomic ioctl and the atomic properties.  Only plane operations on
+	 * a single CRTC will actually work.
+	 */
+	if (i915.nuclear_pageflip)
+		driver.driver_features |= DRIVER_ATOMIC;
+
 	return drm_pci_init(&driver, &i915_pci_driver);
 }
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0d67b17..6a808a6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2526,6 +2526,7 @@ struct i915_params {
 	int use_mmio_flip;
 	bool mmio_debug;
 	bool verbose_state_checks;
+	bool nuclear_pageflip;
 };
 extern struct i915_params i915 __read_mostly;
 
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 07252d8..44f2262 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = {
 	.use_mmio_flip = 0,
 	.mmio_debug = 0,
 	.verbose_state_checks = 1,
+	.nuclear_pageflip = 0,
 };
 
 module_param_named(modeset, i915.modeset, int, 0400);
@@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,
 module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
 MODULE_PARM_DESC(verbose_state_checks,
 	"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
+
+module_param_named_unsafe(nuclear_pageflip, i915.nuclear_pageflip, bool, 0600);
+MODULE_PARM_DESC(nuclear_pageflip,
+		 "Force atomic modeset functionality; only planes work for now (default: false).");
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v3)
  2015-01-23  0:50     ` [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v3) Matt Roper
@ 2015-01-23  5:42       ` Ander Conselvan de Oliveira
  0 siblings, 0 replies; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-23  5:42 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

On 01/23/2015 02:50 AM, Matt Roper wrote:
> 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>
> ---
>   drivers/gpu/drm/i915/intel_crt.c     |  2 ++
>   drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/intel_dp.c      |  2 ++
>   drivers/gpu/drm/i915/intel_dp_mst.c  |  2 ++
>   drivers/gpu/drm/i915/intel_dsi.c     |  2 ++
>   drivers/gpu/drm/i915/intel_dvo.c     |  2 ++
>   drivers/gpu/drm/i915/intel_hdmi.c    |  2 ++
>   drivers/gpu/drm/i915/intel_lvds.c    |  2 ++
>   drivers/gpu/drm/i915/intel_sdvo.c    |  2 ++
>   drivers/gpu/drm/i915/intel_tv.c      |  2 ++
>   10 files changed, 50 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index bb55368..18ee41e 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -28,6 +28,7 @@
>   #include <linux/i2c.h>
>   #include <linux/slab.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_crtc_helper.h>
>   #include <drm/drm_edid.h>
> @@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.destroy = intel_crt_destroy,
>   	.set_property = intel_crt_set_property,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 75b7ca1..b461f90 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)
>   {
>   	struct drm_i915_private *dev_priv = dev->dev_private;
>   	struct intel_encoder *encoder;
> +	struct drm_connector *connector;
>   	bool dpd_is_edp = false;
>
>   	intel_lvds_init(dev);
> @@ -12569,6 +12570,37 @@ static void intel_setup_outputs(struct drm_device *dev)
>   	if (SUPPORTS_TV(dev))
>   		intel_tv_init(dev);
>
> +	/*
> +	 * FIXME:  We don't have full atomic support yet, but we want to be
> +	 * able to enable/test plane updates via the atomic interface in the
> +	 * meantime.  However as soon as we flip DRIVER_ATOMIC on, the DRM core
> +	 * will take some atomic codepaths to lookup properties during
> +	 * drmModeGetConnector() that unconditionally dereference
> +	 * connector->state.
> +	 *
> +	 * We create a dummy connector state here for each connector 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 atomic support for crtc's + connectors lands, this loop should
> +	 * be removed since we'll be setting up real connector state, which
> +	 * will contain Intel-specific properties.
> +	 */
> +	if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
> +		list_for_each_entry(connector,
> +				    &dev->mode_config.connector_list,
> +				    head) {
> +			if (!WARN_ON(connector->state)) {
> +				connector->state =
> +					kzalloc(sizeof(*connector->state),
> +						GFP_KERNEL);
> +			}
> +		}
> +	}
> +
>   	intel_psr_init(dev);
>
>   	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 b38d737..1b1917b 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -31,6 +31,7 @@
>   #include <linux/notifier.h>
>   #include <linux/reboot.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_crtc_helper.h>
>   #include <drm/drm_edid.h>
> @@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_dp_set_property,
>   	.destroy = intel_dp_connector_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 0091a84..f86da0f 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -26,6 +26,7 @@
>   #include <drm/drmP.h>
>   #include "i915_drv.h"
>   #include "intel_drv.h"
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc_helper.h>
>   #include <drm/drm_edid.h>
>
> @@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_dp_mst_set_property,
>   	.destroy = intel_dp_mst_connector_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 6620124..e9226ac 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -24,6 +24,7 @@
>    */
>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include <drm/i915_drm.h>
> @@ -791,6 +792,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_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   void 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 706ab99..1cf2e352 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -27,6 +27,7 @@
>   #include <linux/i2c.h>
>   #include <linux/slab.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include "intel_drv.h"
>   #include <drm/i915_drm.h>
> @@ -390,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_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 200a0e7..b8fab8c 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -31,6 +31,7 @@
>   #include <linux/delay.h>
>   #include <linux/hdmi.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include "intel_drv.h"
> @@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_hdmi_set_property,
>   	.destroy = intel_hdmi_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 c7c6414..908bd42 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -32,6 +32,7 @@
>   #include <linux/i2c.h>
>   #include <linux/slab.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include "intel_drv.h"
> @@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_lvds_set_property,
>   	.destroy = intel_lvds_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 5b8275b..ae00bf9 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -30,6 +30,7 @@
>   #include <linux/delay.h>
>   #include <linux/export.h>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include "intel_drv.h"
> @@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.set_property = intel_sdvo_set_property,
>   	.destroy = intel_sdvo_destroy,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static 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 10e7ebd..d450054 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -31,6 +31,7 @@
>    */
>
>   #include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
>   #include <drm/drm_crtc.h>
>   #include <drm/drm_edid.h>
>   #include "intel_drv.h"
> @@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
>   	.destroy = intel_tv_destroy,
>   	.set_property = intel_tv_set_property,
>   	.fill_modes = drm_helper_probe_single_connector_modes,
> +	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>   };
>
>   static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors (v2)
  2015-01-23  0:51     ` [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors (v2) Matt Roper
@ 2015-01-23  5:43       ` Ander Conselvan de Oliveira
  0 siblings, 0 replies; 25+ messages in thread
From: Ander Conselvan de Oliveira @ 2015-01-23  5:43 UTC (permalink / raw)
  To: Matt Roper, intel-gfx

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

On 01/23/2015 02:51 AM, Matt Roper wrote:
> 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>
> ---
>   drivers/gpu/drm/i915/intel_atomic.c | 38 +++++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/intel_crt.c    |  1 +
>   drivers/gpu/drm/i915/intel_dp.c     |  1 +
>   drivers/gpu/drm/i915/intel_dp_mst.c |  1 +
>   drivers/gpu/drm/i915/intel_drv.h    |  4 ++++
>   drivers/gpu/drm/i915/intel_dsi.c    |  1 +
>   drivers/gpu/drm/i915/intel_dvo.c    |  1 +
>   drivers/gpu/drm/i915/intel_hdmi.c   |  1 +
>   drivers/gpu/drm/i915/intel_lvds.c   |  1 +
>   drivers/gpu/drm/i915/intel_sdvo.c   |  1 +
>   drivers/gpu/drm/i915/intel_tv.c     |  1 +
>   11 files changed, 51 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index 5c31f54..52ef6f4 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -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;
> +}
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 18ee41e..e66e17a 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -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 = {
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 1b1917b..bac55dd 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index f86da0f..2856b0b 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 833f44c..b068d7a 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1249,6 +1249,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);
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index e9226ac..6271d24 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -792,6 +792,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,
>   };
>
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index 1cf2e352..d857951 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -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,
>   };
>
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index b8fab8c..995c5b2 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 908bd42..071b96d 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index ae00bf9..64ad2b4 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -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,
>   };
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index d450054..892d23c 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -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,
>   };
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v4)
  2015-01-23  0:53     ` [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v4) Matt Roper
@ 2015-01-27  9:22       ` Daniel Vetter
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2015-01-27  9:22 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

On Thu, Jan 22, 2015 at 04:53:12PM -0800, Matt Roper wrote:
> We don't have full atomic modeset support yet, but the "nuclear
> pageflip" subset of functionality (i.e., plane operations only) should
> be ready.  Allow the user to force atomic on for debug purposes, or for
> fixed-purpose embedded devices that will only use atomic for plane
> updates.
> 
> The term 'nuclear' is used here instead of 'atomic' to make it clear
> that this doesn't allow full atomic modeset support, just a (very
> useful) subset of the atomic functionality.
> 
> We'll drop the kernel parameter and unconditionally enable atomic in a
> future patch once all of the necessary pieces are in.
> 
> v2:
>  - Use module_param_named_unsafe() (Daniel)
>  - Simplify comment on DRIVER_ATOMIC guard (Daniel)
> 
> v3:
>  - Make the parameter "nuclear_pageflip" rather than just "nuclear"
>    for clarity. (Ander)
> 
> v4:
>  - Make the internal variable "nuclear_pageflip" as well as the
>    command-line option. (Ander)
> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

Pulled in the entire series, thanks for patches&review.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.c    | 8 ++++++++
>  drivers/gpu/drm/i915/i915_drv.h    | 1 +
>  drivers/gpu/drm/i915/i915_params.c | 5 +++++
>  3 files changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 66c72bd..2a96656 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1637,6 +1637,14 @@ static int __init i915_init(void)
>  #endif
>  	}
>  
> +	/*
> +	 * FIXME: Note that we're lying to the DRM core here so that we can get access
> +	 * to the atomic ioctl and the atomic properties.  Only plane operations on
> +	 * a single CRTC will actually work.
> +	 */
> +	if (i915.nuclear_pageflip)
> +		driver.driver_features |= DRIVER_ATOMIC;
> +
>  	return drm_pci_init(&driver, &i915_pci_driver);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 0d67b17..6a808a6 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2526,6 +2526,7 @@ struct i915_params {
>  	int use_mmio_flip;
>  	bool mmio_debug;
>  	bool verbose_state_checks;
> +	bool nuclear_pageflip;
>  };
>  extern struct i915_params i915 __read_mostly;
>  
> diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> index 07252d8..44f2262 100644
> --- a/drivers/gpu/drm/i915/i915_params.c
> +++ b/drivers/gpu/drm/i915/i915_params.c
> @@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = {
>  	.use_mmio_flip = 0,
>  	.mmio_debug = 0,
>  	.verbose_state_checks = 1,
> +	.nuclear_pageflip = 0,
>  };
>  
>  module_param_named(modeset, i915.modeset, int, 0400);
> @@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,
>  module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
>  MODULE_PARM_DESC(verbose_state_checks,
>  	"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
> +
> +module_param_named_unsafe(nuclear_pageflip, i915.nuclear_pageflip, bool, 0600);
> +MODULE_PARM_DESC(nuclear_pageflip,
> +		 "Force atomic modeset functionality; only planes work for now (default: false).");
> -- 
> 1.8.5.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2015-01-27  9:22 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22  0:35 [PATCH 00/10] i915 nuclear pageflip (v2) Matt Roper
2015-01-22  0:35 ` [PATCH 01/10] drm: Add rotation value to plane state Matt Roper
2015-01-22  0:35 ` [PATCH 02/10] drm/i915: Move rotation from intel_plane to drm_plane_state Matt Roper
2015-01-22 10:54   ` Ander Conselvan de Oliveira
2015-01-22  0:35 ` [PATCH 03/10] drm/i915: Consolidate plane handler vtables Matt Roper
2015-01-22  0:35 ` [PATCH 04/10] drm/i915: Add .atomic_{get, set}_property() entrypoints to planes Matt Roper
2015-01-22 11:09   ` Ander Conselvan de Oliveira
2015-01-22  0:35 ` [PATCH 05/10] drm/i915: Add main atomic entrypoints (v2) Matt Roper
2015-01-22 12:52   ` Ander Conselvan de Oliveira
2015-01-22  0:35 ` [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v2) Matt Roper
2015-01-22 16:00   ` Ander Conselvan de Oliveira
2015-01-23  0:50     ` [PATCH 06/10] drm/i915: Setup dummy atomic state for connectors (v3) Matt Roper
2015-01-23  5:42       ` Ander Conselvan de Oliveira
2015-01-22  0:35 ` [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors Matt Roper
2015-01-22 16:55   ` Ander Conselvan de Oliveira
2015-01-23  0:51     ` [PATCH 07/10] drm/i915: Add atomic_get_property entrypoint for connectors (v2) Matt Roper
2015-01-23  5:43       ` Ander Conselvan de Oliveira
2015-01-22  0:35 ` [PATCH 08/10] drm/i915: Add crtc state duplication/destruction functions Matt Roper
2015-01-22 17:08   ` Ander Conselvan de Oliveira
2015-01-22  0:35 ` [PATCH 09/10] drm/i915: Switch plane properties to full atomic helper Matt Roper
2015-01-22 17:16   ` Ander Conselvan de Oliveira
2015-01-22  0:35 ` [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v3) Matt Roper
2015-01-22 17:32   ` Ander Conselvan de Oliveira
2015-01-23  0:53     ` [PATCH 10/10] drm/i915: Add i915.nuclear_pageflip command line param to force atomic (v4) Matt Roper
2015-01-27  9:22       ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.