[Intel-gfx] [PATCH 3/3] drm/i915: Use intel_plane_obj_offset from more places

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed May 27 02:52:34 PDT 2015


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

These are the display call sites so should use the proper helper.

Also requires intel_plane_obj_offset to assume normal view when
plane pointer is not available.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 8 +++++---
 drivers/gpu/drm/i915/intel_fbdev.c   | 9 +++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 657a333..0dc872b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2626,7 +2626,8 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
 			continue;
 
 		obj = intel_fb_obj(fb);
-		if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) {
+		if (intel_plane_obj_offset(to_intel_plane(c->primary), obj) ==
+		    plane_config->base) {
 			drm_framebuffer_reference(fb);
 			goto valid_fb;
 		}
@@ -2911,7 +2912,8 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
 {
 	const struct i915_ggtt_view *view = &i915_ggtt_view_normal;
 
-	if (intel_rotation_90_or_270(intel_plane->base.state->rotation))
+	if (intel_plane &&
+	    intel_rotation_90_or_270(intel_plane->base.state->rotation))
 		view = &i915_ggtt_view_rotated;
 
 	return i915_gem_obj_ggtt_offset_view(obj, view);
@@ -13661,7 +13663,7 @@ intel_commit_cursor_plane(struct drm_plane *plane,
 	if (!obj)
 		addr = 0;
 	else if (!INTEL_INFO(dev)->cursor_needs_physical)
-		addr = i915_gem_obj_ggtt_offset(obj);
+		addr = intel_plane_obj_offset(to_intel_plane(plane), obj);
 	else
 		addr = obj->phys_handle->busaddr;
 
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 4e7e7da..4338324 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -180,6 +180,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	struct fb_info *info;
 	struct drm_framebuffer *fb;
 	struct drm_i915_gem_object *obj;
+	unsigned long disp_addr;
 	int size, ret;
 	bool prealloc = false;
 
@@ -243,12 +244,12 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	info->apertures->ranges[0].base = dev->mode_config.fb_base;
 	info->apertures->ranges[0].size = dev_priv->gtt.mappable_end;
 
-	info->fix.smem_start = dev->mode_config.fb_base + i915_gem_obj_ggtt_offset(obj);
+	disp_addr = intel_plane_obj_offset(NULL, obj);
+	info->fix.smem_start = dev->mode_config.fb_base + disp_addr;
 	info->fix.smem_len = size;
 
 	info->screen_base =
-		ioremap_wc(dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj),
-			   size);
+		ioremap_wc(dev_priv->gtt.mappable_base + disp_addr, size);
 	if (!info->screen_base) {
 		ret = -ENOSPC;
 		goto out_unpin;
@@ -272,7 +273,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 
 	DRM_DEBUG_KMS("allocated %dx%d fb: 0x%08lx, bo %p\n",
 		      fb->width, fb->height,
-		      i915_gem_obj_ggtt_offset(obj), obj);
+		      disp_addr, obj);
 
 	mutex_unlock(&dev->struct_mutex);
 	vga_switcheroo_client_fb_set(dev->pdev, info);
-- 
2.4.0



More information about the Intel-gfx mailing list