public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: [igt-dev] [PATCH i-g-t v3 1/2] lib/igt_fb: Don't use blitter for large buffers
Date: Mon,  8 Apr 2019 20:13:06 +0300	[thread overview]
Message-ID: <20190408171306.31586-1-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20190328175450.8370-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The blitter stride is limited to <32k. Fall back to gtt mmap or
rendercopy if we're about to exceed that.

Not quite sure why we're not just using gtt mmap for Y tiling
always. But let's keep it like that for now.

v2: Use rendercopy as the fallback for Yf
v3: Deal with gen4+ tiled stride correctly (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_fb.c | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 6adf422228e8..d2f756dba2e9 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1576,6 +1576,31 @@ struct fb_blit_upload {
 	struct intel_batchbuffer *batch;
 };
 
+static int max_blitter_stride(int fd, uint64_t modifier)
+{
+	int stride = 32768;
+
+	if (intel_gen(intel_get_drm_devid(fd)) >= 4 &&
+	    modifier != DRM_FORMAT_MOD_NONE)
+		stride *= 4;
+
+	return stride;
+}
+
+static bool use_rendercopy(const struct igt_fb *fb)
+{
+	return is_ccs_modifier(fb->modifier) ||
+		(fb->modifier == I915_FORMAT_MOD_Yf_TILED &&
+		 fb->strides[0] >= max_blitter_stride(fb->fd, fb->modifier));
+}
+
+static bool use_blitter(const struct igt_fb *fb)
+{
+	return (fb->modifier == I915_FORMAT_MOD_Y_TILED ||
+		fb->modifier == I915_FORMAT_MOD_Yf_TILED) &&
+		fb->strides[0] < max_blitter_stride(fb->fd, fb->modifier);
+}
+
 static void init_buf(struct fb_blit_upload *blit,
 		     struct igt_buf *buf,
 		     const struct igt_fb *fb,
@@ -2755,7 +2780,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 	blit->base.fd = fd;
 	blit->base.fb = fb;
 
-	if (is_ccs_modifier(fb->modifier)) {
+	if (use_rendercopy(fb)) {
 		blit->base.bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 		blit->base.batch = intel_batchbuffer_alloc(blit->base.bufmgr,
 						   intel_get_drm_devid(fd));
@@ -2767,9 +2792,7 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 							     &blit->shadow_fb);
 	igt_assert(blit->shadow_ptr);
 
-	if (fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-	    fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED ||
-	    is_ccs_modifier(fb->modifier)) {
+	if (use_rendercopy(fb) || use_blitter(fb)) {
 		setup_linear_mapping(&blit->base);
 	} else {
 		blit->base.linear.fb = *fb;
@@ -2849,10 +2872,9 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 		    ((f->cairo_id == CAIRO_FORMAT_INVALID) &&
 		     (f->pixman_id != PIXMAN_invalid)))
 			create_cairo_surface__convert(fd, fb);
-		else if (is_ccs_modifier(fb->modifier))
+		else if (use_rendercopy(fb))
 			create_cairo_surface__rendercopy(fd, fb);
-		else if (fb->modifier == LOCAL_I915_FORMAT_MOD_Y_TILED ||
-			 fb->modifier == LOCAL_I915_FORMAT_MOD_Yf_TILED)
+		else if (use_blitter(fb))
 			create_cairo_surface__blit(fd, fb);
 		else
 			create_cairo_surface__gtt(fd, fb);
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-04-08 17:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-28 17:54 [igt-dev] [PATCH i-g-t 1/2] lib/igt_fb: Don't use blitter for large buffers Ville Syrjala
2019-03-28 17:54 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: Don't leak the bufmgr and batch for converted surfaces Ville Syrjala
2019-04-02 23:01   ` Dhinakaran Pandiyan
2019-03-28 18:17 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/igt_fb: Don't use blitter for large buffers Patchwork
2019-03-28 18:25 ` [igt-dev] [PATCH i-g-t 1/2] " Chris Wilson
2019-04-02 22:41   ` Dhinakaran Pandiyan
2019-04-03 15:24     ` Ville Syrjälä
2019-03-29  4:20 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/2] " Patchwork
2019-04-08 17:13 ` Ville Syrjala [this message]
2019-04-08 17:19   ` [igt-dev] [PATCH i-g-t v3 1/2] " Chris Wilson
2019-04-08 17:20     ` Chris Wilson
2019-04-09 12:25       ` Ville Syrjälä
2019-04-09 19:49         ` Chris Wilson
2019-04-09 20:12           ` Ville Syrjälä
2019-04-08 18:02 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/2] lib/igt_fb: Don't use blitter for large buffers (rev2) Patchwork
2019-04-08 21:09 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190408171306.31586-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox