summaryrefslogtreecommitdiff
path: root/sysutils/libdrm
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2019-07-22 11:50:47 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2019-07-22 17:37:52 +0200
commit49dcc14de3dd4f9756be1b6f039fd5041e57da4c (patch)
tree2816baa111f5c9963ddd7d46e17d4365c6aacc0b /sysutils/libdrm
parent2d373558f646b1ac1d5638f4d5e83d6921014dff (diff)
Initial libdrm
Diffstat (limited to 'sysutils/libdrm')
-rw-r--r--sysutils/libdrm/Makefile139
-rw-r--r--sysutils/libdrm/distinfo2
-rw-r--r--sysutils/libdrm/patches/patch-libsync_h14
-rw-r--r--sysutils/libdrm/patches/patch-man_drm_xml14
-rw-r--r--sysutils/libdrm/patches/patch-xf86drm_c168
-rw-r--r--sysutils/libdrm/pkg/DESCR11
-rw-r--r--sysutils/libdrm/pkg/PLIST69
7 files changed, 417 insertions, 0 deletions
diff --git a/sysutils/libdrm/Makefile b/sysutils/libdrm/Makefile
new file mode 100644
index 0000000..284abf8
--- /dev/null
+++ b/sysutils/libdrm/Makefile
@@ -0,0 +1,139 @@
+# $OpenBSD: Makefile.template,v 1.83 2019/07/02 12:03:14 sthen Exp $
+#
+ONLY_FOR_ARCHS = amd64 i386 sparc64
+
+COMMENT = Direct Rendering Manager library and headers
+
+# XX .99
+DISTNAME = libdrm-2.4.98
+
+SHARED_LIBS = drm 7.7 drm_radeon 4.0 drm_intel 5.4 \
+ drm_amdgpu 1.8 drm_nouveau 3.0
+
+# the category used in the directory name, /usr/ports/<category>/portname,
+# must be included and listed first.
+CATEGORIES = sysutils
+
+HOMEPAGE = https://gitlab.freedesktop.org/mesa/drm
+
+MAINTAINER = xenocara@openbsd.org
+
+# MIT
+PERMIT_PACKAGE = Yes
+
+WANTLIB = m pciaccess
+
+MASTER_SITES = https://dri.freedesktop.org/libdrm/
+
+# Dependencies
+#MODULES = ???
+#BUILD_DEPENDS = ???
+#RUN_DEPENDS = ???
+#LIB_DEPENDS = ???
+#TEST_DEPENDS = ???
+
+#MAKE_FLAGS = ???
+#MAKE_ENV = ???
+#FAKE_FLAGS = ???
+#TEST_FLAGS = ???
+
+# build/configuration variables
+#
+SEPARATE_BUILD = Yes
+#SEPARATE_BUILD = flavored (distinct flavors may share a common WRKSRC)
+#USE_GMAKE = Yes
+#USE_GROFF = Yes
+# Programs that require GNU libtool to build instead of the OpenBSD one
+# should use this option. Add a comment explaining why. Don't use this if
+# a port requires libtool's .m4 files but otherwise can use OpenBSD libtool,
+# in that case use "BUILD_DEPENDS=devel/libtool" instead.
+#USE_LIBTOOL= gnu
+# Set CONFIGURE_STYLE to value corresponding to some standard configuration
+# perl [modbuild]: perl's MakeMaker Makefile.PL (modbuild: perl's
+# Module::Build Build.PL)
+# gnu [autoconf] [old] [dest]: gnu style configure (old: no
+# sysconfdir), (dest: add DESTDIR, does not handle it),
+# autoconf: run autoconf to regenerate configure script. implies gnu.
+# (see also "do-gen" target below).
+# XXX: cygnus products do NOT use autoconf for making the main
+# configure from configure.in
+# imake [noman]: port uses imake for configuration.
+# (noman: no man page installation)
+# simple: port has its own configure script
+# none: override default CONFIGURE_STYLE coming from a module
+# (needed for some ports using lang/python, etc.)
+CONFIGURE_STYLE = gnu
+#CONFIGURE_SCRIPT = ??? (if other than configure)
+#CONFIGURE_ARGS = ???
+#CONFIGURE_ENV = ???
+
+# for gnu stuff
+#AUTOCONF_VERSION = ??? (defaults to 2.13)
+#AUTOMAKE_VERSION = ??? (defaults to 1.4)
+# config.guess and others are copied here
+#MODGNU_CONFIG_GUESS_DIRS = ??? (defaults to ${WRKSRC})
+
+# Is the build automagic or is it interactive
+#
+#IS_INTERACTIVE = Yes
+#TEST_IS_INTERACTIVE = Yes
+
+# Assume you have one multiple choice flavor: 1 2 3 and switches a b.
+# You would write
+#
+#FLAVORS = 1 2 3 a b
+#FLAVOR ?=
+# grab multiple choice value
+#CHOICE = ${FLAVOR:Na:Nb}
+# check that CHOICE is 1 OR 2 OR 3, or error out
+#.if ${CHOICE} == "1"
+# code for 1
+#.elif ${CHOICE} == "2"
+# code for 2
+#.elif ${CHOICE} == "3"
+# code for 3
+#.else
+#ERRORS += "Fatal: Conflicting flavor: ${FLAVOR}"
+#.endif
+# check for switches
+#.if ${FLAVOR:Ma}
+# code for a
+#.endif
+#.if ${FLAVOR:Mb}
+# code for b
+#.endif
+
+# Things that we don't want to do for this port/package
+# Generally, DON'T set anything to No if it's not needed.
+# The time gained is not worth it.
+#
+#NO_BUILD = Yes
+#NO_TEST = Yes
+
+# Overrides for default values
+#
+#CFLAGS = ???
+#LDFLAGS = ???
+#MAKE_FILE = ???
+#PKG_ARCH = ??? (* for arch-independent packages)
+#WRKDIST = ??? if other than ${WRKDIR}/${DISTNAME}
+#WRKSRC = ??? if other than ${WRKDIST}
+#WRKBUILD = ??? if other than ${WRKSRC}
+#WRKCONF = ??? if other than ${WRKBUILD}
+
+#ALL_TARGET = ???
+#INSTALL_TARGET = ???
+#TEST_TARGET = ???
+
+# For ports that use a script or autoreconf to generate autoconf/automake
+# files (where "CONFIGURE_STYLE=autoconf" isn't enough), use some/all of these
+# dependencies, and add a do-gen target:
+#
+#BUILD_DEPENDS = ${MODGNU_AUTOCONF_DEPENDS} \
+# ${MODGNU_AUTOMAKE_DEPENDS} \
+# devel/libtool
+#
+#do-gen:
+# cd ${WRKSRC}; ${AUTOCONF_ENV} ./autogen.sh
+
+.include <bsd.port.mk>
diff --git a/sysutils/libdrm/distinfo b/sysutils/libdrm/distinfo
new file mode 100644
index 0000000..33fe2a3
--- /dev/null
+++ b/sysutils/libdrm/distinfo
@@ -0,0 +1,2 @@
+SHA256 (libdrm-2.4.98.tar.gz) = OXieLDfnMAMkd3pcCk6hhGU3gisV6j5jCwoADYJD7pc=
+SIZE (libdrm-2.4.98.tar.gz) = 1141680
diff --git a/sysutils/libdrm/patches/patch-libsync_h b/sysutils/libdrm/patches/patch-libsync_h
new file mode 100644
index 0000000..d1fad0f
--- /dev/null
+++ b/sysutils/libdrm/patches/patch-libsync_h
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: libsync.h
+--- libsync.h.orig
++++ libsync.h
+@@ -75,7 +75,7 @@ static inline int sync_wait(int fd, int timeout)
+ }
+ return 0;
+ } else if (ret == 0) {
+- errno = ETIME;
++ errno = ETIMEDOUT;
+ return -1;
+ }
+ } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
diff --git a/sysutils/libdrm/patches/patch-man_drm_xml b/sysutils/libdrm/patches/patch-man_drm_xml
new file mode 100644
index 0000000..033d745
--- /dev/null
+++ b/sysutils/libdrm/patches/patch-man_drm_xml
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: man/drm.xml
+--- man/drm.xml.orig
++++ man/drm.xml
+@@ -60,7 +60,7 @@
+ <para>When a GPU is detected, the DRM system loads a driver for the detected
+ hardware type. Each connected GPU is then presented to user-space via
+ a character-device that is usually available as
+- <filename>/dev/dri/card0</filename> and can be accessed with
++ <filename>/dev/drm0</filename> and can be accessed with
+ <citerefentry><refentrytitle>open</refentrytitle><manvolnum>2</manvolnum></citerefentry>
+ and
+ <citerefentry><refentrytitle>close</refentrytitle><manvolnum>2</manvolnum></citerefentry>.
diff --git a/sysutils/libdrm/patches/patch-xf86drm_c b/sysutils/libdrm/patches/patch-xf86drm_c
new file mode 100644
index 0000000..835484b
--- /dev/null
+++ b/sysutils/libdrm/patches/patch-xf86drm_c
@@ -0,0 +1,168 @@
+$OpenBSD$
+
+Index: xf86drm.c
+--- xf86drm.c.orig
++++ xf86drm.c
+@@ -101,6 +101,10 @@
+ #define DRM_MAJOR 226 /* Linux */
+ #endif
+
++#ifdef __OpenBSD__
++#define X_PRIVSEP
++#endif
++
+ #if defined(__OpenBSD__) || defined(__DragonFly__)
+ struct drm_pciinfo {
+ uint16_t domain;
+@@ -310,6 +314,18 @@ static int chown_check_return(const char *path, uid_t
+ }
+ #endif
+
++#ifdef X_PRIVSEP
++static int
++_priv_open_device(const char *path)
++{
++ drmMsg("_priv_open_device\n");
++ return open(path, O_RDWR, 0);
++}
++
++drm_public int priv_open_device(const char *)
++ __attribute__((weak, alias ("_priv_open_device")));
++#endif
++
+ /**
+ * Open the DRM device, creating it if necessary.
+ *
+@@ -360,6 +376,7 @@ static int drmOpenDevice(dev_t dev, int minor, int typ
+ devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
+ }
+
++#ifndef __OpenBSD__
+ #if !UDEV
+ if (stat(DRM_DIR_NAME, &st)) {
+ if (!isroot)
+@@ -406,14 +423,19 @@ wait_for_udev:
+ }
+ }
+ #endif
++#endif /* __OpenBSD__ */
+
++#ifndef X_PRIVSEP
+ fd = open(buf, O_RDWR | O_CLOEXEC, 0);
++#else
++ fd = priv_open_device(buf);
++#endif
+ drmMsg("drmOpenDevice: open result is %d, (%s)\n",
+ fd, fd < 0 ? strerror(errno) : "OK");
+ if (fd >= 0)
+ return fd;
+
+-#if !UDEV
++#if !UDEV && !defined(__OpenBSD__)
+ /* Check if the device node is not what we expect it to be, and recreate it
+ * and try again if so.
+ */
+@@ -476,8 +498,13 @@ static int drmOpenMinor(int minor, int create, int typ
+ };
+
+ sprintf(buf, dev_name, DRM_DIR_NAME, minor);
+- if ((fd = open(buf, O_RDWR | O_CLOEXEC, 0)) >= 0)
+- return fd;
++#ifndef X_PRIVSEP
++ fd = open(buf, O_RDWR | O_CLOEXEC, 0);
++#else
++ fd = priv_open_device(buf);
++#endif
++ if (fd >= 0)
++ return fd;
+ return -errno;
+ }
+
+@@ -2904,7 +2931,7 @@ static char *drmGetMinorNameForFD(int fd, int type)
+ char buf[PATH_MAX + 1];
+ const char *dev_name;
+ unsigned int maj, min;
+- int n, base;
++ int n;
+
+ if (fstat(fd, &sbuf))
+ return NULL;
+@@ -2929,11 +2956,7 @@ static char *drmGetMinorNameForFD(int fd, int type)
+ return NULL;
+ };
+
+- base = drmGetMinorBase(type);
+- if (base < 0)
+- return NULL;
+-
+- n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min - base);
++ n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min);
+ if (n == -1 || n >= sizeof(buf))
+ return NULL;
+
+@@ -3141,10 +3164,6 @@ drm_public int drmDevicesEqual(drmDevicePtr a, drmDevi
+
+ static int drmGetNodeType(const char *name)
+ {
+- if (strncmp(name, DRM_PRIMARY_MINOR_NAME,
+- sizeof(DRM_PRIMARY_MINOR_NAME) - 1) == 0)
+- return DRM_NODE_PRIMARY;
+-
+ if (strncmp(name, DRM_CONTROL_MINOR_NAME,
+ sizeof(DRM_CONTROL_MINOR_NAME ) - 1) == 0)
+ return DRM_NODE_CONTROL;
+@@ -3153,6 +3172,10 @@ static int drmGetNodeType(const char *name)
+ sizeof(DRM_RENDER_MINOR_NAME) - 1) == 0)
+ return DRM_NODE_RENDER;
+
++ if (strncmp(name, DRM_PRIMARY_MINOR_NAME,
++ sizeof(DRM_PRIMARY_MINOR_NAME) - 1) == 0)
++ return DRM_NODE_PRIMARY;
++
+ return -EINVAL;
+ }
+
+@@ -3827,7 +3850,7 @@ drm_public int drmGetDevice2(int fd, uint32_t flags, d
+ char node[PATH_MAX + 1];
+ const char *dev_name;
+ int node_type, subsystem_type;
+- int maj, min, n, ret, base;
++ int maj, min, n, ret;
+
+ if (fd == -1 || device == NULL)
+ return -EINVAL;
+@@ -3859,11 +3882,7 @@ drm_public int drmGetDevice2(int fd, uint32_t flags, d
+ return -EINVAL;
+ };
+
+- base = drmGetMinorBase(node_type);
+- if (base < 0)
+- return -EINVAL;
+-
+- n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min - base);
++ n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min);
+ if (n == -1 || n >= PATH_MAX)
+ return -errno;
+ if (stat(node, &sbuf))
+@@ -4083,7 +4102,7 @@ drm_public char *drmGetDeviceNameFromFd2(int fd)
+ char node[PATH_MAX + 1];
+ const char *dev_name;
+ int node_type;
+- int maj, min, n, base;
++ int maj, min, n;
+
+ if (fstat(fd, &sbuf))
+ return NULL;
+@@ -4112,11 +4131,7 @@ drm_public char *drmGetDeviceNameFromFd2(int fd)
+ return NULL;
+ };
+
+- base = drmGetMinorBase(node_type);
+- if (base < 0)
+- return NULL;
+-
+- n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min - base);
++ n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min);
+ if (n == -1 || n >= PATH_MAX)
+ return NULL;
+
diff --git a/sysutils/libdrm/pkg/DESCR b/sysutils/libdrm/pkg/DESCR
new file mode 100644
index 0000000..041fb85
--- /dev/null
+++ b/sysutils/libdrm/pkg/DESCR
@@ -0,0 +1,11 @@
+This is libdrm, a userspace library for accessing the DRM, direct
+rendering manager, on Linux, BSD and other operating systems that
+support the ioctl interface. The library provides wrapper functions
+for the ioctls to avoid exposing the kernel interface directly, and
+for chipsets with drm memory manager, support for tracking relocations
+and buffers. New functionality in the kernel DRM drivers typically
+requires a new libdrm, but a new libdrm will always work with an older
+kernel.
+
+libdrm is a low-level library, typically used by graphics drivers such
+as the Mesa drivers, the X drivers, libva and similar projects.
diff --git a/sysutils/libdrm/pkg/PLIST b/sysutils/libdrm/pkg/PLIST
new file mode 100644
index 0000000..33cb445
--- /dev/null
+++ b/sysutils/libdrm/pkg/PLIST
@@ -0,0 +1,69 @@
+@comment $OpenBSD: PLIST,v$
+include/libdrm/
+include/libdrm/amdgpu.h
+include/libdrm/amdgpu_drm.h
+include/libdrm/drm.h
+include/libdrm/drm_fourcc.h
+include/libdrm/drm_mode.h
+include/libdrm/drm_sarea.h
+include/libdrm/i915_drm.h
+include/libdrm/intel_aub.h
+include/libdrm/intel_bufmgr.h
+include/libdrm/intel_debug.h
+include/libdrm/mach64_drm.h
+include/libdrm/mga_drm.h
+include/libdrm/msm_drm.h
+include/libdrm/nouveau/
+include/libdrm/nouveau/nouveau.h
+include/libdrm/nouveau/nvif/
+include/libdrm/nouveau/nvif/cl0080.h
+include/libdrm/nouveau/nvif/cl9097.h
+include/libdrm/nouveau/nvif/class.h
+include/libdrm/nouveau/nvif/if0002.h
+include/libdrm/nouveau/nvif/if0003.h
+include/libdrm/nouveau/nvif/ioctl.h
+include/libdrm/nouveau/nvif/unpack.h
+include/libdrm/nouveau_drm.h
+include/libdrm/qxl_drm.h
+include/libdrm/r128_drm.h
+include/libdrm/r600_pci_ids.h
+include/libdrm/radeon_bo.h
+include/libdrm/radeon_bo_gem.h
+include/libdrm/radeon_bo_int.h
+include/libdrm/radeon_cs.h
+include/libdrm/radeon_cs_gem.h
+include/libdrm/radeon_cs_int.h
+include/libdrm/radeon_drm.h
+include/libdrm/radeon_surface.h
+include/libdrm/savage_drm.h
+include/libdrm/sis_drm.h
+include/libdrm/tegra_drm.h
+include/libdrm/vc4_drm.h
+include/libdrm/via_drm.h
+include/libdrm/virtgpu_drm.h
+include/libdrm/vmwgfx_drm.h
+include/libsync.h
+include/xf86drm.h
+include/xf86drmMode.h
+lib/libdrm.a
+lib/libdrm.la
+@lib lib/libdrm.so.${LIBdrm_VERSION}
+lib/libdrm_amdgpu.a
+lib/libdrm_amdgpu.la
+@lib lib/libdrm_amdgpu.so.${LIBdrm_amdgpu_VERSION}
+lib/libdrm_intel.a
+lib/libdrm_intel.la
+@lib lib/libdrm_intel.so.${LIBdrm_intel_VERSION}
+lib/libdrm_nouveau.a
+lib/libdrm_nouveau.la
+@lib lib/libdrm_nouveau.so.${LIBdrm_nouveau_VERSION}
+lib/libdrm_radeon.a
+lib/libdrm_radeon.la
+@lib lib/libdrm_radeon.so.${LIBdrm_radeon_VERSION}
+lib/pkgconfig/libdrm.pc
+lib/pkgconfig/libdrm_amdgpu.pc
+lib/pkgconfig/libdrm_intel.pc
+lib/pkgconfig/libdrm_nouveau.pc
+lib/pkgconfig/libdrm_radeon.pc
+share/libdrm/
+share/libdrm/amdgpu.ids