platform/upstream/libdrm.git
9 years agoxf86drm: use the correct device minor names on OpenBSD
Jonathan Gray [Mon, 20 Jul 2015 17:12:56 +0000 (03:12 +1000)]
xf86drm: use the correct device minor names on OpenBSD

Add defines for the device minor names and make use of them
in drmGetMinorName() so the correct paths will be used on OpenBSD.

v2: don't add new defines to xf86drm.h to keep them out of the API
    as requested by Emil.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoxf86drm: correct the OpenBSD DRM_MAJOR define
Jonathan Gray [Mon, 20 Jul 2015 17:12:10 +0000 (03:12 +1000)]
xf86drm: correct the OpenBSD DRM_MAJOR define

As far as I can tell no OpenBSD platform ever used 81
for a drm major.  While the value was added to libdrm in 2003
or earlier drm didn't appear in OpenBSD till 2007.

Of the OpenBSD platforms that support drm amd64/macppc/sparc64
use a major of 87, i386 uses 88.

v2: rearrange ifdefs as suggested by Emil.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoxf86drmMode: Implement drmCheckModesettingSupported() for OpenBSD
Jonathan Gray [Sat, 18 Jul 2015 21:20:37 +0000 (07:20 +1000)]
xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSD

This is implemented with kms ioctls so it could also be used as a
generic fallback.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoman: remove .man_fixup workaround
Emil Velikov [Wed, 15 Jul 2015 15:31:15 +0000 (16:31 +0100)]
man: remove .man_fixup workaround

The whole thing is quite messy - the file is used to indicate that the
man pages were correctly generated prior to applying the "fixup" (alias)

At the same time we use a rule with the same name, to create the same
file if the generation has failed.

In other words - it attempts to create the file either way. So there is
little point in it and we can remove it.

Spotted while attempting to build with bmake which kindly blocked on the
following (non compliant construct)

.man_fixup: | $(miscman_DATA)

Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodrm: Detect no-op drmModeAtomicRequest and return early
Chris Wilson [Tue, 21 Jul 2015 12:46:45 +0000 (13:46 +0100)]
drm: Detect no-op drmModeAtomicRequest and return early

If the number of items to process in the request is zero, we can forgo
duplicating, sorting the request and feeding it into the kernel and
instead report success immediately.  This prevents a NULL dereference of
the sorted->items for the no-op request.

Fixes: ed44e0b9585c563905447eceed12af9c1c7ca8d4
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Rob Clark <robclark@freedesktop.org>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoBuild vbltest irrespective of the presence of libudev.
Joonyoung Shim [Mon, 20 Jul 2015 05:36:53 +0000 (14:36 +0900)]
Build vbltest irrespective of the presence of libudev.

The vbltest doesn't have any dependency of LIBUDEV.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoConsistently check the fd value
Emil Velikov [Tue, 14 Jul 2015 13:55:42 +0000 (14:55 +0100)]
Consistently check the fd value

Follow the approach used through the rest of the project.

Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
9 years agoxf86drm: fix incorrect fd comparison in drmOpenOnce{,WithType}
Emil Velikov [Tue, 14 Jul 2015 14:05:18 +0000 (15:05 +0100)]
xf86drm: fix incorrect fd comparison in drmOpenOnce{,WithType}

Spotted by looking for similar "let's assume fd == 0 is invalid" bugs.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
9 years agoomap: zero is a valid fd number, treat it as such
Emil Velikov [Tue, 14 Jul 2015 13:59:19 +0000 (14:59 +0100)]
omap: zero is a valid fd number, treat it as such

Equivalent to the previous patch.

Cc: Rob Clark <robdclark@gmail.com>
Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
9 years agofreedreno: zero is a valid fd number, treat it as such
Emil Velikov [Mon, 13 Jul 2015 13:34:57 +0000 (14:34 +0100)]
freedreno: zero is a valid fd number, treat it as such

Abeit quite unlikely to get hit by this bug here, let just fix it.

v2: Correct conditional (do not call ioctl(DRM_IOCTL_PRIME_HANDLE_TO_FD)
when we already have the fd).
v3: Fix kgsl_pipe.c, suggested by Thierry.

Cc: freedreno@lists.freedesktop.org
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
9 years agoinclude <sys/types.h> & <sys/mkdev.h> directly for major() and minor()
Alan Coopersmith [Wed, 8 Jul 2015 17:41:43 +0000 (10:41 -0700)]
include <sys/types.h> & <sys/mkdev.h> directly for major() and minor()

Linux seems to pick these up via another header, but Solaris needs them
explicitly included, or we get undefined symbol errors for major & minor.

v2: use headers documented in makedev(3C) man page instead of sysmacros.h

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
v3 [Emil Velikov]: include sys/mkdev.h only when available.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoFix headers inclusion in xf86drmMode.c
Julien Cristau [Mon, 6 Jul 2015 11:45:31 +0000 (12:45 +0100)]
Fix headers inclusion in xf86drmMode.c

Add sys/sysctl.h to get sysctlbyname declaration on kFreeBSD

Updated by Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
to add autoconf check and only include <sys/sysctl.h> if it
is detected by configure as it’s unusable on Linux/x32 (and
others, e.g. other new architectures).

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoSet alignment value in drm_intel_add_validate_buffer()
Anuj Phogat [Sat, 11 Apr 2015 00:20:56 +0000 (17:20 -0700)]
Set alignment value in drm_intel_add_validate_buffer()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965/gen9: Pass alignment as function parameter in drm_intel_gem_bo_alloc_internal()
Anuj Phogat [Sat, 11 Apr 2015 00:20:55 +0000 (17:20 -0700)]
i965/gen9: Pass alignment as function parameter in drm_intel_gem_bo_alloc_internal()

In case of YF/YS tiled buffers libdrm need not know about the tiling
format because these buffers don't have hardware support to be tiled
or detiled through a fenced region. But, libdrm still need to know
about buffer alignment restrictions because kernel uses it when
resolving the relocation.

Mesa uses drm_intel_gem_bo_alloc_for_render() to allocate Yf/Ys buffers.
So, use the passed alignment value in this function to initialize the
align variable in drm_intel_bo. Note that we continue ignoring the
alignment value passed to drm_intel_gem_bo_alloc() to follow the
previous behavior.

V2: Add a condition to avoid allocation from cache. (Ben)
V3: Make no changes in cache allocation strategy. Just update the alignment.
    Update the aperture size estimate including the alignment. (Ben, Chris)
V4: Move aperture size adjustments inside drm_intel_bo_gem_set_in_aperture_size()
    Don't split sentences across the one-line header and the changelog. (Chris)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
9 years agoconfigure: default --enable-valgrind to auto
Emil Velikov [Tue, 30 Jun 2015 13:01:14 +0000 (14:01 +0100)]
configure: default --enable-valgrind to auto

... as the help text says.

Reported-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoconfigure.ac: bump version to 2.4.62 for release libdrm-2.4.62
Emil Velikov [Mon, 29 Jun 2015 18:25:35 +0000 (19:25 +0100)]
configure.ac: bump version to 2.4.62 for release

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agotests/exynos: handle G2D_IMGBUF_COLOR in switch statements
Tobias Jakobi [Fri, 12 Jun 2015 18:15:14 +0000 (20:15 +0200)]
tests/exynos: handle G2D_IMGBUF_COLOR in switch statements

This fixes a compiler warning about missing handling of enum
values in the switch statements.

Also remove the silent mapping to G2D_IMGBUF_GEM when an
unknown buffer type is encountered. We have full control
about the type here, and if it's unknown then we obviously
have a bug in the code.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agotests/exynos: remove connector_find_plane
Tobias Jakobi [Fri, 12 Jun 2015 18:15:13 +0000 (20:15 +0200)]
tests/exynos: remove connector_find_plane

No test uses DRM planes at the moment so this function
is never called. Inspection of the git history shows
that DRM planes were also never used in these tests
in the past.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agotests/exynos: simplify drm_set_crtc
Tobias Jakobi [Fri, 12 Jun 2015 18:15:12 +0000 (20:15 +0200)]
tests/exynos: simplify drm_set_crtc

We can just return 'ret' here, the goto serves no purpose.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agotests/exynos: remove struct fimg2d_test_case
Tobias Jakobi [Fri, 12 Jun 2015 18:15:11 +0000 (20:15 +0200)]
tests/exynos: remove struct fimg2d_test_case

It doesn't make sense to keep this structure, since we
can just call all tests directly. An inspection of the
git history shows that no code ever used this
abstraction in the past.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agotests/exynos: remove unused define
Tobias Jakobi [Fri, 12 Jun 2015 18:15:10 +0000 (20:15 +0200)]
tests/exynos: remove unused define

It doesn't make sense to limit the number of
test cases anyway.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agotests/exynos: clean struct connector
Tobias Jakobi [Fri, 12 Jun 2015 18:15:09 +0000 (20:15 +0200)]
tests/exynos: clean struct connector

Remove all unused struct members. An inspection of the
git history shows that these members were also never
used in the past.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoexynos/fimg2d: simplify g2d_fini()
Tobias Jakobi [Fri, 12 Jun 2015 18:15:08 +0000 (20:15 +0200)]
exynos/fimg2d: simplify g2d_fini()

free()ing a nullptr is a noop, so remove the check.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agotests/exynos: replace return by break
Tobias Jakobi [Fri, 12 Jun 2015 18:15:07 +0000 (20:15 +0200)]
tests/exynos: replace return by break

The 'usage' function already does exit(0), so that this
'return -EINVAL' is never called. Just put a break there
to avoid confusion.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoexynos: fimg2d: fix return codes
Tobias Jakobi [Fri, 12 Jun 2015 18:15:06 +0000 (20:15 +0200)]
exynos: fimg2d: fix return codes

Even if flushing the command buffer doesn't succeed, the
G2D calls would still return zero. Fix this by just passing
the flush return code.

In fact error handling currently ignores the fact that
g2d_add_cmd() can fail. This is going to be handled
in a later patch.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoconfigure: Add flag to disable valgrind support.
Matt Turner [Mon, 22 Jun 2015 16:56:33 +0000 (09:56 -0700)]
configure: Add flag to disable valgrind support.

v2 [Emil Velikov]: Autodetect valgrind.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoxf86drmMode: include config.h before anything else
Emil Velikov [Mon, 29 Jun 2015 16:32:21 +0000 (17:32 +0100)]
xf86drmMode: include config.h before anything else

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoxf86drmMode: remove unused valgrind(VG) macros
Emil Velikov [Mon, 22 Jun 2015 17:58:05 +0000 (17:58 +0000)]
xf86drmMode: remove unused valgrind(VG) macros

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoAdd blob property create/destroy ioctl wrappers
Daniel Stone [Mon, 22 Jun 2015 16:26:03 +0000 (17:26 +0100)]
Add blob property create/destroy ioctl wrappers

v2: Use memclear to zero out structure.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
9 years agoSupport atomic modesetting ioctl
Ville Syrjälä [Mon, 22 Jun 2015 16:26:02 +0000 (17:26 +0100)]
Support atomic modesetting ioctl

Add support for the atomic modesetting ioctl through a property-set API.

v1: Squashed intermediate patches from Ville, Rob and myself. Updated
    for current kernel interface (no blobs).
v2: Rewrite user-facing API to provide transactional/cursor interface.
    Use memclear to zero out ioctl.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Daniel Stone <daniels@collabora.com>
v3 [Emil Velikov]: Remove DRM_CAP_ATOMIC - superseded by
DRM_CLIENT_CAP_ATOMIC.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoRevert "Add device enumeration interface (v4)"
Emil Velikov [Sat, 30 May 2015 13:25:08 +0000 (14:25 +0100)]
Revert "Add device enumeration interface (v4)"

This reverts commit fde4969176822fe54197b6baa78f8b0ef900baba.

The commit adds an API that does not seem flexible enough to be used in
current open-source projects. Additionally it adds a hidden dependency
of libudev, which when used in mesa caused grief when combined with
Steam('s runtime).

Let's revert this for now and add a tweaked API later on that can be
used in mesa/xserver.

Cc: Frank Min <frank.min@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agonouveau: add asserts to make sure krefs are there
Ilia Mirkin [Sun, 21 Jun 2015 23:26:42 +0000 (19:26 -0400)]
nouveau: add asserts to make sure krefs are there

This should help catch odd bugs at the callsites rather than much later
on with completely bogus bo indices.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agotests/kmstest: support atmel-hlcdc
Boris BREZILLON [Thu, 28 May 2015 08:07:43 +0000 (10:07 +0200)]
tests/kmstest: support atmel-hlcdc

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
9 years agomodetest: add atmel-hlcdc driver support
Boris BREZILLON [Thu, 28 May 2015 08:07:42 +0000 (10:07 +0200)]
modetest: add atmel-hlcdc driver support

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
9 years agomodetest: only select plane with matching format
Tobias Jakobi [Wed, 6 May 2015 12:29:33 +0000 (14:29 +0200)]
modetest: only select plane with matching format

Don't assume that a plane supports any kind of pixelformat
but do a check first.

v2: Simplify the format check.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomodetest: make middle SMPTE colors transparent
Tobias Jakobi [Wed, 6 May 2015 12:22:03 +0000 (14:22 +0200)]
modetest: make middle SMPTE colors transparent

This enables us to check for overlay planes which are located
'below' the primary plane.

Since the alpha value only has an effect when creating surfaces
with an alpha-pixelformat this doesn't affect the regular
XRGB8888 primary surface.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodrmPrime*: initialize output args to 0
Guillaume Desmottes [Wed, 29 Apr 2015 08:16:22 +0000 (10:16 +0200)]
drmPrime*: initialize output args to 0

Fix Valgrind errors because those memory was uninitialized.

https://bugs.freedesktop.org/show_bug.cgi?id=90194
Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
v2: Explicitly zero the whole struct using memclear.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoFix one warning (v2)
Jammy Zhou [Mon, 27 Apr 2015 02:29:55 +0000 (10:29 +0800)]
Fix one warning (v2)

xf86drm.c:356:2: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
  group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
  ^

v2: do 'int' cast to fix the warning

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoxf86drm: simplify drmMalloc/drmFree
Emil Velikov [Tue, 28 Apr 2015 12:33:46 +0000 (13:33 +0100)]
xf86drm: simplify drmMalloc/drmFree

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agomodetest: replace malloc + memset with calloc
Emil Velikov [Tue, 28 Apr 2015 12:25:24 +0000 (13:25 +0100)]
modetest: replace malloc + memset with calloc

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agomodetest: explicitly zero the newly allocated memory
Emil Velikov [Tue, 28 Apr 2015 13:20:30 +0000 (14:20 +0100)]
modetest: explicitly zero the newly allocated memory

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoAdd device enumeration interface (v4)
frank [Tue, 19 May 2015 15:31:05 +0000 (23:31 +0800)]
Add device enumeration interface (v4)

Add an interface for enumerating PCI devices on
a system.

v3: switch to udev/sysfs for the enumeration
v4: fix warnings

Signed-off-by: Frank Min <frank.min@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
9 years agoradeon: add new bonaire pci id
Alex Deucher [Tue, 12 May 2015 17:18:37 +0000 (13:18 -0400)]
radeon: add new bonaire pci id

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agonouveau: add coherent BO attribute
Alexandre Courbot [Thu, 21 May 2015 06:08:28 +0000 (15:08 +0900)]
nouveau: add coherent BO attribute

Add a flag allowing Nouveau to specify that an object should be coherent
at allocation time. This is required for some class of objects like
fences which are randomly-accessed by both the CPU and GPU. This flag
instructs the kernel driver to make sure the object remains coherent
even on architectures for which coherency is not guaranteed by the bus.

Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
9 years agointel: Add the Broxton PCI IDs
Damien Lespiau [Fri, 15 May 2015 18:34:12 +0000 (19:34 +0100)]
intel: Add the Broxton PCI IDs

Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
9 years agoconfigure.ac: bump version to 2.4.61 for release libdrm-2.4.61
Ben Skeggs [Wed, 6 May 2015 23:06:31 +0000 (09:06 +1000)]
configure.ac: bump version to 2.4.61 for release

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9 years agonouveau: restore check that avoids multiple user bos per kernel bo
Ben Skeggs [Wed, 6 May 2015 04:34:22 +0000 (14:34 +1000)]
nouveau: restore check that avoids multiple user bos per kernel bo

Lost in 5ea6f1c32628887c9df0c53bc8c199eb12633fec, triggering fdo#89842.

Unlike the PRIME fd->handle interfaces, the GEM_OPEN interface doesn't
do anything at the kernel level to prevent this situation occuring,
and we end up with multiple GEM handles for a single kernel buffer.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9 years agomodetest: fix allocation for yuv420/yvu420
Rob Clark [Tue, 5 May 2015 15:16:23 +0000 (11:16 -0400)]
modetest: fix allocation for yuv420/yvu420

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agofreedreno: link against CLOCK_LIB
Emil Velikov [Wed, 1 Apr 2015 15:53:42 +0000 (16:53 +0100)]
freedreno: link against CLOCK_LIB

Required by clock_gettime()

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoandroid: set the HAVE_VISIBILITY define
Emil Velikov [Wed, 1 Apr 2015 15:54:26 +0000 (16:54 +0100)]
android: set the HAVE_VISIBILITY define

... in order to limit the exported symbols only to the required ones.
Both compilers used with Android (GCC and LLVM) support this, so set it
unconditionally.

Cc: Chih-Wei Huang <cwhuang@linux.org.tw>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomodetest: fix the arguments of the MAKE_RGB_INFO define
Joonyoung Shim [Fri, 17 Apr 2015 04:13:59 +0000 (13:13 +0900)]
modetest: fix the arguments of the MAKE_RGB_INFO define

The current order (rbg) seems wrong.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[Emil Velikov: Tweak the commit message.]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agointel: Leak the userptr test bo
Tvrtko Ursulin [Fri, 17 Apr 2015 10:57:28 +0000 (11:57 +0100)]
intel: Leak the userptr test bo

In order to use userptr, the kernel tracks the owner's mm with a
mmu_notifier. Setting that is very expensive - it involves taking all
mm_locks and a stop_machine(). This tracking lives only for as long as
the client is using userptr objects - so if the client allocates then
frees a userptr in a loop, we will be executing that heavyweight setup
everytime. To ammoritize this cost, just leak the test bo and the single
backing page we use for detecting userptr.

v2: Free the object and memory when bufmgr is destroyed.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
9 years agomodetest: destroy the cursor bo
Joonyoung Shim [Mon, 13 Apr 2015 08:32:18 +0000 (17:32 +0900)]
modetest: destroy the cursor bo

Currently we are missing the bo_destroy() when modetest terminates.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[Emil Velikov: Tweak the commit message.]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomodetest: clear buffer and framebuffer for planes
Joonyoung Shim [Tue, 28 Apr 2015 10:41:39 +0000 (11:41 +0100)]
modetest: clear buffer and framebuffer for planes

Currently we don't destroy buffer and remove framebuffer for
planes when closing modetest.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[Emil Velikov: Tweak the commit message. fb_id = 0 is unused]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomodetest: fix the error path handling
Joonyoung Shim [Mon, 13 Apr 2015 08:32:16 +0000 (17:32 +0900)]
modetest: fix the error path handling

Remove the framebuffer and destroy the bo when error occurs on set_mode
and test_page_flip.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[Emil Velikov: Tweak the commit message.]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomodetest: make use of drmModeRmFB
Joonyoung Shim [Mon, 13 Apr 2015 08:32:15 +0000 (17:32 +0900)]
modetest: make use of drmModeRmFB

We should remove the framebuffer before destroying the buffer.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[Emil Velikov: Tweak the commit message. fb_id = 0 is unused]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomodetest: fix Segmentation fault
Joonyoung Shim [Mon, 13 Apr 2015 08:32:14 +0000 (17:32 +0900)]
modetest: fix Segmentation fault

If use -P option without -s option, the program segfaults due to
dev.mode.bo being NULL.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
[Emil Velikov: Tweak the commit message.]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomodetest: initialize handles/pitches in set_plane()
Tobias Jakobi [Mon, 20 Apr 2015 19:50:45 +0000 (21:50 +0200)]
modetest: initialize handles/pitches in set_plane()

Only the 'offsets' array was initialized to zero.
Since bo_create only sets the handles which are
necessary, were we passing garbage data to the
kernel when calling drmModeAddFB2 later.

The issue only seems to appear when passing e.g.
NV12 data to the kernel, a case where not only
handles[0] is used. I therefore also removed the
corresponding comment.

v2: Do the same for set_mode(), set_cursors()
    and test_page_flip().

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoAdd missing <strings.h> includes
Greg Hackmann [Thu, 16 Apr 2015 17:55:40 +0000 (10:55 -0700)]
Add missing <strings.h> includes

A couple of files use ffs() without explicitly including strings.h.
Some systems will pull in ffs()'s declaration through another header
anyway, but not when compiling against bionic in AOSP master.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoman: rework the Makefile.am
Emil Velikov [Mon, 6 Apr 2015 18:02:38 +0000 (19:02 +0100)]
man: rework the Makefile.am

Remove GNU make specific constructs and take into consideration that
Solaris man 7 is not the same as Linux man 7.

This commit introduces a dependency of xorg-macros 1.12 (released 4+
years ago) which is used to handle the above man section discrepancies.

Cc: Niveditha Rau <niveditha.rau@oracle.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodrm: use c99 __func__ over __FUNCTION__
Emil Velikov [Sun, 5 Apr 2015 15:50:33 +0000 (16:50 +0100)]
drm: use c99 __func__ over __FUNCTION__

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoconfigure: request/set the compiler in C99 mode
Emil Velikov [Sun, 5 Apr 2015 15:40:11 +0000 (16:40 +0100)]
configure: request/set the compiler in C99 mode

Required by intel and drmstat at least. Considering that every compiler
used to build libdrm is C99 compatible, just enable it for the whole
build.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodrm: remove drm_public macro
Emil Velikov [Tue, 31 Mar 2015 21:32:11 +0000 (22:32 +0100)]
drm: remove drm_public macro

Some compilers (like the Oracle Studio), require that the function
declaration must be annotated with the same visibility attribute as the
definition. As annotating functions with drm_public is no longer
required just remove the macro.

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodrm: remove no longer needed VISIBILITY_CFLAGS
Emil Velikov [Tue, 31 Mar 2015 21:07:13 +0000 (22:07 +0100)]
drm: remove no longer needed VISIBILITY_CFLAGS

With earlier commits we've annotated the private symbols, thus
we no longer require the -fvisibility=hidden CFLAGS.

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodrm: rename libdrm{,_macros}.h
Emil Velikov [Sun, 5 Apr 2015 14:51:59 +0000 (15:51 +0100)]
drm: rename libdrm{,_macros}.h

Provide a more meaningful name, considering what it does.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agotegra: add symbols test
Emil Velikov [Tue, 31 Mar 2015 19:14:58 +0000 (20:14 +0100)]
tegra: add symbols test

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoomap: add symbols test
Emil Velikov [Tue, 31 Mar 2015 19:12:06 +0000 (20:12 +0100)]
omap: add symbols test

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoexynos: add symbols test
Emil Velikov [Tue, 31 Mar 2015 19:04:54 +0000 (20:04 +0100)]
exynos: add symbols test

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agolibkms: add symbols test
Emil Velikov [Tue, 31 Mar 2015 18:51:45 +0000 (19:51 +0100)]
libkms: add symbols test

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agolibkms: annotate private symbols
Emil Velikov [Mon, 23 Mar 2015 23:24:48 +0000 (23:24 +0000)]
libkms: annotate private symbols

Cc: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agonouveau: add symbols test
Emil Velikov [Tue, 31 Mar 2015 18:47:24 +0000 (19:47 +0100)]
nouveau: add symbols test

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agonouveau: annotate the private symbols
Emil Velikov [Mon, 23 Mar 2015 21:52:00 +0000 (21:52 +0000)]
nouveau: annotate the private symbols

They are less and easier to track than the public ones. The macro
drm_public will be going away by the end of the series.

Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agointel: add symbols test
Emil Velikov [Tue, 31 Mar 2015 18:43:30 +0000 (19:43 +0100)]
intel: add symbols test

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agointel: annotate the private symbols
Emil Velikov [Tue, 31 Mar 2015 20:12:14 +0000 (21:12 +0100)]
intel: annotate the private symbols

They are less and easier to track than the public ones. The macro
drm_public will be going away by the end of the series.

Cc: Damien Lespiau <damien.lespiau@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agointel: remove unused mmFindBlock
Emil Velikov [Tue, 31 Mar 2015 20:11:03 +0000 (21:11 +0100)]
intel: remove unused mmFindBlock

The function was never part of the public API and a release or so back
was hidden from the global name-space (list of exported symbols).

According to git log this function was never used internally.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agointel: remove the drm_mm* symbol workarounds
Emil Velikov [Tue, 31 Mar 2015 19:22:50 +0000 (20:22 +0100)]
intel: remove the drm_mm* symbol workarounds

Added with commit 57b4c4c32d3(Move the renaming of mm.c symbols to
symbol duplication/collision with ones that are available elsewhere.

As the public/private symbols of libdrm are properly annotated neither
one of the symbols will end up in the global name-space, thus should no
longer be required.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agofreedreno: add symbols test
Emil Velikov [Tue, 31 Mar 2015 18:24:23 +0000 (19:24 +0100)]
freedreno: add symbols test

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agofreedreno: annotate the private symbols
Emil Velikov [Mon, 23 Mar 2015 21:35:38 +0000 (21:35 +0000)]
freedreno: annotate the private symbols

They are less and easier to track than the public ones. The macro
drm_public will be going away by the end of the series.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoradeon: add symbols test
Emil Velikov [Sun, 5 Apr 2015 14:51:28 +0000 (15:51 +0100)]
radeon: add symbols test

Will allow us to catch when the library exports more symbols than
the ones in the public headers.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoradeon: move bof.[ch] out of libdrm_radeon
Emil Velikov [Mon, 23 Mar 2015 22:28:00 +0000 (22:28 +0000)]
radeon: move bof.[ch] out of libdrm_radeon

The functions(files) are used if one explicitly modifies radeon_cs_gem.c
by setting CS_BOF_DUMP to 1. As bof.[ch] is used (copied) to other
out-of-tree projects, keep them around in the distribution tarball.

Cc: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoconfigure.ac: split -fvisibility and __attribute__((visibility)) checks
Emil Velikov [Mon, 9 Mar 2015 12:18:32 +0000 (12:18 +0000)]
configure.ac: split -fvisibility and __attribute__((visibility)) checks

The former does not imply the latter and vice-versa. One such example is
the Sun compiler.

v2: Add missing closing brakets. (Alan)

Cc: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomodeprint: add missing encoder/connector type names
Rob Clark [Wed, 15 Apr 2015 13:35:00 +0000 (09:35 -0400)]
modeprint: add missing encoder/connector type names

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agointel: Delay testing for userptr until first use
Chris Wilson [Tue, 4 Nov 2014 14:26:49 +0000 (14:26 +0000)]
intel: Delay testing for userptr until first use

Running __mmu_notifier_register() is surprisingly expensive, so let's
not do that unless we have to.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
9 years agomode: Retrieve only the current information for a Connector
Chris Wilson [Wed, 4 Mar 2015 10:07:19 +0000 (10:07 +0000)]
mode: Retrieve only the current information for a Connector

Add a new API that allows the caller to skip any forced probing, which
may require slow i2c to a remote display, and only report the currently
active mode and encoder for a Connector. This is often the information
of interest and is much, much faster than re-retrieving the link status
and EDIDs, e.g. if the caller only wishes to count the number of active
outputs.

v2: Fix error path to avoid double free after a failed GETCONNECTOR
ioctl.

v3: Daniel strongly disapproved of my disjoint in behaviour between
GetConnector and GetConnectorCurrent, and considering how best to make a
drop in replacement for drmmode_output_init() convinced me keeping the
API as consistent as possible was the right approach.

v4: Avoid probing on the second calls to GETCONNECTOR for unconnected
outputs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.com>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Cc: David Herrmann <dh.herrmann@googlemail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agoandroid: remove unnecessary TARGET_OUT_HEADERS variable
Chih-Wei Huang [Tue, 31 Mar 2015 07:32:13 +0000 (15:32 +0800)]
android: remove unnecessary TARGET_OUT_HEADERS variable

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoxf86drmMode.h: inline -> __inline for use with gcc -std=c89 -pedantic
Daniel Kurtz [Wed, 25 Mar 2015 01:01:02 +0000 (18:01 -0700)]
xf86drmMode.h: inline -> __inline for use with gcc -std=c89 -pedantic

Unfortunately, there are some users of libdrm installed headers that like
to be built with -std=c89 -pedantic, which does not like "inline".

However, __inline works.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoxf86drm: Fix ioctl struct clearing in drmAgpEnable
Connor Behan [Tue, 24 Mar 2015 17:53:51 +0000 (13:53 -0400)]
xf86drm: Fix ioctl struct clearing in drmAgpEnable

This one is a bit harder to notice.

Signed-off-by: Connor Behan <connor.behan@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodrm: use correct printf modifiers
Emil Velikov [Sun, 22 Mar 2015 21:52:16 +0000 (21:52 +0000)]
drm: use correct printf modifiers

The valies are unsigned long, thus we should use %lu.

v2: Drop old printf statement. (Jan)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
9 years agodrm: replace HASH_DEBUG with DEBUG
Emil Velikov [Thu, 26 Mar 2015 21:19:26 +0000 (21:19 +0000)]
drm: replace HASH_DEBUG with DEBUG

... and remove the useless SL_DEBUG and RANDOM_DEBUG

v2: Rebase on earlier changes.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
9 years agotests/random: return non-zero on test failure
Emil Velikov [Sun, 5 Apr 2015 14:12:48 +0000 (15:12 +0100)]
tests/random: return non-zero on test failure

... and wire it up to make check

v2: s/rand - state->check/rand != state->check/. (Jan)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
9 years agotests/random: extract test out of xf86drmRandom.c
Emil Velikov [Sun, 22 Mar 2015 21:38:08 +0000 (21:38 +0000)]
tests/random: extract test out of xf86drmRandom.c

With follow up commits we can clear it up and wire to
make check

v2:
 - Use xf86drmRandom.h for common struct.(Jan)
 - Add test to .gitignore.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
9 years agotests/hash: return non-zero on failure
Emil Velikov [Sun, 5 Apr 2015 14:12:16 +0000 (15:12 +0100)]
tests/hash: return non-zero on failure

... and wire up to `make check' now that it's useful.

v2: Really return non-zero on failure.
v3: Initialise ret.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu> (v2)
9 years agotests/hash: style fixes
Emil Velikov [Thu, 26 Mar 2015 23:09:31 +0000 (23:09 +0000)]
tests/hash: style fixes

v2: Rebase on earlier changes. Keep count initialisation as is.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
9 years agotests/hash: misc compilation fixes
Emil Velikov [Sun, 22 Mar 2015 19:58:17 +0000 (19:58 +0000)]
tests/hash: misc compilation fixes

Get the test from completely broken to working like a charm.

 - Use the same variable type for both HashInsert and HashLookup.
 - Use correct storage type for the HashLookup return value.
 - Remove useless backward iteration of HashLookup(i).

v2:
 - Use void * instead of unsigned long.
 - Change value to key << 16 | key.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
9 years agotests/hash: extract test out of xf86drmHash.c
Emil Velikov [Sun, 22 Mar 2015 19:41:12 +0000 (19:41 +0000)]
tests/hash: extract test out of xf86drmHash.c

This way with follow up commits we can fix it and wire it up to
make check

v2:
 - Use xf86drmHash.h for common structs.(Jan)
 - Add test to .gitignore.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
9 years agotests/drmsl: Extract tests out of xf86drmSL.c
Jan Vesely [Fri, 20 Mar 2015 20:58:29 +0000 (16:58 -0400)]
tests/drmsl: Extract tests out of xf86drmSL.c

v2: merge tests creation and xf86drmSL cleanup
    rename tests/drmsltest -> tests/drmsl
    move the test out of libudev test block
v3: run test even on noudev builds

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodrmSL: Fix neighbor lookup
Jan Vesely [Fri, 27 Feb 2015 17:20:32 +0000 (12:20 -0500)]
drmSL: Fix neighbor lookup

Commit e4a519635f75bde38aeb5b09f2ff4efbf73453e9:
    Tidy up compile warnings by cleaning up types.

removed call to SLLocate which gutted the function of all functionality.
This patch restores the original behavior, with an additional fix
that zeros the update array in case SLLocate bails early.

v2: zero the update array instead of checking the return value.
    SLLocate returns NULL both on failure and if the element is greater
    than everything in the list
v3: Improve commit message

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoandroid: remove explicit include to libpciaccess
Emil Velikov [Fri, 20 Mar 2015 18:38:35 +0000 (18:38 +0000)]
android: remove explicit include to libpciaccess

Both android-x86 and android-ia versions of libpciacccess correctly
"export" the include. If anyone else is wrapping up their own version
they should do so as well.

Remove this fixed location hack from the build.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chih-Wei Huang <cwhuang@linux.org.tw>
9 years agotests/exynos: Fix missing static keyword
Jan Vesely [Wed, 18 Mar 2015 18:23:47 +0000 (14:23 -0400)]
tests/exynos: Fix missing static keyword

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
9 years agoRemove drmSetDebugMsgFunction and related infrastructure
Jan Vesely [Wed, 18 Mar 2015 18:17:26 +0000 (14:17 -0400)]
Remove drmSetDebugMsgFunction and related infrastructure

Not used anywhere

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>