[Intel-gfx] [RFC 1/3] drm/i915: Pass in plane state instead of plane to intel_plane_obj_offset

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Jun 16 06:34:26 PDT 2015


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

We don't need the plane but just it's state and so it will be more
handy to pass it in directly.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 13 +++++++------
 drivers/gpu/drm/i915/intel_drv.h     |  6 ++++--
 drivers/gpu/drm/i915/intel_sprite.c  |  3 ++-
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index afe91a8..95a2375 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2897,12 +2897,13 @@ u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier,
 	}
 }
 
-unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
-				     struct drm_i915_gem_object *obj)
+unsigned long
+intel_plane_obj_offset(struct intel_plane_state *intel_plane_state,
+		       struct drm_i915_gem_object *obj)
 {
 	const struct i915_ggtt_view *view = &i915_ggtt_view_normal;
 
-	if (intel_rotation_90_or_270(intel_plane->base.state->rotation))
+	if (intel_rotation_90_or_270(intel_plane_state->base.rotation))
 		view = &i915_ggtt_view_rotated;
 
 	return i915_gem_obj_ggtt_offset_view(obj, view);
@@ -3063,7 +3064,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
 	obj = intel_fb_obj(fb);
 	stride_div = intel_fb_stride_alignment(dev, fb->modifier[0],
 					       fb->pixel_format);
-	surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj);
+	surf_addr = intel_plane_obj_offset(plane_state, obj);
 
 	/*
 	 * FIXME: intel_plane_state->src, dst aren't set when transitional
@@ -11557,8 +11558,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	if (ret)
 		goto cleanup_pending;
 
-	work->gtt_offset = intel_plane_obj_offset(to_intel_plane(primary), obj)
-						  + intel_crtc->dspaddr_offset;
+	work->gtt_offset = intel_plane_obj_offset(to_intel_plane_state(primary->state),
+						  obj) + intel_crtc->dspaddr_offset;
 
 	if (mmio_flip) {
 		ret = intel_queue_mmio_flip(dev, crtc, fb, obj, ring,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index b28029a..5599f43 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1153,8 +1153,10 @@ int skl_update_scaler_users(struct intel_crtc *intel_crtc,
 	struct intel_plane_state *plane_state, int force_detach);
 int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
 
-unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
-				     struct drm_i915_gem_object *obj);
+unsigned long
+intel_plane_obj_offset(struct intel_plane_state *intel_plane_state,
+		       struct drm_i915_gem_object *obj);
+
 u32 skl_plane_ctl_format(uint32_t pixel_format);
 u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
 u32 skl_plane_ctl_rotation(unsigned int rotation);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 8193a35..f123090 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -225,7 +225,8 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
 	else if (key->flags & I915_SET_COLORKEY_SOURCE)
 		plane_ctl |= PLANE_CTL_KEY_ENABLE_SOURCE;
 
-	surf_addr = intel_plane_obj_offset(intel_plane, obj);
+	surf_addr = intel_plane_obj_offset(to_intel_plane_state(drm_plane->state),
+					   obj);
 
 	if (intel_rotation_90_or_270(rotation)) {
 		/* stride: Surface height in tiles */
-- 
2.4.2



More information about the Intel-gfx mailing list