diff options
author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2015-08-13 17:37:06 -0300 |
---|---|---|
committer | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2015-08-14 15:28:27 -0300 |
commit | 9113c9aa9be5626d4d12a794c70860097ae59c1f (patch) | |
tree | 10fe7c959b0243a5a65a5242bc817e6ac8d38bf0 /lib/igt_draw.c | |
parent | 9194f4efdf89d9c2e9ab79a232e642b8664fa54f (diff) |
lib/igt_draw: break if we already wrote every pixel
Due to the nature of accessing a tiled buffer in an untiled way, we
used to loop through the whole buffer all the time. Add a small
mechanism to just break in case we know we already wrote every pixel
we should have written.
On kms_frontbuffer_tracknig/fbc-2p-primscrn-pri-shrfb-draw-pwrite
(with a 3200x1800 primary screen and a 1920x1080 secondary screen), I
could reduce the runtime from ~7.53s to ~6.01s.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'lib/igt_draw.c')
-rw-r--r-- | lib/igt_draw.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/igt_draw.c b/lib/igt_draw.c index 10187d8e..760bda8c 100644 --- a/lib/igt_draw.c +++ b/lib/igt_draw.c @@ -349,6 +349,7 @@ static void draw_rect_pwrite_tiled(int fd, struct buf_data *buf, int tmp_used = 0, tmp_size; bool flush_tmp = false; int tmp_start_pos = 0; + int pixels_written = 0; /* We didn't implement suport for the older tiling methods yet. */ igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5); @@ -380,7 +381,11 @@ static void draw_rect_pwrite_tiled(int fd, struct buf_data *buf, gem_write(fd, buf->handle, tmp_start_pos, tmp, tmp_used * pixel_size); flush_tmp = false; + pixels_written += tmp_used; tmp_used = 0; + + if (pixels_written == rect->w * rect->h) + break; } } } |