Re: [PATCH libdrm] amdgpu: move asic id table to a separate file

2017-07-19 Thread Chih-Wei Huang
Sorry for reply late.

2017-07-05 19:05 GMT+08:00 Emil Velikov :
> On 5 July 2017 at 11:44, Chih-Wei Huang  wrote:
>>
>> Yep. The first problem to prepare the patch is,
>> where to install amdgpu.ids on Android?
>> Is /system/etc/amdgpu.ids OK?
>>
> Personally I'd stick it alongside the pci.ids/usb.ids, but it's up-to
> you really.

Thanks!
There files are usually in /usr/share/hwdata/
but Android has no such a directory.
So I'm going to use /etc/hwdata/.

> The library does not care about the filename/path - it's passed as a define.


-- 
Chih-Wei
Android-x86 project
http://www.android-x86.org
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm] amdgpu: move asic id table to a separate file

2017-07-05 Thread Emil Velikov
On 5 July 2017 at 11:44, Chih-Wei Huang  wrote:
> 2017-07-05 17:35 GMT+08:00 Emil Velikov :
>> On 4 July 2017 at 07:40, Chih-Wei Huang  wrote:
>>>
>>> Unfortunately this patch breaks Android build
>>> since the two macros are not defined.
>>>
>>> Anyone is working on a fix?
>>> If not, I'll try to provide one.
>>>
>> Please send a patch. I doubt many of the AMD devs have an Android setup.
>> Do ensure that the amdgpu.ids file is installed and accessible.
>
> Yep. The first problem to prepare the patch is,
> where to install amdgpu.ids on Android?
> Is /system/etc/amdgpu.ids OK?
>
Personally I'd stick it alongside the pci.ids/usb.ids, but it's up-to
you really.
The library does not care about the filename/path - it's passed as a define.

-Emil
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm] amdgpu: move asic id table to a separate file

2017-07-05 Thread Chih-Wei Huang
2017-07-05 17:35 GMT+08:00 Emil Velikov :
> On 4 July 2017 at 07:40, Chih-Wei Huang  wrote:
>>
>> Unfortunately this patch breaks Android build
>> since the two macros are not defined.
>>
>> Anyone is working on a fix?
>> If not, I'll try to provide one.
>>
> Please send a patch. I doubt many of the AMD devs have an Android setup.
> Do ensure that the amdgpu.ids file is installed and accessible.

Yep. The first problem to prepare the patch is,
where to install amdgpu.ids on Android?
Is /system/etc/amdgpu.ids OK?

> JFYI: a similar work is coming on the radeon side, so keep an eye open.




-- 
Chih-Wei
Android-x86 project
http://www.android-x86.org
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm] amdgpu: move asic id table to a separate file

2017-07-05 Thread Emil Velikov
On 4 July 2017 at 07:40, Chih-Wei Huang  wrote:
> 2017-06-12 17:50 GMT+08:00 Michel Dänzer :
>> From: Xiaojie Yuan 
>>
>> v2: fix an off by one error and leading white spaces
>> v3: use thread safe strtok_r(); initialize len before calling getline();
>> change printf() to drmMsg(); add initial amdgpu.ids
>> v4: integrate some recent internal changes, including format changes
>> v5: fix line number for empty/commented lines; realloc to save memory;
>> indentation changes
>> v6: remove a line error
>> v7: [Michel Dänzer]
>> * Move amdgpu.ids to new data directory
>> * Remove placeholder entries from amdgpu.ids
>> * Set libdrmdatadir variable in configure.ac instead of Makefile.am
>>   [Emil Velikov]
>> * Use isblank() instead of open-coding it [Emil Velikov]
>> * Don't leak asic_id_table memory if realloc fails [Emil Velikov]
>> * Check and bump table_max_size at the beginning of the while loop [Emil
>>   Velikov]
>> * Initialize table_max_size to the number of entries in data/amdgpu.ids
>>
>> Reviewed-by: Junwei Zhang 
>> Signed-off-by: Samuel Li 
>> Signed-off-by: Michel Dänzer 
>> ---
>>  Makefile.am  |   1 +
>>  amdgpu/Makefile.am   |   6 ++
>>  amdgpu/Makefile.sources  |   2 +-
>>  amdgpu/amdgpu_asic_id.c  | 219 
>> +++
>>  amdgpu/amdgpu_asic_id.h  | 165 ---
>>  amdgpu/amdgpu_device.c   |  28 --
>>  amdgpu/amdgpu_internal.h |  10 +++
>>  configure.ac |   4 +
>>  data/Makefile.am |  23 +
>>  data/amdgpu.ids  | 159 ++
>>  10 files changed, 444 insertions(+), 173 deletions(-)
>>  create mode 100644 amdgpu/amdgpu_asic_id.c
>>  delete mode 100644 amdgpu/amdgpu_asic_id.h
>>  create mode 100644 data/Makefile.am
>>  create mode 100644 data/amdgpu.ids
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index dfb8fcdb..7b86214e 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -109,6 +109,7 @@ SUBDIRS = \
>> $(TEGRA_SUBDIR) \
>> $(VC4_SUBDIR) \
>> $(ETNAVIV_SUBDIR) \
>> +   data \
>> tests \
>> $(MAN_SUBDIR)
>>
>> diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am
>> index cf7bc1ba..3444883f 100644
>> --- a/amdgpu/Makefile.am
>> +++ b/amdgpu/Makefile.am
>> @@ -30,6 +30,12 @@ AM_CFLAGS = \
>> $(PTHREADSTUBS_CFLAGS) \
>> -I$(top_srcdir)/include/drm
>>
>> +libdrmdatadir = @libdrmdatadir@
>> +ASIC_ID_TABLE_NUM_ENTRIES := $(shell egrep -ci '^[0-9a-f]{4},.*[0-9a-f]+,' \
>> +   $(top_srcdir)/data/amdgpu.ids)
>> +AM_CPPFLAGS = -DAMDGPU_ASIC_ID_TABLE=\"${libdrmdatadir}/amdgpu.ids\" \
>> +   -DAMDGPU_ASIC_ID_TABLE_NUM_ENTRIES=$(ASIC_ID_TABLE_NUM_ENTRIES)
>
> Unfortunately this patch breaks Android build
> since the two macros are not defined.
>
> Anyone is working on a fix?
> If not, I'll try to provide one.
>
Please send a patch. I doubt many of the AMD devs have an Android setup.
Do ensure that the amdgpu.ids file is installed and accessible.

JFYI: a similar work is coming on the radeon side, so keep an eye open.

Thanks
Emil
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [PATCH libdrm] amdgpu: move asic id table to a separate file

2017-07-04 Thread Chih-Wei Huang
2017-06-12 17:50 GMT+08:00 Michel Dänzer :
> From: Xiaojie Yuan 
>
> v2: fix an off by one error and leading white spaces
> v3: use thread safe strtok_r(); initialize len before calling getline();
> change printf() to drmMsg(); add initial amdgpu.ids
> v4: integrate some recent internal changes, including format changes
> v5: fix line number for empty/commented lines; realloc to save memory;
> indentation changes
> v6: remove a line error
> v7: [Michel Dänzer]
> * Move amdgpu.ids to new data directory
> * Remove placeholder entries from amdgpu.ids
> * Set libdrmdatadir variable in configure.ac instead of Makefile.am
>   [Emil Velikov]
> * Use isblank() instead of open-coding it [Emil Velikov]
> * Don't leak asic_id_table memory if realloc fails [Emil Velikov]
> * Check and bump table_max_size at the beginning of the while loop [Emil
>   Velikov]
> * Initialize table_max_size to the number of entries in data/amdgpu.ids
>
> Reviewed-by: Junwei Zhang 
> Signed-off-by: Samuel Li 
> Signed-off-by: Michel Dänzer 
> ---
>  Makefile.am  |   1 +
>  amdgpu/Makefile.am   |   6 ++
>  amdgpu/Makefile.sources  |   2 +-
>  amdgpu/amdgpu_asic_id.c  | 219 
> +++
>  amdgpu/amdgpu_asic_id.h  | 165 ---
>  amdgpu/amdgpu_device.c   |  28 --
>  amdgpu/amdgpu_internal.h |  10 +++
>  configure.ac |   4 +
>  data/Makefile.am |  23 +
>  data/amdgpu.ids  | 159 ++
>  10 files changed, 444 insertions(+), 173 deletions(-)
>  create mode 100644 amdgpu/amdgpu_asic_id.c
>  delete mode 100644 amdgpu/amdgpu_asic_id.h
>  create mode 100644 data/Makefile.am
>  create mode 100644 data/amdgpu.ids
>
> diff --git a/Makefile.am b/Makefile.am
> index dfb8fcdb..7b86214e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -109,6 +109,7 @@ SUBDIRS = \
> $(TEGRA_SUBDIR) \
> $(VC4_SUBDIR) \
> $(ETNAVIV_SUBDIR) \
> +   data \
> tests \
> $(MAN_SUBDIR)
>
> diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am
> index cf7bc1ba..3444883f 100644
> --- a/amdgpu/Makefile.am
> +++ b/amdgpu/Makefile.am
> @@ -30,6 +30,12 @@ AM_CFLAGS = \
> $(PTHREADSTUBS_CFLAGS) \
> -I$(top_srcdir)/include/drm
>
> +libdrmdatadir = @libdrmdatadir@
> +ASIC_ID_TABLE_NUM_ENTRIES := $(shell egrep -ci '^[0-9a-f]{4},.*[0-9a-f]+,' \
> +   $(top_srcdir)/data/amdgpu.ids)
> +AM_CPPFLAGS = -DAMDGPU_ASIC_ID_TABLE=\"${libdrmdatadir}/amdgpu.ids\" \
> +   -DAMDGPU_ASIC_ID_TABLE_NUM_ENTRIES=$(ASIC_ID_TABLE_NUM_ENTRIES)

Unfortunately this patch breaks Android build
since the two macros are not defined.

Anyone is working on a fix?
If not, I'll try to provide one.

>  libdrm_amdgpu_la_LTLIBRARIES = libdrm_amdgpu.la
>  libdrm_amdgpu_ladir = $(libdir)
>  libdrm_amdgpu_la_LDFLAGS = -version-number 1:0:0 -no-undefined
> diff --git a/amdgpu/Makefile.sources b/amdgpu/Makefile.sources
> index 487b9e0a..bc3abaa6 100644
> --- a/amdgpu/Makefile.sources
> +++ b/amdgpu/Makefile.sources
> @@ -1,5 +1,5 @@
>  LIBDRM_AMDGPU_FILES := \
> -   amdgpu_asic_id.h \
> +   amdgpu_asic_id.c \
> amdgpu_bo.c \
> amdgpu_cs.c \
> amdgpu_device.c \
> diff --git a/amdgpu/amdgpu_asic_id.c b/amdgpu/amdgpu_asic_id.c
> new file mode 100644
> index ..3a88896b
> --- /dev/null
> +++ b/amdgpu/amdgpu_asic_id.c
> @@ -0,0 +1,219 @@
> +/*
> + * Copyright © 2017 Advanced Micro Devices, Inc.
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "xf86drm.h"
> +#include "amdgpu_drm.h"
> +#include 

RE: [PATCH libdrm] amdgpu: move asic id table to a separate file

2017-06-12 Thread Deucher, Alexander
> -Original Message-
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf
> Of Michel Dänzer
> Sent: Monday, June 12, 2017 5:50 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: dri-de...@lists.freedesktop.org
> Subject: [PATCH libdrm] amdgpu: move asic id table to a separate file
> 
> From: Xiaojie Yuan 
> 
> v2: fix an off by one error and leading white spaces
> v3: use thread safe strtok_r(); initialize len before calling getline();
> change printf() to drmMsg(); add initial amdgpu.ids
> v4: integrate some recent internal changes, including format changes
> v5: fix line number for empty/commented lines; realloc to save memory;
> indentation changes
> v6: remove a line error
> v7: [Michel Dänzer]
> * Move amdgpu.ids to new data directory
> * Remove placeholder entries from amdgpu.ids
> * Set libdrmdatadir variable in configure.ac instead of Makefile.am
>   [Emil Velikov]
> * Use isblank() instead of open-coding it [Emil Velikov]
> * Don't leak asic_id_table memory if realloc fails [Emil Velikov]
> * Check and bump table_max_size at the beginning of the while loop [Emil
>   Velikov]
> * Initialize table_max_size to the number of entries in data/amdgpu.ids
> 
> Reviewed-by: Junwei Zhang 
> Signed-off-by: Samuel Li 
> Signed-off-by: Michel Dänzer 

Reviewed-by: Alex Deucher 

> ---
>  Makefile.am  |   1 +
>  amdgpu/Makefile.am   |   6 ++
>  amdgpu/Makefile.sources  |   2 +-
>  amdgpu/amdgpu_asic_id.c  | 219
> +++
>  amdgpu/amdgpu_asic_id.h  | 165 ---
>  amdgpu/amdgpu_device.c   |  28 --
>  amdgpu/amdgpu_internal.h |  10 +++
>  configure.ac |   4 +
>  data/Makefile.am |  23 +
>  data/amdgpu.ids  | 159 ++
>  10 files changed, 444 insertions(+), 173 deletions(-)
>  create mode 100644 amdgpu/amdgpu_asic_id.c
>  delete mode 100644 amdgpu/amdgpu_asic_id.h
>  create mode 100644 data/Makefile.am
>  create mode 100644 data/amdgpu.ids
> 
> diff --git a/Makefile.am b/Makefile.am
> index dfb8fcdb..7b86214e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -109,6 +109,7 @@ SUBDIRS = \
>   $(TEGRA_SUBDIR) \
>   $(VC4_SUBDIR) \
>   $(ETNAVIV_SUBDIR) \
> + data \
>   tests \
>   $(MAN_SUBDIR)
> 
> diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am
> index cf7bc1ba..3444883f 100644
> --- a/amdgpu/Makefile.am
> +++ b/amdgpu/Makefile.am
> @@ -30,6 +30,12 @@ AM_CFLAGS = \
>   $(PTHREADSTUBS_CFLAGS) \
>   -I$(top_srcdir)/include/drm
> 
> +libdrmdatadir = @libdrmdatadir@
> +ASIC_ID_TABLE_NUM_ENTRIES := $(shell egrep -ci '^[0-9a-f]{4},.*[0-9a-f]+,'
> \
> + $(top_srcdir)/data/amdgpu.ids)
> +AM_CPPFLAGS = -
> DAMDGPU_ASIC_ID_TABLE=\"${libdrmdatadir}/amdgpu.ids\" \
> + -
> DAMDGPU_ASIC_ID_TABLE_NUM_ENTRIES=$(ASIC_ID_TABLE_NUM_ENTRI
> ES)
> +
>  libdrm_amdgpu_la_LTLIBRARIES = libdrm_amdgpu.la
>  libdrm_amdgpu_ladir = $(libdir)
>  libdrm_amdgpu_la_LDFLAGS = -version-number 1:0:0 -no-undefined
> diff --git a/amdgpu/Makefile.sources b/amdgpu/Makefile.sources
> index 487b9e0a..bc3abaa6 100644
> --- a/amdgpu/Makefile.sources
> +++ b/amdgpu/Makefile.sources
> @@ -1,5 +1,5 @@
>  LIBDRM_AMDGPU_FILES := \
> - amdgpu_asic_id.h \
> + amdgpu_asic_id.c \
>   amdgpu_bo.c \
>   amdgpu_cs.c \
>   amdgpu_device.c \
> diff --git a/amdgpu/amdgpu_asic_id.c b/amdgpu/amdgpu_asic_id.c
> new file mode 100644
> index ..3a88896b
> --- /dev/null
> +++ b/amdgpu/amdgpu_asic_id.c
> @@ -0,0 +1,219 @@
> +/*
> + * Copyright © 2017 Advanced Micro Devices, Inc.
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
> EVENT SHALL
> + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM,
> DAMAGES OR
> + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> OTHERWISE,
> + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
> THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
>