perfmon support
v3 cover perfmon support
Add some basic functions to query performance monitor domains and signals. Also add support to submit performance monitor requests (pmrs).
There is only one small change in v3 compared to v2. We mark perfmon bos as RW now.
Christian Gmeiner (3):
etnaviv: sync uapi header
etnaviv: add permon support
etnaviv: support performance monitor requests
etnaviv/Makefile.sources | 1 + etnaviv/etnaviv-symbol-check | 5 ++ etnaviv/etnaviv_cmd_stream.c | 20 +++++ etnaviv/etnaviv_drm.h | 43 +++++++++- etnaviv/etnaviv_drmif.h | 23 ++++++ etnaviv/etnaviv_perfmon.c | 189 +++++++++++++++++++++++++++++++++++++++++++ etnaviv/etnaviv_priv.h | 25 ++++++ 7 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 etnaviv/etnaviv_perfmon.c
Signature · 6 lines
2.14.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 1/3 etnaviv: sync uapi header
Import the etnaviv header changes from kernel commit 05916bed1 (drm-next)
The drm_etnaviv_gem_submit structure was extended to include performance monitor requests. Also two new ioctls got added to be able to readout performance monitor domains and their signals.
--- etnaviv/etnaviv_drm.h | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-)
etnaviv/etnaviv_drm.h +42 -1
@@ -150,6 +150,19 @@ struct drm_etnaviv_gem_submit_bo {__u64 presumed;/* in/out, presumed buffer address */ }; +/* performance monitor request (pmr) */ +#define ETNA_PM_PROCESS_PRE 0x0001 +#define ETNA_PM_PROCESS_POST 0x0002 +struct drm_etnaviv_gem_submit_pmr { +__u32 flags;/* in, when to process request (ETNA_PM_PROCESS_x) */ +__u8 domain;/* in, pm domain */ +__u8 pad; +__u16 signal;/* in, pm signal */ +__u32 sequence;/* in, sequence number */ +__u32 read_offset;/* in, offset from read_bo */ +__u32 read_idx;/* in, index of read_bo buffer */ +}; +/* Each cmdstream submit consists of a table of buffers involved, and * one or more cmdstream buffers. This allows for conditional execution * (context-restore), and IB buffers needed for per tile/bin draw cmds.
@@ -175,6 +188,9 @@ struct drm_etnaviv_gem_submit {__u64 stream;/* in, ptr to cmdstream */ __u32 flags;/* in, mask of ETNA_SUBMIT_x */ __s32 fence_fd;/* in/out, fence fd (see ETNA_SUBMIT_FENCE_FD_x) */ +__u64 pmrs;/* in, ptr to array of submit_pmr's */ +__u32 nr_pmrs;/* in, number of submit_pmr's */ +__u32 pad; };/* The normal way to synchronize with the GPU is just to CPU_PREP on
@@ -210,6 +226,27 @@ struct drm_etnaviv_gem_wait {struct drm_etnaviv_timespec timeout;/* in */ }; +/* +* Performance Monitor (PM): +*/ + +struct drm_etnaviv_pm_domain { +__u32 pipe;/* in */ +__u8 iter;/* in/out, select pm domain at index iter */ +__u8 id;/* out, id of domain */ +__u16 nr_signals;/* out, how many signals does this domain provide */ +char name[64 ];/* out, name of domain */ +}; + +struct drm_etnaviv_pm_signal { +__u32 pipe;/* in */ +__u8 domain;/* in, pm domain index */ +__u8 pad; +__u16 iter;/* in/out, select pm source at index iter */ +__u16 id;/* out, id of signal */ +char name[64 ];/* out, name of domain */ +}; +#define DRM_ETNAVIV_GET_PARAM 0x00/* placeholder: #define DRM_ETNAVIV_SET_PARAM 0x01
@@ -222,7 +259,9 @@ struct drm_etnaviv_gem_wait {#define DRM_ETNAVIV_WAIT_FENCE 0x07#define DRM_ETNAVIV_GEM_USERPTR 0x08#define DRM_ETNAVIV_GEM_WAIT 0x09 -#define DRM_ETNAVIV_NUM_IOCTLS 0x0a +#define DRM_ETNAVIV_PM_QUERY_DOM 0x0a +#define DRM_ETNAVIV_PM_QUERY_SIG 0x0b +#define DRM_ETNAVIV_NUM_IOCTLS 0x0c#define DRM_IOCTL_ETNAVIV_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GET_PARAM, struct drm_etnaviv_param)#define DRM_IOCTL_ETNAVIV_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_NEW, struct drm_etnaviv_gem_new)
@@ -233,6 +272,8 @@ struct drm_etnaviv_gem_wait {#define DRM_IOCTL_ETNAVIV_WAIT_FENCE DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_WAIT_FENCE, struct drm_etnaviv_wait_fence)#define DRM_IOCTL_ETNAVIV_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_USERPTR, struct drm_etnaviv_gem_userptr)#define DRM_IOCTL_ETNAVIV_GEM_WAIT DRM_IOW(DRM_COMMAND_BASE + DRM_ETNAVIV_GEM_WAIT, struct drm_etnaviv_gem_wait) +#define DRM_IOCTL_ETNAVIV_PM_QUERY_DOM DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_PM_QUERY_DOM, struct drm_etnaviv_pm_domain) +#define DRM_IOCTL_ETNAVIV_PM_QUERY_SIG DRM_IOWR(DRM_COMMAND_BASE + DRM_ETNAVIV_PM_QUERY_SIG, struct drm_etnaviv_pm_signal)#if defined(__cplusplus) }
Signature · 6 lines
2.14.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 2/3 etnaviv: add permon support
In reply to Christian GmeinerQuery all domains and their signals and provide it this information via struct etna_perfmon and the corresponding api functions.
v2:
- code style changes
- etna_perfmon_create(..): add missing clean up in error case
--- etnaviv/Makefile.sources | 1 + etnaviv/etnaviv-symbol-check | 4 + etnaviv/etnaviv_drmif.h | 11 +++ etnaviv/etnaviv_perfmon.c | 189 +++++++++++++++++++++++++++++++++++++++++++ etnaviv/etnaviv_priv.h | 21 +++++ 5 files changed, 226 insertions(+) create mode 100644 etnaviv/etnaviv_perfmon.c
etnaviv/Makefile.sources +1 -0
@@ -3,6 +3,7 @@ LIBDRM_ETNAVIV_FILES := \ etnaviv_gpu.c \ etnaviv_bo.c \ etnaviv_bo_cache.c \ + etnaviv_perfmon.c \ etnaviv_pipe.c \ etnaviv_cmd_stream.c \ etnaviv_drm.h \
etnaviv/etnaviv-symbol-check +4 -0
@@ -42,6 +42,10 @@ etna_cmd_stream_flush etna_cmd_stream_flush2 etna_cmd_stream_finish etna_cmd_stream_reloc +etna_perfmon_create +etna_perfmon_del +etna_perfmon_get_dom_by_name +etna_perfmon_get_sig_by_name EOF done)
etnaviv/etnaviv_drmif.h +11 -0
@@ -35,6 +35,9 @@ struct etna_pipe;struct etna_gpu ;struct etna_device ;struct etna_cmd_stream ; +struct etna_perfmon ; +struct etna_perfmon_domain ; +struct etna_perfmon_signal ;enum etna_pipe_id {ETNA_PIPE_3D =0 ,
@@ -190,4 +193,12 @@ struct etna_reloc {void etna_cmd_stream_reloc (struct etna_cmd_stream *stream,const struct etna_reloc *r); +/* performance monitoring functions: +*/ + +struct etna_perfmon *etna_perfmon_create (struct etna_pipe *pipe); +void etna_perfmon_del (struct etna_perfmon *perfmon); +struct etna_perfmon_domain *etna_perfmon_get_dom_by_name (struct etna_perfmon *pm,const char *name); +struct etna_perfmon_signal *etna_perfmon_get_sig_by_name (struct etna_perfmon_domain *dom,const char *name); +#endif /* ETNAVIV_DRMIF_H_ */
etnaviv/etnaviv_perfmon.c new file +189 -0
189 lines not on this page · raw message
etnaviv/etnaviv_priv.h +21 -0
@@ -151,6 +151,27 @@ struct etna_cmd_stream_priv {void *reset_notify_priv; }; +struct etna_perfmon { +struct list_head domains; +struct etna_pipe *pipe; +}; + +struct etna_perfmon_domain +{ +struct list_head head; +struct list_head signals; +uint8_t id; +char name[64 ]; +}; + +struct etna_perfmon_signal +{ +struct list_head head; +struct etna_perfmon_domain *domain; +uint8_t signal; +char name[64 ]; +}; +#define ALIGN (v,a) (((v) + (a) - 1) & ~((a) - 1))#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]))
Signature · 6 lines
2.14.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 3/3 etnaviv: support performance monitor requests
In reply to Christian GmeinerAdd 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
--- etnaviv/etnaviv-symbol-check | 1 + etnaviv/etnaviv_cmd_stream.c | 20 ++++++++++++++++++++ etnaviv/etnaviv_drmif.h | 12 ++++++++++++ etnaviv/etnaviv_priv.h | 4 ++++ 4 files changed, 37 insertions(+)
etnaviv/etnaviv-symbol-check +1 -0
@@ -41,6 +41,7 @@ etna_cmd_stream_timestamp etna_cmd_stream_flush etna_cmd_stream_flush2 etna_cmd_stream_finish +etna_cmd_stream_perf etna_cmd_stream_reloc etna_perfmon_create etna_perfmon_del
etnaviv/etnaviv_cmd_stream.c +20 -0
@@ -105,6 +105,7 @@ void etna_cmd_stream_del(struct etna_cmd_stream *stream)free (stream->buffer);free (priv->submit.relocs); +free (priv->submit.pmrs);free (priv); }
@@ -115,6 +116,7 @@ static void reset_buffer(struct etna_cmd_stream *stream) stream->offset =0 ; priv->submit.nr_bos =0 ; priv->submit.nr_relocs =0 ; + priv->submit.nr_pmrs =0 ; priv->nr_bos =0 ;if (priv->reset_notify)
@@ -191,6 +193,8 @@ static void flush(struct etna_cmd_stream *stream, int in_fence_fd, .nr_bos = priv->submit.nr_bos, .relocs = VOID2U64(priv->submit.relocs), .nr_relocs = priv->submit.nr_relocs, + .pmrs = VOID2U64(priv->submit.pmrs), + .nr_pmrs = priv->submit.nr_pmrs, .stream = VOID2U64(stream->buffer), .stream_size = stream->offset * 4, /* in bytes */ };
@@ -260,3 +264,19 @@ void etna_cmd_stream_reloc(struct etna_cmd_stream *stream, const struct etna_reletna_cmd_stream_emit (stream, addr); } + +void etna_cmd_stream_perf (struct etna_cmd_stream *stream,const struct etna_perf *p) +{ +struct etna_cmd_stream_priv *priv =etna_cmd_stream_priv (stream); +struct drm_etnaviv_gem_submit_pmr *pmr; +uint32_t idx =APPEND (&priv->submit, pmrs); + + pmr = &priv->submit.pmrs[idx]; + + pmr->flags = p->flags; + pmr->sequence = p->sequence; + pmr->read_offset = p->offset; + pmr->read_idx =bo2idx (stream, p->bo,ETNA_SUBMIT_BO_READ |ETNA_SUBMIT_BO_WRITE ); + pmr->domain = p->signal->domain->id; + pmr->signal = p->signal->signal; +}
etnaviv/etnaviv_drmif.h +12 -0
@@ -201,4 +201,16 @@ void etna_perfmon_del(struct etna_perfmon *perfmon);struct etna_perfmon_domain *etna_perfmon_get_dom_by_name (struct etna_perfmon *pm,const char *name);struct etna_perfmon_signal *etna_perfmon_get_sig_by_name (struct etna_perfmon_domain *dom,const char *name); +struct etna_perf { +#define ETNA_PM_PROCESS_PRE 0x0001 +#define ETNA_PM_PROCESS_POST 0x0002 +uint32_t flags; +uint32_t sequence; +struct etna_perfmon_signal *signal; +struct etna_bo *bo; +uint32_t offset; +}; + +void etna_cmd_stream_perf (struct etna_cmd_stream *stream,const struct etna_perf *p); +#endif /* ETNAVIV_DRMIF_H_ */
etnaviv/etnaviv_priv.h +4 -0
@@ -140,6 +140,10 @@ struct etna_cmd_stream_priv {/* reloc's table: */ struct drm_etnaviv_gem_submit_reloc *relocs;uint32_t nr_relocs, max_relocs; + +/* perf's table: */ +struct drm_etnaviv_gem_submit_pmr *pmrs; +uint32_t nr_pmrs, max_pmrs; } submit;/* should have matching entries in submit.bos: */
Signature · 6 lines
2.14.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 3/3] etnaviv: support performance monitor requests
Am Freitag, den 15.12.2017, 08:43 +0100 schrieb Christian Gmeiner:
Quoted 9 lines
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 RWSigned-off-by Christian Gmeiner <[email protected]>---
[...]
etnaviv/etnaviv_priv.h struct etna_cmd_stream_priv { · line 146
Quoted 13 lines
#endif /*
ETNAVIV_DRMIF_H_*/etnaviv/etnaviv_priv.h +4
-0@@ -140,6 +140,10 @@ struct etna_cmd_stream_priv { /* reloc's table: */ struct drm_etnaviv_gem_submit_reloc *relocs; uint32_t nr_relocs, max_relocs; + +/* perf's table: */ +struct drm_etnaviv_gem_submit_pmr *pmrs; +uint32_t nr_pmrs, max_pmrs;
On v2 I commented that I don't see max_pmrs used anywhere. If it's unused please remove before pushing the patch.
Since this is a nitpick, you have my
Regards,
Lucas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 3/3] etnaviv: support performance monitor requests
Am Freitag, den 15.12.2017, 10:33 +0100 schrieb Lucas Stach:
Quoted 13 lines
Am Freitag, den 15.12.2017, 08:43 +0100 schrieb Christian Gmeiner:
Quoted 9 lines
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 RWSigned-off-by Christian Gmeiner <[email protected]>---
[...]
Quoted 16 lines
etnaviv/etnaviv_priv.h struct etna_cmd_stream_priv { · line 146
Quoted 13 lines
#endif /*
ETNAVIV_DRMIF_H_*/etnaviv/etnaviv_priv.h +4
-0@@ -140,6 +140,10 @@ struct etna_cmd_stream_priv { /* reloc's table: */ struct drm_etnaviv_gem_submit_reloc *relocs; uint32_t nr_relocs, max_relocs; + +/* perf's table: */ +struct drm_etnaviv_gem_submit_pmr *pmrs; +uint32_t nr_pmrs, max_pmrs;On v2 I commented that I don't see
max_pmrsused anywhere. If it's unused please remove before pushing the patch.
... And I just saw your reply to my v2 review explaining this stuff. So please disregard this comment.
Quoted 6 lines
Since this is a nitpick, you have my
Reviewed-by Lucas Stach <[email protected]>Regards,
Lucas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel