drm: Branch 'master' - 3 commits

[email protected] (Rob Clark)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 freedreno/freedreno_drmif.h |    1 
 freedreno/kgsl/kgsl_pipe.c  |    3 ++
 freedreno/msm/msm_drm.h     |    1 
 freedreno/msm/msm_pipe.c    |   45 +++++++++++++++++++++++++++++++-------------
 4 files changed, 37 insertions(+), 13 deletions(-)

New commits:
commit 9b77443f6344791851a6c2067e4081b7f43618ea
Author: Rob Clark <[email protected]>
Date:   Wed Feb 10 12:27:33 2016 -0500

    freedreno: add support for FD_MAX_FREQ
    
    Only msm backend supports this.  Sorry, if you are using kgsl, no
    time-elapsed query for you.
    
    Signed-off-by: Rob Clark <[email protected]>

diff --git a/freedreno/freedreno_drmif.h b/freedreno/freedreno_drmif.h
index 5547e94..950fd63 100644
--- a/freedreno/freedreno_drmif.h
+++ b/freedreno/freedreno_drmif.h
@@ -50,6 +50,7 @@ enum fd_param_id {
 	FD_GMEM_SIZE,
 	FD_GPU_ID,
 	FD_CHIP_ID,
+	FD_MAX_FREQ,
 };
 
 /* bo flags: */
diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c
index 58b3b4d..5569da0 100644
--- a/freedreno/kgsl/kgsl_pipe.c
+++ b/freedreno/kgsl/kgsl_pipe.c
@@ -50,6 +50,9 @@ static int kgsl_pipe_get_param(struct fd_pipe *pipe,
 	case FD_CHIP_ID:
 		*value = kgsl_pipe->devinfo.chip_id;
 		return 0;
+	case FD_MAX_FREQ:
+		/* unsupported on kgsl */
+		return -1;
 	default:
 		ERROR_MSG("invalid param id: %d", param);
 		return -1;
diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c
index 38db21d..f539b9a 100644
--- a/freedreno/msm/msm_pipe.c
+++ b/freedreno/msm/msm_pipe.c
@@ -67,6 +67,8 @@ static int msm_pipe_get_param(struct fd_pipe *pipe,
 	case FD_CHIP_ID:
 		*value = msm_pipe->chip_id;
 		return 0;
+	case FD_MAX_FREQ:
+		return query_param(pipe, MSM_PARAM_MAX_FREQ, value);
 	default:
 		ERROR_MSG("invalid param id: %d", param);
 		return -1;
commit bc5497d061aaaf31e6b38109443c20e1ebfd21a3
Author: Rob Clark <[email protected]>
Date:   Wed Feb 10 12:26:55 2016 -0500

    freedreno: small refactor for get_param
    
    Will simplify next commit.
    
    Signed-off-by: Rob Clark <[email protected]>

diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c
index aa0866b..38db21d 100644
--- a/freedreno/msm/msm_pipe.c
+++ b/freedreno/msm/msm_pipe.c
@@ -32,6 +32,25 @@
 
 #include "msm_priv.h"
 
+static int query_param(struct fd_pipe *pipe, uint32_t param,
+		uint64_t *value)
+{
+	struct msm_pipe *msm_pipe = to_msm_pipe(pipe);
+	struct drm_msm_param req = {
+			.pipe = msm_pipe->pipe,
+			.param = param,
+	};
+	int ret;
+
+	ret = drmCommandWriteRead(pipe->dev->fd, DRM_MSM_GET_PARAM,
+			&req, sizeof(req));
+	if (ret)
+		return ret;
+
+	*value = req.value;
+
+	return 0;
+}
 
 static int msm_pipe_get_param(struct fd_pipe *pipe,
 		enum fd_param_id param, uint64_t *value)
@@ -87,21 +106,15 @@ static const struct fd_pipe_funcs funcs = {
 		.destroy = msm_pipe_destroy,
 };
 
-static uint64_t get_param(struct fd_device *dev, uint32_t pipe, uint32_t param)
+static uint64_t get_param(struct fd_pipe *pipe, uint32_t param)
 {
-	struct drm_msm_param req = {
-			.pipe = pipe,
-			.param = param,
-	};
-	int ret;
-
-	ret = drmCommandWriteRead(dev->fd, DRM_MSM_GET_PARAM, &req, sizeof(req));
+	uint64_t value;
+	int ret = query_param(pipe, param, &value);
 	if (ret) {
 		ERROR_MSG("get-param failed! %d (%s)", ret, strerror(errno));
 		return 0;
 	}
-
-	return req.value;
+	return value;
 }
 
 drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev,
@@ -123,10 +136,14 @@ drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev,
 	pipe = &msm_pipe->base;
 	pipe->funcs = &funcs;
 
+	/* initialize before get_param(): */
+	pipe->dev = dev;
 	msm_pipe->pipe = pipe_id[id];
-	msm_pipe->gpu_id = get_param(dev, pipe_id[id], MSM_PARAM_GPU_ID);
-	msm_pipe->gmem   = get_param(dev, pipe_id[id], MSM_PARAM_GMEM_SIZE);
-	msm_pipe->chip_id = get_param(dev, pipe_id[id], MSM_PARAM_CHIP_ID);
+
+	/* these params should be supported since the first version of drm/msm: */
+	msm_pipe->gpu_id = get_param(pipe, MSM_PARAM_GPU_ID);
+	msm_pipe->gmem   = get_param(pipe, MSM_PARAM_GMEM_SIZE);
+	msm_pipe->chip_id = get_param(pipe, MSM_PARAM_CHIP_ID);
 
 	if (! msm_pipe->gpu_id)
 		goto fail;
commit c47385ccdae1d3a461e35c558af34431f10c83e2
Author: Rob Clark <[email protected]>
Date:   Wed Feb 10 12:26:20 2016 -0500

    freedreno: update uapi
    
    In drm-next.. needed for time-elapsed (and future perf ctrs) in mesa.
    
    Signed-off-by: Rob Clark <[email protected]>

diff --git a/freedreno/msm/msm_drm.h b/freedreno/msm/msm_drm.h
index f7474c5..baf505c 100644
--- a/freedreno/msm/msm_drm.h
+++ b/freedreno/msm/msm_drm.h
@@ -58,6 +58,7 @@ struct drm_msm_timespec {
 #define MSM_PARAM_GPU_ID     0x01
 #define MSM_PARAM_GMEM_SIZE  0x02
 #define MSM_PARAM_CHIP_ID    0x03
+#define MSM_PARAM_MAX_FREQ   0x04
 
 struct drm_msm_param {
 	uint32_t pipe;           /* in, MSM_PIPE_x */

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.