mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-25 00:36:16 +00:00
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>
This commit is contained in:
parent
9194f4efdf
commit
9113c9aa9b
@ -349,6 +349,7 @@ static void draw_rect_pwrite_tiled(int fd, struct buf_data *buf,
|
|||||||
int tmp_used = 0, tmp_size;
|
int tmp_used = 0, tmp_size;
|
||||||
bool flush_tmp = false;
|
bool flush_tmp = false;
|
||||||
int tmp_start_pos = 0;
|
int tmp_start_pos = 0;
|
||||||
|
int pixels_written = 0;
|
||||||
|
|
||||||
/* We didn't implement suport for the older tiling methods yet. */
|
/* We didn't implement suport for the older tiling methods yet. */
|
||||||
igt_require(intel_gen(intel_get_drm_devid(fd)) >= 5);
|
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,
|
gem_write(fd, buf->handle, tmp_start_pos, tmp,
|
||||||
tmp_used * pixel_size);
|
tmp_used * pixel_size);
|
||||||
flush_tmp = false;
|
flush_tmp = false;
|
||||||
|
pixels_written += tmp_used;
|
||||||
tmp_used = 0;
|
tmp_used = 0;
|
||||||
|
|
||||||
|
if (pixels_written == rect->w * rect->h)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user