summaryrefslogtreecommitdiff
path: root/lib/igt_draw.c
AgeCommit message (Collapse)Author
2019-02-26lib/i915: Move mmap IOCTLs wrappers into separate fileAntonio Argenziano
Move all mmap flavours and support function to separate file in i915 folder. This helps with moving i915 specific functions away from common libraries. v2: - Autotools still exists. (Petri) - Include gem_mman.h directly. (Chris) v3: - Keep includes explicit. (Chris) Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-01-23lib/draw: Align mmap requests to page boundariesChris Wilson
Since we trust fb->size as either calculated by calc_fb_size() or the supplied by the user, it invariably isn't page aligned. The mmap routines and ioctls only deal in pages... Not sure if fb->size should be page aligned, but that may break some other drawing tests, so opt to just fix up the mmap requests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
2018-11-20lib/igt_draw: Pass bpp along to rendercopy.Maarten Lankhorst
Now that rendercopy can perform copies for 8 bpp and 16 bpp, there's no reason we have to skip on odd x/w any more for 16 bpp. Pass the correct bpp to rendercopy, and prevent tests from skipping. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> [mlankhorst: set src_buf.bpp to tmp.bpp (Ville)] Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-11-20lib/batchbuffer: Set bpp in igt_buf.Maarten Lankhorst
We want to allow bpp = 8 or 16, so make sure we set the bpp in igt_buf. This way we can extend rendercopy to support other values for bpp. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> [mlankhorst: Fix double ;; (Ville] Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-11-16lib/igt_draw: Only skip when width/x is not a multiple of 2.Maarten Lankhorst
Y and height have no such restrictions, since pixel size has no relation to height. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-09-27lib/igt_fb: Pass around igt_fb internallyVille Syrjälä
Instead of passing around a boatload of integers everywhere let's just pass around the igt_fb struct. That obviously means we have to populate it first sufficiently, to which end we'll add a small helper. Later on the stride/size calculations will consult the already pre-populated igt_fb and fill in the rest as needed. This makes the whole thing a lot less error prone as it's impossible to accidentally pass the arguments in the wrong order when there's just the one of them, and it's a pointer. v2: Rebase due to uint64_t size Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2018-07-09lib/igt_draw: Zero initalize the igt_bufsVille Syrjälä
I missed these when sprinkling the memsets. Using stack garbage as the aux surface state isn't a good idea. Causes kms_front_buffer_tracking to fail on skl+. Fixes: a4393c3951ec ("lib: Add aux surface state to igt_buf") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-05-07lib: drop drmtest dependency on intel_batchbufferLionel Landwerlin
It doesn't look like there should be a dependency there. v2: s/intel_batchbuffer/intel_reg/ v3: One more s/intel_batchbuffer/intel_reg/ in benchmarks Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
2018-02-28lib/igt_draw: Fix bo leak in gpu draw routinesMaarten Lankhorst
gem_handle_to_libdrm_bo creates a new handle through the use of flink, which makes kms_frontbuffer_tracking through a single run not complete when it starts leaking 50MB objects. Add the missing bo_unref to kill the duplicated handle and fix the leaks! Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-12-19lib/draw: Use more typical form for computing swizzle addressesChris Wilson
Actually use the XOR operation rather than open coding it with three bitwise operators (including XOR itself). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-07-25lib/igt_draw: add support for Y tilingPaulo Zanoni
Most of the patch is to change the tile/untile functions so they can work with Y-major tiling. v2: (Praveen) No skipping on BLT for Y-tile now as we have a fix for that. Reviewed-by: Praveen Paneri <praveen.paneri@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
2017-07-13lib/igt_draw: Add Y-tiling support for IGT_DRAW_BLT methodAkash Goel
v2: Moved identical code into a single function (Paulo) v3 (from Paulo): stay under 80 columns. Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Akash Goel <akash.goel@intel.com> Signed-off-by: Praveen Paneri <praveen.paneri@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2017-02-27lib: Add basic support for valgrind annotations.Maarten Lankhorst
SIGRTMAX appears to be used by valgrind now for its internal tracking, so avoid it in the helpers. Also add some valgrind annotations in gem_mmap, to make sure that its accesses are tracked correctly. I've also added gem_munmap, but there are a lot of places that don't use it yet in tests/. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2016-10-19igt: Check the physical swizzle statusChris Wilson
The kernel tries to hide L-shaped memory with asymmetric swizzling from userspace by reporting lies through the get-tiling interface. Check for these lies by comparing the reported swizzle with the actual swizzle, and only run swizzling tests where we know the underlying physical swizzling. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-29lib/igt_draw: use igt_drm_format_to_bpp()Paulo Zanoni
Don't reimplement the function. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-10-12Replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with gem_mmap__{cpu,gtt,wc}()Ville Syrjälä
gem_mmap__{cpu,gtt,wc}() already has the assert built in, so replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with it. Mostly done with coccinelle, with some manual help: @@ identifier I; expression E1, E2, E3, E4, E5, E6; @@ ( - I = __gem_mmap__gtt(E1, E2, E3, E4); + I = gem_mmap__gtt(E1, E2, E3, E4); ... - igt_assert(I); | - I = __gem_mmap__cpu(E1, E2, E3, E4, E5); + I = gem_mmap__cpu(E1, E2, E3, E4, E5); ... - igt_assert(I); | - I = __gem_mmap__wc(E1, E2, E3, E4, E5); + I = gem_mmap__wc(E1, E2, E3, E4, E5); ... - igt_assert(I); ) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09Make gem_mmap__{cpu,gtt,wc}() assert on failureVille Syrjälä
Rename the current gem_mmap__{cpu,gtt,wc}() functions into __gem_mmap__{cpu,gtt,wc}(), and add back wrappers with the original name that assert that the pointer is valid. Most callers will expect a valid pointer and shouldn't have to bother with failures. To avoid changing anything (yet), sed 's/gem_mmap__/__gem_mmap__/g' over the entire codebase. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-08lib: various documentation fixesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-14lib/igt_draw: break if we already wrote every pixelPaulo Zanoni
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>
2015-08-14lib/igt_draw: fix pwrite_tiled()Paulo Zanoni
Don't forget to flush in case we're in the last iteration of the loop. This fixes failures of kms_frontbuffer_tracking when used with --use-small-modes on eDP monitors. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14lib/igt_draw: add support for RGB565 and XRGB2101010Paulo Zanoni
We need to test those pixel formats on the FBC code, so let's make sure the drawing library works on them first. v2: Update the gtkdoc (Daniel). Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-06-27doc: Remove i-g-t/intel prefixes and capitalize section titlesDamien Lespiau
Looks better! Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-26lib/igt_draw: move to the GTT domain before using GTT mmapsPaulo Zanoni
With this, we don't need to worry about what happened to the buffer before. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14docs: various documentation fixesThomas Wood
Fix various typos, add missing parameter documentation, include the igt_draw section and update the list of ignored headers. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-05-07lib: add igt_drawPaulo Zanoni
For all those IGT tests that need an easy way to draw rectangles on buffers using different methods. Current planned users: FBC and PSR CRC tests. There is also a tests/kms_draw_crc program to check if the library is sane. v2: - Move the test from lib/tests to tests/ (Daniel). - Add igt_require() to filter out the swizzling/tiling methods we don't support (Daniel). - Simplify reloc handling on the BLT case (Daniel). - Document enum igt_draw_method (Daniel). - Document igt_draw_get_method_name() (Paulo). v3: - Add IGT_DRAW_MMAP_WC (Chris). - Implement the other trivial swizzling methods (Chris). - Remove the gem_sync() calls (Chris). Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>