OSDN Git Service

android-x86/external-libdrm.git
8 years agoamdgpu: improve the amdgpu_cs_query_fence_status interface
Jammy Zhou [Thu, 9 Jul 2015 05:51:13 +0000 (13:51 +0800)]
amdgpu: improve the amdgpu_cs_query_fence_status interface

make amdgpu_cs_query_fence reusable to support multi-fence query

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: add va range query interface
Sabre Shao [Thu, 9 Jul 2015 05:53:24 +0000 (13:53 +0800)]
amdgpu: add va range query interface

amdgpu_va_range_query interface is added so that client can query va
range supported by specific device.

Signed-off-by: Sabre Shao <Sabre.Shao@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: add va allocation intefaces
Sabre Shao [Thu, 9 Jul 2015 05:50:36 +0000 (13:50 +0800)]
amdgpu: add va allocation intefaces

Two new interfaces are added to support client request for
allocate virtual address without physical memory committed to.
The virtual address space can be managed by client itself.

Signed-off-by: Sabre Shao <Sabre.Shao@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: add base_preferred parameter to amdgpu_vamgr_find_va
Ken Wang [Thu, 9 Jul 2015 05:48:25 +0000 (13:48 +0800)]
amdgpu: add base_preferred parameter to amdgpu_vamgr_find_va

base_preferred parameter is added to amdgpu_vamgr_find_va
so UMD can specify preferred va address when allocating.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: check the user fence only if the IP supports user fences
Marek Olšák [Wed, 8 Jul 2015 09:12:31 +0000 (11:12 +0200)]
amdgpu: check the user fence only if the IP supports user fences

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agodrm/amdgpu: allow passing absolute timeouts to amdgpu_cs_query_fence_status
Marek Olšák [Fri, 26 Jun 2015 19:58:17 +0000 (21:58 +0200)]
drm/amdgpu: allow passing absolute timeouts to amdgpu_cs_query_fence_status

Useful when Mesa wants to wait for a lot of fences at the same time and
doesn't want to recalculate the relative timeout after every call.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: remove reference to AMD specific error codes
Christian König [Tue, 30 Jun 2015 14:27:27 +0000 (16:27 +0200)]
amdgpu: remove reference to AMD specific error codes

We just have never defined any.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: cleanup public interface style
Christian König [Tue, 30 Jun 2015 14:04:44 +0000 (16:04 +0200)]
amdgpu: cleanup public interface style

Fix some style problems, adjust to a common indentation, reorder two
function definitions and remove stale comments.

No intended functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agogitignore: add some generated amdgpu files
Christian König [Tue, 30 Jun 2015 13:46:29 +0000 (15:46 +0200)]
gitignore: add some generated amdgpu files

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: add CS dependencies v2
Christian König [Wed, 24 Jun 2015 12:17:57 +0000 (14:17 +0200)]
amdgpu: add CS dependencies v2

This allows the driver to specify on which previous CS to wait.

v2: fix spelling in comment

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoamdgpu: update to the latest kernel header
Alex Deucher [Mon, 29 Jun 2015 16:02:47 +0000 (12:02 -0400)]
amdgpu: update to the latest kernel header

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: remove pointer arithmetic from command submission
Christian König [Wed, 24 Jun 2015 12:13:00 +0000 (14:13 +0200)]
amdgpu: remove pointer arithmetic from command submission

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoamdgpu: do NULL check for bo handle in amdgpu_bo_query_info
Jammy Zhou [Tue, 16 Jun 2015 14:42:43 +0000 (22:42 +0800)]
amdgpu: do NULL check for bo handle in amdgpu_bo_query_info

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: cleanup VA IOCTL handling
Christian König [Mon, 8 Jun 2015 13:05:07 +0000 (15:05 +0200)]
amdgpu: cleanup VA IOCTL handling

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: remove flink export workaround v2
Christian König [Sat, 6 Jun 2015 10:02:29 +0000 (12:02 +0200)]
amdgpu: remove flink export workaround v2

Alternative solution to Mareks patch to stop causing trouble with render nodes.

v2: rebased

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: explicitly unmap GPU mapping on BO destruction
Christian König [Sat, 6 Jun 2015 10:00:17 +0000 (12:00 +0200)]
amdgpu: explicitly unmap GPU mapping on BO destruction

That exercises the IOCTL and stops relying us on implicit unmapping.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: merge amdgpu_drm.h from kernel
Jammy Zhou [Fri, 5 Jun 2015 21:07:56 +0000 (05:07 +0800)]
amdgpu: merge amdgpu_drm.h from kernel

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: cleanup gds specific alloc/free functions
Jammy Zhou [Fri, 5 Jun 2015 21:02:23 +0000 (05:02 +0800)]
amdgpu: cleanup gds specific alloc/free functions

amdgpu_bo_alloc/free can be used with GDS/OA/QWS domains specified

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: add amdgpu_query_gds_info
Jammy Zhou [Fri, 5 Jun 2015 21:00:36 +0000 (05:00 +0800)]
amdgpu: add amdgpu_query_gds_info

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: fix double mutex_unlock in amdgpu_bo_import
Marek Olšák [Thu, 4 Jun 2015 16:57:57 +0000 (18:57 +0200)]
amdgpu: fix double mutex_unlock in amdgpu_bo_import

The handles array is used below, which is followed by another unlock,
so remove the first one.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: fix valgrind warnings
Marek Olšák [Thu, 4 Jun 2015 16:57:50 +0000 (18:57 +0200)]
amdgpu: fix valgrind warnings

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: use alloca and malloc in critical codepaths (v2)
Marek Olšák [Tue, 2 Jun 2015 12:43:52 +0000 (14:43 +0200)]
amdgpu: use alloca and malloc in critical codepaths (v2)

And don't clear the memory when it's unnecessary.

v2: use malloc for arrays that can be big

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: allow exporting KMS handles with render nodes
Marek Olšák [Thu, 4 Jun 2015 10:47:22 +0000 (12:47 +0200)]
amdgpu: allow exporting KMS handles with render nodes

Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: add zero timeout check in amdgpu_cs_query_fence_status
Jack Xiao [Thu, 4 Jun 2015 02:41:24 +0000 (10:41 +0800)]
amdgpu: add zero timeout check in amdgpu_cs_query_fence_status

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: remove bo_handle from amdgpu_cs_ib_info, IBs should be in buffer list
Marek Olšák [Tue, 2 Jun 2015 11:05:41 +0000 (13:05 +0200)]
amdgpu: remove bo_handle from amdgpu_cs_ib_info, IBs should be in buffer list

Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: remove amdgpu_ib helpers
Marek Olšák [Mon, 1 Jun 2015 12:12:10 +0000 (14:12 +0200)]
amdgpu: remove amdgpu_ib helpers

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: remove amdgpu_ib
Marek Olšák [Fri, 29 May 2015 17:13:41 +0000 (19:13 +0200)]
amdgpu: remove amdgpu_ib

Not useful if we're gonna use BO handles directly.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: don't use amdgpu_cs_create_ib for allocation of the fence BO
Marek Olšák [Fri, 29 May 2015 15:13:12 +0000 (17:13 +0200)]
amdgpu: don't use amdgpu_cs_create_ib for allocation of the fence BO

amdgpu_cs_create_ib will go away.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agotests/amdgpu: manage IB in client side
Jammy Zhou [Mon, 25 May 2015 12:38:03 +0000 (20:38 +0800)]
tests/amdgpu: manage IB in client side

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: get rid of IB pool management v3
Jammy Zhou [Fri, 29 May 2015 10:59:59 +0000 (12:59 +0200)]
amdgpu: get rid of IB pool management v3

v1: by Jammy Zhou
v2: remove bo wait when destroy IB by Jammy Zhou
v3: more cleanups by Marek

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: add ib_start_alignment and ib_size_alignment for interface query
Ken Wang [Wed, 3 Jun 2015 09:23:37 +0000 (17:23 +0800)]
amdgpu: add ib_start_alignment and ib_size_alignment for interface query

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: add ce_ram_size for interface query
Ken Wang [Wed, 3 Jun 2015 09:21:27 +0000 (17:21 +0800)]
amdgpu: add ce_ram_size for interface query

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: add vram_type and vram_bit_width for interface query
Ken Wang [Wed, 3 Jun 2015 09:15:29 +0000 (17:15 +0800)]
amdgpu: add vram_type and vram_bit_width for interface query

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: add max_memory_clock for interface query
Ken Wang [Wed, 3 Jun 2015 09:07:44 +0000 (17:07 +0800)]
amdgpu: add max_memory_clock for interface query

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: rename GEM_OP_SET_INITIAL_DOMAIN -> GEM_OP_SET_PLACEMENT
Marek Olšák [Wed, 27 May 2015 12:31:12 +0000 (14:31 +0200)]
amdgpu: rename GEM_OP_SET_INITIAL_DOMAIN -> GEM_OP_SET_PLACEMENT

No users.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: stop checking flag masks
Christian König [Tue, 19 May 2015 14:06:50 +0000 (16:06 +0200)]
amdgpu: stop checking flag masks

The kernel is responsible for parameter checking, not libdrm.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
8 years agotests/amdgpu: implement VCE unit tests
Leo Liu [Tue, 19 May 2015 16:51:15 +0000 (12:51 -0400)]
tests/amdgpu: implement VCE unit tests

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: make vamgr global
Ken Wang [Thu, 21 May 2015 09:21:21 +0000 (17:21 +0800)]
amdgpu: make vamgr global

This is the first sub-patch of va interface task, the va task is
about adding more va management interfaces for UMD, by design, the
vamgr should be per-process rather than per-device.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agotests/amdgpu: add shared IB submission test v2
Jammy Zhou [Wed, 20 May 2015 20:20:26 +0000 (04:20 +0800)]
tests/amdgpu: add shared IB submission test v2

v2: some function renaming

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: add IB sharing support v2
Jammy Zhou [Wed, 20 May 2015 20:17:48 +0000 (04:17 +0800)]
amdgpu: add IB sharing support v2

A new 'offset' flag is added to the amdgpu_cs_ib_info structure,
which can be used to specify location of PM4 packets to execute
in the IB buffer object

v2: remove the shared IB flag, etc

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: add new AMDGPU_TILING flags
Marek Olšák [Thu, 14 May 2015 22:16:41 +0000 (00:16 +0200)]
amdgpu: add new AMDGPU_TILING flags

Copied from the kernel.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: add helper for VM mapping v2
Christian König [Mon, 18 May 2015 14:10:10 +0000 (16:10 +0200)]
amdgpu: add helper for VM mapping v2

Less code and also provides the map_size parameter.

v2: Also set offset_in_bo, use *_handle defines.

Signed-off-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: remove bo_vas hash table v2
Christian König [Mon, 18 May 2015 13:28:30 +0000 (15:28 +0200)]
amdgpu: remove bo_vas hash table v2

Not used any more.

v2: Keep accidental removed lines.

Signed-off-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: add amdgpu_bo_list_update interface v2
Jammy Zhou [Mon, 18 May 2015 12:27:24 +0000 (20:27 +0800)]
amdgpu: add amdgpu_bo_list_update interface v2

v2: some minor improvement

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: replace alloca with calloc v2
Jammy Zhou [Mon, 18 May 2015 12:57:41 +0000 (20:57 +0800)]
amdgpu: replace alloca with calloc v2

use heap memory instead of stack memory to avoid potential stack overflow
when a large number of resources are used for the bo_list.

v2: some minor improvement

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: remove unused AMDGPU_IB_RESOURCE_PRIORITY
Jammy Zhou [Mon, 18 May 2015 12:50:17 +0000 (20:50 +0800)]
amdgpu: remove unused AMDGPU_IB_RESOURCE_PRIORITY

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: fix the number of IB size enums
Jammy Zhou [Mon, 18 May 2015 11:14:56 +0000 (19:14 +0800)]
amdgpu: fix the number of IB size enums

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: fix a valgrind warning
Marek Olšák [Wed, 6 May 2015 16:59:02 +0000 (18:59 +0200)]
amdgpu: fix a valgrind warning

==10307== Conditional jump or move depends on uninitialised value(s)
==10307==    at 0xB9F4CFA: amdgpu_device_initialize (amdgpu_device.c:193)

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: implement amdgpu_cs_query_reset_state
Marek Olšák [Tue, 5 May 2015 19:23:02 +0000 (21:23 +0200)]
amdgpu: implement amdgpu_cs_query_reset_state

v2: also return the number of hangs

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: fix vamgr_free_va logic
monk.liu [Wed, 13 May 2015 06:01:53 +0000 (14:01 +0800)]
amdgpu: fix vamgr_free_va logic

va+size will overflow if va equals to AMDGPU_INVALID_VA_ADDRESS, just
return when hit that condition

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
8 years agoamdgpu: fix code alignment
monk.liu [Wed, 13 May 2015 05:58:43 +0000 (13:58 +0800)]
amdgpu: fix code alignment

Signed-off-by: monk.liu <monk.liu@amd.com>
8 years agoamdgpu: validate the upper limit of virtual address v2
Jammy Zhou [Tue, 12 May 2015 17:14:11 +0000 (01:14 +0800)]
amdgpu: validate the upper limit of virtual address v2

Only 8GB virtual address space is used by default now

v2: use -ENOSPC for the error case

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: reuse the kernel IB flags v2
Jammy Zhou [Mon, 11 May 2015 15:02:09 +0000 (23:02 +0800)]
amdgpu: reuse the kernel IB flags v2

v2: remove 'CE' from the preamble flag

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: add ctx_id for wait_cs
Jammy Zhou [Fri, 8 May 2015 10:34:20 +0000 (18:34 +0800)]
amdgpu: add ctx_id for wait_cs

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: David Zhou <david1.zhou@amd.com>
8 years agoamdgpu: fix round down/up page size error
Jack Xiao [Thu, 7 May 2015 08:07:03 +0000 (16:07 +0800)]
amdgpu: fix round down/up page size error

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Monk Liu monk.liu@amd.com
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: fix 32-on-64 support (v2)
Jammy Zhou [Thu, 7 May 2015 03:38:28 +0000 (11:38 +0800)]
amdgpu: fix 32-on-64 support (v2)

0xffffffff was appended to the higher 32bit with (intptr_t) when use
32bit libdrm_amdgpu.so with 64bit kernel, and it caused segmentation
fault for 32bit application.

v2: switch to uintptr_t

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoamdgpu: remove AMDGPU_GEM_CREATE_CPU_GTT_UC
Jammy Zhou [Wed, 6 May 2015 10:45:57 +0000 (18:45 +0800)]
amdgpu: remove AMDGPU_GEM_CREATE_CPU_GTT_UC

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: remove active_rb_pipes from amdgpu_gpu_info
Jammy Zhou [Tue, 5 May 2015 07:43:19 +0000 (15:43 +0800)]
amdgpu: remove active_rb_pipes from amdgpu_gpu_info

The active RB pipes can be retrieved from enabled_rb_pipes_mask,
for which each bit indicates one active pipe if it is '1'.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: fix segfault when resources are NULL
monk.liu [Tue, 5 May 2015 07:15:15 +0000 (15:15 +0800)]
amdgpu: fix segfault when resources are NULL

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
8 years agoamdgpu: compare the primary device names instead
Christian König [Thu, 30 Apr 2015 12:13:28 +0000 (14:13 +0200)]
amdgpu: compare the primary device names instead

Instead of taking a look at the device major/minor we
just compare the primary device name to figure out if
two fds are pointing to the same device.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu: add public bo list interface v3
Christian König [Wed, 22 Apr 2015 12:52:34 +0000 (14:52 +0200)]
amdgpu: add public bo list interface v3

v2: cleanup comments and function parameter
v3: rebased on internal branch

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: cleanup public interface v2
Christian König [Wed, 22 Apr 2015 10:21:13 +0000 (12:21 +0200)]
amdgpu: cleanup public interface v2

Remove the mostly unused device parameter, for the few cases
where we really need it keep a copy in the context structure.

v2: rebased on internal branch

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: do not call BO_LIST ioctl when no resource referred
monk.liu [Mon, 27 Apr 2015 07:23:54 +0000 (15:23 +0800)]
amdgpu: do not call BO_LIST ioctl when no resource referred

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: fix an error of bo_list handler
monk.liu [Mon, 27 Apr 2015 02:25:54 +0000 (10:25 +0800)]
amdgpu: fix an error of bo_list handler

original method is just totally wrong, it loses the bo_list handler at
all after command stream accomplished

Signed-off-by: Monk.Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: add missing mutex lock/unlock pair
monk.liu [Thu, 23 Apr 2015 05:19:57 +0000 (13:19 +0800)]
amdgpu: add missing mutex lock/unlock pair

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu: support non-page-aligned userptr
monk.liu [Thu, 23 Apr 2015 05:18:59 +0000 (13:18 +0800)]
amdgpu: support non-page-aligned userptr

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm: add tests/amdgpu (v3)
Alex Deucher [Mon, 20 Apr 2015 16:15:23 +0000 (12:15 -0400)]
drm: add tests/amdgpu (v3)

This adds some basic unit tests for the new amdgpu driver.

v2: use common util_math.h
v3: implement suggestions from Emil
    replace malloc/memset with calloc
    make header guards all caps
    use posix_memalign rather than mem_align
    replace malloc with calloc for pm4 allocations
    make CU_SuiteInfo static
    fix Makefile.am
    fix fd numbering
    use drmGetVersion/drmFreeVersion rather than open coding it
    close fd, clean up CU registry on error

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm: add libdrm_amdgpu (v7)
Alex Deucher [Mon, 20 Apr 2015 16:04:22 +0000 (12:04 -0400)]
drm: add libdrm_amdgpu (v7)

This is the new ioctl wrapper used by the new admgpu driver.
It's primarily used by xf86-video-amdgpu and mesa.

v2: fix amdgpu_drm.h install
v3: Integrate some of the sugestions from Emil:
    clean up Makefile.am, configure.ac
    capitalize header guards
    fix _FILE_OFFSET_BITS with config.h
    use drm_mmap/drm_munmap
    Remove unused ARRAY_SIZE macro
    use shared list implementation
    use shared math implementation
    use drmGetNodeTypeFromFd helper
v4: remove unused tiling defines
v5: include amdgpu.h in Makefile.am
v6: update amdgpu_drm.h
v7: libdrm.h -> libdrm_macros.h

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm: add util_math.h
Alex Deucher [Thu, 23 Apr 2015 20:44:28 +0000 (16:44 -0400)]
drm: add util_math.h

Used by amdgpu, could be used by other components.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm: consolidate common list implementations (v2)
Alex Deucher [Thu, 7 May 2015 17:03:47 +0000 (13:03 -0400)]
drm: consolidate common list implementations (v2)

This is used by radeon and freedreno and will be used
by amdgpu.  I looked at switching to libdrm_lists.h,
but it's pretty horrible.  E.g., DRMLISTFOREACHENTRYSAFE.

v2: remove missed list.h from tests/radeon/Makefile.am

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agointel: Drop aub dumping functionality
Kristian Høgsberg Kristensen [Fri, 31 Jul 2015 17:47:50 +0000 (10:47 -0700)]
intel: Drop aub dumping functionality

We now have a separate tool for this in intel-gpu-tools and we don't
need to clutter up libdrm with this feature. We leave the entry points
in there to avoid breaking API/ABI.

Install intel-gpu-tools, then run (for example)

    $ intel_aubdump --output=trace.aub glxgears -geometry 500x500

See the intel_aubdump man page for more details.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 years agoconfigure.ac: bump version to 2.4.62 for release
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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>