Ben Skeggs [Wed, 25 Nov 2015 22:24:55 +0000 (08:24 +1000)]
nouveau: clean up nouveau.h, noting deprecated members/functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Tue, 24 Nov 2015 03:08:21 +0000 (13:08 +1000)]
nouveau: add support for newer kernel interfaces
v2.
- leave client-provided pointer unmodified on sclass_get() failure
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Tue, 24 Nov 2015 01:21:05 +0000 (11:21 +1000)]
nouveau: add new interface to create a nouveau_device
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Fri, 27 Nov 2015 00:16:13 +0000 (10:16 +1000)]
nouveau: remove nouveau_object_find()
No more internal users, and there's never been external users.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Tue, 24 Nov 2015 01:00:53 +0000 (11:00 +1000)]
nouveau: make use of nouveau_drm::fd instead of nouveau_device::fd
The latter is deprecated, and will not be valid for newer clients.
v2.
- split out nouveau_object_find removal
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Tue, 24 Nov 2015 00:45:01 +0000 (10:45 +1000)]
nouveau: stack legacy nouveau_device on top of nouveau_drm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Tue, 24 Nov 2015 00:33:56 +0000 (10:33 +1000)]
nouveau: introduce object to represent the kernel client
Because NVIF intentionally lacks some of the paths necessary to be
compatible with various mistakes we've made over the years, libdrm
needs to know whether a client has been updated and that it's safe
to make use of the new kernel interfaces.
Clients still using nouveau_device_open()/wrap() will be forced to
make use of ABI16 instead of NVIF.
v2.
- remove lib_version, nothing used it
- leave client-provided pointer unmodified on failure
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Tue, 24 Nov 2015 00:10:04 +0000 (10:10 +1000)]
nouveau: add interfaces to query information about supported classes
This will expose functionality supported by newer kernel interfaces.
Current userspace uses the chipset to determine which classes are likely
exposed, which generally works pretty well, but isn't as flexible as it
could be.
Unfortunately, the G98:GF100 video code in Mesa is still relying on the
kernel exposing incorrect vdec classes on some chipsets. The ABI16
kernel interfaces have a workaround for this in place, but that will no
longer be available once libdrm supports NVIF.
To prevent a regression when NVIF support is added, if there's no kernel
support for NVIF, libdrm will magic up a class list containing correct
vdec classes anyway instead of failing with -ENODEV.
v2.
- add description of abi16/vdec workaround
- add description of sclass/mclass
- leave client-provided pointer unmodified on abi16_sclass() failure
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Mon, 23 Nov 2015 23:58:39 +0000 (09:58 +1000)]
nouveau: add interface to call an object's methods
This will expose functionality supported by newer kernel interfaces,
giving access to things such as ZBC controls, perfmon, etc.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Mon, 23 Nov 2015 23:28:23 +0000 (09:28 +1000)]
nouveau: make it possible to init object in pre-allocated memory
Required for an upcoming patch, not exposed to library clients.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Tue, 24 Nov 2015 04:36:48 +0000 (14:36 +1000)]
nouveau: move object functions up, to avoid future foward decls
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Mon, 23 Nov 2015 23:17:52 +0000 (09:17 +1000)]
nouveau: move more abi16-specific logic into abi16.c
v2.
- add a comment about the (ab)use of nouveau_object::length
- add a comment about abi16_object() return values
v3.
- handle new client + old kernel for sw classes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Ben Skeggs [Thu, 29 Oct 2015 23:27:13 +0000 (09:27 +1000)]
nouveau: import and install a selection of nvif headers from the kernel
This commit also modifies the install path of the main libdrm_nouveau
header to be under a nouveau/ subdirectory.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Stefan Agner [Fri, 18 Dec 2015 08:14:49 +0000 (00:14 -0800)]
tests: remove missleading comments
The comment has been copied from modetest and is not applicable
for vbltest.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Thierry Reding [Wed, 9 Dec 2015 17:37:48 +0000 (18:37 +0100)]
vbltest: Use util_open()
Use the new util_open() helper instead of open-coding the method for
finding a usable device. While at it, this adds -D and -M command-line
options to vbltest to make its usage more consistent with its siblings
modetest and proptest.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:47 +0000 (18:37 +0100)]
proptest: Use util_open()
Use the new util_open() helper instead of open-coding the method for
finding a usable device. While at it, make the command-line interface
more consistent with that of modetest by adding the -D and -M options.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:46 +0000 (18:37 +0100)]
modetest: Use util_open()
Use the new util_open() helper instead of open-coding the method for
finding a usable device.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:45 +0000 (18:37 +0100)]
tests: Add helper to open a device/module
The new function util_open() encapsulates the standard method employed
by tests to open a device or module. There is a verbatim copy of this in
almost all test programs, with slight variations in the list of modules.
Moving this code into a common helper allows code reuse and makes tests
more consistent.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:44 +0000 (18:37 +0100)]
tests: kms: Implement universal planes test
This small program allows universal planes to be tested. Currently this
isn't very flexible because it allows only the first plane of a given
type to be tested on the first CRTC. However it should be simple to
extend this with some additional command-line arguments.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:43 +0000 (18:37 +0100)]
tests: kms: Implement CRTC stealing test
This test program sets a mode and framebuffer on a connector and cycles
through all CRTCs, moving the connector to each of them in turn. This is
useful to verify that CRTC stealing is properly handled in the DRM core
and drivers.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:42 +0000 (18:37 +0100)]
tests: Add libkms-test library
This library contains abstractions for KMS that help remove the need for
a lot of boilerplate in KMS test programs.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:41 +0000 (18:37 +0100)]
proptest: Add Android support
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:40 +0000 (18:37 +0100)]
tests: Move name tables to libutil
These tables are duplicated in several places, so move them into libutil
so that they can be shared.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Thierry Reding [Wed, 9 Dec 2015 17:37:39 +0000 (18:37 +0100)]
tests: Split helpers into library
Some of the helpers, such as the pattern drawing helpers or the format
lookup helpers, have potential to be reused. Move them into a separate
library to make it easier to share them.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:21 +0000 (12:12 +0900)]
exynos: bump version number
The Exynos API was extended quite a bit, so reflect this in the
version number.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:20 +0000 (12:12 +0900)]
tests/exynos: add test for g2d_move
To check if g2d_move() works properly we create a small checkerboard
pattern in the center of the screen and then shift this pattern
around with g2d_move(). The pattern should be properly preserved
by the operation (but not the surrounding area).
Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
Reviewed-by: Hyungwon Hwang <human.hwang@samsung.com>
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
[Emil Velikov: add g2d_move to the symbol check]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:19 +0000 (12:12 +0900)]
exynos/fimg2d: add g2d_move
We already have g2d_copy() which implements G2D copy
operations from one buffer to another. However we can't
do a overlapping copy operation in one buffer.
Add g2d_move() which acts like the standard memmove()
and properly handles overlapping copies.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:18 +0000 (12:12 +0900)]
exynos: fimg2d: add g2d_set_direction
This allows setting the two direction registers, which specify how
the engine blits pixels. This can be used for overlapping blits,
which happen e.g. when 'moving' a rectangular region inside a
fixed buffer.
Reviewed-by: Hyungwon Hwang <human.hwang@samsung.com>
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:17 +0000 (12:12 +0900)]
tests/exynos: use XRGB8888 for framebuffer
This matches the G2D color mode that is used in the entire code.
The previous (incorrect) RGBA8888 would only work since the
Exynos mixer did its configuration based on the bpp, and not
based on the actual pixelformat.
Reviewed-by: Hyungwon Hwang <human.hwang@samsung.com>
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:16 +0000 (12:12 +0900)]
tests/exynos: add fimg2d event test
This tests async processing of G2D jobs. A separate thread is spawned
to monitor the DRM fd for events and check whether a G2D job was
completed.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:15 +0000 (12:12 +0900)]
exynos/fimg2d: add g2d_config_event
This enables us to pass command buffers to the kernel which
trigger an event on the DRM fd upon completion.
The final goal is to enable asynchronous operation of the
G2D engine, similar to async page flips.
Passing the event userdata pointer through the G2D context
was chosen to not change the current API (e.g. by adding
a userdata argument to each public functions).
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:14 +0000 (12:12 +0900)]
tests/exynos: add fimg2d performance analysis
Currently only fast solid color clear performance is measured.
A large buffer is allocated and solid color clear operations
are executed on it with randomly chosen properties (position
and size of the region, clear color). Execution time is
measured and output together with the amount of pixels
processed.
The 'simple' variant only executes one G2D command buffer at
a time, while the 'multi' variant executes multiple ones. This
can be used to measure setup/exec overhead.
The test also serves a stability check. If clocks/voltages are
too high or low respectively, the test quickly reveals this.
Tested-by: Hyungwon Hwang <human.hwang@samsung.com>
Reviewed-by: Hyungwon Hwang <human.hwang@samsung.com>
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Tobias Jakobi [Mon, 30 Nov 2015 03:12:13 +0000 (12:12 +0900)]
exynos: Introduce exynos_handle_event()
Used to handle kernel events specific to the Exynos platform.
Currently only G2D events are handled.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
Kristian Høgsberg Kristensen [Mon, 14 Dec 2015 19:33:26 +0000 (11:33 -0800)]
intel: Add drm_intel_bo_set_softpin_offset to intel-symbol-check
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Kristian Høgsberg Kristensen [Mon, 14 Dec 2015 18:55:55 +0000 (10:55 -0800)]
Add tests/drmdevice to .gitignore
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Michał Winiarski [Wed, 9 Sep 2015 14:07:10 +0000 (16:07 +0200)]
intel: Add support for softpin
Softpin allows userspace to take greater control of GPU virtual address
space and eliminates the need of relocations. It can also be used to
mirror addresses between GPU and CPU (shared virtual memory).
Calls to drm_intel_bo_emit_reloc are still required to build the list of
drm_i915_gem_exec_objects at exec time, but no entries in relocs are
created. Self-relocs don't make any sense for softpinned objects and can
indicate a programming errors, thus are forbidden. Softpinned objects
are marked by asterisk in debug dumps.
Cc: Thomas Daniel <thomas.daniel@intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Cc: Zou Nanhai <nanhai.zou@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Michel Thierry [Thu, 3 Sep 2015 14:23:59 +0000 (15:23 +0100)]
intel: add drm_intel_bo_use_48b_address_range to symbol-check test
Signed-off-by: Michel Thierry <michel.thierry@intel.com>
Reviewed-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Michel Thierry [Thu, 3 Sep 2015 14:23:58 +0000 (15:23 +0100)]
intel: 48b ppgtt support (EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag)
Gen8+ supports 48-bit virtual addresses, but some objects must always be
allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000)
General State Heap (GSH) or Instruction State Heap (ISH) must be in a
32-bit range, because the General State Offset and Instruction State Offset
are limited to 32-bits.
The i915 driver has been modified to provide a flag to set when the 4GB
limit is not necessary in a given bo (EXEC_OBJECT_SUPPORTS_48B_ADDRESS).
48-bit range will only be used when explicitly requested.
Callers to the existing drm_intel_bo_emit_reloc function should set the
use_48b_address_range flag beforehand, in order to use full ppgtt range.
v2: Make set/clear functions nops on pre-gen8 platforms, and use them
internally in emit_reloc functions (Ben)
s/48BADDRESS/48B_ADDRESS/ (Dave)
v3: Keep set/clear functions internal, no-one needs to use them directly.
v4: Don't set 48bit-support flag in emit reloc, check for ppgtt type
before enabling set/clear function, print full offsets in debug
statements, using port of lower_32_bits and upper_32_bits from linux
kernel (Michał)
References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Signed-off-by: Michel Thierry <michel.thierry@intel.com>
Reviewed-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Kristian Høgsberg Kristensen [Mon, 14 Dec 2015 19:27:53 +0000 (11:27 -0800)]
intel: Update i915_drm.h
Copy from drm-intel-nightly
a307a3a81c2bf2883457e03abcf5c9520cf452c1.
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Chih-Wei Huang [Fri, 30 Oct 2015 03:49:42 +0000 (11:49 +0800)]
intel: add the missing <strings.h> include
It defines the prototype of ffs that fixes the building error
on Android 6.0 64-bit image.
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tom St Denis [Tue, 17 Nov 2015 15:58:36 +0000 (10:58 -0500)]
amdgpu: Make amdgpu_cs_calculate_timeout() return something sensible on error
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Jammy Zhou [Tue, 17 Nov 2015 09:14:35 +0000 (17:14 +0800)]
amdgpu: fix overflow for timeout calculation
Set the timeout to AMDGPU_TIMEOUT_INFINITE when overflow happens
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Emil Velikov [Mon, 16 Nov 2015 13:51:01 +0000 (13:51 +0000)]
configure.ac: test for the same atomic function as the one we use
Unlikely that we'll hit a case where __sync_fetch_and_add is present
while __sync_add_and_fetch isn't. Regardless let's keep things sane and
consistent.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Jonathan Gray [Sat, 29 Aug 2015 07:32:50 +0000 (17:32 +1000)]
configure.ac: rework compiler builtin atomic tests
The libdrm autoconf test for atomics uses __sync_val_compare_and_swap with
the address of a function argument which triggers a gcc ICE on sparc64
with the OpenBSD system compiler.
Mark Kettenis pointed out that while other architectures probably spill the
argument onto the stack this is likely not the case on register window
architectures like SPARC and suggested passing a pointer as an argument
instead which avoids the ICE and allows the drm libraries requiring
atomics to build on sparc64 with the autoconf build.
Reported-by: Christian Weisgerber <naddy@openbsd.org>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Matthieu Herrb <matthieu@openbsd.org>
Michel Dänzer [Tue, 8 Sep 2015 06:03:55 +0000 (15:03 +0900)]
radeon: Handle surface offsets exceeding 32 bits correctly
The slice_size and bo_size fields were getting truncated to 32 bits.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tvrtko Ursulin [Wed, 23 Sep 2015 12:33:16 +0000 (13:33 +0100)]
libdrm: Use userspace compatible type in fourcc_mod_code macro
__u64 should be used instead of u64.
Kernel headers originally pulled in:
commit
8983fe5497e89a3ffaba3ad1ee06a30a1c7e6daf
Author: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Date: Mon Aug 3 10:48:03 2015 +0100
libdrm: Add framebuffer modifiers uapi
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Rob Clark <robdclark@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Ben Widawsky [Thu, 22 Oct 2015 19:06:59 +0000 (12:06 -0700)]
intel: Cleanup SKL PCI ID definitions.
This removes ones which aren't used, and adds some new ones. I kept the original
names where possible.
Cc: Kristian Høgsberg <krh@bitplanet.net>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Ben Widawsky [Thu, 22 Oct 2015 19:15:50 +0000 (12:15 -0700)]
intel: Add SKL GT4 PCI IDs
Cc: Kristian Høgsberg <krh@bitplanet.net>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tom St Denis [Fri, 9 Oct 2015 16:46:40 +0000 (12:46 -0400)]
amdgpu: Cleanly handle ENOMEM on result in amdgpu_bo_list_create()
Move the allocation of result prior to the IOCTL so we can cleanly
backtrack if the allocation fails.
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tom St Denis [Fri, 9 Oct 2015 16:07:26 +0000 (12:07 -0400)]
amdgpu: Fix use-after-free bug in vamgr_deinit
This patch fixes a use-after-free bug in the vamgr_deinit function.
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tom St Denis [Fri, 9 Oct 2015 14:36:04 +0000 (10:36 -0400)]
amdgpu: Unlock mutex if base_required is invalid
In the function amdgpu_vamgr_find_va() the function would return
without unlocking the mutex if the base_required offset was below
the va managers base offset.
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Dave Airlie [Tue, 20 Oct 2015 23:21:07 +0000 (09:21 +1000)]
drm: add virtgpu_drm.h
This is in drm-next now, so add to libdrm.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Matt Roper [Fri, 16 Oct 2015 22:11:24 +0000 (15:11 -0700)]
xf86drm: Handle unrecognized subsystems safely in drmGetDevice[s]()
Both drmGetDevice() and drmGetDevices() currently print a warning when
they encounter an unknown (non-PCI) subsystem type for a device node,
but they still proceed to assume that the drmDevicePtr was initialized
and try to add it to the local device array. Add a 'continue' to the
error case handling to bypass the rest of the processing for devices we
can't handle.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Matt Roper [Fri, 16 Oct 2015 22:11:23 +0000 (15:11 -0700)]
xf86drm: Fix error handling for drmGetDevice()
Some of the error conditions in drmGetDevice() can lead to us calling
closedir(NULL) or leaking memory. Fix these conditions the same way we
did for drmGetDevices() in commit:
commit
8c4a1cbd98bd8d185d489395f33302a17db643a9
Author: Matt Roper <matthew.d.roper@intel.com>
Date: Wed Sep 30 09:30:51 2015 -0700
xf86drm: Fix error handling for drmGetDevices()
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Michel Dänzer [Wed, 14 Oct 2015 03:48:52 +0000 (12:48 +0900)]
Fix void pointer arithmetic in drmProcessPciDevice
Arithmetic on void pointers is a GCC extension.
CC libdrm_la-xf86drm.lo
../xf86drm.c: In function 'drmProcessPciDevice':
../xf86drm.c:3017:10: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
addr += sizeof(drmDevice);
^
../xf86drm.c:3020:10: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
addr += DRM_NODE_MAX * sizeof(void *);
^
../xf86drm.c:3023:14: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
addr += max_node_str;
^
../xf86drm.c:3035:14: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
addr += sizeof(drmPciBusInfo);
^
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Matt Roper [Wed, 30 Sep 2015 16:30:51 +0000 (09:30 -0700)]
xf86drm: Fix error handling for drmGetDevices()
If the opendir() call in drmGetDevices() returns failure, we jump to an
error label that calls closedir() and then returns. However this means
that we're calling closedir(NULL) which may not be safe on all
implementations. We are also leaking the local_devices array that was
allocated before the opendir() call.
Fix both of these issues by jumping to an earlier error label (to free
local_devices) and guarding the closedir() call with a NULL test.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
[Emil Velikov: make the teardown symmetrical, remove the NULL check]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Felix Janda [Sat, 26 Sep 2015 06:08:43 +0000 (08:08 +0200)]
xf86drm: include <limits.h> for PATH_MAX
fixes compilation error with musl libc and Solaris based platforms.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92082
Signed-off-by: Felix Janda <felix.janda@posteo.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Fri, 7 Aug 2015 15:13:32 +0000 (16:13 +0100)]
xf86drm: remove makedev() hack/workaround
Back when this was introduced commit
569da5a42eb(Merged glxmisc-3-0-0)
sys/sysmacros.h was used instead of the respecive headers (as per the
manual).
We've been handling it correctly for a little while now - in Linux, BSD
and Solaris. Thus we can drop this workaround.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:34 +0000 (17:22 +0200)]
exynos/fimg2d: remove g2d_context from public header
All functions from the public API only operation on
struct g2d_context*, so this shouldn't break too much.
Make the context private since we don't want the
user to modify its content directly. Also remove
the defines that were only used for fields of
g2d_context.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:33 +0000 (17:22 +0200)]
exynos/fimg2d: add message prefix
Add a prefix to the messages printed to the console via
printf() and fprintf() so that one can easily see where
the message comes from.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:32 +0000 (17:22 +0200)]
exynos/fimg2d: make g2d_add_cmd() less heavy
The function currently checks for each added command
if an overflow of the corresponding command buffers
occurs, but none of the callers ever checks the
return value.
Since all callers are now converted to use
g2d_check_space() simplify the function.
(1) The overflow checks become asserts, so they're only
active for debug builds. This is fine since
g2d_add_cmd() is not part of the public API.
(2) Switch the return value to void.
(3) Explicitly state that the caller has to check
buffer space before calling g2d_add_cmd().
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:31 +0000 (17:22 +0200)]
exynos/fimg2d: remove superfluous initialization of g2d_point_val
The g2d_point_val union consists of two coordinates of 16
bits. Whenever this union is used though, both coordinates
are explicitly set. Hence prior initialization is unnecessary.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:30 +0000 (17:22 +0200)]
exynos/fimg2d: remove default case from g2d_get_blend_op()
We now validate the blending mode via g2d_validate_mode()
prior to feeding it to g2d_get_blend_op().
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:29 +0000 (17:22 +0200)]
exynos/fimg2d: add g2d_validate_xyz() functions
The G2D headers define a number of modes through enums
(like e.g. color, select, repeat, etc.).
This introduces g2d_validate_select_mode() and
g2d_validate_blending_op() which validate a
select mode or blending operation respectively.
Use this together with g2d_check_space() in
g2d_{blend,scale_and_blend}().
For this we move parameter validation to the top and
also validate the select mode of the source image and
the requested blending operation before starting
command submission.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:28 +0000 (17:22 +0200)]
exynos/fimg2d: add g2d_check_space()
This is going to be used to check if the command buffers have
enough space left prior to actual submission of the commands.
Use this in g2d_{solid_fill,copy,copy_with_scale}().
For this the parameter validation before buffer space
checking so that we can exit early if it fails.
Also don't reset the G2D context in this situation since
the buffers are not partially submitted anymore.
The repeat mode in g2d_copy_with_scale() is checked first
to make computation of space easier.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:27 +0000 (17:22 +0200)]
exynos/fimg2d: simplify base address submission in g2d_scale_and_blend()
Use g2d_add_base_addr() for source and destination base
address just like all other calls.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tobias Jakobi [Tue, 8 Sep 2015 15:22:26 +0000 (17:22 +0200)]
exynos/fimg2d: fix empty buffer handling in g2d_flush()
Empty command buffers are no error, we just don't have
anything to do for flushing then.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Mon, 21 Sep 2015 16:29:55 +0000 (17:29 +0100)]
Fix SunOS/NetBSD atomic macro
Reported-by: Evgeny Litvinenko <evgeny.v.litvinenko@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Wed, 9 Sep 2015 17:13:01 +0000 (18:13 +0100)]
tests/drmdevice: add drm{Get,Free}Device() example
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Wed, 9 Sep 2015 15:02:18 +0000 (16:02 +0100)]
xf86drm: add drm{Get,Free}Device
Similar interface to the *Devices() ones but they obtain/free the
information of the opened device (as given by its fd).
Note there is a fair bit of duplication between the two Get functions,
and anyone interested is more than welcome to consolidate it.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Wed, 9 Sep 2015 16:54:34 +0000 (17:54 +0100)]
xf86drm: split out drmProcessPciDevice and drmFoldDuplicatedDevices
Will be reused in the next commit.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Mon, 7 Sep 2015 17:29:05 +0000 (18:29 +0100)]
xf86drm: warn on missing drmGetMinorNameForFD implementation
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Mon, 7 Sep 2015 17:26:34 +0000 (18:26 +0100)]
xf86drm: move ifdef __linux__ guards where needed
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Mon, 7 Sep 2015 12:54:32 +0000 (13:54 +0100)]
xf86drm: rework drmGetDevices()
Do a once off memory allocation for each drmDevice.
This allows us to ease the error handling and simplify the
de-duplication loop. As part of this we need to rework drmFreeDevice()
such so that it frees the relevant hunks, rather than leaving that to
the caller.
Some memory stats from the drmdevice test
before: 22 allocs, 22 frees, 66,922 bytes allocated
after: 9 allocs, 9 frees, 66,436 bytes allocated
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Mon, 7 Sep 2015 13:13:32 +0000 (14:13 +0100)]
util_math: add MAX3 macro
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Mon, 7 Sep 2015 12:51:54 +0000 (13:51 +0100)]
xf86drm: rename drmSameDevice to drmCompareBusInfo
Move away form the boolean name, change the return value
appropriately and check if either argument is NULL.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Mon, 7 Sep 2015 11:54:27 +0000 (12:54 +0100)]
xf86drm: move the final linux specific bits out of drmGetDevices
Third and final piece of making drmGetDevices less crazy/ugly.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Mon, 7 Sep 2015 11:47:47 +0000 (12:47 +0100)]
xf86drm: move platform details to drmParsePciDeviceInfo()
As with previous commit let's try to keep drmGetDevices clean of linux
specifics.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Mon, 7 Sep 2015 11:37:57 +0000 (12:37 +0100)]
xf86drm: flex platform specifics into drmParsePciBusInfo
This will allow one to reuse the core drmGetDevices implementation on
other platforms. Keeping all the platform specifics in ParseFoo.
On the plus side this saves a bit of code :)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Wed, 9 Sep 2015 15:48:29 +0000 (16:48 +0100)]
tests/drmdevice: add new 'test'
A simple example of how to use/what is the new drm{Get,Free}Devices()
interface.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Sat, 5 Sep 2015 16:20:53 +0000 (17:20 +0100)]
xf86drmMode: smoke-test the atomic API
As going through the modetest patches for atomic support I've noticed
that if we pass NULL for the drmModeAtomicReqPtr argument we'll crash.
So let's handle things appropriately if the user forgot to check the
return value of drmModeAtomicAlloc and drmModeAtomicDuplicate or made a
typo somewhere along the way.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Rob Clark <robclark@freedesktop.org>
Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Fri, 4 Sep 2015 21:06:44 +0000 (22:06 +0100)]
automake: set --enable-valgrind during make distcheck
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Rob Clark [Fri, 4 Sep 2015 15:44:33 +0000 (11:44 -0400)]
freedreno: debug msg cleanup
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Rob Clark [Fri, 4 Sep 2015 15:41:47 +0000 (11:41 -0400)]
freedreno: drop exported dmabuf fd tracking
There is really no reason to keep around the fd, it just consumes an
extra file handle.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Rob Clark [Sat, 29 Aug 2015 16:49:28 +0000 (12:49 -0400)]
freedreno: don't reuse exported buffers
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Rob Clark [Wed, 16 Sep 2015 13:03:40 +0000 (09:03 -0400)]
Bump version for release
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Alan Coopersmith [Sun, 6 Sep 2015 16:34:31 +0000 (09:34 -0700)]
Include <alloca.h> when needed before calling alloca
Fixes "error: implicit declaration of function 'alloca'" failures
when building on Solaris
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tvrtko Ursulin [Mon, 3 Aug 2015 09:48:03 +0000 (10:48 +0100)]
libdrm: Add framebuffer modifiers uapi
Sync up with new kernel features as per commits:
e3eb3250d84ef97b766312345774367b6a310db8
93b81f5102a7cd270a305c2741b17c8d44bb0629
b5ff6e1637b683d5996ae11ac29afe406c0bee90
8c4f83fb1e8bf317e894f62d17a63c32b7a6b75e
570655b09b065d2fff1b8ab9bdb8308f4c5a05a3
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Rob Clark <robdclark@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Michel Dänzer [Mon, 7 Sep 2015 10:02:14 +0000 (19:02 +0900)]
tests: Add -lm to LDADD for dristat
Fixes build failure due to unresolved log2.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sat, 15 Aug 2015 16:00:37 +0000 (17:00 +0100)]
configure: remove -Wno-missing-field-initializers
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sun, 23 Aug 2015 13:20:17 +0000 (14:20 +0100)]
intel: ignore missing-field-initializers warnings
We're about to remove the -Wno flag from configure.ac which will lead
to a lot of unnecessary spam.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sat, 15 Aug 2015 17:01:53 +0000 (18:01 +0100)]
nouveau: use designated initializers
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sun, 23 Aug 2015 13:44:55 +0000 (14:44 +0100)]
tests/amdgpu: ensure tests work by using c99 initializers
In the latest version of CUnit the fourth parameter of the CU_SuiteInfo
struct is pSetUpFunc rather than *pTests.
Seems like the CUnit ABI broke at some point, so let's the the robust
thing and use c99 designated initializers to correctly populate the
struct(s).
Cc: Leo Liu <leo.liu@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Sat, 15 Aug 2015 16:35:58 +0000 (17:35 +0100)]
tests/amdgpu: annotate (most of) the vce templates as const data
The remaining two templates are modified on the fly, depending on the
type of test to be performed.
Cc: Leo Liu <leo.liu@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Sat, 15 Aug 2015 16:25:21 +0000 (17:25 +0100)]
tests/amdgpu: annotate the uvd message templates as const data
Cc: Leo Liu <leo.liu@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Sat, 15 Aug 2015 16:24:21 +0000 (17:24 +0100)]
tests/amdgpu: reference the correct variable for memcpy
Cc: Leo Liu <leo.liu@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Sat, 15 Aug 2015 16:17:52 +0000 (17:17 +0100)]
freedreno: annotate the device/bo/pipe/ringbuffer funcs as const data
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sat, 15 Aug 2015 16:12:13 +0000 (17:12 +0100)]
radeon: cleanup bo/cs func tables
Annotate the data as static const and use C99 designated initializers.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Emil Velikov [Sat, 15 Aug 2015 16:01:55 +0000 (17:01 +0100)]
libkms: use static const for good measure
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Sat, 15 Aug 2015 16:00:56 +0000 (17:00 +0100)]
modetest: annotate const data as such for good measure
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>