Commit Graph

6172 Commits (a4b487cd80f7394f3c285d5883a24a07e156f867)

Author SHA1 Message Date
Chris Wilson e0f05b2fad intel: Move is_softpin to obj->kflags
Use obj->kflags to set EXEC_OBJECT_PINNED when the object is softpinned,
and so remember to clear the softpin status when the object is freed
(and reused).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-02-11 11:02:06 +00:00
Alex Xie fe7cb34eda amdgpu: vamgr can be a struct instead of a pointer
vamgr is an integral part of amdgpu_device. We don't need to calloc and free it.
This can save CPU time, reduce heap fragmentation.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
[Grazvydas Ignotas: rebase, correct a typo in commit message]
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-02-02 15:22:53 -05:00
Alex Xie 067e9a1d47 amdgpu: vamgr_32 can be a struct instead of a pointer
vamgr_32 is an integral part of amdgpu_device. We don't need to calloc and free it.
This can save CPU time, reduce heap fragmentation.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
[Grazvydas Ignotas: rebase, correct a typo in commit message]
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-02-02 15:22:45 -05:00
Alex Xie 7a03cdf6a7 amdgpu: Free/uninit vamgr_32 in theoretically correct order
vamgr_32 is a region inside general VAM range. It is better to free and
deinitialize it before general VAM range.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-02-02 15:22:07 -05:00
Emil Velikov 07edf5d905 Remove unused tests/drmstat.c
Earlier commit removed all the legacy 'tests' but a file was left
danglig.

Fixes: 0c80fddd1d "tests: remove useless legacy tests"
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reported-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-02-01 22:09:42 +00:00
Chad Versace d4b8344363 Bump version for 2.4.75 release
For Intel explicit fencing.

Signed-off-by: Chad Versace <chadversary@chromium.org>
2017-01-28 11:14:18 +10:00
Dave Airlie 0ad0c12fd3 intel: fix make distcheck
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-01-28 11:13:59 +10:00
Dave Airlie ab5a963556 Revert "Bump version for 2.4.75 release"
This reverts commit 736970c49b.
2017-01-28 11:13:40 +10:00
Chad Versace 736970c49b Bump version for 2.4.75 release
For Intel explicit fencing.

Signed-off-by: Chad Versace <chadversary@chromium.org>
2017-01-27 13:07:03 -08:00
Chris Wilson dfd536c60d intel: Export a function to re-enable implicit synchronisation
Implicit synchronisation is the default behaviour of the kernel when
rendering with an execobject. It may be disabled with
drm_intel_gem_bo_disable_implicit_sync(), and then to restore it use
drm_intel_gem_bo_enable_implicit_sync().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-01-27 20:25:04 +00:00
Chris Wilson 22cfd04311 intel: Clear execobject flags before preserving object in reuse cache
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-01-27 20:20:30 +00:00
Chris Wilson c4b00767a7 intel: Support passing of explicit fencing from execbuf
Allow the caller to pass in an fd to an array of fences to control
serialisation of the execbuf in the kernel and on the GPU, and in return
allow creation of a fence fd for signaling the completion (and flushing)
of the batch. When the returned fence is signaled, all writes to the
buffers inside the batch will be complete and coherent from the cpu, or
other consumers. The return fence is a sync_file object and can be
passed to other users (such as atomic modesetting, or other drivers).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-01-27 20:00:38 +00:00
Chris Wilson 1bd35da961 intel: Allow the client to control implicit synchronisation
The kernel allows implicit synchronisation to be disabled on individual
buffers. Use at your own risk.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-01-27 20:00:38 +00:00
Chris Wilson a3d715ee14 Import uapi/i915_drm.h from v4.10-rc5-950-g152d5750dda9
To sync with "drm/i915: Support explicit fencing for execbuf"
2017-01-27 20:00:38 +00:00
Alex Xie 8a89d5f620 amdgpu: A new option to run tests on render node
Tested:
1. As root, tests passed on primary.
2. As root, tests passed on render node.
   BO export/import test was skipped
3. As non-privileged user, tests failed on primary as expected.
4. As non-privileged user, tests passed on render node.
   BO export/import test was skipped

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-01-27 11:56:23 -05:00
Alex Xie 12dd7a2e9c amdgpu: A new option to choose which device to run most tests
This can be used to test multiple GPUs

v2: Use PCI bus ID and optional PCI device ID to choose device
    Add an option to display information of AMDGPU devices

Tested:
   ./amdgpu_test -p
   ./amdgpu_test
   ./amdgpu_test -b 1 #fail as expected
   ./amdgpu_test -b 6 #pass
   ./amdgpu_test -b -d 1 #fail as expected
   ./amdgpu_test -b -d 0 #pass

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-01-27 11:55:28 -05:00
Alex Xie 5e0f7c5c65 amdgpu: verify the tested device
Verify the vender ID and driver name.
Open all AMDGPU devices.
Provide an option to open render node.

Tested as root: PASS
Tested as non-privileged user:
All tests failed as expected

v2: Return value in the ene of function amdgpu_open_devices.
    Check the return value of amdgpu_open_devices.
    amdgpu_test is not for USB device for the time being.
    Get the name of node from function drmGetDevices2.
    Drop the legacy drmAvailable() from the test.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-01-27 11:53:26 -05:00
Tomasz Figa 8ef7e5b702 tests: Use -pthread in CFLAGS instead of -lpthread
-lpthread is not always a valid flag to pull pthread support, especially
on Android it will fail to link due to a missing libpthread.so. The more
generic way to build-in pthread support is to use the -pthread CFLAG, so
let's use it instead.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
[Emil Velikov: rebase on top of previous commit]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-01-27 16:18:02 +00:00
Emil Velikov 58459a57fa tests/nouveau: automake: fold C and CPP flags
Since we don't have any C++ souces this should be a no-op. Folding the
two seems to be the common practise throughout the repo.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-01-27 16:15:45 +00:00
Emil Velikov 9c924e8235 android: silence ~550 warnings
Analogous to the autoconf build add the following to the build

   -Wno-unused-parameter
   -Wno-missing-field-initializers

Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2017-01-27 15:48:16 +00:00
Emil Velikov ff38457e0f android: add note about command line defines and config.h
Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2017-01-27 15:48:16 +00:00
Emil Velikov fc05e89b6f android: add HAVE_VISIBILITY to Android.common.mk
Currently only libdrm.so properly annotates its internal/private
symbols. By setting the macro every binary produced will be in the same
boat. This should give is smaller and more secure files

Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2017-01-27 15:48:16 +00:00
Emil Velikov 03d2e91d00 android: introduce Android.common.mk to reduce boilerplate
... across the makefiles. Currently this isn't much but that will change
shortly.

As an added bonus this fixes all present and future cases where we've
forgotten to strip out the headers from LOCAL_SRC_FILES.

In a couple of cases (the tests) we start setting
LOCAL_EXPORT_C_INCLUDE_DIRS, which shouldn't be an issue.

Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2017-01-27 15:48:16 +00:00
Emil Velikov de5b41ef5a android: remove LOCAL_MODULE_TAGS := optional tag
Seems to be the default option since ~2009 with commit 2f31293ba78 "auto
import from //branches/cupcake/...@137197". Fleshed out from a larger
commit in the AOSP repo/fork.

Cc: Dan Willemsen <dwillemsen@google.com>
Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2017-01-27 15:47:13 +00:00
Thierry Reding 5403cb39c1 xf86drm: Reuse sysfs_uevent_get()
Recent patches for USB, platform and host1x bus support introduced the
sysfs_uevent_get() function that provides a generic way of parsing the
sysfs uevent file that is associated with each device in Linux.

Open-coded variants of this still exist in other places, so make those
reuse the new function to remove some code duplication.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-20 16:27:33 +01:00
Thierry Reding 13b99f2a89 tests/drmdevice: Add USB, platform and host1x support
Extend the drmdevice test with support for the newly added USB, platform
and host1x busses.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-20 16:27:33 +01:00
Thierry Reding 7b1f37f474 xf86drm: Add platform and host1x bus support
ARM SoCs usually have their DRM/KMS devices on the platform bus, so add
support for that to enable these devices to be used with the drmDevice
infrastructure.

NVIDIA Tegra SoCs have an additional level in the hierarchy and DRM/KMS
devices can also be on the host1x bus. This is mostly equivalent to the
platform bus.

v4:
- continue on error to process platform or host1x device

v3:
- guard Linux-specific sysfs parsing code with #ifdef __linux__

v2:
- be careful not to overflow the full name
- read compatible strings into device info

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-20 16:27:20 +01:00
Thierry Reding f8484ccbd1 xf86drm: Add USB support
Allow DRM/KMS devices hosted on USB to be detected by the drmDevice
infrastructure.

v4:
- continue on error to process USB devices

v3:
- guard Linux-specific sysfs parsing code with #ifdef __linux__

v2:
- make sysfs_uevent_get() more flexible using a format string

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2017-01-20 16:25:53 +01:00
Thierry Reding 2e57bba870 xf86drm: Factor out drmDeviceAlloc()
Subsequent patches will add support for other bus types to drmDevice and
they will duplicate a lot of the code to allocate a drmDevice. Factor
out the common code so it can be reused.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-20 16:25:35 +01:00
Neil Armstrong 9e4c686aa3 tests/util: Add support for meson module
Add support for Amlogic Meson DRM driver merged for Linux 4.10.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-19 10:18:33 +01:00
Thierry Reding ecc2a09729 xf86drm: Fix type-punned pointer build warning
CC       libdrm_la-xf86drmMode.lo
    ../xf86drmMode.c: In function 'drmHandleEvent':
    ../xf86drmMode.c:854:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
       e = (struct drm_event *)(&buffer[i]);
                   ^

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99350
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-18 08:34:53 +01:00
Thierry Reding 4bfbe4c69e xf86drmMode.h: Add DisplayPort MST and DPI encoders/connectors
This brings xf86drmMode.h in sync with include/drm/drm_mode.h.
Eventually we really should only have a single set of definitions rather
than duplicating this in two files.

v2: add DPI encoder and connector types introduced in Linux v4.7

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-18 08:34:49 +01:00
Thierry Reding ab50ffbc70 xf86drmMode.h: Use consistent padding
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-18 08:34:36 +01:00
Fabio Estevam 5856a5868c README: Fix grammar
Fix two grammar issues:

- "standard  autotools  packages ---> "standard  autotools  package"
- "If you are install" ---> "If you are installing"

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-01-16 14:54:45 +00:00
Taro Yamada 4ecd1ef010 xf86drm: fix null termination of string buffer
The string written to the buffer by read() is not null-terminated,
but currently drmParsePciBusInfo() places null character only at the end of the buffer, not at the end of the
string.
As a result, the string passed to sscanf() contains an uninitialized value.

This patch changes to places null character at the end of the string.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99045
Signed-off-by: Taro Yamada <archer_ame@yahoo.co.jp>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-01-16 14:41:36 +00:00
Dongwon Kim 44f220ad62 intel: update global_name before HASH_ADD
bo->global_name should be updated first before a hash value
for the entry is calculated with it by HASH_ADD macro.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-01-15 20:15:37 +00:00
Alex Xie e1ee01a758 amdgpu: Provide more specific error message if non-privileged user runs amdgpu_test
Before this change, the error message is:
"WARNING - Suite initialization failed..."
People might think this is a driver problem.

Tested with non-privileged user. Now the error message is like:
...
Error:Permission denied. Hint:Try to run this test program as root.
WARNING - Suite initialization failed for 'Basic Tests'.
...

Tested as root with no regression.

amdgpu_test uses CUnit. CUnit outputs warning message to stdout.
To be consistent, this commit outputs error message to stdout.

v2: Use strerror instead of %m. %m is a GNU C Library extension.
v3: Limit code and commit message within 80 characters per line.
    Update commit message.
    Remove a space before starting parenthesis in function call.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-01-13 10:35:43 -05:00
Thierry Reding 885624b0b9 Add .editorconfig
This encodes the indentation style for libdrm and can be used with
various editors. See http://editorconfig.org for instructions.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-12 22:40:59 +01:00
Thierry Reding e17cad1994 xf86drm: Fix indentation
libdrm uses spaces for indentation. Fix the two inconsistent lines in
this file.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-12 22:40:41 +01:00
Jonathan Gray eebefaf72c xf86drm: don't fatal on per device error in drmGetDevice[s]2
When iterating over all the device nodes if drmProcessPciDevice()
returned an error for any node the function would return an error,
ignoring any valid nodes.

The result of this on OpenBSD where drmProcessPciDevice() results in
device nodes being opened to issue ioctls to get pci data
was that data obtained from /dev/drm0 would be ignored if /dev/drm1
could not be opened.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2016-12-24 17:06:58 +00:00
Jonathan Gray e2e766d5ac xf86drm: add a non-sysfs version of drmGetDeviceNameFromFd2
Implement a generic drmGetDeviceNameFromFd2() to use on non-linux
systems without sysfs.

v2: remove min < base test as requested by Emil

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2016-12-24 17:06:53 +00:00
Jonathan Gray d5cf3f9831 xf86drm: adjust device node path for minor base
When constructing a path to a device node the minor number retrieved
from fstat needs to have the offset of the node type subtracted from it.
Control and render node types have the same major as the primary node
but each has their own block of minor types at fixed offsets.

v2: remove min < base test as requested by Emil

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2016-12-24 17:06:49 +00:00
Ville Syrjälä e3af5368b2 modetest: Allow the user to specify the plane ID
Devices can have multiple planes, so allow the user to choose between
them.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-12-19 15:14:07 +02:00
Seung-Woo Kim a07cf7f08d libkms/exynos: fix memory leak in error path
This patch fixes memory leak in error path of exynos_bo_create().

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-12-14 17:10:51 +00:00
Emil Velikov 0645648dd0 autogen.sh: set format.subjectPrefix and sendemail.to if needed
Just set the rules automatically rather than asking each contributor to
update thing locally.

v2: Silence errors if run outside of git repo. (Eric)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-12-14 17:10:51 +00:00
Grazvydas Ignotas 3bc14c8cb9 xf86drm: fix sign-compare warning
xf86drm.c:3601:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while (expected < sizeof(match)) {
                     ^

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-12-12 14:01:19 +00:00
Jonathan Gray 0825792723 xf86drm: implement an OpenBSD specific drmGetDevice2
DRI devices on OpenBSD are not in their own directory.  They reside in
/dev with a large number of statically generated /dev nodes.

Avoid stat'ing all of /dev on OpenBSD by implementing this custom path.

v2:
   - use drmGetMinorType to get node type
   - adapt to drmProcessPciDevice changes
   - verify drmParseSubsystemType type is PCI
   - add a comment describing why this was added

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:53:11 +00:00
Jonathan Gray fd190564da xf86drm: implement drmParsePciBusInfo for OpenBSD
Implement drmParsePciBusInfo for OpenBSD by using the new
DRM_IOCTL_GET_PCIINFO ioctl.

v2: use drmGetMinorType to get node type instead of always
    using DRM_NODE_PRIMARY.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:53:05 +00:00
Jonathan Gray c0ef1d0788 xf86drm: implement drmParsePciDeviceInfo for OpenBSD
Implement drmParsePciDeviceInfo for OpenBSD by using the new
DRM_IOCTL_GET_PCIINFO ioctl.

v2: adapt to drmParsePciDeviceInfo changes and use drmOpenMinor

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:53:00 +00:00
Jonathan Gray d05b9f2dde xf86drm: implement drmParseSubsystemType for OpenBSD
Implement drmParseSubsystemType for OpenBSD by always returning
DRM_BUS_PCI.  No non-pci drm drivers are in the kernel and this is
unlikely to change anytime soon as the existing ones aren't permissively
licensed.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:52:53 +00:00