All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] amdgpu: sync amdgpu_drm.h with the kernel
@ 2017-01-09 11:18 Arindam Nath
       [not found] ` <1483960700-20924-1-git-send-email-arindam.nath-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Arindam Nath @ 2017-01-09 11:18 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Arindam Nath, emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w,
	Christian.Koenig-5C7GfCeVMHo

v1:
* User might want to query the maximum number of UVD
  instances supported by firmware. In addition to that,
  if there are multiple applications using UVD handles
  at the same time, he might also want to query the
  currently used number of handles.

  For this we add a new query AMDGPU_INFO_NUM_HANDLES
  and a new struct drm_amdgpu_info_num_handles to
  get these values.

v2:
* Generated using make headers_install.
* Generated from linux-stable/master commit
  a121103c922847ba5010819a3f250f1f7fc84ab8

Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Arindam Nath <arindam.nath@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 include/drm/amdgpu_drm.h | 106 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)

diff --git a/include/drm/amdgpu_drm.h b/include/drm/amdgpu_drm.h
index d8f2497..d4e49de 100644
--- a/include/drm/amdgpu_drm.h
+++ b/include/drm/amdgpu_drm.h
@@ -50,6 +50,7 @@ extern "C" {
 #define DRM_AMDGPU_WAIT_CS		0x09
 #define DRM_AMDGPU_GEM_OP		0x10
 #define DRM_AMDGPU_GEM_USERPTR		0x11
+#define DRM_AMDGPU_WAIT_FENCES		0x12
 
 #define DRM_IOCTL_AMDGPU_GEM_CREATE	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
 #define DRM_IOCTL_AMDGPU_GEM_MMAP	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
@@ -63,6 +64,7 @@ extern "C" {
 #define DRM_IOCTL_AMDGPU_WAIT_CS	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
 #define DRM_IOCTL_AMDGPU_GEM_OP		DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
 #define DRM_IOCTL_AMDGPU_GEM_USERPTR	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
+#define DRM_IOCTL_AMDGPU_WAIT_FENCES	DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
 
 #define AMDGPU_GEM_DOMAIN_CPU		0x1
 #define AMDGPU_GEM_DOMAIN_GTT		0x2
@@ -79,6 +81,10 @@ extern "C" {
 #define AMDGPU_GEM_CREATE_CPU_GTT_USWC		(1 << 2)
 /* Flag that the memory should be in VRAM and cleared */
 #define AMDGPU_GEM_CREATE_VRAM_CLEARED		(1 << 3)
+/* Flag that create shadow bo(GTT) while allocating vram bo */
+#define AMDGPU_GEM_CREATE_SHADOW		(1 << 4)
+/* Flag that allocating the BO should use linear VRAM */
+#define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS	(1 << 5)
 
 struct drm_amdgpu_gem_create_in  {
 	/** the requested memory size */
@@ -303,6 +309,32 @@ union drm_amdgpu_wait_cs {
 	struct drm_amdgpu_wait_cs_out out;
 };
 
+struct drm_amdgpu_fence {
+	uint32_t ctx_id;
+	uint32_t ip_type;
+	uint32_t ip_instance;
+	uint32_t ring;
+	uint64_t seq_no;
+};
+
+struct drm_amdgpu_wait_fences_in {
+	/** This points to uint64_t * which points to fences */
+	uint64_t fences;
+	uint32_t fence_count;
+	uint32_t wait_all;
+	uint64_t timeout_ns;
+};
+
+struct drm_amdgpu_wait_fences_out {
+	uint32_t status;
+	uint32_t first_signaled;
+};
+
+union drm_amdgpu_wait_fences {
+	struct drm_amdgpu_wait_fences_in in;
+	struct drm_amdgpu_wait_fences_out out;
+};
+
 #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO	0
 #define AMDGPU_GEM_OP_SET_PLACEMENT		1
 
@@ -434,6 +466,7 @@ struct drm_amdgpu_cs_chunk_data {
  *
  */
 #define AMDGPU_IDS_FLAGS_FUSION         0x1
+#define AMDGPU_IDS_FLAGS_PREEMPTION     0x2
 
 /* indicate if acceleration can be working */
 #define AMDGPU_INFO_ACCEL_WORKING		0x00
@@ -483,6 +516,20 @@ struct drm_amdgpu_cs_chunk_data {
 #define AMDGPU_INFO_DEV_INFO			0x16
 /* visible vram usage */
 #define AMDGPU_INFO_VIS_VRAM_USAGE		0x17
+/* number of TTM buffer evictions */
+#define AMDGPU_INFO_NUM_EVICTIONS		0x18
+/* Query memory about VRAM and GTT domains */
+#define AMDGPU_INFO_MEMORY			0x19
+/* Query vce clock table */
+#define AMDGPU_INFO_VCE_CLOCK_TABLE		0x1A
+/* Query vbios related information */
+#define AMDGPU_INFO_VBIOS			0x1B
+	/* Subquery id: Query vbios size */
+	#define AMDGPU_INFO_VBIOS_SIZE		0x1
+	/* Subquery id: Query vbios image */
+	#define AMDGPU_INFO_VBIOS_IMAGE		0x2
+/* Query UVD handles */
+#define AMDGPU_INFO_NUM_HANDLES			0x1C
 
 #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT	0
 #define AMDGPU_INFO_MMR_SE_INDEX_MASK	0xff
@@ -541,6 +588,11 @@ struct drm_amdgpu_info {
 		} read_mmr_reg;
 
 		struct drm_amdgpu_query_fw query_fw;
+
+		struct {
+			uint32_t type;
+			uint32_t offset;
+		} vbios_info;
 	};
 };
 
@@ -568,6 +620,34 @@ struct drm_amdgpu_info_vram_gtt {
 	uint64_t gtt_size;
 };
 
+struct drm_amdgpu_heap_info {
+	/** max. physical memory */
+	uint64_t total_heap_size;
+
+	/** Theoretical max. available memory in the given heap */
+	uint64_t usable_heap_size;
+
+	/**
+	 * Number of bytes allocated in the heap. This includes all processes
+	 * and private allocations in the kernel. It changes when new buffers
+	 * are allocated, freed, and moved. It cannot be larger than
+	 * heap_size.
+	 */
+	uint64_t heap_usage;
+
+	/**
+	 * Theoretical possible max. size of buffer which
+	 * could be allocated in the given heap
+	 */
+	uint64_t max_allocation;
+};
+
+struct drm_amdgpu_memory_info {
+	struct drm_amdgpu_heap_info vram;
+	struct drm_amdgpu_heap_info cpu_accessible_vram;
+	struct drm_amdgpu_heap_info gtt;
+};
+
 struct drm_amdgpu_info_firmware {
 	uint32_t ver;
 	uint32_t feature;
@@ -641,10 +721,36 @@ struct drm_amdgpu_info_hw_ip {
 	uint32_t  _pad;
 };
 
+struct drm_amdgpu_info_num_handles {
+	/** Max handles as supported by firmware for UVD */
+	uint32_t uvd_max_handles;
+	/** Handles currently in use for UVD */
+	uint32_t uvd_used_handles;
+};
+
+#define AMDGPU_VCE_CLOCK_TABLE_ENTRIES		6
+
+struct drm_amdgpu_info_vce_clock_table_entry {
+	/** System clock */
+	uint32_t sclk;
+	/** Memory clock */
+	uint32_t mclk;
+	/** VCE clock */
+	uint32_t eclk;
+	uint32_t pad;
+};
+
+struct drm_amdgpu_info_vce_clock_table {
+	struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES];
+	uint32_t num_valid_entries;
+	uint32_t pad;
+};
+
 /*
  * Supported GPU families
  */
 #define AMDGPU_FAMILY_UNKNOWN			0
+#define AMDGPU_FAMILY_SI			110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */
 #define AMDGPU_FAMILY_CI			120 /* Bonaire, Hawaii */
 #define AMDGPU_FAMILY_KV			125 /* Kaveri, Kabini, Mullins */
 #define AMDGPU_FAMILY_VI			130 /* Iceland, Tonga */
-- 
1.9.1

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] amdgpu: sync amdgpu_drm.h with the kernel
       [not found] ` <1483960700-20924-1-git-send-email-arindam.nath-5C7GfCeVMHo@public.gmane.org>
@ 2017-01-09 16:39   ` Emil Velikov
       [not found]     ` <CACvgo53Ns-Qm1vFeR9_BrV1SV3B4GNbkd_v0FoPvfw0QpAbkXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Emil Velikov @ 2017-01-09 16:39 UTC (permalink / raw)
  To: Arindam Nath; +Cc: Christian König, amd-gfx mailing list

On 9 January 2017 at 11:18, Arindam Nath <arindam.nath@amd.com> wrote:

> v2:
> * Generated using make headers_install.
> * Generated from linux-stable/master commit
>   a121103c922847ba5010819a3f250f1f7fc84ab8
>
The above is either wrong or you've done manual changes. Both of which
are _not_ cool.

Please be more careful.
Emil
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] amdgpu: sync amdgpu_drm.h with the kernel
       [not found]     ` <CACvgo53Ns-Qm1vFeR9_BrV1SV3B4GNbkd_v0FoPvfw0QpAbkXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-01-09 16:44       ` Christian König
       [not found]         ` <0536c131-9db7-1a38-970e-efe45e2dda97-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Christian König @ 2017-01-09 16:44 UTC (permalink / raw)
  To: Emil Velikov, Arindam Nath; +Cc: amd-gfx mailing list

Am 09.01.2017 um 17:39 schrieb Emil Velikov:
> On 9 January 2017 at 11:18, Arindam Nath <arindam.nath@amd.com> wrote:
>
>> v2:
>> * Generated using make headers_install.
>> * Generated from linux-stable/master commit
>>    a121103c922847ba5010819a3f250f1f7fc84ab8
>>
> The above is either wrong or you've done manual changes. Both of which
> are _not_ cool.

Well according to my git history that is:

commit a121103c922847ba5010819a3f250f1f7fc84ab8
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sun Jan 8 14:18:17 2017 -0800

     Linux 4.10-rc3


Christian.

>
> Please be more careful.
> Emil


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] amdgpu: sync amdgpu_drm.h with the kernel
       [not found]         ` <0536c131-9db7-1a38-970e-efe45e2dda97-5C7GfCeVMHo@public.gmane.org>
@ 2017-01-09 17:20           ` Emil Velikov
       [not found]             ` <CACvgo52HQMMO7Jz_VQ3_p5YF0_zOUnFMu62FrSxfswJOJ8+Bug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Emil Velikov @ 2017-01-09 17:20 UTC (permalink / raw)
  To: Christian König; +Cc: Arindam Nath, amd-gfx mailing list

On 9 January 2017 at 16:44, Christian König <christian.koenig@amd.com> wrote:
> Am 09.01.2017 um 17:39 schrieb Emil Velikov:
>>
>> On 9 January 2017 at 11:18, Arindam Nath <arindam.nath@amd.com> wrote:
>>
>>> v2:
>>> * Generated using make headers_install.
>>> * Generated from linux-stable/master commit
>>>    a121103c922847ba5010819a3f250f1f7fc84ab8
>>>
>> The above is either wrong or you've done manual changes. Both of which
>> are _not_ cool.
>
>
> Well according to my git history that is:
>
> commit a121103c922847ba5010819a3f250f1f7fc84ab8
> Author: Linus Torvalds <torvalds@linux-foundation.org>
> Date:   Sun Jan 8 14:18:17 2017 -0800
>
>     Linux 4.10-rc3
>
>
Yes that is the commit in question, yet "Generated using make
headers_install" is a lie ;-)
... or there there are manual changes.

Just do checkout && make headers_install && cp && git diff for the specifics.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] amdgpu: sync amdgpu_drm.h with the kernel
       [not found]             ` <CACvgo52HQMMO7Jz_VQ3_p5YF0_zOUnFMu62FrSxfswJOJ8+Bug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-01-09 17:25               ` Nath, Arindam
  0 siblings, 0 replies; 5+ messages in thread
From: Nath, Arindam @ 2017-01-09 17:25 UTC (permalink / raw)
  To: Emil Velikov, Koenig, Christian; +Cc: amd-gfx mailing list

>-----Original Message-----
>From: Emil Velikov [mailto:emil.l.velikov@gmail.com]
>Sent: Monday, January 09, 2017 10:51 PM
>To: Koenig, Christian
>Cc: Nath, Arindam; amd-gfx mailing list
>Subject: Re: [PATCH v2] amdgpu: sync amdgpu_drm.h with the kernel
>
>On 9 January 2017 at 16:44, Christian König <christian.koenig@amd.com>
>wrote:
>> Am 09.01.2017 um 17:39 schrieb Emil Velikov:
>>>
>>> On 9 January 2017 at 11:18, Arindam Nath <arindam.nath@amd.com>
>wrote:
>>>
>>>> v2:
>>>> * Generated using make headers_install.
>>>> * Generated from linux-stable/master commit
>>>>    a121103c922847ba5010819a3f250f1f7fc84ab8
>>>>
>>> The above is either wrong or you've done manual changes. Both of which
>>> are _not_ cool.
>>
>>
>> Well according to my git history that is:
>>
>> commit a121103c922847ba5010819a3f250f1f7fc84ab8
>> Author: Linus Torvalds <torvalds@linux-foundation.org>
>> Date:   Sun Jan 8 14:18:17 2017 -0800
>>
>>     Linux 4.10-rc3
>>
>>
>Yes that is the commit in question, yet "Generated using make
>headers_install" is a lie ;-)
>... or there there are manual changes.

Yes, that is correct. I have done manual changes for converting __u32/__u64 in kernel headers to uint32_t/uint64_t in libdrm headers. The types of variables in the kernel header are __u32/__u64.

Thanks,
Arindam

>
>Just do checkout && make headers_install && cp && git diff for the specifics.
>
>-Emil
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-09 17:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 11:18 [PATCH v2] amdgpu: sync amdgpu_drm.h with the kernel Arindam Nath
     [not found] ` <1483960700-20924-1-git-send-email-arindam.nath-5C7GfCeVMHo@public.gmane.org>
2017-01-09 16:39   ` Emil Velikov
     [not found]     ` <CACvgo53Ns-Qm1vFeR9_BrV1SV3B4GNbkd_v0FoPvfw0QpAbkXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-09 16:44       ` Christian König
     [not found]         ` <0536c131-9db7-1a38-970e-efe45e2dda97-5C7GfCeVMHo@public.gmane.org>
2017-01-09 17:20           ` Emil Velikov
     [not found]             ` <CACvgo52HQMMO7Jz_VQ3_p5YF0_zOUnFMu62FrSxfswJOJ8+Bug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-09 17:25               ` Nath, Arindam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.