[PATCH libdrm 1/3] amdgpu: verify the tested device

2017-01-24 Thread Alex Xie
. amdgpu_test is not for USB device for the time being. Get the name of node from function drmGetDevices2. Drop the legacy drmAvailable() from the test. Signed-off-by: Alex Xie <alexbin@amd.com> --- tests/amdgpu/amdgpu_test.c | 145 +++--

[PATCH libdrm 2/3] amdgpu: A new option to choose which device to run most tests

2017-01-24 Thread Alex Xie
1 #fail as expected ./amdgpu_test -b -d 0 #pass Signed-off-by: Alex Xie <alexbin@amd.com> --- tests/amdgpu/amdgpu_test.c | 133 +++-- 1 file changed, 116 insertions(+), 17 deletions(-) diff --git a/tests/amdgpu/amdgpu_test.c b/tests/

[PATCH libdrm 3/3] amdgpu: A new option to run tests on render node

2017-01-24 Thread Alex Xie
-by: Alex Xie <alexbin@amd.com> --- tests/amdgpu/amdgpu_test.c | 13 ++--- tests/amdgpu/amdgpu_test.h | 3 +++ tests/amdgpu/bo_tests.c| 5 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c index c01ee54..3

[PATCH libdrm 1/3] amdgpu: verify the tested device

2017-01-19 Thread Alex Xie
Verify the vender ID and driver name. Open all AMDGPU devices. Provide an option to open render node. Tested as root: PASS Tested as non-privileged user: All tests failed as expected Signed-off-by: Alex Xie <alexbin@amd.com> --- tests/amdgpu/amdgpu_test.c

[PATCH libdrm 2/3] amdgpu: A new option to choose which device to run most tests

2017-01-19 Thread Alex Xie
This can be used to test multiple GPUs Signed-off-by: Alex Xie <alexbin@amd.com> --- tests/amdgpu/amdgpu_test.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c index e42ef9d..2437db4

[PATCH libdrm 3/3] amdgpu: A new option to run tests on render node

2017-01-19 Thread Alex Xie
Tested: 1. As root, tests passed on primary. 2. As root, BO export/import failed on render node as expected. 3. As non-privileged user, tests failed on primary as expected. 4. As non-privileged user, only BO export/import failed on render node as expected. Signed-off-by: Alex Xie <alex

[PATCH libdrm] amdgpu: Provide more specific error message if non-privileged user runs amdgpu_test

2017-01-12 Thread Alex Xie
it message within 80 characters per line. Update commit message. Remove a space before starting parenthesis in function call. Change-Id: Ib891c40ec812053f49ce5a99909455ac3137e32c Signed-off-by: Alex Xie <alexbin@amd.com> --- tests/amdgpu/basic_tests.c | 7 ++- tests/amdgpu/b

[PATCH] drm/amdgpu: Fix 32bit x86 compilation warning

2017-03-28 Thread Alex Xie
shift count >= width of type [enabled by default] Reported by: kbuild-...@01.org Change-Id: I0c3e52f7fd1026d07ac1042b5e8796fbdf09afff Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 2 +- driv

[PATCH] drm/amdgpu: Move function amdgpu_has_atpx near other similar functions

2017-04-04 Thread Alex Xie
Change-Id: I1266af0697146369c9fb720b241bfa02280571c9 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/

[PATCH] drm/amdgpu: fix compile warning

2017-04-06 Thread Alex Xie
warning: comparison of distinct pointer types lacks a cast Change-Id: I317eddd1bd430c98a3c50ec170f592f944081a6e Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/

[PATCH 1/2] drm/amdgpu: Avoid using signed integer to store pointer value

2017-04-05 Thread Alex Xie
Change-Id: I861ba3c85c182fdb6b89533029b3272191f331f5 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- 3 files changed, 3 insertions

[PATCH 2/2] drm/amdgpu: use uintptr_t instead of unsigned long to store pointer

2017-04-05 Thread Alex Xie
Change-Id: Ic1cb6252482bcf9602c7700c3db075b9edf20e2a Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/

[PATCH] dmr/amdgpu: Fix wrongly unref of BO

2017-04-13 Thread Alex Xie
: If76071a768950a0d3ad9d5da7fcae04881807621 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 53996e3..1

[PATCH v2 2/2] drm/amdgpu: print debug message when fails to reserve BO

2017-04-18 Thread Alex Xie
Change-Id: Ie5a6ba045bde07ccd35b27690709ad1670139447 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

[PATCH v2 1/2] dmr/amdgpu: Fix wrongly unref of BO

2017-04-18 Thread Alex Xie
: If76071a768950a0d3ad9d5da7fcae04881807621 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index a09ad3cf..7

[PATCH] drm/amdgpu: Fix compilation warning

2017-04-05 Thread Alex Xie
Change-Id: Ia251723599024fe258b018a53078d340af01207e Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +- 4

[PATCH] drm/amdgpu: Fix blocking in RCU critical section(v2)

2017-07-19 Thread Alex Xie
apping+0x83/0x83 [amdgpu] [ 141.965942] ? trace_hardirqs_on_caller+0x16a/0x186 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_

[PATCH] drm/amdgpu: Free resources of bo_list when idr_alloc fails

2017-07-05 Thread Alex Xie
Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c index efa6903..dc87962 100644 --- a/d

Re: [PATCH 2/2] drm/amdgpu: Fix use of interruptible waiting

2017-04-26 Thread Alex Xie
of signals to a GUI process which uses this IOCTL. Thanks, Alex Bin On 17-04-26 04:34 AM, Christian König wrote: Am 26.04.2017 um 03:17 schrieb Michel Dänzer: On 26/04/17 06:25 AM, Alex Xie wrote: 1. The wait is short. There is not much benefit by interruptible waiting. 2. In this function

[PATCH 2/4] drm/amdgpu: Fix use of interruptible waiting 1. The signal interrupt can affect the expected behaviour. 2. There is no mechanism to handle the corresponding error.

2017-04-24 Thread Alex Xie
Change-Id: I43f3b0b420833a02ad5ece3ddeef04c6512667e9 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/

[PATCH 4/4] drm/amdgpu: Fix use of interruptible waiting 1. The signal interrupt can affect the expected behaviour. 2. There is no good mechanism to handle the corresponding error.

2017-04-24 Thread Alex Xie
Change-Id: I504cc9c280c70fa832cb64e6a1e0f8b4a1f3cbfd Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/

[PATCH 1/4] drm/amdgpu: Fix potential issue if reserve function is interrupted If amdgpu_bo_reserve function is interrupted by signal, amdgpu_bo_kunmap function is not called.

2017-04-24 Thread Alex Xie
Change-Id: Ide2b3be6549b3afb8d6116094b5fff495b18addf Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/

[PATCH 2/2] drm/amdgpu: Fix use of interruptible waiting 1. The signal interrupt can affect the expected behaviour. 2. There is no good mechanism to handle the corresponding error. When signal interru

2017-04-24 Thread Alex Xie
Change-Id: I6889a4d9dd2703bcf5d448d18f6af51c496a93c9 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c b/drivers/gpu/drm/amd/

[PATCH 1/2] drm/amdgpu: Real return value can be over-written when clean up

2017-04-24 Thread Alex Xie
Change-Id: Ib69f035eeb213a1aec5025e0a9f4515065706118 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c b/drivers/gpu/d

[PATCH 3/4] drm/amdgpu: Fix use of interruptible waiting 1. The signal interrupt can affect the expected behaviour. 2. There is no good mechanism to handle the corresponding error.

2017-04-24 Thread Alex Xie
Change-Id: I43f3b0b420833a02ad5ece3ddeef04c6512667e9 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/

[PATCH] drm/amdgpu: Fix use of interruptible waiting

2017-04-25 Thread Alex Xie
. Future caller of these functions might have same issue. Change-Id: Ifc0e0ab862f98cdc6cdaef87cd96f11c91d64f27 Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/g

[PATCH 1/2] drm/amdgpu: Fix use of interruptible waiting

2017-04-25 Thread Alex Xie
There is no good mechanism to handle the corresponding error. When signal interrupt happens, unpin is not called. As a result, inside AMDGPU, the statistic of pin size will be wrong. Change-Id: I4a06a227c2757c447cec0058ace4b028553658a2 Signed-off-by: Alex Xie <alexbin@amd.com> --- d

[PATCH 2/2] drm/amdgpu: Fix use of interruptible waiting

2017-04-25 Thread Alex Xie
1. The wait is short. There is not much benefit by interruptible waiting. 2. In this function and caller functions, the error handling for such interrupt is complicated and risky. Change-Id: I289674ecd3f5ef20c93fe63e33df6d668b3c2edc Signed-off-by: Alex Xie <alexbin@amd.com> --- drive

[PATCH 2/4] drm/amdgpu: Optimization of critical section

2017-06-12 Thread Alex Xie
Make the critical section smaller. There is no need to protect the bo_list, because there is no other task can access the newly created BO list yet. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 4 ++-- 1 file changed, 2 insertions

[PATCH 1/4] drm/amdgpu: Optimization of critical section

2017-06-12 Thread Alex Xie
This patch is to move a loop of unref BOs and several memory free function calls out of critical sections. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/d

[PATCH 4/4] drm/amdgpu: Optimize mutex usage

2017-06-12 Thread Alex Xie
ost of such long waiting. Secondly, this patch allows several tasks(readers of idr) to proceed at the same time. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 14 +++--- drivers/gp

[PATCH 3/4] drm/amdgpu: Optimization of mutex usage

2017-06-12 Thread Alex Xie
There is no need to lock the bo_list mutex, because there is no other task can access the newly created BO list yet. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/amd/

[PATCH 2/3] drm/amdgpu: change a function to static function

2017-06-21 Thread Alex Xie
The function is called only once inside the .c file. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h| 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgp

[PATCH 3/3] drm/amdgpu: optimize out a spin lock Use atomic instead of spin lock.

2017-06-21 Thread Alex Xie
Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h| 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 110 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 - 3 files changed, 76 insertions(+), 40 deletions(-) diff

[PATCH 1/3] drm/amdgpu: fix a typo

2017-06-21 Thread Alex Xie
Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 7635f38..94c27fc 100644 --- a/drivers/gpu/d

[PATCH] drm/amdgpu: optimize out a spin lock (v2)

2017-06-21 Thread Alex Xie
Use atomic instead of spin lock. v2: Adjust commit message Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h| 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 110 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |

[PATCH 2/3] drm/amdgpu: Remove two ! operations in an if condition

2017-05-30 Thread Alex Xie
Make the code easier to understand. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 7

[PATCH 1/3] drm/amdgpu: Optimize a function called by every IB sheduling

2017-05-30 Thread Alex Xie
Move several if statements and a loop statment from run time to initialization time. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 33 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 6 ++ drivers/gpu/d

[PATCH] drm/amdgpu: Move compute vm bug logic to amdgpu_vm.c

2017-05-31 Thread Alex Xie
In review, Christian would like to keep the logic inside amdgpu_vm.c with a cost of slightly slower. The loop is still optimized out with this patch. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++ drivers/gpu/drm/amd/

[PATCH 3/3] drm/amdgpu: move comment to the right place

2017-06-08 Thread Alex Xie
Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index f3e7885..a7d6804 100644 --- a/d

[PATCH 1/3] drm/amdgpu: remove duplicate function prototypes

2017-06-08 Thread Alex Xie
There are two identical function prototypes in same headere file Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 7

[PATCH 2/3] drm/amdgpu: fix a typo in comment

2017-06-08 Thread Alex Xie
Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index b17635c..7a70a2d 100644 --- a/drivers/gpu/d

[PATCH 2/2] drm/amdgpu: Optimize mutex usage (v2)

2017-06-15 Thread Alex Xie
ost of such long waiting. Secondly, this patch allows several tasks(readers of idr) to proceed at the same time. v2: use rcu and kref (Dave Airlie and Christian König) Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/a

[PATCH 1/2] drm/amdgpu: Optimization of AMDGPU_BO_LIST_OP_CREATE (v2)

2017-06-15 Thread Alex Xie
-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 53 - 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c index a664987..5

[PATCH] drm/amdgpu: Optimize mutex usage (v3)

2017-06-16 Thread Alex Xie
rcu and kref (Dave Airlie and Christian König) v3: update v1 commit message (Michel Dänzer) Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 40 - 2 files changed, 30 i

[PATCH] drm/amdgpu: fix errors in comments.

2017-05-08 Thread Alex Xie
Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 66bb60e..aab3206

[PATCH 3/3] drm/amdgpu: clean up code to make it easier to understand

2017-05-30 Thread Alex Xie
The original code convert pointer from amdgpu_crtc to drm_crtc then later convert the pointer back. It is difficult to understand why it was written that way. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +-- 1 file changed, 1 insertion

[PATCH] drm/amdgpu: Move compute vm bug logic to amdgpu_vm.c

2017-05-31 Thread Alex Xie
In review, Christian would like to keep the logic inside amdgpu_vm.c with a cost of slightly slower. The loop is still optimized out with this patch. v2: remove the if statement. Now it is not slower. Signed-off-by: Alex Xie <alexbin@amd.com> --- drivers/gpu/drm/amd/