From: Samuel Pitoiset <samuel.pitoiset@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH libdrm 3/4] amdgpu: allow to query GPU sensor related information
Date: Tue, 14 Feb 2017 01:09:01 +0100 [thread overview]
Message-ID: <20170214000902.30234-4-samuel.pitoiset@gmail.com> (raw)
In-Reply-To: <20170214000902.30234-1-samuel.pitoiset@gmail.com>
This exposes amdgpu_query_gpu_sensor_info().
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
amdgpu/amdgpu.h | 19 +++++++++++++++++++
amdgpu/amdgpu_gpu_info.c | 15 +++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 7b26a04c..b040f6ab 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -1059,6 +1059,25 @@ int amdgpu_query_gds_info(amdgpu_device_handle dev,
struct amdgpu_gds_resource_info *gds_info);
/**
+ * Query information about GPU sensor.
+ *
+ * The return size is query-specific and depends on the "sensor_type"
+ * parameter. No more than "size" bytes is returned.
+ *
+ * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
+ * \param sensor_type - \c [in] AMDGPU_INFO_GPU_SENSOR_*
+ * \param size - \c [in] Size of the returned value.
+ * \param value - \c [out] Pointer to the return value.
+ *
+ * \return 0 on success\n
+ * <0 - Negative POSIX Error code
+ *
+*/
+int amdgpu_query_gpu_sensor_info(amdgpu_device_handle dev,
+ unsigned sensor_type,
+ unsigned size, void *value);
+
+/**
* Read a set of consecutive memory-mapped registers.
* Not all registers are allowed to be read by userspace.
*
diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c
index 66c7e0e1..778c2ee1 100644
--- a/amdgpu/amdgpu_gpu_info.c
+++ b/amdgpu/amdgpu_gpu_info.c
@@ -314,3 +314,18 @@ int amdgpu_query_gds_info(amdgpu_device_handle dev,
return 0;
}
+
+int amdgpu_query_gpu_sensor_info(amdgpu_device_handle dev, unsigned sensor_type,
+ unsigned size, void *value)
+{
+ struct drm_amdgpu_info request;
+
+ memset(&request, 0, sizeof(request));
+ request.return_pointer = (uintptr_t)value;
+ request.return_size = size;
+ request.query = AMDGPU_INFO_GPU_SENSOR;
+ request.gpu_sensor_info.type = sensor_type;
+
+ return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request,
+ sizeof(struct drm_amdgpu_info));
+}
--
2.11.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-02-14 0:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 0:08 [PATCH libdrm 0/4] libdrm: add new GPU sensor interface for AMDGPU Samuel Pitoiset
2017-02-14 0:08 ` [PATCH libdrm 1/4] amdgpu: sync amdgpu_drm.h with the kernel Samuel Pitoiset
2017-02-14 0:09 ` [PATCH libdrm 2/4] amdgpu: add new GPU sensor related interface Samuel Pitoiset
2017-02-14 0:09 ` Samuel Pitoiset [this message]
2017-02-14 0:09 ` [PATCH libdrm 4/4] Bump version for 2.4.76 release Samuel Pitoiset
2017-02-14 1:44 ` [PATCH libdrm 0/4] libdrm: add new GPU sensor interface for AMDGPU Emil Velikov
2017-02-14 9:43 ` Christian König
2017-02-14 10:25 ` Samuel Pitoiset
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170214000902.30234-4-samuel.pitoiset@gmail.com \
--to=samuel.pitoiset@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox