implement nouveau-perfKit
cover implement nouveau-perfKit
Hello,
A series I started a long time ago but now I need some feedbacks. :-)
This state tracker implements NVIDIA PerfKit 3.0.1 which is currently only available on Windows 7+ for desktop graphics cards. A Linux/Android implementation is provided by NVIDIA but only for NVIDIA Tegra K1.
This Gallium state tracker is loosely based on the VDPAU tracker and since it uses the pipe_query interface, other drivers which expose performance counters should be also able to expose them easily through PerfKit.
Unlike GL_AMD_performance_monitor, NVIDIA PerfKit allows to monitor multi-passes events and the API supports different types of performance counters (GPU, CPU, OpenGL).
Currently, only MP counters for NVC0:NVE4 Nouveau drivers are exposed.
To be able to use NVIDIA PerfKit from your OpenGL applications, you will need to install the wrapper library which includes the headers of the API.
You can download this library from:
http://cgit.freedesktop.org/~hakzsam/libperfkit/
The wrapper library contains a large number of unit tests (~120) that helped me to understand the API. More than 85% of test compliance for mesa.
Feel free to make a review of the perfkit state tracker and libperfkit. Thanks!
Samuel Pitoiset (3):
util: move LIST_FIRST_ENTRY from nv30_query.c to list.h
util: add LIST_MOVE_TAIL to list.h
st/perfkit: add a state tracker for NVIDIA PerfKit
configure.ac | 30 ++ src/gallium/Makefile.am | 4 + src/gallium/drivers/nouveau/nv30/nv30_query.c | 3 - src/gallium/state_trackers/perfkit/Makefile.am | 41 ++ .../state_trackers/perfkit/Makefile.sources | 8 + src/gallium/state_trackers/perfkit/context.c | 186 ++++++++ src/gallium/state_trackers/perfkit/counter.c | 522 +++++++++++++++++++++ src/gallium/state_trackers/perfkit/device.c | 91 ++++ src/gallium/state_trackers/perfkit/entrypoint.c | 78 +++ src/gallium/state_trackers/perfkit/monitoring.c | 360 ++++++++++++++ .../state_trackers/perfkit/perfkit_private.h | 145 ++++++ src/gallium/state_trackers/perfkit/util.c | 56 +++ src/gallium/targets/dri-perfkit.dyn | 3 + src/gallium/targets/perfkit/Makefile.am | 123 +++++ src/gallium/targets/perfkit/perfkit.sym | 7 + src/gallium/targets/perfkit/target.c | 1 + src/util/list.h | 12 + 17 files changed, 1667 insertions(+), 3 deletions(-) create mode 100644 src/gallium/state_trackers/perfkit/Makefile.am create mode 100644 src/gallium/state_trackers/perfkit/Makefile.sources create mode 100644 src/gallium/state_trackers/perfkit/context.c create mode 100644 src/gallium/state_trackers/perfkit/counter.c create mode 100644 src/gallium/state_trackers/perfkit/device.c create mode 100644 src/gallium/state_trackers/perfkit/entrypoint.c create mode 100644 src/gallium/state_trackers/perfkit/monitoring.c create mode 100644 src/gallium/state_trackers/perfkit/perfkit_private.h create mode 100644 src/gallium/state_trackers/perfkit/util.c create mode 100644 src/gallium/targets/dri-perfkit.dyn create mode 100644 src/gallium/targets/perfkit/Makefile.am create mode 100644 src/gallium/targets/perfkit/perfkit.sym create mode 100644 src/gallium/targets/perfkit/target.c
Signature · 6 lines
2.4.2 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1433276104-16460-1-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
RFC 1/3 util: move LIST_FIRST_ENTRY from nv30_query.c to list.h
--- src/gallium/drivers/nouveau/nv30/nv30_query.c | 3 --- src/util/list.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
src/gallium/drivers/nouveau/nv30/nv30_query.c +0 -3
@@ -28,9 +28,6 @@#include "nv30/nv30_screen.h" #include "nv30/nv30_context.h" -#define LIST_FIRST_ENTRY (__type, __item, __field) \ - LIST_ENTRY(__type, (__item)->next, __field) -struct nv30_query_object {struct list_head list;struct nouveau_heap *hw;
src/util/list.h +3 -0
@@ -126,6 +126,9 @@ static inline void list_validate(struct list_head *list)#define LIST_ENTRY (__type, __item, __field) \ ((__type *)(((char *)(__item)) - offsetof(__type, __field))) +#define LIST_FIRST_ENTRY (__type, __item, __field) \ + LIST_ENTRY(__type, (__item)->next, __field) +#define LIST_IS_EMPTY (__list) \ ((__list)->next == (__list))
Signature · 6 lines
2.4.2 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
RFC 2/3 util: add LIST_MOVE_TAIL to list.h
In reply to a message not in the archive--- src/util/list.h | 9 +++++++++ 1 file changed, 9 insertions(+)
src/util/list.h +9 -0
@@ -116,12 +116,21 @@ static inline void list_validate(struct list_head *list)assert (node->next->prev == node && node->prev->next == node); } +static inline void list_move_tail (struct list_head *list, +struct list_head *head) +{ + list->next->prev = list->prev; + list->prev->next = list->next; +list_addtail (list, head); +} +#define LIST_INITHEAD (__item) list_inithead(__item)#define LIST_ADD (__item, __list) list_add(__item, __list)#define LIST_ADDTAIL (__item, __list) list_addtail(__item, __list)#define LIST_REPLACE (__from, __to) list_replace(__from, __to)#define LIST_DEL (__item) list_del(__item)#define LIST_DELINIT (__item) list_delinit(__item) +#define LIST_MOVE_TAIL (__list, __head) list_move_tail(__list, __head)#define LIST_ENTRY (__type, __item, __field) \ ((__type *)(((char *)(__item)) - offsetof(__type, __field)))
Signature · 6 lines
2.4.2 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
RFC 3/3 st/perfkit: add a state tracker for NVIDIA PerfKit
In reply to Samuel PitoisetThis state tracker implements NVIDIA PerfKit 3.0.1 which is currently only available on Windows 7+ for desktop graphics cards. A Linux/Android implementation is provided by NVIDIA but only for NVIDIA Tegra K1.
This Gallium state tracker is loosely based on the VDPAU tracker and since it uses the pipe_query interface, other drivers which expose performance counters should be also able to expose them easily through PerfKit.
Unlike GL_AMD_performance_monitor, NVIDIA PerfKit allows to monitor multi-passes events and the API supports different types of performance counters (GPU, CPU, OpenGL).
Currently, only MP counters for NVC0:NVE4 Nouveau drivers are exposed.
To be able to use NVIDIA PerfKit from your OpenGL applications, you will need to install the wrapper library which includes the headers of the API.
You can download this library from:
http://cgit.freedesktop.org/~hakzsam/libperfkit/
--- configure.ac | 30 ++ src/gallium/Makefile.am | 4 + src/gallium/state_trackers/perfkit/Makefile.am | 41 ++ .../state_trackers/perfkit/Makefile.sources | 8 + src/gallium/state_trackers/perfkit/context.c | 186 ++++++++ src/gallium/state_trackers/perfkit/counter.c | 522 +++++++++++++++++++++ src/gallium/state_trackers/perfkit/device.c | 91 ++++ src/gallium/state_trackers/perfkit/entrypoint.c | 78 +++ src/gallium/state_trackers/perfkit/monitoring.c | 360 ++++++++++++++ .../state_trackers/perfkit/perfkit_private.h | 145 ++++++ src/gallium/state_trackers/perfkit/util.c | 56 +++ src/gallium/targets/dri-perfkit.dyn | 3 + src/gallium/targets/perfkit/Makefile.am | 123 +++++ src/gallium/targets/perfkit/perfkit.sym | 7 + src/gallium/targets/perfkit/target.c | 1 + 15 files changed, 1655 insertions(+) create mode 100644 src/gallium/state_trackers/perfkit/Makefile.am create mode 100644 src/gallium/state_trackers/perfkit/Makefile.sources create mode 100644 src/gallium/state_trackers/perfkit/context.c create mode 100644 src/gallium/state_trackers/perfkit/counter.c create mode 100644 src/gallium/state_trackers/perfkit/device.c create mode 100644 src/gallium/state_trackers/perfkit/entrypoint.c create mode 100644 src/gallium/state_trackers/perfkit/monitoring.c create mode 100644 src/gallium/state_trackers/perfkit/perfkit_private.h create mode 100644 src/gallium/state_trackers/perfkit/util.c create mode 100644 src/gallium/targets/dri-perfkit.dyn create mode 100644 src/gallium/targets/perfkit/Makefile.am create mode 100644 src/gallium/targets/perfkit/perfkit.sym create mode 100644 src/gallium/targets/perfkit/target.c
configure.ac +30 -0
@@ -79,6 +79,7 @@ LIBUDEV_REQUIRED=151 GLPROTO_REQUIRED=1.4.14 LIBOMXIL_BELLAGIO_REQUIRED=0.0 LIBVA_REQUIRED=0.35.0 +PERFKIT_REQUIRED=3.0 VDPAU_REQUIRED=0.4.1 WAYLAND_REQUIRED=1.2.0 XCB_REQUIRED=1.9.3
@@ -790,6 +791,11 @@ AC_ARG_ENABLE([vdpau], [enable vdpau library @<:@default=auto@:>@])], [enable_vdpau="$enableval"], [enable_vdpau=auto]) +AC_ARG_ENABLE([perfkit], + [AS_HELP_STRING([--enable-perfkit], + [enable perfkit library @<:@default=auto@:>@])], + [enable_perfkit="$enableval"], + [enable_perfkit=auto]) AC_ARG_ENABLE([omx], [AS_HELP_STRING([--enable-omx], [enable OpenMAX library @<:@default=disabled@:>@])],
@@ -856,6 +862,7 @@ if test "x$enable_opengl" = xno -a \ "x$enable_xa" = xno -a \ "x$enable_xvmc" = xno -a \ "x$enable_vdpau" = xno -a \ + "x$enable_perfkit" = xno -a \ "x$enable_omx" = xno -a \ "x$enable_va" = xno -a \ "x$enable_opencl" = xno; then
@@ -1584,6 +1591,10 @@ if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then PKG_CHECK_EXISTS([vdpau >= $VDPAU_REQUIRED], [enable_vdpau=yes], [enable_vdpau=no]) fi + if test "x$enable_perfkit" = xauto; then + PKG_CHECK_EXISTS([perfkit], [enable_perfkit=yes], [enable_perfkit=no]) + fi + if test "x$enable_omx" = xauto; then PKG_CHECK_EXISTS([libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED], [enable_omx=yes], [enable_omx=no]) fi
@@ -1623,6 +1634,12 @@ if test "x$enable_vdpau" = xyes; then fi AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes) +if test "x$enable_perfkit" = xyes; then + PKG_CHECK_MODULES([PERFKIT], [perfkit >= $PERFKIT_REQUIRED]) + enable_gallium_loader=$enable_shared_pipe_drivers +fi +AM_CONDITIONAL(HAVE_ST_PERFKIT, test "x$enable_perfkit" = xyes) + if test "x$enable_omx" = xyes; then PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED]) enable_gallium_loader=$enable_shared_pipe_drivers
@@ -1979,6 +1996,14 @@ AC_ARG_WITH([vdpau-libdir], [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau']) AC_SUBST([VDPAU_LIB_INSTALL_DIR]) +dnl Directory for PERFKIT libs +AC_ARG_WITH([perfkit-libdir], + [AS_HELP_STRING([--with-perfkit-libdir=DIR], + [directory for the PERFKIT libraries @<:@default=${libdir}/perfkit@:>@])], + [PERFKIT_LIB_INSTALL_DIR="$withval"], + [PERFKIT_LIB_INSTALL_DIR='${libdir}/perfkit']) +AC_SUBST([PERFKIT_LIB_INSTALL_DIR]) + dnl Directory for OMX libs AC_ARG_WITH([omx-libdir],
@@ -2291,6 +2316,9 @@ AC_SUBST([NINE_VERSION], "$NINE_MAJOR.$NINE_MINOR.$NINE_TINY") AC_SUBST([VDPAU_MAJOR], 1) AC_SUBST([VDPAU_MINOR], 0) +AC_SUBST([PERFKIT_MAJOR], 1) +AC_SUBST([PERFKIT_MINOR], 0) + VA_MAJOR=`$PKG_CONFIG --modversion libva | $SED -n 's/\([[^\.]]*\)\..*$/\1/p'` VA_MINOR=`$PKG_CONFIG --modversion libva | $SED -n 's/.*\.\(.*\)\..*$/\1/p'` AC_SUBST([VA_MAJOR], $VA_MAJOR)
@@ -2357,6 +2385,7 @@ AC_CONFIG_FILES([Makefile src/gallium/state_trackers/nine/Makefile src/gallium/state_trackers/omx/Makefile src/gallium/state_trackers/osmesa/Makefile + src/gallium/state_trackers/perfkit/Makefile src/gallium/state_trackers/va/Makefile src/gallium/state_trackers/vdpau/Makefile src/gallium/state_trackers/xa/Makefile
@@ -2369,6 +2398,7 @@ AC_CONFIG_FILES([Makefile src/gallium/targets/opencl/Makefile src/gallium/targets/osmesa/Makefile src/gallium/targets/osmesa/osmesa.pc + src/gallium/targets/perfkit/Makefile src/gallium/targets/pipe-loader/Makefile src/gallium/targets/va/Makefile src/gallium/targets/vdpau/Makefile
src/gallium/Makefile.am +4 -0
@@ -141,6 +141,10 @@ if HAVE_ST_VA SUBDIRS += state_trackers/va targets/va endif +if HAVE_ST_PERFKIT +SUBDIRS += state_trackers/perfkit targets/perfkit +endif + if HAVE_ST_VDPAU SUBDIRS += state_trackers/vdpau targets/vdpau endif
src/gallium/state_trackers/perfkit/Makefile.am new file +41 -0
41 lines not on this page · raw message
src/gallium/state_trackers/perfkit/Makefile.sources new file +8 -0
@@ -0,0 +1,8 @@ +C_SOURCES := \ + context.c \ + counter.c \ + device.c \ + entrypoint.c \ + monitoring.c \ + perfkit_private.h \ + util.c
src/gallium/state_trackers/perfkit/context.c new file +186 -0
186 lines not on this page · raw message
src/gallium/state_trackers/perfkit/counter.c new file +522 -0
522 lines not on this page · raw message
src/gallium/state_trackers/perfkit/device.c new file +91 -0
91 lines not on this page · raw message
src/gallium/state_trackers/perfkit/entrypoint.c new file +78 -0
78 lines not on this page · raw message
src/gallium/state_trackers/perfkit/monitoring.c new file +360 -0
360 lines not on this page · raw message
src/gallium/state_trackers/perfkit/perfkit_private.h new file +145 -0
145 lines not on this page · raw message
src/gallium/state_trackers/perfkit/util.c new file +56 -0
56 lines not on this page · raw message
src/gallium/targets/dri-perfkit.dyn new file +3 -0
@@ -0,0 +1,3 @@ +{ + nouveau_drm_screen_create; +};
src/gallium/targets/perfkit/Makefile.am new file +123 -0
123 lines not on this page · raw message
src/gallium/targets/perfkit/perfkit.sym new file +7 -0
@@ -0,0 +1,7 @@ +{ + global: + NVPMGetExportTable; + nouveau_drm_screen_create; + local: + *; +};
src/gallium/targets/perfkit/target.c new file +1 -0
@@ -0,0 +1 @@ +#include "target-helpers/inline_drm_helper.h"
Signature · 6 lines
2.4.2 _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev