[PATCH 2/2] drm/i915/fbdev: Setup for using FBC tracking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When FBC is enabled, access through the fbdev is tracked using
ORIGIN_GTT, i.e. native hw tracking by FBC. This requires the
framebuffer to be fenced, which requires us to allocate the object
as X-tiled.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_fbdev.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 8d6bfa565b50..ad3995f87485 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -138,14 +138,17 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
 
 	mode_cmd.pitches[0] = ALIGN(mode_cmd.width *
 				    DIV_ROUND_UP(sizes->surface_bpp, 8), 64);
+	if (i915.enable_fbc)
+		mode_cmd.pitches[0] = ALIGN(mode_cmd.pitches[0], 512);
+
 	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
 							  sizes->surface_depth);
 
-	mutex_lock(&dev->struct_mutex);
-
 	size = mode_cmd.pitches[0] * mode_cmd.height;
 	size = PAGE_ALIGN(size);
 
+	mutex_lock(&dev->struct_mutex);
+
 	/* If the FB is too big, just don't use it since fbdev is not very
 	 * important and we should probably use that space with FBC or other
 	 * features. */
@@ -159,6 +162,12 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
 		goto out;
 	}
 
+	if (i915.enable_fbc) {
+		obj->tiling_and_stride = mode_cmd.pitches[0] | I915_TILING_X;
+		mode_cmd.modifier[0] = I915_FORMAT_MOD_X_TILED;
+		mode_cmd.flags |= DRM_MODE_FB_MODIFIERS;
+	}
+
 	fb = __intel_framebuffer_create(dev, &mode_cmd, obj);
 	if (IS_ERR(fb)) {
 		i915_gem_object_put(obj);
-- 
2.9.3

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux