platform/upstream/libdrm.git
6 years agoautomake: set NM before running the tests
Emil Velikov [Thu, 6 Sep 2018 14:46:16 +0000 (15:46 +0100)]
automake: set NM before running the tests

Set/export the NM variable since it may not be set already.

Fixes: 4f08bfe96da ("*-symbol-check: Don't hard-code nm executable")
Cc: Heiko Becker <heirecka@exherbo.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoCI: Capture test logs as GitLab artifacts
Daniel Stone [Thu, 6 Sep 2018 10:01:17 +0000 (11:01 +0100)]
CI: Capture test logs as GitLab artifacts

GitLab CI already captures all the stdout/stderr output from the build
process as the log. However, some other important information is hidden
in other log files.

Taken from Wayland, capture logs from the configuration process as well
as from every check.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
Cc: Eric Engeström <eric.engestrom@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
[Emil: use wildcard to match the artefacts]
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agomodeprint: print encoder type
Stefan Agner [Wed, 5 Sep 2018 18:00:21 +0000 (11:00 -0700)]
modeprint: print encoder type

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agomodeprint: use libutil to lookup strings
Stefan Agner [Wed, 5 Sep 2018 18:00:19 +0000 (11:00 -0700)]
modeprint: use libutil to lookup strings

Use libutil to lookup connector type names and state. This also
makes sure that the latest connector type addition "DPI" gets
printed correctly.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agofreedreno: add missing drm_public
Eric Engestrom [Thu, 20 Sep 2018 18:24:10 +0000 (19:24 +0100)]
freedreno: add missing drm_public

Fixes: 9a1470fb410bbc840459 "freedreno: annotate public functions"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoomap: fix symbol annotations
Eric Engestrom [Thu, 20 Sep 2018 17:27:18 +0000 (18:27 +0100)]
omap: fix symbol annotations

Fixes: f3f7266d94e0354bfd97 "omap: annotate public functions"
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
6 years agoradeon: add missing drm_public exports
Eric Engestrom [Thu, 20 Sep 2018 15:53:08 +0000 (16:53 +0100)]
radeon: add missing drm_public exports

Fixes: 9f45264815eff6ebeba3 "radeon: annotate public functions"
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Mark Janes <mark.a.janes@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108006
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
6 years agonouveau: add missing drm_public exports
Eric Engestrom [Thu, 20 Sep 2018 15:52:30 +0000 (16:52 +0100)]
nouveau: add missing drm_public exports

Fixes: d7320bfcddc596f23fa2 "nouveau: annotate public functions"
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Mark Janes <mark.a.janes@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108006
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Tested-by: Dylan Baker <dylan@pnwbakers.com>
6 years agointel: add missing drm_public exports
Eric Engestrom [Thu, 20 Sep 2018 15:51:45 +0000 (16:51 +0100)]
intel: add missing drm_public exports

Fixes: 36bb0ea47b71d220b31e "intel: annotate public functions"
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Mark Janes <mark.a.janes@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108006
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Tested-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoautotools: make symbols hidden by default
Lucas De Marchi [Thu, 13 Sep 2018 23:24:32 +0000 (16:24 -0700)]
autotools: make symbols hidden by default

Now that symbols that should be exported are annotated accordingly, make
all the rest hidden by default.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: make symbols hidden by default
Lucas De Marchi [Wed, 12 Sep 2018 20:24:12 +0000 (13:24 -0700)]
meson: make symbols hidden by default

Now that symbols that should be exported are annotated accordingly, make
all the rest hidden by default.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoexynos: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 23:13:06 +0000 (16:13 -0700)]
exynos: annotate public functions

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

In which /tmp/a.txt contains the public symbols from
exynos-symbol-check. The idea here will be to switch the default
visibility to hidden so we don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agotegra: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 23:06:31 +0000 (16:06 -0700)]
tegra: annotate public functions

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

In which /tmp/a.txt contains the public symbols from
tegra-symbol-check. The idea here will be to switch the default
visibility to hidden so we don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoradeon: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 23:05:15 +0000 (16:05 -0700)]
radeon: annotate public functions

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

In which /tmp/a.txt contains the public symbols from
radeon-symbol-check. The idea here will be to switch the default
visibility to hidden so we don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoomap: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 22:55:46 +0000 (15:55 -0700)]
omap: annotate public functions

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

In which /tmp/a.txt contains the public symbols from
omap-symbol-check. The idea here will be to switch the default
visibility to hidden so we don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agofreedreno: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 22:49:18 +0000 (15:49 -0700)]
freedreno: annotate public functions

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

In which /tmp/a.txt contains the public symbols from
freedreno-symbol-check. The idea here will be to switch the default
visibility to hidden so we don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoetnaviv: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 22:49:18 +0000 (15:49 -0700)]
etnaviv: annotate public functions

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

In which /tmp/a.txt contains the public symbols from
etnaviv-symbol-check. The idea here will be to switch the default
visibility to hidden so we don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agolibdrm: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 22:42:26 +0000 (15:42 -0700)]
libdrm: annotate public functions

This was done with:
nm --dynamic --defined-only build/libdrm.so | \
grep " T " | \
grep -v _fini | grep -v _init | \
cut -d' ' -f3 > /tmp/a.txt

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

Then the alignment of function arguments were manually fixed all over.
The idea here will be to switch the default visibility to hidden so we
don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoamdgpu: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 21:57:13 +0000 (14:57 -0700)]
amdgpu: annotate public functions

This was done with:
nm --dynamic --defined-only build/amdgpu/libdrm_amdgpu.so | \
grep amdgpu_ | \
cut -d' ' -f3 > /tmp/a.txt

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
line=$((line-1))
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

Then the alignment of function arguments were manually fixed all over.
The idea here will be to switch the default visibility to hidden so we
don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
6 years agonouveau: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 21:39:50 +0000 (14:39 -0700)]
nouveau: annotate public functions

This was done with:
nm --dynamic --defined-only build/nouveau/libdrm_nouveau.so | \
grep nouveau_ | \
cut -d ' ' -f3 > /tmp/a.txt

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
line=$((line-1))
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

Then some corner cases were manually fixed. The idea here will be to
switch the default visibility to hidden so we don't export symbols we
shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agolibkms: annotate public functions
Lucas De Marchi [Thu, 13 Sep 2018 20:00:55 +0000 (13:00 -0700)]
libkms: annotate public functions

This was done with:
nm --dynamic --defined-only build/libkms/libkms.so | \
grep kms_ | \
cut -d' ' -f3 > /tmp/a.txt

while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

The idea here will be to switch the default visibility to hidden so we
don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agointel: annotate public functions
Lucas De Marchi [Wed, 12 Sep 2018 20:09:08 +0000 (13:09 -0700)]
intel: annotate public functions

This was done with:
while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
line=$((line-1))
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt

Then some corner cases were manually fixed. "a.txt" above contains the
symbols collected from intel/intel-symbol-check. The idea here will be
to switch the default visibility to hidden so we don't export symbols we
shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoheaders/README: fix/add link to drm-next
Eric Engestrom [Tue, 18 Sep 2018 15:22:42 +0000 (16:22 +0100)]
headers/README: fix/add link to drm-next

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agotest/amdgpu: add GDS, GWS and OA tests
Christian König [Fri, 14 Sep 2018 13:08:06 +0000 (15:08 +0200)]
test/amdgpu: add GDS, GWS and OA tests

Add allocation tests for GDW, GWS and OA.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agotest/amdgpu: add proper error handling v2
Christian König [Fri, 14 Sep 2018 13:04:38 +0000 (15:04 +0200)]
test/amdgpu: add proper error handling v2

Otherwise the calling function won't notice that something is wrong.

v2: check map result as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu: remove invalid check in amdgpu_bo_alloc
Christian König [Fri, 14 Sep 2018 12:58:24 +0000 (14:58 +0200)]
amdgpu: remove invalid check in amdgpu_bo_alloc

The heap is checked by the kernel and not libdrm, to make it even worse
it prevented allocating resources other than VRAM and GTT.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agofreedreno: move ring_cache behind fd_bo_del()
Rob Clark [Fri, 17 Aug 2018 19:58:17 +0000 (15:58 -0400)]
freedreno: move ring_cache behind fd_bo_del()

So that it isn't bypassing normal refcnt'ing.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agofreedreno: fix spelling typo
Rob Clark [Fri, 17 Aug 2018 19:44:40 +0000 (15:44 -0400)]
freedreno: fix spelling typo

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agotests/amdgpu: add unaligned VM test
Christian König [Fri, 7 Sep 2018 11:25:01 +0000 (13:25 +0200)]
tests/amdgpu: add unaligned VM test

Make a VM mapping which is as unaligned as possible.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agointel: annotate the intel genx helpers as private
Emil Velikov [Thu, 6 Sep 2018 15:14:07 +0000 (16:14 +0100)]
intel: annotate the intel genx helpers as private

They're used internally and never meant to be part of the API.
Add the drm_private notation, which should resolve that.

v2: (Rodrigo) Add missing include.
v3: (Rodrigo) Keep includes grouped per Eric suggestion.

Cc: Eric Engestrom <eric.engestrom@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Fixes: 4e81d4f9c9b ("intel: add generic functions to check PCI ID")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agogitlab-ci: use templates to deduplicate the build commands
Eric Engestrom [Thu, 6 Sep 2018 11:10:50 +0000 (12:10 +0100)]
gitlab-ci: use templates to deduplicate the build commands

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agointel: get gen once for gen >= 9
Lucas De Marchi [Wed, 5 Sep 2018 18:32:00 +0000 (11:32 -0700)]
intel: get gen once for gen >= 9

We don't need to call IS_GEN() for each gen >= 9: we can rather use the
new intel_is_genx() helper to iterate the pciids array once.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agointel: make gen9 use generic gen macro
Lucas De Marchi [Wed, 5 Sep 2018 18:31:59 +0000 (11:31 -0700)]
intel: make gen9 use generic gen macro

The 2 PCI IDs that are used for the command line overrid mechanism
were left defined. The rest can be gone and then we just use the kernel
defines.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agointel: make gen10 use generic gen macro
Lucas De Marchi [Wed, 5 Sep 2018 18:31:58 +0000 (11:31 -0700)]
intel: make gen10 use generic gen macro

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agointel: make gen11 use generic gen macro
Lucas De Marchi [Wed, 5 Sep 2018 18:31:57 +0000 (11:31 -0700)]
intel: make gen11 use generic gen macro

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agointel: add generic functions to check PCI ID
Lucas De Marchi [Wed, 5 Sep 2018 18:31:56 +0000 (11:31 -0700)]
intel: add generic functions to check PCI ID

This will allow platforms to reuse kernel IDs instead of manually
keeping them in sync. In most of the cases we only need to extend
IS_9XX().  Current platforms that fit this requirement can be ported
over to use this macro. Right now it's a nop since it doesn't have any
PCI ID added.

The i915_pciids.h header is in sync with kernel tree on
drm-tip 2018y-08m-20d-21h-41m-11s.

v2: - move to a separate .c so we can have the array in a single
      compilation unit
    - use a single array for all gens
    - add real functions to get or check gen by pciid
    - define our own pci device struct rather than inherit the one
      kernel uses: we can throw away most of the fields

v3: - add comment to keep ids sorted by gen
    - remove misleading comment about all gens

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agoxf86drm: rename "real_path" to "pci_path"
Eric Engestrom [Wed, 5 Sep 2018 12:29:08 +0000 (13:29 +0100)]
xf86drm: rename "real_path" to "pci_path"

"real_path" was getting confusing when there are other *paths in the
same functions.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoxf86drm: merge get_normal_pci_path() into get_real_pci_path()
Eric Engestrom [Wed, 5 Sep 2018 12:23:59 +0000 (13:23 +0100)]
xf86drm: merge get_normal_pci_path() into get_real_pci_path()

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoFix build with -std=c11
Tom Anderson [Wed, 25 Jul 2018 19:06:29 +0000 (12:06 -0700)]
Fix build with -std=c11

typeof() is a GNU extension that will only work when the compiler is passed
-std=gnu*.  __typeof__() works with -std=c*, however.
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoadd gitlab-ci builds of libdrm
Eric Engestrom [Thu, 30 Aug 2018 14:51:40 +0000 (15:51 +0100)]
add gitlab-ci builds of libdrm

It currently does 4 builds: 2 using Meson and 2 using Autotools, 2 using
the latest dependencies on ArchLinux and 2 using very old dependencies
on Debian (including manually building libpciaccess to have the oldest
version supported, to make sure it keeps being supported).

All the build options are turned on for both Meson and Autotools.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Daniel Stone <daniels@collabora.com>
6 years agoAdd basic CONTRIBUTING file
Daniel Vetter [Wed, 15 Aug 2018 17:04:45 +0000 (19:04 +0200)]
Add basic CONTRIBUTING file

I picked up a bunch of the pieces from wayland's version:

https://gitlab.freedesktop.org/wayland/wayland/blob/master/CONTRIBUTING.md

The weston one is fairly similar. Then I rather massively trimmed it
down since in reality libdrm is a bit a dumping ground with very few
real rules. The commit rights and CoC sections I've copied verbatim
from igt respectively drm-misc. Weston/Wayland only differ in their
pick of how many patches you need (10 instead of 5). I think for
libdrm this is supremely relevant, since most everyone will get their
commit rights by contributing already to the kernel or mesa and having
commit rights there already.

Anyway, I figured this is good to get the rules documented, even if
there's mostly not many rules.

Note: This references maintainers in a MAINTAINERS file, which needs
to be created first.

Note: With the gitlab migration the entire commit rights process is
still a bit up in the air. But gitlab commit rights and roles are
hierarchical, so we can do libdrm-only maintainer/commiter roles
("Owner" and "Developer" in gitlab-speak). This should avoid
conflating libdrm roles with mesa roles, useful for those pushing to
libdrm as primarily kernel contributors.

v2: Comments from Emil:
- Recommend subject prefix.
- Fix copypaste fumbles, this isn't igt/wayland ...

v3: Comments from Marek:
- libdrm moved to mesa, update the document. Atm the entire account
  request situation is entirely not clear for gitlab and mesa
  projects, so that's a bit up in the air. Also, should probably send
  an announcement to dri-devel@, which didn't happen.
- amd folks don't submit their patches to dri-devel, document that.
  Probably applies to other drivers too.

v4: Comments from Rob:
- Also include kernel/userspace in the commit counts criteria, due to
  libdrm's special role as a glue library.

v5: Summarize the irc discussion on gitlab roles in the commit message
a bit.

v6: Some grammer stuff from Eric E.

v7: Use --local in git config (Eric E.)

Cc: Dave Airlie <airlied@gmail.com>
Cc: Michel Dänzer <michel@daenzer.net>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com> (v4)
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> (v6)
Acked-by: Emil Velikov <emil.l.velikov@gmail.com> (v6)
Acked-by: Marek Olšák <marek.olsak@amd.com> (v5)
Acked-by: Dave Airlie <airlied@redhat.com>
References: https://gitlab.freedesktop.org/wayland/weston/blob/master/CONTRIBUTING.md
References: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html#commit-rights
References: https://cgit.freedesktop.org/drm/igt-gpu-tools/tree/CONTRIBUTING#n54
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
6 years agoamdgpu: amdgpu_bo_inc_ref don't return dummy int
Qiang Yu [Mon, 3 Sep 2018 10:06:02 +0000 (18:06 +0800)]
amdgpu: amdgpu_bo_inc_ref don't return dummy int

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoamdgpu: add amdgpu_bo_inc_ref() function.
Qiang Yu [Mon, 3 Sep 2018 06:55:09 +0000 (14:55 +0800)]
amdgpu: add amdgpu_bo_inc_ref() function.

For Pro OGL be able to work with upstream libdrm.

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoamdgpu: add error return value for finding bo by cpu mapping (v2)
Junwei Zhang [Thu, 30 Aug 2018 09:35:40 +0000 (17:35 +0800)]
amdgpu: add error return value for finding bo by cpu mapping (v2)

If nothing is found, error should be returned.

v2: udpate the error value different from parameter check

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
6 years agoamdgpu-symbol-check: Add amdgpu_find_bo_by_cpu_mapping
Michel Dänzer [Mon, 27 Aug 2018 09:48:48 +0000 (11:48 +0200)]
amdgpu-symbol-check: Add amdgpu_find_bo_by_cpu_mapping

Fixes: 4d454424e1f2 ("amdgpu: add a function to find bo by cpu mapping
                      (v2)"

6 years agoxf86drm: fallback to normal path when realpath fails
Emil Velikov [Thu, 23 Aug 2018 09:49:54 +0000 (10:49 +0100)]
xf86drm: fallback to normal path when realpath fails

Earlier commit reworked our sysfs handling to use realpath.
Sadly that backfired since the Firefox sandboxing mechanism rejects
that. Despite the files/folders being in the allowed list, of the
sandboxing mechanism.

Oddly enough, the Chromium sandboxing doesn't complain about any of
this.

Since there are no Firefox releases with the fix, add a temporary
solution which falls back to the original handling.

Sadly, this won't work for virgl.

v2: drop return type - function cannot return NULL (Eric)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107516
Fixes: a02900133b3 ("xf86drm: introduce a get_real_pci_path() helper")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoBump to version 2.4.94 libdrm-2.4.94
Kristian H. Kristensen [Thu, 23 Aug 2018 21:38:37 +0000 (14:38 -0700)]
Bump to version 2.4.94

6 years agolibdrm: add msm drm uapi header
Tanmay Shah [Tue, 14 Aug 2018 00:29:21 +0000 (17:29 -0700)]
libdrm: add msm drm uapi header

msm_drm.h file Generated using make headers_install.

Generated from
tree - git://people.freedesktop.org/~airlied/linux
branch - drm-next
commit - 6d08b06e67cd117f6992c46611dfb4ce267cd71e

Remove freedreno/msm/msm_drm.h to maintain only
one copy of msm_drm.h and change freedreno Makefile
and meson.build file accordingly.

v2: Remove private freedreno/msm/msm_drm.h
v3: meson.build update
v3: README update (by anholt)

Signed-off-by: Tanmay Shah <tanmay@codeaurora.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agoamdgpu: add a function to create amdgpu bo internally (v4)
Junwei Zhang [Tue, 14 Aug 2018 03:00:09 +0000 (11:00 +0800)]
amdgpu: add a function to create amdgpu bo internally (v4)

a helper function to create and initialize amdgpu bo

v2: update error handling: add label and free bo
v3: update error handling: separate each error label
v4: update error handling and rebase

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoamdgpu: free flink bo in bo import
Junwei Zhang [Tue, 14 Aug 2018 03:00:08 +0000 (11:00 +0800)]
amdgpu: free flink bo in bo import

Fix potential memory leak when handle flink bo in bo import.
Free the flink bo after bo import and in error handling.

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoamdgpu: Eliminate void* arithmetic in amdgpu_find_bo_by_cpu_mapping
Michel Dänzer [Tue, 14 Aug 2018 09:53:19 +0000 (11:53 +0200)]
amdgpu: Eliminate void* arithmetic in amdgpu_find_bo_by_cpu_mapping

Arithmetic using void* pointers isn't defined by the C standard, only as
a GCC extension. Avoids compiler warnings:

../../amdgpu/amdgpu_bo.c: In function ‘amdgpu_find_bo_by_cpu_mapping’:
../../amdgpu/amdgpu_bo.c:554:48: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
   if (cpu >= bo->cpu_ptr && cpu < (bo->cpu_ptr + bo->alloc_size))
                                                ^
../../amdgpu/amdgpu_bo.c:561:23: warning: pointer of type ‘void *’ used in subtraction [-Wpointer-arith]
   *offset_in_bo = cpu - bo->cpu_ptr;
                       ^

v2: Use uintptr_t instead of char*, don't change function signature
    (Junwei Zhang)

Fixes: 4d454424e1f2 ("amdgpu: add a function to find bo by cpu mapping
                     (v2)")
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoamdgpu: Disable deadlock test suite for RV
Likun Gao [Tue, 14 Aug 2018 11:10:10 +0000 (19:10 +0800)]
amdgpu: Disable deadlock test suite for RV

disable deadlock test suite for RV

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu: fix off by one in handle_table_insert
Christian König [Wed, 15 Aug 2018 11:25:14 +0000 (13:25 +0200)]
amdgpu: fix off by one in handle_table_insert

Stupid me, max_key must always be larger than key.

Signed-off-by: Christian König <christian.koenig@amd.com>
Bugzilla: https://bugs.freedesktop.org/107552
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoamdgpu: Use uint32_t i in amdgpu_find_bo_by_cpu_mapping
Michel Dänzer [Tue, 14 Aug 2018 09:41:29 +0000 (11:41 +0200)]
amdgpu: Use uint32_t i in amdgpu_find_bo_by_cpu_mapping

The compiler points out that an int doesn't work as intended if
dev->bo_handles.max_key > INT_MAX:

../../amdgpu/amdgpu_bo.c: In function ‘amdgpu_find_bo_by_cpu_mapping’:
../../amdgpu/amdgpu_bo.c:550:16: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
  for (i = 0; i < dev->bo_handles.max_key; i++) {
                ^
../../amdgpu/amdgpu_bo.c:558:8: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
  if (i < dev->bo_handles.max_key) {
        ^

Fixes: 4d454424e1f2 ("amdgpu: add a function to find bo by cpu mapping
                     (v2)")
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agointel: Add a new CFL PCI ID.
Rodrigo Vivi [Thu, 9 Aug 2018 05:38:41 +0000 (22:38 -0700)]
intel: Add a new CFL PCI ID.

One more CFL ID added to spec.

Align with kernel commit d0e062ebb3a4 ("drm/i915/cfl:
Add a new CFL PCI ID.")

v2: fix commit subject.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
6 years agofreedreno: fix use-after-free with stateobj rb's
Rob Clark [Wed, 8 Aug 2018 14:39:52 +0000 (10:39 -0400)]
freedreno: fix use-after-free with stateobj rb's

We could be dropping last reference in ->flush(), so clear the entry in
the parent rb's table to avoid deref'ing after free'd.

Also, ring_bo_del()'s use of ring_cache expects that it is dropping the
last reference.  So drop our ref to the stateobj's ring_bo first.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agofreedreno: don't leak stateobj rb refs
Rob Clark [Tue, 7 Aug 2018 15:13:09 +0000 (11:13 -0400)]
freedreno: don't leak stateobj rb refs

One stateobj can be emitted multiple times in a single cmdstream, but
only the first time is a cmd entry added to the parent.  Since it will
be only unref'd once after flush, we should only ref it the first time
it is emitted (ie. the time it is added to cmd table).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agotests/amdgpu: add test for finding bo by CPU mapping
Junwei Zhang [Wed, 8 Aug 2018 09:56:47 +0000 (17:56 +0800)]
tests/amdgpu: add test for finding bo by CPU mapping

Add a test for API to query bo by CPU mapping

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoamdgpu: add a function to find bo by cpu mapping (v2)
Junwei Zhang [Wed, 8 Aug 2018 09:56:46 +0000 (17:56 +0800)]
amdgpu: add a function to find bo by cpu mapping (v2)

Userspace needs to know if the user memory is from BO or malloc.

v2: update mutex range and rebase

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoamdgpu: add bo from user memory to handle table
Junwei Zhang [Wed, 8 Aug 2018 09:56:45 +0000 (17:56 +0800)]
amdgpu: add bo from user memory to handle table

When create bo from user memory, add it to handle table
for future query.

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agotests/util: Add support for stm module
Benjamin Gaignard [Fri, 20 Jul 2018 11:32:52 +0000 (13:32 +0200)]
tests/util: Add support for stm module

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agolibdrm: Fix amdgpu build failure
Mike Lothian [Tue, 7 Aug 2018 12:38:09 +0000 (13:38 +0100)]
libdrm: Fix amdgpu build failure

Use the correct files to build libdrm_amdgpu.

Signed-of-by: Mike Lothian <mike@fireburn.co.uk>
Fixes: d6cb0ee408e ("amdgpu: remove the hash table implementation")
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agotests/modetest: Add atomic support
Benjamin Gaignard [Wed, 25 Jul 2018 14:00:16 +0000 (16:00 +0200)]
tests/modetest: Add atomic support

If "-a" option is set this make modetest use atomic API instead
of legacy API.

Test the frame rate ("-v") it does a loop and swap between two
framebuffer for each active planes.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoamdgpu: always add all BOs to handle table
Christian König [Thu, 2 Aug 2018 08:45:19 +0000 (10:45 +0200)]
amdgpu: always add all BOs to handle table

This way we can always find a BO structure by its handle.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-and-Tested-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoamdgpu: remove the hash table implementation
Christian König [Thu, 2 Aug 2018 08:58:51 +0000 (10:58 +0200)]
amdgpu: remove the hash table implementation

Not used any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-and-Tested-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoamdgpu: use handle table for flink names
Christian König [Thu, 2 Aug 2018 08:56:11 +0000 (10:56 +0200)]
amdgpu: use handle table for flink names

Instead of the hash use the handle table.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-and-Tested-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoamdgpu: use handle table for KMS handles
Christian König [Thu, 2 Aug 2018 08:47:02 +0000 (10:47 +0200)]
amdgpu: use handle table for KMS handles

Instead of the hash use the handle table.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-and-Tested-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoamdgpu: add handle table implementation v2
Christian König [Thu, 2 Aug 2018 08:42:41 +0000 (10:42 +0200)]
amdgpu: add handle table implementation v2

The kernel handles are dense and the kernel always tries to use the
lowest free id. Use this to implement a more efficient handle table
by using a resizeable array instead of a hash.

v2: add handle_table_fini function, extra key checks,
    fix typo in function name

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-and-Tested-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoamdgpu: stop using the hash table for fd_tab
Christian König [Wed, 1 Aug 2018 18:44:44 +0000 (20:44 +0200)]
amdgpu: stop using the hash table for fd_tab

We have so few devices that just walking a linked list is probably
faster.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-and-Tested-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agoconfigure.ac: bump version to 2.4.93 libdrm-2.4.93
Marek Olšák [Wed, 1 Aug 2018 01:26:11 +0000 (21:26 -0400)]
configure.ac: bump version to 2.4.93

6 years agofreedreno/msm: "stateobj" support
Rob Clark [Mon, 23 Jul 2018 14:46:12 +0000 (10:46 -0400)]
freedreno/msm: "stateobj" support

Adds support for "state object" cmdstream buffers which can be
constructed once, and re-used many times.  This enables the use
for CP_SET_DRAW_STATE packets on newer hardware, to lower the
CPU overhead.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agofreedreno: slight reordering
Rob Clark [Mon, 23 Jul 2018 14:23:50 +0000 (10:23 -0400)]
freedreno: slight reordering

Splitting code-motion out from next patch.  Once we add stateobj rb's
this loop could add new entries to bos table, so it needs to be before
we set req.bos/req.nr_bos.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agofreedreno: small cleanup
Rob Clark [Mon, 23 Jul 2018 13:42:22 +0000 (09:42 -0400)]
freedreno: small cleanup

Make cheezy growable array thing less open-coded before adding more.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agofreedreno: add fd_ringbuffer_new_object()
Rob Clark [Sun, 22 Jul 2018 15:44:15 +0000 (11:44 -0400)]
freedreno: add fd_ringbuffer_new_object()

Add new API for reusable "state objects" which can be re-used multiple
times.  Backend implementation for msm will follow.  (Probably not
needed to support this for any device that uses kgsl backend, since this
is mostly useful for a5xx+.)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agoxf86drm: Fix error path in drmGetDevice2
Mariusz Ceier [Sun, 29 Jul 2018 08:20:14 +0000 (10:20 +0200)]
xf86drm: Fix error path in drmGetDevice2

In drmGetDevice2 when no local device is found or when
drm_device_has_rdev filters out all devices, *device might be left
uninitialized causing drmGetDevice2 to not return error - since
it's only returned when *device == NULL.

Above leads to crash in the firefox in system with amdgpu.

With this change firefox displays:

libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu

and doesn't crash.

Bugzilla: https://bugs.freedesktop.org/107384
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Mariusz Ceier <mceier+mesa-dev@gmail.com>
6 years agoamdgpu: add amdgpu_bo_handle_type_kms_noimport
Marek Olšák [Thu, 12 Jul 2018 00:35:19 +0000 (20:35 -0400)]
amdgpu: add amdgpu_bo_handle_type_kms_noimport

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agodrmdevice: print the correct host1x information
Emil Velikov [Mon, 25 Jun 2018 17:31:35 +0000 (18:31 +0100)]
drmdevice: print the correct host1x information

While fairly close, the host1x and platform are two separate things.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
6 years agodrmdevice: convert the tabbed output into a tree
Emil Velikov [Mon, 25 Jun 2018 17:29:35 +0000 (18:29 +0100)]
drmdevice: convert the tabbed output into a tree

Making the output a little bit easier to parse by human beings.

v2: Add extra whitespace (Eric)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
6 years agotests/drmdevice: add a couple of printf headers
Emil Velikov [Mon, 25 Jun 2018 17:07:49 +0000 (18:07 +0100)]
tests/drmdevice: add a couple of printf headers

Add a few printf statements, which should make the output easier to
parse.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
6 years agotests/drmdevices: install alongside other utilities
Emil Velikov [Mon, 25 Jun 2018 16:45:23 +0000 (17:45 +0100)]
tests/drmdevices: install alongside other utilities

It's mildly useful program, to ship it when the user wants the "tests"
installed. Obviously the "tests" in the name is a misnomer.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
6 years agoxf86drm: Add drmDevice support for virtio_gpu
Emil Velikov [Tue, 15 May 2018 16:37:49 +0000 (17:37 +0100)]
xf86drm: Add drmDevice support for virtio_gpu

The GPU almost exclusively lives on the PCI bus, so we expose it as a
normal PCI one.

This allows all existing drmDevice users to work without any changes.

One could wonder why a separate typeset is not introduced, alike say
host1x. Unlike host1x the PCI/platform distinction for virtio provides
no extra information. Plus if needed we can add the separate set at a
later stage.

Here are a few 'features' that virtio seems to be missing:
 - provides extra information on top the plaform devices
 - supports a range of GPU devices
 - is considered hardware description (DT)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
6 years agoxf86drm: introduce a get_real_pci_path() helper
Emil Velikov [Tue, 15 May 2018 16:29:44 +0000 (17:29 +0100)]
xf86drm: introduce a get_real_pci_path() helper

Introduce a helper which gets the real sysfs path for the given pci
device.

In other words, instead opening the /sys/dev/char/*/device symlink, we
opt for the actual /sys/devices/pci*/*/

It folds three (nearly identical) snprintf's and paves the way of adding
extra devices (see next patch) a piece of pie.

v2: use a caller (on stack) provided real_path (Eric)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
6 years agoxf86drm: Allocate drmDevicePtr's on stack
Emil Velikov [Tue, 15 May 2018 15:32:10 +0000 (16:32 +0100)]
xf86drm: Allocate drmDevicePtr's on stack

Currently we dynamically allocate 16 pointers and reallocate more as
needed.

Instead, allocate the maximum number (256) on stack - the number is
small enough and is unlikely to change in the foreseeable future.

This allows us to simplify the error handling and even shed a few bytes
off the final binary.

v2:
 - add a define & description behind the magic 256
 - report error to strerr and skip when over 256 device nodes

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
6 years agoxf86drm: Fold drmDevice processing into process_device() helper
Emil Velikov [Tue, 15 May 2018 14:02:52 +0000 (15:02 +0100)]
xf86drm: Fold drmDevice processing into process_device() helper

Don't duplicate the nearly identical code across the two call sites.
It improves legibility and the diff stat seems nice.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
6 years agoxf86drm: introduce drm_device_has_rdev() helper
Emil Velikov [Thu, 21 Jun 2018 15:06:35 +0000 (16:06 +0100)]
xf86drm: introduce drm_device_has_rdev() helper

Currently we match the opened drmDevice fd with each drmDevice we
process.

Move that after all the devices are processed and folded, via the
drm_device_has_rdev(). This makes the code easier to follow and allows
us to unify the massive process loop across drmGetDevice2 and
drmGetDevices2. That in itself is coming with a later commit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
6 years agoxf86drm: drmGetDevice2: error out if the fd has unknown subsys
Emil Velikov [Tue, 15 May 2018 15:43:58 +0000 (16:43 +0100)]
xf86drm: drmGetDevice2: error out if the fd has unknown subsys

Currently one can open() any /dev node. If it's unknown
drmParseSubsystemType() will return an error.

Track that and bail as needed.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
6 years agoamdgpu: make sure to set CLOEXEC on duplicated FDs
Christian König [Tue, 17 Jul 2018 09:04:31 +0000 (11:04 +0200)]
amdgpu: make sure to set CLOEXEC on duplicated FDs

Otherwise we leak file descriptors into child processes.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
6 years agoRevert "amdgpu: don't call add_handle_to_table for KMS BO exports"
Michel Dänzer [Wed, 11 Jul 2018 13:43:59 +0000 (15:43 +0200)]
Revert "amdgpu: don't call add_handle_to_table for KMS BO exports"

This reverts commit fe0488aa13c35952b9f3f37ff2c74b6b858e8e73.

It caused messages like

 amdgpu 0000:23:00.0: bo 000000007dce0b3e va 0x0000101800-0x000010181f conflict with 0x0000101800-0x0000101820

in dmesg, and eventually a Xorg crash while running piglit.

Evidently, such BOs can actually be re-imported by other means than via
a KMS handle.

6 years agoamdgpu: don't call add_handle_to_table for KMS BO exports
Marek Olšák [Fri, 6 Jul 2018 20:15:31 +0000 (16:15 -0400)]
amdgpu: don't call add_handle_to_table for KMS BO exports

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
6 years agointel: Introducing Amber Lake platform
José Roberto de Souza [Tue, 19 Jun 2018 23:45:21 +0000 (16:45 -0700)]
intel: Introducing Amber Lake platform

Amber Lake uses the same gen graphics as Kaby Lake, including a id
that were previously marked as reserved on Kaby Lake, but that now is
moved to AML page.

So, let's just move it to AML macro that will feed into KBL macro
just to keep it better organized to make easier future code review
but it will be handled as a KBL.

This is a copy of merged i915's
commit e364672477a1 ("drm/i915/aml: Introducing Amber Lake platform")

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agointel: Introducing Whiskey Lake platform
José Roberto de Souza [Tue, 19 Jun 2018 23:45:20 +0000 (16:45 -0700)]
intel: Introducing Whiskey Lake platform

Whiskey Lake uses the same gen graphics as Coffe Lake, including some
ids that were previously marked as reserved on Coffe Lake, but that
now are moved to WHL page.

So, let's just move them to WHL macros that will feed into CFL macro
just to keep it better organized to make easier future code review
but it will be handled as a CFL.

This is a copy of merged i915's
commit b9be78531d27 ("drm/i915/whl: Introducing Whiskey Lake platform")

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agofreedreno: add user ptr to fd_ringbuffer
Rob Clark [Mon, 18 Jun 2018 17:05:01 +0000 (13:05 -0400)]
freedreno: add user ptr to fd_ringbuffer

Something for users of fd_ringbuffer to use as they see fit.  (For now,
just so mesa can add some debugging state.)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agoamdgpu: Destroy fd_hash table when the last device is removed.
Jan Vesely [Fri, 18 May 2018 15:39:15 +0000 (11:39 -0400)]
amdgpu: Destroy fd_hash table when the last device is removed.

Fixes memory leak on module unload.
Analogous to mesa commit of the same name.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu/util_hash_table: Add helper function to count the number of entries in hash...
Jan Vesely [Fri, 18 May 2018 15:36:20 +0000 (11:36 -0400)]
amdgpu/util_hash_table: Add helper function to count the number of entries in hash table

Analogous to the mesa commit of the same name.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu: Take a lock before removing devices from fd_tab hash table.
Jan Vesely [Thu, 10 May 2018 23:22:17 +0000 (19:22 -0400)]
amdgpu: Take a lock before removing devices from fd_tab hash table.

Close the file descriptors under lock as well.
v2: close fds after removing from hash table

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoAlways pass O_CLOEXEC when opening DRM file descriptors
Michel Dänzer [Fri, 18 May 2018 09:16:51 +0000 (11:16 +0200)]
Always pass O_CLOEXEC when opening DRM file descriptors

Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoxf86drm: Be sure to closedir before return
Kevin Strasser [Fri, 18 May 2018 19:48:17 +0000 (12:48 -0700)]
xf86drm: Be sure to closedir before return

removed in commit bb45ce4e3ac751315bfd7fbfd9e1425bf515ec0d

Adding it back as it is still needed in the case where we don't find a
match.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
Fixes: bb45ce4e3ac751315bfd "libdrm: Use readdir instead of readdir_r to
                             avoid build warnings"$
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agobump version for release libdrm-2.4.92
Rob Clark [Wed, 9 May 2018 22:03:45 +0000 (18:03 -0400)]
bump version for release

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agofreedreno: add fd_pipe refcounting
Rob Clark [Wed, 9 May 2018 11:40:29 +0000 (07:40 -0400)]
freedreno: add fd_pipe refcounting

In mesa/gallium, a pipe_fence can outlive the pipe_context it was
created from.  But to wait on the fence we need to know the submit-
queue (ie. the fd_pipe).

The most straightforward way to fix this is to add reference counting
to the fd_pipe and let the fence hold a reference to the pipe (rather
than hanging on to the context, which might have been destroyed before
the fence).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
6 years agointel: add support for ICL 11
Paulo Zanoni [Thu, 26 Apr 2018 00:09:37 +0000 (17:09 -0700)]
intel: add support for ICL 11

Add the PCI IDs and the basic code to enable ICL.  This is the current
PCI ID list in our documentation.

Kernel commit: d55cb4fa2cf0 ("drm/i915/icl: Add the ICL PCI IDs")

v2: Michel provided a fix to IS_9XX that was broken by rebase bot.
v3: Fix double definition of PCI IDs, update IDs according to bspec
    and keep them in the same order and rebase (Lucas)

Cc: Michel Thierry <michel.thierry@intel.com>
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>