aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Gmeiner2017-12-15 01:43:40 -0600
committerChristian Gmeiner2017-12-15 12:10:01 -0600
commit6a6b7432bfe94f8047b688fd6875ad93d153c6d0 (patch)
treeafa42ff5a2c3fcc273c21ec983ca48bd300200ca
parent305c1d113ca26cadf695bd41eeed20cff79aa671 (diff)
downloadexternal-libgbm-6a6b7432bfe94f8047b688fd6875ad93d153c6d0.tar.gz
external-libgbm-6a6b7432bfe94f8047b688fd6875ad93d153c6d0.tar.xz
external-libgbm-6a6b7432bfe94f8047b688fd6875ad93d153c6d0.zip
etnaviv: support performance monitor requests
Add etna_cmd_stream_perf(..) to submit perform requests. Userspace can submit pmrs via submit ioctl to sample perfmon signals. v3: - mark perfmon bos as RW Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
-rwxr-xr-xetnaviv/etnaviv-symbol-check1
-rw-r--r--etnaviv/etnaviv_cmd_stream.c20
-rw-r--r--etnaviv/etnaviv_drmif.h12
-rw-r--r--etnaviv/etnaviv_priv.h4
4 files changed, 37 insertions, 0 deletions
diff --git a/etnaviv/etnaviv-symbol-check b/etnaviv/etnaviv-symbol-check
index bd95b459..bc509615 100755
--- a/etnaviv/etnaviv-symbol-check
+++ b/etnaviv/etnaviv-symbol-check
@@ -41,6 +41,7 @@ etna_cmd_stream_timestamp
41etna_cmd_stream_flush 41etna_cmd_stream_flush
42etna_cmd_stream_flush2 42etna_cmd_stream_flush2
43etna_cmd_stream_finish 43etna_cmd_stream_finish
44etna_cmd_stream_perf
44etna_cmd_stream_reloc 45etna_cmd_stream_reloc
45etna_perfmon_create 46etna_perfmon_create
46etna_perfmon_del 47etna_perfmon_del
diff --git a/etnaviv/etnaviv_cmd_stream.c b/etnaviv/etnaviv_cmd_stream.c
index 8d0e8135..e8c58cd5 100644
--- a/etnaviv/etnaviv_cmd_stream.c
+++ b/etnaviv/etnaviv_cmd_stream.c
@@ -105,6 +105,7 @@ void etna_cmd_stream_del(struct etna_cmd_stream *stream)
105 105
106 free(stream->buffer); 106 free(stream->buffer);
107 free(priv->submit.relocs); 107 free(priv->submit.relocs);
108 free(priv->submit.pmrs);
108 free(priv); 109 free(priv);
109} 110}
110 111
@@ -115,6 +116,7 @@ static void reset_buffer(struct etna_cmd_stream *stream)
115 stream->offset = 0; 116 stream->offset = 0;
116 priv->submit.nr_bos = 0; 117 priv->submit.nr_bos = 0;
117 priv->submit.nr_relocs = 0; 118 priv->submit.nr_relocs = 0;
119 priv->submit.nr_pmrs = 0;
118 priv->nr_bos = 0; 120 priv->nr_bos = 0;
119 121
120 if (priv->reset_notify) 122 if (priv->reset_notify)
@@ -191,6 +193,8 @@ static void flush(struct etna_cmd_stream *stream, int in_fence_fd,
191 .nr_bos = priv->submit.nr_bos, 193 .nr_bos = priv->submit.nr_bos,
192 .relocs = VOID2U64(priv->submit.relocs), 194 .relocs = VOID2U64(priv->submit.relocs),
193 .nr_relocs = priv->submit.nr_relocs, 195 .nr_relocs = priv->submit.nr_relocs,
196 .pmrs = VOID2U64(priv->submit.pmrs),
197 .nr_pmrs = priv->submit.nr_pmrs,
194 .stream = VOID2U64(stream->buffer), 198 .stream = VOID2U64(stream->buffer),
195 .stream_size = stream->offset * 4, /* in bytes */ 199 .stream_size = stream->offset * 4, /* in bytes */
196 }; 200 };
@@ -260,3 +264,19 @@ void etna_cmd_stream_reloc(struct etna_cmd_stream *stream, const struct etna_rel
260 264
261 etna_cmd_stream_emit(stream, addr); 265 etna_cmd_stream_emit(stream, addr);
262} 266}
267
268void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct etna_perf *p)
269{
270 struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
271 struct drm_etnaviv_gem_submit_pmr *pmr;
272 uint32_t idx = APPEND(&priv->submit, pmrs);
273
274 pmr = &priv->submit.pmrs[idx];
275
276 pmr->flags = p->flags;
277 pmr->sequence = p->sequence;
278 pmr->read_offset = p->offset;
279 pmr->read_idx = bo2idx(stream, p->bo, ETNA_SUBMIT_BO_READ | ETNA_SUBMIT_BO_WRITE);
280 pmr->domain = p->signal->domain->id;
281 pmr->signal = p->signal->signal;
282}
diff --git a/etnaviv/etnaviv_drmif.h b/etnaviv/etnaviv_drmif.h
index 949b9b62..5a6bef8d 100644
--- a/etnaviv/etnaviv_drmif.h
+++ b/etnaviv/etnaviv_drmif.h
@@ -201,4 +201,16 @@ void etna_perfmon_del(struct etna_perfmon *perfmon);
201struct etna_perfmon_domain *etna_perfmon_get_dom_by_name(struct etna_perfmon *pm, const char *name); 201struct etna_perfmon_domain *etna_perfmon_get_dom_by_name(struct etna_perfmon *pm, const char *name);
202struct etna_perfmon_signal *etna_perfmon_get_sig_by_name(struct etna_perfmon_domain *dom, const char *name); 202struct etna_perfmon_signal *etna_perfmon_get_sig_by_name(struct etna_perfmon_domain *dom, const char *name);
203 203
204struct etna_perf {
205#define ETNA_PM_PROCESS_PRE 0x0001
206#define ETNA_PM_PROCESS_POST 0x0002
207 uint32_t flags;
208 uint32_t sequence;
209 struct etna_perfmon_signal *signal;
210 struct etna_bo *bo;
211 uint32_t offset;
212};
213
214void etna_cmd_stream_perf(struct etna_cmd_stream *stream, const struct etna_perf *p);
215
204#endif /* ETNAVIV_DRMIF_H_ */ 216#endif /* ETNAVIV_DRMIF_H_ */
diff --git a/etnaviv/etnaviv_priv.h b/etnaviv/etnaviv_priv.h
index 7b289b61..e45d364c 100644
--- a/etnaviv/etnaviv_priv.h
+++ b/etnaviv/etnaviv_priv.h
@@ -140,6 +140,10 @@ struct etna_cmd_stream_priv {
140 /* reloc's table: */ 140 /* reloc's table: */
141 struct drm_etnaviv_gem_submit_reloc *relocs; 141 struct drm_etnaviv_gem_submit_reloc *relocs;
142 uint32_t nr_relocs, max_relocs; 142 uint32_t nr_relocs, max_relocs;
143
144 /* perf's table: */
145 struct drm_etnaviv_gem_submit_pmr *pmrs;
146 uint32_t nr_pmrs, max_pmrs;
143 } submit; 147 } submit;
144 148
145 /* should have matching entries in submit.bos: */ 149 /* should have matching entries in submit.bos: */