summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjimqu <Jim.Qu@amd.com>2015-11-16 15:13:00 +0800
committerQiang Yu <Qiang.Yu@amd.com>2017-05-17 10:24:19 +0800
commit87be19955d9f536e59a3afe62641ae3143fb6622 (patch)
tree842603b3d8730ccb119ae25b8203b77829c8372e
parent60677cdc38d057b5e09e19170fc2318716b090d7 (diff)
amdgpu: add amdgpu_query_capability interface v2
v2: ef1af912181c816eae8136ed2a4ad398731a51d3 amdgpu: add query amdgpu capability defination a3e54ad86d25445b77f69e4224206b4629a03333 add query amdgpu pinning memory capability defination c4f4bec65e64524c54dfd156dd36ae3fd3facf1f add more capability query Change-Id: I89aab43caf4a45edb6bd5ed3fe6c7d3213045fb3 Signed-off-by: JimQu <Jim.Qu@amd.com> Signed-off-by: Flora Cui <Flora.Cui@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
-rw-r--r--amdgpu/amdgpu.h20
-rw-r--r--amdgpu/amdgpu_gpu_info.c7
-rw-r--r--include/drm/amdgpu_drm.h12
3 files changed, 39 insertions, 0 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index e9eef188..4d89c963 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -42,6 +42,7 @@ extern "C" {
#endif
struct drm_amdgpu_info_hw_ip;
+struct drm_amdgpu_capability;
/*--------------------------------------------------------------------------*/
/* --------------------------- Defines ------------------------------------ */
@@ -66,6 +67,11 @@ struct drm_amdgpu_info_hw_ip;
*/
#define AMDGPU_QUERY_FENCE_TIMEOUT_IS_ABSOLUTE (1 << 0)
+/**
+ * Used in amdgpu_query_capability(), meaning if pin feature is enabled.
+ */
+#define AMDGPU_CAP_PIN_MEM (1 << 0)
+
/*--------------------------------------------------------------------------*/
/* ----------------------------- Enums ------------------------------------ */
/*--------------------------------------------------------------------------*/
@@ -1075,6 +1081,20 @@ int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
unsigned size, void *value);
/**
+ * Query hardware or driver capabilities.
+ *
+ *
+ * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
+ * \param value - \c [out] Pointer to the return value.
+ *
+ * \return 0 on success\n
+ * <0 - Negative POSIX error code
+ *
+*/
+int amdgpu_query_capability(amdgpu_device_handle dev,
+ struct drm_amdgpu_capability *cap);
+
+/**
* Query information about GDS
*
* \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c
index 697360b2..dddf6e78 100644
--- a/amdgpu/amdgpu_gpu_info.c
+++ b/amdgpu/amdgpu_gpu_info.c
@@ -48,6 +48,13 @@ int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
sizeof(struct drm_amdgpu_info));
}
+int amdgpu_query_capability(amdgpu_device_handle dev,
+ struct drm_amdgpu_capability *cap)
+{
+ return amdgpu_query_info(dev, AMDGPU_INFO_CAPABILITY,
+ sizeof(struct drm_amdgpu_capability), cap);
+}
+
int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id,
int32_t *result)
{
diff --git a/include/drm/amdgpu_drm.h b/include/drm/amdgpu_drm.h
index e274b68d..035799c5 100644
--- a/include/drm/amdgpu_drm.h
+++ b/include/drm/amdgpu_drm.h
@@ -583,6 +583,8 @@ struct drm_amdgpu_cs_chunk_data {
/* Subquery id: Query graphics voltage */
#define AMDGPU_INFO_SENSOR_VDDGFX 0x7
+/* gpu capability */
+#define AMDGPU_INFO_CAPABILITY 0x50
/* virtual range */
#define AMDGPU_INFO_VIRTUAL_RANGE 0x51
@@ -841,6 +843,16 @@ struct drm_amdgpu_virtual_range {
uint64_t end;
};
+/* query pin memory capability */
+#define AMDGPU_CAPABILITY_PIN_MEM_FLAG (1 << 0)
+/* query direct gma capability */
+#define AMDGPU_CAPABILITY_DIRECT_GMA_FLAG (1 << 1)
+
+struct drm_amdgpu_capability {
+ uint32_t flag;
+ uint32_t direct_gma_size;
+};
+
#if defined(__cplusplus)
}
#endif