Skip to contentSkip to conversation

drm/i915/fbc: fix the check for already reserved fbc size

PATCH Applied Jani Nikula 5 participants 6 messages Feb 5, 2015 – Feb 6, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/fbc: fix the check for already reserved fbc size

The check for previously reserved stolen space size for FBC in i915_gem_stolen_setup_compression() did not take the compression threshold into account. Fix this by storing and comparing to uncompressed size instead.

The bug has been introduced in

commit 5e59f7175f96550ede91f58d267d2b551cb6fbba

Author: Ben Widawsky <[email protected]>
Date:   Mon Jun 30 10:41:24 2014 -0700

drm/i915: Try harder to get FBC

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88975

---
 drivers/gpu/drm/i915/i915_drv.h        | 2 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c | 8 ++++----
 drivers/gpu/drm/i915/intel_fbc.c       | 3 ++-
 3 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index ca64b999403f..97ce50a176a7 100644
@@ -772,7 +772,7 @@ struct intel_context {
 };
 
 struct i915_fbc {
-	unsigned long size;
+	unsigned long uncompressed_size;
 	unsigned threshold;
 	unsigned int fb_id;
 	enum plane plane;
drivers/gpu/drm/i915/i915_gem_stolen.c +4 -4
index a2045848bd1a..59401f3b902c 100644
@@ -231,7 +231,7 @@ static int i915_setup_compression(struct drm_device *dev, int size, int fb_cpp)
 			   dev_priv->mm.stolen_base + compressed_llb->start);
 	}
 
-	dev_priv->fbc.size = size / dev_priv->fbc.threshold;
+	dev_priv->fbc.uncompressed_size = size;
 
 	DRM_DEBUG_KMS("reserved %d bytes of contiguous stolen space for FBC\n",
 		      size);
@@ -253,7 +253,7 @@ int i915_gem_stolen_setup_compression(struct drm_device *dev, int size, int fb_c
 	if (!drm_mm_initialized(&dev_priv->mm.stolen))
 		return -ENODEV;
 
-	if (size < dev_priv->fbc.size)
+	if (size < dev_priv->fbc.uncompressed_size)
 		return 0;
 
 	/* Release any current block */
@@ -266,7 +266,7 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (dev_priv->fbc.size == 0)
+	if (dev_priv->fbc.uncompressed_size == 0)
 		return;
 
 	drm_mm_remove_node(&dev_priv->fbc.compressed_fb);
@@ -276,7 +276,7 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev)
 		kfree(dev_priv->fbc.compressed_llb);
 	}
 
-	dev_priv->fbc.size = 0;
+	dev_priv->fbc.uncompressed_size = 0;
 }
 
 void i915_gem_cleanup_stolen(struct drm_device *dev)
drivers/gpu/drm/i915/intel_fbc.c +2 -1
index 624d1d92d284..b572bb6ebcff 100644
@@ -78,7 +78,8 @@ static void i8xx_fbc_enable(struct drm_crtc *crtc)
 
 	dev_priv->fbc.enabled = true;
 
-	cfb_pitch = dev_priv->fbc.size / FBC_LL_SIZE;
+	/* Note: fbc.threshold == 1 for i8xx */
+	cfb_pitch = dev_priv->fbc.uncompressed_size / FBC_LL_SIZE;
 	if (fb->pitches[0] < cfb_pitch)
 		cfb_pitch = fb->pitches[0];
 
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jani Nikula

The check for previously reserved stolen space size for FBC in i915_gem_stolen_setup_compression() did not take the compression threshold into account. Fix this by storing and comparing to uncompressed size instead.

The bug has been introduced in

commit 5e59f7175f96550ede91f58d267d2b551cb6fbba

Author: Ben Widawsky <[email protected]>
Date:   Mon Jun 30 10:41:24 2014 -0700
Quoted 7 lines

drm/i915: Try harder to get FBC

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88975

Thanks, I think uncompressed_size clarifies exactly what we want to compare against (is this allocation request any bigger or smaller than the last request). Then if we need the final size for anything we can add it without further confusion.

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 12 lines · Chris Wilson
Quoted 11 lines · Jani Nikula

The check for previously reserved stolen space size for FBC in i915_gem_stolen_setup_compression() did not take the compression threshold into account. Fix this by storing and comparing to uncompressed size instead.

The bug has been introduced in

commit 5e59f7175f96550ede91f58d267d2b551cb6fbba

Author: Ben Widawsky <[email protected]>
Date:   Mon Jun 30 10:41:24 2014 -0700
Quoted 6 lines
Quoted 6 lines

drm/i915: Try harder to get FBC

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88975

Dropped since fbc isn't enabled by default.

Quoted 8 lines
Quoted 1 line

Thanks, I think uncompressed_size clarifies exactly what we want to compare against (is this allocation request any bigger or smaller than the last request). Then if we need the final size for anything we can add it without further confusion.

Queued for -next, thanks for the patch.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#3 lore raw
In reply to Jani Nikula

Task id: 5714 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 282/283 282/283

ILK                 -1              316/319              315/319
SNB              +22-1              322/346              343/346
IVB                 -1              382/384              381/384

BYT 296/296 296/296
HSW -1 425/428 424/428
BDW 318/333 318/333
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied

*ILK  igt_kms_flip_vblank-vs-hang      PASS(3, M26M37)      TIMEOUT(1, M26)
 SNB  igt_kms_cursor_crc_cursor-size-change      NSPT(1, M22)PASS(1, M35)DMESG_FAIL(1, M35)      PASS(1, M35)
 SNB  igt_kms_flip_dpms-vs-vblank-race-interruptible      DMESG_WARN(1, M35)PASS(2, M22M35)      DMESG_WARN(1, M35)
 SNB  igt_kms_flip_event_leak      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_kms_mmio_vs_cs_flip_setcrtc_vs_cs_flip      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_kms_mmio_vs_cs_flip_setplane_vs_cs_flip      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_kms_rotation_crc_primary-rotation      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_kms_rotation_crc_sprite-rotation      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_cursor      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_cursor-dpms      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_dpms-mode-unset-non-lpsp      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_dpms-non-lpsp      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_drm-resources-equal      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_fences      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_fences-dpms      NSPT(1, M22)DMESG_WARN(1, M35)PASS(1, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_gem-execbuf      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_gem-mmap-cpu      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_gem-mmap-gtt      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_gem-pread      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_i2c      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_modeset-non-lpsp      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_modeset-non-lpsp-stress-no-wait      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_pci-d3-state      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 SNB  igt_pm_rpm_rte      NSPT(1, M22)PASS(2, M35)      PASS(1, M35)
 IVB  igt_gem_pwrite_pread_snooped-copy-performance      DMESG_WARN(1, M34)PASS(1, M21)      DMESG_WARN(1, M34)
*HSW  igt_gem_pwrite_pread_snooped-copy-performance      PASS(2, M20M40)      DMESG_WARN(1, M40)

Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
In reply to Jani Nikula
Quoted 11 lines · Jani Nikula

The check for previously reserved stolen space size for FBC in i915_gem_stolen_setup_compression() did not take the compression threshold into account. Fix this by storing and comparing to uncompressed size instead.

The bug has been introduced in

commit 5e59f7175f96550ede91f58d267d2b551cb6fbba

Author: Ben Widawsky <[email protected]>
Date:   Mon Jun 30 10:41:24 2014 -0700
Quoted 7 lines

drm/i915: Try harder to get FBC

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88975

I guess we can argue semantically about whether or not it was a bug. If I didn't put the DRM_INFO there, everything would have continued to work and nobody would have complained. I personally prefer keeping the size as the compressed size like you did here: https://bugs.freedesktop.org/show_bug.cgi?id=88975#c1
but Chris already reviewed this so nuts to me.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 20 lines · Ben Widawsky
Quoted 11 lines · Jani Nikula

The check for previously reserved stolen space size for FBC in i915_gem_stolen_setup_compression() did not take the compression threshold into account. Fix this by storing and comparing to uncompressed size instead.

The bug has been introduced in

commit 5e59f7175f96550ede91f58d267d2b551cb6fbba

Author: Ben Widawsky <[email protected]>
Date:   Mon Jun 30 10:41:24 2014 -0700
Quoted 7 lines

drm/i915: Try harder to get FBC

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88975

Quoted 3 lines

I guess we can argue semantically about whether or not it was a bug. If I didn't put the DRM_INFO there, everything would have continued to work and nobody would have complained.

Okay, bug or not, I felt it was unnecessary to be doing the reservation over and over at every update.

I also contemplated making the logging DRM_INFO_ONCE as a follow-up, but then thought it's a good canary, at least for now. We occasionally have these moments where we discover we do some stuff way too often.

Quoted 3 lines

I personally prefer keeping the size as the compressed size like you did here: https://bugs.freedesktop.org/show_bug.cgi?id=88975#c1
but Chris already reviewed this so nuts to me.

As you can tell, I did not really have an opinion one way or the other, so someone else having an opinion won...

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx