diff options
author | Lyude Paul <lyude@redhat.com> | 2021-03-24 18:36:06 -0400 |
---|---|---|
committer | Lyude Paul <lyude@redhat.com> | 2021-03-26 12:29:51 -0400 |
commit | 3887134e739f480cefe1dc7f13eb54f7bf3ca27f (patch) | |
tree | 8934b963f474cec6a50f741cf4c2563d00f38ff0 /lib/drmtest.c | |
parent | e76039273b1524147c43dba061756f06003d56ae (diff) |
lib: Introduce the igt_nouveau library
This introduces the igt_nouveau library, which enables support for tiling
formats on nouveau, along with accelerated clears for allocated bos in VRAM
using the dma-copy engine present on Nvidia hardware since Tesla. Typically
the latter would be handled by the kernel automatically, which is the
long-term plan for nouveau, but since the kernel doesn't yet support that
we implement this in igt in order to fulfill the expectation that most of
igt has in which newly allocated fbs are expected to be zero-filled by
default.
The dma-copy engine is capable of fast blitting, and is also able to
perform tiling/untiling at the same time. This is worth mentioning because
unlike many of the other drivers supported in igt, we go out of our way to
avoid using mmap() in order to perform CPU rendering wherever possible.
Instead of mmap()ing an fb that we want to draw to on the CPU (whether it
be for converting formats, or just normal rendering), we instead use
dma-copy to blit linear/tiled fbs over to linear system memory which we
mmap() instead. This is primarily because while mmap() is typically
painfully slow for vram, it's even slower on nouveau due to the current
lack of dynamic reclocking in our driver. Furthermore, using the dma-copy
engine for copying things over to system ram is also dramatically faster
than using igt's memcpy wc helpers even when no tiling is involved. Such
speed improvements are both quite nice, but also very necessary for certain
tests like kms_plane that are rather sensitive when it comes to slow
rendering with drivers.
This doesn't mean we won't want to provide a way of using mmap() for
rendering in the future however, as at least basic testing of mmap() is
certainly something we eventually want for nouveau. However, I think the
best way for us to do this in the future will be to adapt the igt_draw API
to work with nouveau so we can explicitly request using mmap() in tests
which need it.
Finally, this code also adds a hard dependency on libdrm support for
nouveau tests. The main reason for this is currently there are no real
applications that use nouveau's ioctls directly (mesa for instance, uses
libdrm as well) and also that nouveau's ioctls are currently a bit
complicated to use by hand. This will likely be temporary however, as Ben
Skeggs is planning on revamping a lot of nouveau's APIs to simplify them
and make libdrm support for nouveau obsolete in the future. Note that we
take care to make sure that users can still disable libdrm support for
nouveau if needed, with the only caveat being that any tests using
igt_nouveau will be disabled, along with any tiling support for
nvidia-specific tiling formats.
This should enable igt tests which test tiling formats to run on nouveau,
and fix some seemingly random test failures as a result of not having
zero-filled buffers in a few other tests like kms_cursor_crc.
Changes since v1:
* Remove leftover rebase detritus in drm_fourcc.h
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Jeremy Cline <jcline@redhat.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r-- | lib/drmtest.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 8527b56e..a8ba6e11 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -116,7 +116,12 @@ bool is_i915_device(int fd) bool is_nouveau_device(int fd) { + /* Currently all nouveau-specific codepaths require libdrm */ +#ifdef HAVE_LIBDRM_NOUVEAU return __is_device(fd, "nouveau"); +#else + return false; +#endif } bool is_vc4_device(int fd) |