From 1cc0ce7b10cd6e7590acff3d03d13cfdf231860e Mon Sep 17 00:00:00 2001 From: sdk Date: Fri, 29 Oct 2021 21:00:42 +0000 Subject: [PATCH] Import radeontop 1.3.0 View your GPU utilization, both for the total activity percent and individual blocks. The total GPU utilization is also valid for OpenCL loads; the other blocks are only useful in GL loads. Requires access to /dev/dri/cardN files or /dev/mem (root privileges). R600 and up, even Southern Islands should work fine. Tweak: AMD Catalyst driver reference removed from DESCR before commit. Port originally created by thfr@, updated by sdk@ and I'm taking maintainer. ok by thfr@ and solene@ --- graphics/radeontop/Makefile | 40 ++++++++++++++++++ graphics/radeontop/distinfo | 2 + graphics/radeontop/patches/patch-Makefile | 42 +++++++++++++++++++ .../patches/patch-translations_Makefile | 15 +++++++ graphics/radeontop/pkg/DESCR | 5 +++ graphics/radeontop/pkg/PLIST | 6 +++ graphics/radeontop/pkg/README | 11 +++++ 7 files changed, 121 insertions(+) create mode 100644 graphics/radeontop/Makefile create mode 100644 graphics/radeontop/distinfo create mode 100644 graphics/radeontop/patches/patch-Makefile create mode 100644 graphics/radeontop/patches/patch-translations_Makefile create mode 100644 graphics/radeontop/pkg/DESCR create mode 100644 graphics/radeontop/pkg/PLIST create mode 100644 graphics/radeontop/pkg/README diff --git a/graphics/radeontop/Makefile b/graphics/radeontop/Makefile new file mode 100644 index 00000000000..fa0bd04db79 --- /dev/null +++ b/graphics/radeontop/Makefile @@ -0,0 +1,40 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2021/10/29 21:00:42 sdk Exp $ + +COMMENT = monitor GPU utilization for R600 and up + +GH_ACCOUNT = clbr +GH_PROJECT = radeontop +GH_TAGNAME = v1.3 + +SHARED_LIBS = radeontop_xcb 0.0 # 1.3 + +CATEGORIES = graphics + +MAINTAINER = Stefan Hagen + +# GPLv3.0+ +PERMIT_PACKAGE = Yes + +WANTLIB += c curses drm_amdgpu drm intl m pciaccess pthread xcb xcb-dri2 + +COMPILER = base-clang ports-gcc base-gcc + +BUILD_DEPENDS = devel/gettext,-tools + +RUN_DEPENDS = textproc/intltool + +MAKE_FLAGS = amdgpu=1 + +MAKE_ENV = MANDIR=man LDFLAGS="${LDFLAGS}" + +USE_GMAKE = Yes + +NO_TEST = Yes + +CFLAGS += -I${LOCALBASE}/include +LDFLAGS += -L${LOCALBASE}/lib -lintl + +do-gen: + ${SUBST_CMD} ${WRKSRC}/Makefile + +.include diff --git a/graphics/radeontop/distinfo b/graphics/radeontop/distinfo new file mode 100644 index 00000000000..4bbb9f50fd3 --- /dev/null +++ b/graphics/radeontop/distinfo @@ -0,0 +1,2 @@ +SHA256 (radeontop-1.3.tar.gz) = Dmq6yvo8eV7ng74Ytzb238f/k8bjwyN8x8FoSGPggQA= +SIZE (radeontop-1.3.tar.gz) = 38138 diff --git a/graphics/radeontop/patches/patch-Makefile b/graphics/radeontop/patches/patch-Makefile new file mode 100644 index 00000000000..3de5d86b6a4 --- /dev/null +++ b/graphics/radeontop/patches/patch-Makefile @@ -0,0 +1,42 @@ +$OpenBSD: patch-Makefile,v 1.1.1.1 2021/10/29 21:00:42 sdk Exp $ + +version lib +don't redo all target for install +correct the install path + +Index: Makefile +--- Makefile.orig ++++ Makefile +@@ -20,6 +20,7 @@ xcb ?= 1 + + bin = radeontop + xcblib = libradeontop_xcb.so ++xcblib = libradeontop_xcb.so.${LIBradeontop_xcb_VERSION} + src = $(filter-out amdgpu.c auth_xcb.c,$(wildcard *.c)) + verh = include/version.h + +@@ -80,7 +81,6 @@ LIBS += $(shell pkg-config --libs libdrm) + LIBS += -lm + ifeq ($(xcb), 1) + xcb_LIBS += $(shell pkg-config --libs xcb xcb-dri2) +- LIBS += -ldl + endif + + # On some distros, you might have to change this to ncursesw +@@ -116,12 +116,12 @@ trans: + xgettext -o translations/radeontop.pot -k_ *.c \ + --package-name radeontop + +-install: all +- $(INSTALL) -D -m755 $(bin) $(DESTDIR)/$(PREFIX)/sbin/$(bin) ++install: ++ $(INSTALL) -D -m755 $(bin) $(PREFIX)/sbin/$(bin) + ifeq ($(xcb), 1) +- $(INSTALL) -D -m755 $(xcblib) $(DESTDIR)/$(PREFIX)/$(LIBDIR)/$(xcblib) ++ $(INSTALL) -D -m755 $(xcblib) $(PREFIX)/$(LIBDIR)/$(xcblib) + endif +- $(INSTALL) -D -m644 radeontop.1 $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1/radeontop.1 ++ $(INSTALL) -D -m644 radeontop.1 $(PREFIX)/$(MANDIR)/man1/radeontop.1 + ifeq ($(nls), 1) + $(MAKE) -C translations install PREFIX=$(PREFIX) + endif diff --git a/graphics/radeontop/patches/patch-translations_Makefile b/graphics/radeontop/patches/patch-translations_Makefile new file mode 100644 index 00000000000..5de20e1ad87 --- /dev/null +++ b/graphics/radeontop/patches/patch-translations_Makefile @@ -0,0 +1,15 @@ +$OpenBSD: patch-translations_Makefile,v 1.1.1.1 2021/10/29 21:00:42 sdk Exp $ + +fix install dir + +Index: translations/Makefile +--- translations/Makefile.orig ++++ translations/Makefile +@@ -15,6 +15,6 @@ $(obj): $(src) + $(MSGFMT) -o $@ $< + + %.inst: %.mo +- $(INSTALL) -D -m 644 $< $(DESTDIR)/$(PREFIX)/share/locale/$*/LC_MESSAGES/radeontop.mo ++ $(INSTALL) -D -m 644 $< $(PREFIX)/share/locale/$*/LC_MESSAGES/radeontop.mo + + install: all $(inst) diff --git a/graphics/radeontop/pkg/DESCR b/graphics/radeontop/pkg/DESCR new file mode 100644 index 00000000000..1af0c5ad279 --- /dev/null +++ b/graphics/radeontop/pkg/DESCR @@ -0,0 +1,5 @@ +View your GPU utilization, both for the total activity percent and individual +blocks. The total GPU utilization is also valid for OpenCL loads; the other +blocks are only useful in GL loads. +Requires access to /dev/dri/cardN files or /dev/mem (root privileges). +R600 and up, even Southern Islands should work fine. diff --git a/graphics/radeontop/pkg/PLIST b/graphics/radeontop/pkg/PLIST new file mode 100644 index 00000000000..365e06f530e --- /dev/null +++ b/graphics/radeontop/pkg/PLIST @@ -0,0 +1,6 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2021/10/29 21:00:42 sdk Exp $ +@lib lib/libradeontop_xcb.so.${LIBradeontop_xcb_VERSION} +@man man/man1/radeontop.1 +@bin sbin/radeontop +share/doc/pkg-readmes/${PKGSTEM} +share/locale/ru/LC_MESSAGES/radeontop.mo diff --git a/graphics/radeontop/pkg/README b/graphics/radeontop/pkg/README new file mode 100644 index 00000000000..6ba978ecdcf --- /dev/null +++ b/graphics/radeontop/pkg/README @@ -0,0 +1,11 @@ +$OpenBSD: README,v 1.1.1.1 2021/10/29 21:00:42 sdk Exp $ + ++----------------------------------------------------------------------- +| Running ${PKGSTEM} on OpenBSD ++----------------------------------------------------------------------- + +Radeontop needs access to the system main memory via /dev/mem. This is +forbidden on a default installation. To allow access to this device, add +the following line to /etc/sysctl.conf. + +kern.allowkmem=1