summaryrefslogtreecommitdiff
path: root/tests/kms_fbc_crc.c
AgeCommit message (Collapse)Author
2015-11-11tests/kms_fbc_crc: ensure context is initialized correctlyThomas Wood
Initialization was included in commit a976d7e (tests/kms_fbc_crc: refactor context handling code), but won't be executed since it is declared before the first label within a switch statement. kms_fbc_crc.c:178:2: warning: ‘context’ may be used uninitialized in this function [-Wmaybe-uninitialized] rendercopy(batch, context, ^ kms_fbc_crc.c:271:22: note: ‘context’ was declared here drm_intel_context *context = NULL; ^ Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com> Reviewed-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-10-09Sprinkle igt_assert(ptr) after gem_mmap__{cpu,gtt,wc}Ville Syrjälä
Do the following ptr = gem_mmap__{cpu,gtt,wc}() +igt_assert(ptr); whenever the code doesn't handle the NULL ptr in any kind of specific way. Makes it easier to move the assert into gem_mmap__{cpu,gtt,wc}() itself. Mostly done with coccinelle, with some manual cleanups: @@ identifier I; @@ <... when != igt_assert(I) when != igt_require(I) when != igt_require_f(I, ...) when != I != NULL when != I == NULL ( I = gem_mmap__gtt(...); + igt_assert(I); | I = gem_mmap__cpu(...); + igt_assert(I); | I = gem_mmap__wc(...); + 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-09-11convert drm_open_any*() calls to drm_open_driver*(DRIVER_INTEL) calls with cocciMicah Fedke
Apply the new API to all call sites within the test suite using the following semantic patch: // Semantic patch for replacing drm_open_any* with arch-specific drm_open_driver* calls @@ identifier i =~ "\bdrm_open_any\b"; @@ - i() + drm_open_driver(DRIVER_INTEL) @@ identifier i =~ "\bdrm_open_any_master\b"; @@ - i() + drm_open_driver_master(DRIVER_INTEL) @@ identifier i =~ "\bdrm_open_any_render\b"; @@ - i() + drm_open_driver_render(DRIVER_INTEL) @@ identifier i =~ "\b__drm_open_any\b"; @@ - i() + __drm_open_driver(DRIVER_INTEL) Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-21lib: add a single include headerThomas Wood
Add a header that includes all the headers for the library. This allows reorganisation of the library without affecting programs using it and also simplifies the headers that need to be included to use the library. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-05lib: add igt_debugfs_read()Paulo Zanoni
A helpful function for when you want to read a whole debugfs file to a string and don't want to worry about opening and closing file descriptors and asserting buffer sizes. We've been using this already for kms_frontbuffer_tracking and kms_fbcon_fbt, so the only test with new code here is kms_fbc_crc. Also notice that for kms_fbc_crc we had to increase the buffer size since the file can sometimes be bigger than 64 bytes - depending on the reason why FBC is disabled. Of course, there are probably many other programs we can patch, but I'm not doing this now. v2: Add the macro to wrap sizeof() (Daniel). v3: Add documentation for the macro too (Daniel). Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-06-25tests/kms_fbc_crc: Don't force fbc on old platformsDaniel Vetter
It's simply a bit too scary on pre-gen6 and imo not worth the bother really until someone starts to implement all the hacks an w/a required on these platforms. On later platforms the issues are just with correctness and performance hence no risk for hanging machines. Cc: Paulo Zanoni <przanoni@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-06-11tests/kms_fbc_crc: run even if FBC is disabled by defaultPaulo Zanoni
We may not be perfect, but if we don't even test, we will probably only get worse over time. The function called makes sure we restore whatever was the original FBC parameter when we exit the test, so this should not affect the other tests. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14tests/kms_fb_crc: fix the reference CRC checkingPaulo Zanoni
Now we get the reference CRCs on separate untiled FBs just to make sure FBC is not there to mess the CRC computation. We also get the reference CRCs for buffers that were drawn in the same way that we draw them during the tests, so we can finally get rid of that FIXME comment we have! With this, kms_fbc_crc now actually tests something instead of just wasting CPU cycles... Fixes regression introduced by: commit 562bbe12f6fb75811a746c742a28d32a17b26aa9 Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Fri Feb 27 22:04:18 2015 +0100 tests: Remove usage of igt_crc_equal and _non_null Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14tests/kms_fbc_crc: extract fill_mmap_{cpu,gtt}()Paulo Zanoni
Just like we have fill_render() and fill_blt(). I'm also going to use fill_mmap_gtt() for the code that generates the reference CRCs. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14tests/kms_fbc_crc: make the blt test draw the same patternPaulo Zanoni
... as the other drawing tests: single white pixel at top/left of the screen, instead of painting the whole screen blue. This will make it much easier to fix the CRC checking code. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14tests/kms_fbc_crc: extract check_crc()Paulo Zanoni
To remove some duplicated code. When we finally fix that FIXME, the code will get a little bigger too. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14tests/kms_fbc_crc: refactor context handling codePaulo Zanoni
Just a small modification to make the code a little easier to understand, IMHO. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14tests/kms_fbc_crc: unify flip handlingPaulo Zanoni
Just a small simplification to make the code a little easier to understand, and to help us when we further split drawing vs flipping later. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14tests/kms_fbc_crc: increase the FBC wait timeoutPaulo Zanoni
Now that we moved to the frontbuffer tracking scheme, it may take a long time for FBC to be updated after it is invalidated: 300ms is not enough anymore. The problem starts when i915_gem_execbuffer2() indirectly calls intel_fb_obj_invalidate(), which disables FBC. After this, FBC only gets reenabled when i915_gem_retire_work_handler() happens and indirectly calls intel_frontbuffer_flush(). Notice that while FBC is not yet enabled, the screen contents are correct, so this shouldn't really be a bug. Previous versions of this patch were replacing the gem_bo_busy() calls with gem_sync(), but after some discussion we concluded this was not the correct way to handle the problem, so let's just increase the timeout so we can kill those subtest failures. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-14tests/kms_fbc_crc: exec_nop() can also invalidate FBCPaulo Zanoni
So make sure that, at prepare_test(), we wait for FBC to be enabled again after we run the exec_nop() call. Since after this happens, we just assert fbc_enabled() at test_crc() instead of waiting for it to be enabled. This is now needed because we moved to software frontbuffer tracking, so it can take some considerable time for FBC to be reenabled after it is disabled. A previous version of this patch was just calling gem_sync() after exec_nop(). Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-07tests/kms_fbc_crc: fix debugfs readPaulo Zanoni
Commit 47f6b1305cc3752f318a555b932e194e1500c1d8 completely broke this test due to the fread() assertion. When we're reading the debugfs file we really don't care about how many bytes we read because the number is not constant and we just use strstr() later. Change the assertion to make it check for at least 1 byte read, just to make sure no one changes that again. Regression introduced by: commit 47f6b1305cc3752f318a555b932e194e1500c1d8 Author: Thomas Wood <thomas.wood@intel.com> Date: Wed Mar 25 16:42:57 2015 +0000 igt.cocci: check the return values of various functions Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-05tests/kms_fbc_crc: remove redundant information from data_tPaulo Zanoni
While it is nice to have shorter names for the most-accessed variables, it makes the code more difficult to read since it's not clear to the code reader whether that "gem_handle" is from some FB or something else. The reader also has to audit the code to see if, for example, the value of data->handle[0] stays consistent with data->fb[0].gem_handle all the tame or if at some point the value is replaced with something else. So remove the redundant information, making it explicit that we're using the gem handles and FB IDs of the framebuffers all the time. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-05tests/kms_fbc_crc: use igt_pipe_crc_collect_crc()Paulo Zanoni
Instead of its hardcoded implementation. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-05-05tests/kms_fbc_crc: add wait_for_fbc_enabled()Paulo Zanoni
The code has a common pattern of "wait 300ms, then check if FBC is enabled". Most of the time FBC is enabled in either 50ms or 0ms, so introduce wait_for_fbc_enabled(), which can return much earlier if FBC is actually enabled before the 300ms timeout. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-04-09Correct kms_fbc_crc caseliu,lei
Debugfs i915_fbc_status shows "FBC unsupported on this chipset" not "unsupported by this chipset" if the platform doesn't support FBC feature. That typo will cause case fail on some platforms such as byt, bsw. Signed-off-by: Lei Liu <lei.a.liu@intel.com>
2015-04-08tests/kms_fbc_crc: fix fread() return value assertionThomas Wood
Use 1 as the element size to check the number of bytes returned is greater than 0, rather than checking the number of elements returned. This fixes a regression from commit 47f6b13 (igt.cocci: check the return values of various functions). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89833 Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-26igt.cocci: check the return values of various functionsThomas Wood
Add rules to fix unused-result warnings when compiling with _FORTIFY_SOURCE defined and apply them to the library and tests. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-23tests: Remove usage of igt_crc_equal and _non_nullDaniel Vetter
Tests should positively check for crc matches, not for mismatches. Enforce this by only exposing and igt_assert function for comparing crcs. For the few tests which didn't just do this as consistency checks but to do functional tests add FIXME comments that some reference crc values are missing. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-23lib/debugfs: Add igt_assert_crc_equalDaniel Vetter
Because of hash collisions tests should only ever compare crc checksums for equality. Checking for inequality can result in random failures. To ensure this only expose and igt_assert function and use that. Follow-up patches will rework the code for tests which don't follow this requirement and try to compare for CRC inequality. v2: Rebase on top of Matt's kms_plane changes. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-12tiling: Convert framebuffer helpers to use fb modifiersTvrtko Ursulin
This converts the IGT API only, underneath legacy set_tiling is still used. v2: One got away in kms_flip. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-11-24lib/igt_debugfs: Don't setup crc in _newDaniel Vetter
The problem is that this causes writes to registers, and if the pipe is off they might go nowhere (e.g. when runtime pm is enabled). Furthermore we can only really check once the modeset setup is done, but again most tests set up the CRC structure before calling igt_commit and friends. We could add crc restore support to the kernel's rpm code, but that will end up being rather invasive and fragile hard-to-test code. Now originally this was needed back when CRC support wasn't available everywhere. But that's fixed now. So given all this just drop that sanity check and make sure that we only touch the debugfs file (and so the hw state) when we know the pipe is running in the desired configuration. A complementary kernel patch will try to catch offenders by returning -EIO if the pipe is off. v2: Forgot to git add one hunk. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86092 Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-11-06docs: add some test descriptionsThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-04ioctl_wrappers: Pass in offset to CPU mmapsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30test/kms, pm: use drm_open_any_masterImre Deak
These tests require DRM master right, so make sure they have it from the beginning. This gives an early indication if another DRM master is running and makes the given test skip (with a proper explanation of the reason) instead of exiting with error. Signed-off-by: Imre Deak <imre.deak@intel.com>
2014-08-30batch: Specify number of relocations to accommodateChris Wilson
Since relocations are variable size, depending upon generation, it is easier to handle the resizing of the batch request inside the BEGIN_BATCH macro. This still leaves us with having to resize commands in a few places - which still need adaption for gen8+. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-29Prepare for 64bit relocation addressesChris Wilson
This reveal that quite a few locations were writing relocation offsets but only allowing for 32 bit addresses. To reveal such places in active tests, we also now double check that we do not use more batch space than declared. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-21kms_fbc_crc: Use I915_TILING_X to create fbsDamien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-08-12lib/igt_kms: set_vt_graphics_mode is a low-level helperDaniel Vetter
So give it a kmstest_ prefix and shuffle it around a bit. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-08-12lib/igt_kms: Unify pipe name helpersDaniel Vetter
And add api doc while at it. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-11lib/igt.cocci: Add stanza for for_each_pipeDaniel Vetter
Damien dodged this ... Also run the script while at it. v2: Don't just capture identifiers for pipe, but also expressions. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-06-10tests/kms_fbc_crc: Update blit code for BDWVille Syrjälä
Switch to XY_COLOR_BLT from COLOR_BLT and use the appropriate macros to make the code work on BDW. Also make the blit 8bpp instead if 16bpp. 8bpp is what it was supposed to use all along. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76307 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-05-14tests: sprinkle igt loggingDaniel Vetter
All the cases that simply dump some debug information and couldn't be converted to some of the fancier macros. Some information output removed when it's redundant with the subtest status. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-13tests/kms_fbc_crc: Use igt_create_color_fb()Ville Syrjälä
No need to hand roll the alloc fb+paint code anymore, just use the common helper. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-05-13tests/kms_fbc_crc: Reset display state between subtestsVille Syrjälä
If a subtest fails it'll leave the display in a state that may prevent the next subtest from working. So reset the display state between subtests. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-05-13tests/kms_fbc_crc: Switch to using the igt_display stuffVille Syrjälä
Let's try to use the common igt_display framework to make the code a bit nicer. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-05-13tests/kms_fbc_crc: Simplify pipe_crc messVille Syrjälä
There's no need to keep an array of pipe_crc objects around. Just keep one for the duration of the specific crtc/connector/test combo. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-05-09tests/kms_fbc_crc: Check context support earlierVille Syrjälä
Check for context support before doing anything else in the subtest. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-05-09tests/kms_fbc_crc: Allow the subtests to pass even if some planes aren't FBC ↵Ville Syrjälä
capable Don't skip the entire subtest if FBC only works on some of the primary planes, as is the case on pre-gen4 and hsw+. Only skip the entire subtest if all crtc/connector combinations skip. Also print some kind of status for all otherwise valid crtc/connector combos if they skip due to FBC being disabled or CRC support not being there. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-03-26lib/igt_fb: switch to igt_ prefix from kmstest_Daniel Vetter
Shorter and more in line with our general igt_ prefix for everything which isn't somehow intel or i915-gem or otherwise hw specific - these helpers here are all fully generic framebuffer handling functions based on kms + cairo. Well, the actual buffer alloc is done with i915 gem, but meh ;-) Two special cases: - bpp_depth_to_drm_format and drm_format_to_bpp completely lacked prefixes, so just add igt_. - write_fb was a bit misleading given that we have gem_write for uploading to buffers. Rename that to write_fb_to_png to make it crystal clear what this thing does even without looking at docs. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26lib/igt_kms: s/kmstest_create_fb2/kmstest_create_fb/Daniel Vetter
Simplify the name since the old _fb function is now gone. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26lib: remove kmstest_create_fbDaniel Vetter
Use the new-style function using drm fourcc codes instead everywhere. To easily use thew fourcc based interface also expose bpp_depth_to_drm_format from the library. Finally include drm_fourcc.h from the igt_kms.h header since pretty much everyone needs this now. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22lib: unnecessary header removal for drmtest.h, part 1Daniel Vetter
Brought a few missing headers to light in ioctl_wrappers.h, too. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22lib/intel_batchbuffer: igt_ prefix for rendercopy/mediafill funcsDaniel Vetter
Now everything is prepared to pour some neat api docs over this all. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>