diff mbox

[5/7] drm/msm: add chip-id param

Message ID 1394470062-27442-6-git-send-email-robdclark@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Rob Clark March 10, 2014, 4:47 p.m. UTC
Some of the w/a or different behavior of userspace blob driver seem to
be keyed to gpu patch revision, rather than gpu-id.  So expose the full
chip-id to userspace so it can DTRT.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 drivers/gpu/drm/msm/adreno/adreno_gpu.c | 6 ++++++
 include/uapi/drm/msm_drm.h              | 1 +
 2 files changed, 7 insertions(+)

Comments

Jordan Crouse March 10, 2014, 8:20 p.m. UTC | #1
On 03/10/2014 10:47 AM, Rob Clark wrote:
> Some of the w/a or different behavior of userspace blob driver seem to
> be keyed to gpu patch revision, rather than gpu-id.  So expose the full
> chip-id to userspace so it can DTRT.

It is all chip-id all the time in the blob - we used to try to be clever
with unique GPU IDs and such with it but we discovered over time that there
is just too much drama.

> Signed-off-by: Rob Clark <robdclark@gmail.com>

Acked-by: Jordan Crouse <jcrouse@codeaurora.org>

> ---
>   drivers/gpu/drm/msm/adreno/adreno_gpu.c | 6 ++++++
>   include/uapi/drm/msm_drm.h              | 1 +
>   2 files changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index 7a11563..28ca8cd 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -73,6 +73,12 @@ int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value)
>   	case MSM_PARAM_GMEM_SIZE:
>   		*value = adreno_gpu->gmem;
>   		return 0;
> +	case MSM_PARAM_CHIP_ID:
> +		*value = adreno_gpu->rev.patchid |
> +				(adreno_gpu->rev.minor << 8) |
> +				(adreno_gpu->rev.major << 16) |
> +				(adreno_gpu->rev.core << 24);
> +		return 0;
>   	default:
>   		DBG("%s: invalid param: %u", gpu->name, param);
>   		return -EINVAL;
> diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
> index d3c6207..bf91a78 100644
> --- a/include/uapi/drm/msm_drm.h
> +++ b/include/uapi/drm/msm_drm.h
> @@ -50,6 +50,7 @@ struct drm_msm_timespec {
>
>   #define MSM_PARAM_GPU_ID     0x01
>   #define MSM_PARAM_GMEM_SIZE  0x02
> +#define MSM_PARAM_CHIP_ID    0x03
>
>   struct drm_msm_param {
>   	uint32_t pipe;           /* in, MSM_PIPE_x */
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 7a11563..28ca8cd 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -73,6 +73,12 @@  int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value)
 	case MSM_PARAM_GMEM_SIZE:
 		*value = adreno_gpu->gmem;
 		return 0;
+	case MSM_PARAM_CHIP_ID:
+		*value = adreno_gpu->rev.patchid |
+				(adreno_gpu->rev.minor << 8) |
+				(adreno_gpu->rev.major << 16) |
+				(adreno_gpu->rev.core << 24);
+		return 0;
 	default:
 		DBG("%s: invalid param: %u", gpu->name, param);
 		return -EINVAL;
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
index d3c6207..bf91a78 100644
--- a/include/uapi/drm/msm_drm.h
+++ b/include/uapi/drm/msm_drm.h
@@ -50,6 +50,7 @@  struct drm_msm_timespec {
 
 #define MSM_PARAM_GPU_ID     0x01
 #define MSM_PARAM_GMEM_SIZE  0x02
+#define MSM_PARAM_CHIP_ID    0x03
 
 struct drm_msm_param {
 	uint32_t pipe;           /* in, MSM_PIPE_x */