Commit Graph

70 Commits (8f245b777b21e8c0151f9a254a56a7cb23b66d15)

Author SHA1 Message Date
Maarten Lankhorst ba5a0b6274 nouveau: Do not add most bo's to the global bo list.
Only add wrapped bo's and bo's that have been exported through flink or dma-buf.
This avoids a lock in the common case, and decreases traversal needed for importing
a dma-buf or flink.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Tested-By: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-13 20:28:16 +01:00
Maarten Lankhorst 5ea6f1c326 nouveau: make nouveau importing global buffers completely thread-safe, with tests
While I've closed off most races in a previous patch, a small race still existed
where importing then unreffing cound cause an invalid bo. Add a test for this case.

Racing sequence fixed:

- thread 1 releases bo, refcount drops to zero, blocks on acquiring nvdev->lock.
- thread 2 increases refcount to 1.
- thread 2 decreases refcount to zero, blocks on acquiring nvdev->lock.

At this point the 2 threads will clean up the same bo.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Reviewed-By: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-13 20:26:33 +01:00
Chih-Wei Huang 5c1c09e0d2 android: remove duplicate libdrm in LOCAL_SHARED_LIBRARIES
v2: Fold libpciaccess and libdrm into a single local_shared_libraries

Acked-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-02-23 09:27:49 +00:00
Jerome Glisse 7cb1d6e2d6 nouveau: fix unlock nouveau_bo_name_ref()
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
2015-02-16 15:01:30 -05:00
Thomas Klausner 28ee135a37 nouveau: Remove unused static function.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
2015-01-26 10:08:43 +01:00
Rob Clark c09dcbc736 fix compile error on 32bit systems
4c2766b (drm_mmap/drm_unmap) brought this error for every .c file that
was not #including config.h:

  In file included from private.h:4:0,
                   from abi16.c:29:
  ../libdrm.h: In function 'drm_munmap':
  ../libdrm.h:81:4: error: size of unnamed array is negative

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-09-28 14:30:07 -04:00
Emil Velikov c98c54f843 nouveau: use drm_mmap/drm_munmap wrappers
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2014-09-28 17:09:34 +01:00
Emil Velikov 268dce4192 automake: pick up all files for distribution.
Autotools is already smart enough to pick the *.pc.in files but it
needs some help with the Android.mk ones.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2014-09-28 17:09:34 +01:00
Emil Velikov 41bfc07fe5 nouveau: add Android build support
v2 Rename the headers variable(s) to *_H_FILES.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-09-01 16:06:02 +01:00
Emil Velikov 4255d3d51d libdrm, freedreno, intel, nouveau, radeon: add Makefile.sources
Will be used to consolidate the required sources lists as well as the
install-able headers. This is turn will help us to avoid the
duplication with the upcoming Android build support.

v2: Rename the headers variable to *_H_FILES.
v3: Rebase on top of symbol visibility patches.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-09-01 16:06:01 +01:00
Maarten Lankhorst 56c4857f17 nouveau: Only export public functions.
This hides all the abi16_* functions and the nouveau_debug variable,
they should have been private to begin with.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-08-04 09:22:00 +02:00
Maarten Lankhorst 7974b539d2 amend previous commit to actually compile
Ugh!
2014-04-16 16:52:48 +02:00
Maarten Lankhorst b1d4def059 nouveau: safen up nouveau_device list usage against concurrent access
I cannot make nouveau_bo_wrap thread-safe (by design), but it seems to be used to convert
drm fb's to nouveau_bo's and to get a notify handle from fifo->notify in nv30_screen.c

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
2014-04-15 10:29:49 +02:00
Maarten Lankhorst 482abbfafb nouveau: prevent undefined behavior in nouveau_pushbuf_reloc with gcc-4.8
Reported-by: ronald645@gmail.com
Bisected-by (gcc): Andreas Radke <a.radke@arcor.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71116
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2013-11-07 13:37:49 +01:00
Marcin Slusarz f92d7969bf nouveau: add a way to override single pushbuffer memory limits
Currently single pushbuffer can take up to 80% of VRAM and 80% of GART.
As this value seems to be arbitrary (and user may need to set it differently)
this patch adds support for 2 environment variables:
NOUVEAU_LIBDRM_VRAM_LIMIT_PERCENT (default 80)
NOUVEAU_LIBDRM_GART_LIMIT_PERCENT (default 80)
which will let users override pushbuffer VRAM/GART limits.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
2013-03-26 21:08:03 +01:00
Marcin Slusarz 284421a569 nouveau: return error from pushbuf_validate
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
2013-03-26 21:08:03 +01:00
Maarten Lankhorst 481763c2c7 nouveau: use @PACKAGE_VERSION@ in libdrm_nouveau.pc
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2013-01-16 14:29:35 +01:00
Ben Skeggs c41b494c47 nouveau: expose channel engine selection on kepler chipsets
v2: Take Maarten Lankhorst's suggestion of nesting the struct to prevent
    sizeof() issues due to padding on older revisions.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2013-01-16 19:48:49 +10:00
Marcin Slusarz 9e6f96a579 libdrm_nouveau.pc: don't include I${includedir}/nouveau
Nouveau headers are installed in I${includedir}/libdrm.
2013-01-14 18:56:38 +01:00
Ben Skeggs 891517f511 nouveau: disallow pushbuf BOs in multiple memory types
Under certain circumstances it's possible for libdrm to decide to move
a GART|VRAM pushbuf to be VRAM-only.  This causes the kernel to reject
the command submission on GF8 and up, due to a stricter policy where
buffers are only allowed to move to memory types that were specified
at creation time.

The simplest fix for this is to force the creation-time memory type for
the lifetime of the push buffer.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-01-07 13:15:28 +10:00
Dave Airlie 13c06cde4e libdrm/nouveau: add prime handle->bo and bo->handle support.
This adds prime support to nouveau libdrm.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-19 13:05:57 +10:00
Marcin Slusarz 9e0026d35c nouveau: silence some remaining valgrind warnings
Valgrind can't understand some of the fields passed to ioctls are overwritten
by kernel, so we need to initialize them. Almost all of our ioctl wrappers
already do it and the cost of remaining 3 is very small.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
2012-06-09 23:23:32 +02:00
Marcin Slusarz 5288729823 nouveau: fix channel closing
Restore code lost in libdrm_nouveau rewrite.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2012-05-02 21:21:09 +10:00
Christoph Bumiller 754655c795 nouveau: expose notifier handle on nvc0 as well
Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2012-04-24 12:49:58 +10:00
Marcin Slusarz d954648b48 nouveau: remove unnecessary EAGAIN loops
drmCommandWrite / drmCommandWriteRead already loop on EAGAIN.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2012-04-24 12:41:39 +10:00
Ben Skeggs 73b9a2881c nouveau: init nvc0 channel alloc req structure fully
Kernel rejects ~0 handles, even though they're not used on NVC0.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2012-04-17 08:35:43 +10:00
Ben Skeggs 292da616fe nouveau: pull in major libdrm rewrite
Redesigned primarily to allow us to better take advantage of BO's having
fixed GPU virtual addresses on GeForce 8 and up, and to reduce the overhead
of handling relocations on earlier chipsets.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
2012-04-14 02:47:23 +10:00
Maarten Lankhorst 37ccce5e39 nouveau: Mark nouveau subchannel unbound nouveau_grobj_free
Valgrind throws warns about a user-after-free if you try to bind a
new subchannel after the old one in that slot was freed,
so remove it from the channel list.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
2011-11-27 12:28:20 -05:00
Dave Airlie cc088f1721 nouveau: free in error path if drmAvailable fails.
This was reported in coverity.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-19 17:39:54 +01:00
Marcin Slusarz 7d83816141 nouveau: assert argument cannot have side effects
... because argument is evaluated only if NDEBUG is not defined
2011-09-18 15:26:16 +02:00
Ben Skeggs bad5242a59 nouveau: fix up reloc_emit() to accept NULL target buffer
The nvc0 gallium drivers passes NULL here to indicate to the memory manager
that a buffer is being used, but without creating an actual reloc.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-21 12:46:51 +10:00
Ben Skeggs 45cfb9cf08 nouveau: split pushbuf macros specific to nv04-nv50 out, and add nvc0
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-21 12:46:51 +10:00
Ben Skeggs ba731e7b58 nouveau: nvc0 drm has no concept of "notifier block"
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-21 12:46:50 +10:00
Francisco Jerez d17681d538 nouveau: Add implicit pushbuf flush before gpuobj destruction.
It makes sure that GPU object destruction is executed in order with
respect to the previous FIFO commands.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
2010-11-22 03:49:41 +01:00
Francisco Jerez d0a4f2e292 nouveau: Avoid unnecessary call to CPU_FINI.
nouveau_bo_unmap called the CPU_FINI IOCTL even if it was a NOSYNC
mapping. It caused no harmful effects (actually CPU_FINI is a no-op on
recent enough kernels) besides the precious CPU cycles being wasted.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-10-31 02:09:59 +01:00
Francisco Jerez 09b1062628 nouveau: Let the user choose the push buffer size.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
2010-10-12 04:10:09 +02:00
Francisco Jerez 1b9187c43a nouveau: Define buffer object usage flags.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
2010-10-12 04:10:04 +02:00
Ben Skeggs 81fa7a9f56 nouveau: fix drm version check some more
... and make a mental note to not push commits before having coffee

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-21 13:02:07 +10:00
Ben Skeggs d1cec6d2a9 nouveau: fix thinko in drm version check
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-20 08:07:28 +10:00
Ben Skeggs b61e81a191 nouveau: accept both 0.0.16 and 1.x.x
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-18 12:06:48 +10:00
Ben Skeggs 204c76c4d6 nouveau: stop shipping nouveau_class.h
The motivation behind this is that by shipping it here, it's essentially
an API which causes issues while bisecting across changes to the header
files.
2010-04-09 20:38:34 +10:00
Ben Skeggs c1c8bbf80b nouveau: fix annoying compiler warning 2010-03-19 10:20:15 +10:00
Ben Skeggs df32c307e8 nouveau: fix segfault in nouveau_bo_new_tile() failure path 2010-03-19 10:19:12 +10:00
Ben Skeggs a247fca8ba nouveau: remove unused field from nouveau_bo 2010-03-19 10:19:11 +10:00
Francisco Jerez 5671282115 nouveau: Regenerate nouveau_class.h.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-03-18 15:04:20 +01:00
Julien Cristau 976e779f9c Install headers to $(includedir)/libdrm
Avoids conflicts with kernel headers.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-03-17 12:45:46 -07:00
Julien Cristau e73af7f560 libdrm_nouveau requires libdrm
nouveau_drmif.h includes xf86drm.h.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-03-17 12:45:31 -07:00
Francisco Jerez df7157fe2e nouveau: Fix up the stride of NV20TCL_LIGHT_BACK_*.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-03-13 18:57:12 +01:00
Francisco Jerez 04fd3872ee nouveau: Small lighting related addition to nouveau_class.h.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-03-07 19:58:33 +01:00
Francisco Jerez 581cafbc24 nouveau: Update nouveau_class.h.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-03-06 21:08:06 +01:00