Commit Graph

5739 Commits (3045523de214fb7df92ee3c8482e883637504bbe)

Author SHA1 Message Date
Emil Velikov cf7e32bdf9 intel: resolve shadowing warnings
v2: keep the bo_gem declaration in exec2() within the loop (Chris)

Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by Chris Wilson <chris@chris-wilson.co.uk>
2015-09-04 21:38:51 +01:00
Emil Velikov 99722bfec6 modetest: fix shadowing warnings
No real issue here, but let's fix these so that real issues don't get
lost in the spam.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-09-04 21:36:42 +01:00
Emil Velikov 687cc66d46 vbltest: fix variable shadowing warning
Just remove the second (shadowing) declaration of ret.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-09-04 21:36:42 +01:00
Rob Clark 51b5ca9457 freedreno: add API to get drm fd from fd_device
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-09-04 11:08:04 -04:00
Rob Clark eb7c2d5e63 drm: make individual drm_server_info fxns optional
For android / drm_gralloc, we want to hook up our own debug_print()
without bothering with the reset of it.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2015-09-04 08:40:57 -04:00
Rob Clark 7d98a93cec freedreno: don't take ownership of the dmabuf fd on import
EGL_EXT_image_dma_buf_import specifies that the importer retains
ownership of the fd, rather then the importee.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-09-03 14:56:02 -04:00
Jonathan Gray 949c325c50 amdgpu: use EINVAL instead of EBADMSG in amdgpu_bo_cpu_unmap()
EBADMSG is a streams errno.  OpenBSD does not implement streams and does
include the streams errnos, this commit fixes the build on OpenBSD.

None of the callers of this function check the return value for -EBADMSG.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2015-09-02 10:00:25 -04:00
monk.liu f17017b8e2 amdgpu: fix missing deinit on vamgr_32
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: monk.liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-02 09:52:12 -04:00
Varad Gautam c3301d0134 freedreno: serialize drmPrimeFDToHandle under table_lock
fixes the prime sharing race condition described by
"intel: Serialize drmPrimeFDToHandle with struct_mutex".

we inline fd_bo_from_handle() into fd_bo_from_dmabuf() and allow locking.

Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-31 11:54:23 -04:00
Varad Gautam cc7db673fa freedreno: use drmPrime wrappers to import/export prime bo's
don't call drmIoctl() directly for prime bo's, use the wrappers instead.

v3: remove struct drm_prime_handle and split locking

Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-31 11:53:53 -04:00
Thierry Reding 508a5f77fa omap: Initialize DMA BUF file descriptor to -1
Commit c86dabfc9f ("omap: zero is a valid fd number, treat it as
such") corrected checks for valid file descriptors, but the OMAP buffer
object code initializes the DMA-BUF file descriptor to 0 (as a result of
calloc()'ing the structure). Obviously this isn't going to work because
subsequent code will try to use file descriptor 0 (most likely stdin at
that point) as a DMA-BUF. It may also try and close stdin when a buffer
object is destroyed.

Fix this by initializing the DMA-BUF file descriptor to -1, properly
marking it as an invalid file descriptor.

Fixes: c86dabfc9f ("omap: zero is a valid fd number, treat it as such")
Reported-by: Robert Nelson <robertcnelson@gmail.com>
Tested-by: Robert Nelson <robertcnelson@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-08-26 15:15:54 +02:00
Christian König a5ea0c64c5 amdgpu: serialize drmPrimeFDToHandle
Fixes the same problem as "intel: Serialize drmPrimeFDToHandle with struct_mutex".

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
2015-08-25 10:27:45 -04:00
Christian König f6f25d67a9 amdgpu: remove sequence mutex
It's not used any more.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
2015-08-25 10:26:58 -04:00
Emil Velikov 1e66ee21ab Move -lm link flag to LIBADD
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-08-24 18:24:24 +01:00
Jérôme Glisse 51d72a619e drm: Add -lm to libdrm ldflags to fix build failure.
Last commit (b556ea127e) introduced
use of log2 which require -lm flag for the linker on quite few
distribution. Just add that flag to fix build.

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
2015-08-24 13:16:56 -04:00
Emil Velikov b556ea127e drm: add interface to get drm devices on the system v3
For mutiple GPU support, the devices on the system should be enumerated
to get necessary information about each device, and the drmGetDevices
interface is added for this. Currently only PCI devices are supported for
the enumeration.

Typical usage:
int count;
drmDevicePtr *foo;
count = drmGetDevices(NULL, 0);
foo = calloc(count, sizeof(drmDevicePtr));
count = drmGetDevices(foo, count);
/* find proper device, open correct device node, etc */
drmFreeDevices(foo, count);
free(foo);

v2: [Jammy Zhou]
 - return a list of devices, rather than nodes
v3: [Jammy Zhou]
 - fix the signed extension for PCI device info

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-24 17:36:28 +01:00
Mathias Tillman 5c42b5e36a drm: fix the usage after free
For readdir_r(), the next directory entry is returned in caller-allocted
buffer (pointered by pent here).

https://bugs.freedesktop.org/show_bug.cgi?id=91704

Signed-off-by: Mathias Tillman <master.homer@gmail.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-24 11:11:20 +02:00
Varad Gautam 1eba47a763 freedreno: get bo size for imported dma-buf
Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-23 12:33:45 -04:00
Varad Gautam 425c8e5af7 freedreno: fill bo->fd when importing
Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-23 12:33:24 -04:00
Varad Gautam 857c22e5ec freedreno: fix a bo cache segfault with imported bo's
Importing a bo whose handle is still in the bo cache crashes during cleanup.
Remove bo from cache when importing.

Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-23 12:33:09 -04:00
Rafał Sapała cf40cf05a4 intel: Serialize drmPrimeFDToHandle with struct_mutex
It is possible to hit a race condition in create_from_prime, when trying
to import a BO that's currently being freed. In case of prime sharing
we'll succesfully get a handle, but fail on get_tiling call, potentially
confusing the caller (and requiring different locking scheme than with
sharing using flink). Wrap fd_to_handle with struct_mutex to force
a more consistent behaviour between prime/flink, convert fprintf to DBG
when handling errors.

(From Chris:
  The race is that the kernel returns us the same file-private handle as
  the first thread, but that first thread is about to call gem_close
  (thereby removing the handle from the file completely) and does so
  between us acquiring the handle and taking the mutex. If we take
  the mutex, then we acquire the refcnt on the bo prior to the first
  thread completing its unref (and so preventing the early close). Or we
  acquire the handle after the earlier close, in which case we are the new
  owner.
)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Testcase: igt/drm_import_export/import-close-race-prime
Signed-off-by: Rafał Sapała <rafal.a.sapala@intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
2015-08-21 14:43:23 +01:00
Hyungwon Hwang 6e84ada4cc modetest: remove the trailing white spaces
This patch removes the trailing white spaces.

Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
2015-08-20 17:11:15 +01:00
Hyungwon Hwang 4bac035c34 xf86drmMode: remove the trailing white spaces
This patch removes the trailing white spaces.

Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
2015-08-20 17:11:15 +01:00
Mauro Rossi b201abe76b amdgpu: add Android build support
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-08-20 16:58:32 +01:00
Mauro Rossi ae7f7b27a1 amdgpu: add Makefile.sources
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
[Emil Velikov: remove duplicate amdgpu.h from LIBDRM_AMDGPU_FILES]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-08-20 16:56:51 +01:00
Rob Clark ab2fadabde Bump version for release
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-18 11:56:50 -04:00
Rob Clark 04a118d800 freedreno: update freedreno-symbol-check
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-18 10:53:56 -04:00
Thierry Reding 5e5a3c48b8 libdrm: Make indentation consistent
Use tabs and spaces consistently to align function arguments on
subsequent lines with those of the first line.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-08-18 10:48:51 +02:00
Thierry Reding d2d361cddd libdrm: Remove gratuitous blank lines
Usage of blank lines can be a matter of taste, of course, but for these
we can surely all agree that they're not needed and inconsistent.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-08-18 10:48:11 +02:00
Jammy Zhou 56d8dd6a9c amdgpu: make vamgr per device v2
Each device can have its own vamgr, so make it per device now.
This can fix the failure with multiple GPUs used in one single
process.

v2: rebase

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-17 16:29:26 -04:00
Jammy Zhou ffa305d0fc amdgpu: add flag to support 32bit VA address v4
The AMDGPU_VA_RANGE_32_BIT flag is added to request VA range in the
32bit address space for amdgpu_va_range_alloc.

The 32bit address space is reserved at initialization time, and managed
with a separate VAMGR as part of the global VAMGR. And if no enough VA
space available in range above 4GB, this reserved range can be used as
fallback.

v2: add comment for AMDGPU_VA_RANGE_32_BIT, and add vamgr to va_range
v3: rebase to Emil's drm_private series
v4: fix one warning

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-17 16:26:26 -04:00
Jammy Zhou 102ab6f004 amdgpu: improve amdgpu_vamgr_init
Make it a generic function independent of the device info.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-17 16:21:38 -04:00
Rob Clark 15ba8768f7 freedreno: add fd_pipe_wait_timeout()
We need to pass through a timeout parameter to implement
pipe->fence_finish() properly.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-17 14:23:03 -04:00
Rob Clark 4413f191a0 freedreno/msm: dump out submit info on error
User should only see these with LIBGL_DEBUG=verbose.  But in case you
are hitting issues like "handle X at index Y already on submit list"
errors from the kernel, this gives some useful visibility for debug.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-17 10:35:08 -04:00
Rob Clark 9e34ee4f75 freedreno/msm: fix issue where same bo is on multiple rings
It should be a less common case, but it is possible for a single bo to
be on multiple rings, for example when sharing a buffer across multiple
pipe_context's created from same pipe_screen.

So rather than completely fall over in this case, fallback to slow-path
of looping over all bo's in the ring's bo-table (but retain the fast-
path of constant-lookup for the first ring the buffer is on).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-17 10:35:08 -04:00
Rob Clark 2fa58ef8f4 freedreno/msm: reorg ringbuffer struct
Group the parts related to building out submit ioctl into their own
sub-struct.  Split out from next commit since it is just boring churn.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-17 10:10:34 -04:00
Michel Dänzer 2a34176123 tests/amdgpu: Remove unused local variable 'i'
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-17 18:54:33 +09:00
Michel Dänzer 25784d3af2 tests/amdgpu: Include config.h first
Fixes build failure on 32-bit because _FILE_OFFSET_BITS wasn't defined to
64.

Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-17 18:41:11 +09:00
Thierry Reding f05a74fb9c tests: modetest: Accept connector names in addition to connector IDs
Allow connector names to be used in the specification of the -s option.
This requires storing the string passed on the command-line so that it
can later be resolved to a connector ID (after the DRM device has been
opened).

Connector names are constructed from the connector type name and
connector type ID using the same format as used internally in the
Linux kernel.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-08-15 03:06:57 +03:00
Marek Olšák f045da45fe Bump version for release 2015-08-14 14:19:29 +02:00
Emil Velikov 15350568cc amdgpu: add symbols check test
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:39 +01:00
Emil Velikov bddf4df4a1 amdgpu: hide the final internal functions from global namespace
Thus the only symbols that we export are the ones officially provided by
the API.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:36 +01:00
Emil Velikov b471818977 amdgpu/amdgpu_vamgr: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:33 +01:00
Emil Velikov c19fa2b1ca amdgpu: squash trivial documentation typo
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:30 +01:00
Emil Velikov a30da8e9b3 amdgpu: cosmetic chances in license boilerplate
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:27 +01:00
Emil Velikov f4c2bfd63e amdgpu: add a bunch of missing config.h includes
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:24 +01:00
Emil Velikov f4d14f147c amdgpu/util_hash_table: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:22 +01:00
Emil Velikov 5f0f6387a6 amdgpu/util_hash: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:19 +01:00
Emil Velikov bf4826430a Force enable amdgpu for the dist build/check.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:42:04 +01:00
Alex Deucher e57be77810 radeon: add new OLAND pci id
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-10 16:26:42 -04:00