1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[standard]= Direct Rendering Module services kernel interface
8 HOMEPAGE= https://dri.freedesktop.org
12 SITES[main]= https://dri.freedesktop.org/libdrm/
13 DISTFILE[1]= libdrm-2.4.115.tar.xz:main
15 SPKGS[standard]= complete
20 OPTIONS_AVAILABLE= ARM X86
21 OPTIONS_STANDARD= ARM X86
26 BUILD_DEPENDS= libpthread-stubs:single:standard
27 libxslt:primary:standard
28 python-docutils:single:python_default
30 USES= gmake pkgconfig solaris-funcs meson
31 GNOME_COMPONENTS= libxml2
32 XORG_COMPONENTS= pciaccess
35 LICENSE_FILE= MIT:{{WRKDIR}}/LICENSE_MIT
36 LICENSE_AWK= MIT:"_XF86DRM_H_"
37 LICENSE_SOURCE= MIT:{{WRKSRC}}/xf86drm.h
40 FPC_EQUIVALENT= graphics/libdrm
41 MESON_ARGS= -Dman-pages=enabled
42 -Dinstall-test-programs=true
43 -Dcairo-tests=disabled
47 SOL_FUNCTIONS= getline:amdgpu/amdgpu_asic_id.c
49 asprintf:tests/modetest/modetest.c
50 strndup:tests/modetest/modetest.c
52 INSTALL_TARGET= install-strip
53 INSTALL_REQ_TOOLCHAIN= yes
55 VAR_OPSYS[sunos]= LDFLAGS=-lrt
56 VAR_OPSYS[netbsd]= LDFLAGS=-lpci
58 [X86].DESCRIPTION= DRM Drivers for amd64 and i386 architectures
59 [X86].CONFIGURE_ARGS_OFF= -Dintel=disabled
61 [X86].CONFIGURE_ARGS_ON= -Dintel=enabled
64 [ARM].DESCRIPTION= DRM Drivers for AARCH64 architecture
65 [ARM].CONFIGURE_ARGS_OFF= -Detnaviv=disabled
71 [ARM].CONFIGURE_ARGS_ON= -Detnaviv=enabled
78 [FILE:70:descriptions/desc.primary]
79 Userspace interface to kernel DRM (Direct Rendering Module) services.
83 554cfbfe0542bddb391b4e3e05bfbbfc3e282b955bd56218d21c0616481f65eb 469952 libdrm-2.4.115.tar.xz
86 [FILE:409:manifests/plist.primary]
89 libdrm_freedreno.so.1.0.0
90 %%X86-ON%%bin/amdgpu_stress
93 libdrm_amdgpu.so.1.0.0
97 libdrm_nouveau.so.2.0.0
99 libdrm_radeon.so.1.0.1
100 %%X86-ON%%share/libdrm/amdgpu.ids
112 [FILE:139:manifests/plist.man]
116 drmModeGetResources.3.gz
123 [FILE:1117:manifests/plist.dev]
124 %%ARM-ON%%include/freedreno/
126 freedreno_ringbuffer.h
127 %%ARM-ON%%include/libdrm/
130 %%ARM-ON%%lib/libdrm_freedreno.so
131 %%ARM-ON%%lib/pkgconfig/
134 %%X86-ON%%include/libdrm/
148 %%X86-ON%%include/libdrm/nouveau/nouveau.h
149 %%X86-ON%%include/libdrm/nouveau/nvif/
162 %%X86-ON%%lib/pkgconfig/
192 lib/pkgconfig/libdrm.pc
195 [FILE:425:patches/patch-amdgpu_amdgpu__cs.c]
196 $NetBSD: patch-amdgpu_amdgpu__cs.c,v 1.3 2022/03/13 15:20:01 tnn Exp $
198 libc-supplied compat alloca(3) should not be used
200 --- amdgpu/amdgpu_cs.c.orig 2022-11-03 08:33:36 UTC
201 +++ amdgpu/amdgpu_cs.c
205 #include <sys/ioctl.h>
207 -# include <alloca.h>
209 +#define alloca(size) __builtin_alloca(size)
212 #include "amdgpu_drm.h"
215 [FILE:834:patches/patch-amdgpu_amdgpu__device.c]
216 --- amdgpu/amdgpu_device.c.orig 2022-11-03 08:33:36 UTC
217 +++ amdgpu/amdgpu_device.c
218 @@ -177,7 +177,12 @@ drm_public int amdgpu_device_initialize(
221 if ((flag_auth) && (!flag_authexist)) {
222 +#ifdef F_DUPFD_CLOEXEC
223 dev->flink_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
225 + dev->flink_fd = fcntl(fd, F_DUPFD, 0);
226 + fcntl(dev->flink_fd, F_SETFD, FD_CLOEXEC);
229 *major_version = dev->major_version;
230 *minor_version = dev->minor_version;
231 @@ -211,7 +216,12 @@ drm_public int amdgpu_device_initialize(
235 +#ifdef F_DUPFD_CLOEXEC
236 dev->fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
238 + dev->fd = fcntl(fd, F_DUPFD, 0);
239 + fcntl(dev->fd, F_SETFD, FD_CLOEXEC);
241 dev->flink_fd = dev->fd;
242 dev->major_version = version->version_major;
243 dev->minor_version = version->version_minor;
246 [FILE:283:patches/patch-include_drm_drm.h]
247 --- include/drm/drm.h.orig 2022-11-03 08:33:36 UTC
248 +++ include/drm/drm.h
249 @@ -837,7 +837,11 @@ struct drm_set_client_cap {
252 #define DRM_RDWR O_RDWR
254 +#define DRM_CLOEXEC 0
256 #define DRM_CLOEXEC O_CLOEXEC
258 struct drm_prime_handle {
263 [FILE:689:patches/patch-intel_intel__bufmgr__gem.c]
264 --- intel/intel_bufmgr_gem.c.orig 2022-11-03 08:33:36 UTC
265 +++ intel/intel_bufmgr_gem.c
266 @@ -966,6 +966,27 @@ drm_intel_gem_bo_alloc_userptr(drm_intel
271 +#define posix_memalign illumos_memalign
273 +posix_memalign(void **memptr, size_t alignment, size_t size)
278 + if (alignment == 0 ||
279 + (alignment & (sizeof (void *) - 1)) != 0 ||
280 + (alignment & (alignment - 1)) != 0)
282 + else if (size != 0 &&
283 + (ptr = memalign(alignment, size)) == NULL)
292 has_userptr(drm_intel_bufmgr_gem *bufmgr_gem)
296 [FILE:379:patches/patch-intel_test__decode.c]
297 --- intel/test_decode.c.orig 2022-11-03 08:33:36 UTC
298 +++ intel/test_decode.c
301 #include <sys/types.h>
302 #include <sys/stat.h>
304 +#define errx(exitcode, format, args...) \
305 + { fprintf(stderr, format "\n", ## args); \
311 #include "libdrm_macros.h"
312 #include "intel_bufmgr.h"
315 [FILE:521:patches/patch-libsync.h]
316 define ETIME as ETIMEOUT same as done in mesa
318 --- libsync.h.orig 2022-11-03 08:33:36 UTC
321 #include <sys/ioctl.h>
322 #include <sys/poll.h>
325 +#define ETIME ETIMEDOUT
328 #if defined(__cplusplus)
330 @@ -53,6 +56,9 @@ struct sync_merge_data {
335 +#include <sys/ioccom.h>
337 #define SYNC_IOC_MAGIC '>'
338 #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
342 [FILE:542:patches/patch-meson.build]
343 $NetBSD: patch-meson.build,v 1.3 2022/11/03 20:52:29 triaxx Exp $
345 xxx how to deal with this properly?
347 --- meson.build.orig 2022-11-03 08:33:36 UTC
349 @@ -40,7 +40,7 @@ with_freedreno_kgsl = get_option('freedr
350 with_install_tests = get_option('install-test-programs')
351 with_tests = get_option('tests')
353 -if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system())
354 +if ['dragonfly'].contains(host_machine.system())
355 dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
357 dep_pthread_stubs = []
360 [FILE:267:patches/patch-tests_drmdevice.c]
361 --- tests/drmdevice.c.orig 2022-11-03 08:33:36 UTC
362 +++ tests/drmdevice.c
372 print_device_info(drmDevicePtr device, int i, bool print_revision)
375 [FILE:333:patches/patch-tests_modetest_meson.build]
376 --- tests/modetest/meson.build.orig 2022-11-03 08:33:36 UTC
377 +++ tests/modetest/meson.build
378 @@ -25,5 +25,6 @@ modetest = executable(
379 include_directories : [inc_root, inc_tests, inc_drm],
380 dependencies : [dep_threads, dep_cairo],
381 link_with : [libdrm, libutil],
382 + link_args : ['-lpthread'],
383 install : with_install_tests,
387 [FILE:358:patches/patch-tests_nouveau_meson.build]
388 --- tests/nouveau/meson.build.orig 2022-11-03 08:33:36 UTC
389 +++ tests/nouveau/meson.build
390 @@ -24,6 +24,7 @@ threaded = executable(
391 dependencies : [dep_dl, dep_threads],
392 include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
393 link_with : [libdrm, libdrm_nouveau],
394 + link_args : ['-lpthread'],
395 c_args : libdrm_c_args,
400 [FILE:387:patches/patch-tests_nouveau_threaded.c]
401 --- tests/nouveau/threaded.c.orig 2022-11-03 08:33:36 UTC
402 +++ tests/nouveau/threaded.c
403 @@ -36,7 +36,7 @@ static int failed;
405 static int import_fd;
407 -#if defined(__GLIBC__) || defined(__FreeBSD__)
408 +#if defined(__GLIBC__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
409 int ioctl(int fd, unsigned long request, ...)
411 int ioctl(int fd, int request, ...)
414 [FILE:7504:patches/patch-xf86drm.c]
415 --- xf86drm.c.orig 2022-11-03 08:33:36 UTC
419 #include <inttypes.h>
421 -#if defined(__FreeBSD__)
426 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
433 #include <sys/param.h>
434 #include <sys/pciio.h>
440 -#define DRM_MAJOR 34
441 +#define DRM_MAJOR 180
442 +#include <sys/param.h>
443 +#include <dev/pci/pcireg.h>
448 @@ -313,8 +326,10 @@ drmGetFormatModifierNameFromArm(uint64_t
449 char *modifier_name = NULL;
453 fp = open_memstream(&modifier_name, &size);
459 @@ -459,8 +474,10 @@ drmGetFormatModifierNameFromAmd(uint64_t
460 tile_version = AMD_FMT_MOD_GET(TILE_VERSION, modifier);
461 dcc = AMD_FMT_MOD_GET(DCC, modifier);
464 fp = open_memstream(&mod_amd, &size);
470 @@ -963,7 +980,7 @@ static int drmGetMinorBase(int type)
472 static int drmGetMinorType(int major, int minor)
476 char name[SPECNAMELEN];
479 @@ -3219,7 +3236,7 @@ drm_public int drmIsMaster(int fd)
481 drm_public char *drmGetDeviceNameFromFd(int fd)
488 @@ -3266,7 +3283,7 @@ static bool drmNodeIsDRM(int maj, int mi
489 snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm",
491 return stat(path, &sbuf) == 0;
492 -#elif defined(__FreeBSD__)
494 char name[SPECNAMELEN];
496 if (!devname_r(makedev(maj, min), S_IFCHR, name, sizeof(name)))
497 @@ -3389,7 +3406,7 @@ static char *drmGetMinorNameForFD(int fd
501 -#elif defined(__FreeBSD__)
504 char dname[SPECNAMELEN];
506 @@ -3574,6 +3591,65 @@ static int drmParseSubsystemType(int maj
507 return DRM_BUS_VIRTIO;
509 return subsystem_type;
510 +#elif defined(__NetBSD__)
514 + unsigned domain, bus, dev;
518 + /* Get the type of device we're looking for to pick the right pathname. */
519 + type = drmGetMinorType(maj, min);
523 + /* Open the device. Don't try to create it if it's not there. */
524 + fd = drmOpenMinor(min, 0, type);
529 + * Set the interface version to 1.4 or 1.1, which has the effect of
530 + * populating the bus id for us.
532 + sv.drm_di_major = 1;
533 + sv.drm_di_minor = 4;
534 + sv.drm_dd_major = -1;
535 + sv.drm_dd_minor = -1;
536 + if (drmSetInterfaceVersion(fd, &sv)) {
537 + sv.drm_di_major = 1;
538 + sv.drm_di_minor = 1;
539 + sv.drm_dd_major = -1;
540 + sv.drm_dd_minor = -1;
541 + if (drmSetInterfaceVersion(fd, &sv)) {
543 + * We're probably not the master. Hope the master already
544 + * set the version to >=1.1 so that we can get the busid.
549 + /* Get the bus id. */
550 + buf = drmGetBusid(fd);
552 + /* We're done with the device now. */
555 + /* If there is no bus id, fail. */
559 + /* Find a string we know about; otherwise -EINVAL. */
561 + if (strncmp(buf, "pci:", 4) == 0)
564 + /* We're done with the bus id. */
567 + /* Success or not, we're done. */
569 #elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
572 @@ -3600,7 +3676,7 @@ get_pci_path(int maj, int min, char *pci
578 static int get_sysctl_pci_bus_info(int maj, int min, drmPciBusInfoPtr info)
580 char dname[SPECNAMELEN];
581 @@ -3685,6 +3761,73 @@ static int drmParsePciBusInfo(int maj, i
585 +#elif defined(__NetBSD__)
589 + unsigned domain, bus, dev;
593 + /* Get the type of device we're looking for to pick the right pathname. */
594 + type = drmGetMinorType(maj, min);
598 + /* Open the device. Don't try to create it if it's not there. */
599 + fd = drmOpenMinor(min, 0, type);
604 + * Set the interface version to 1.4 or 1.1, which has the effect of
605 + * populating the bus id for us.
607 + sv.drm_di_major = 1;
608 + sv.drm_di_minor = 4;
609 + sv.drm_dd_major = -1;
610 + sv.drm_dd_minor = -1;
611 + if (drmSetInterfaceVersion(fd, &sv)) {
612 + sv.drm_di_major = 1;
613 + sv.drm_di_minor = 1;
614 + sv.drm_dd_major = -1;
615 + sv.drm_dd_minor = -1;
616 + if (drmSetInterfaceVersion(fd, &sv)) {
618 + * We're probably not the master. Hope the master already
619 + * set the version to >=1.1 so that we can get the busid.
624 + /* Get the bus id. */
625 + buf = drmGetBusid(fd);
627 + /* We're done with the device now. */
630 + /* If there is no bus id, fail. */
634 + /* Parse the bus id. */
635 + ret = sscanf(buf, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, &func);
637 + /* We're done with the bus id. */
640 + /* If scanf didn't return 4 -- domain, bus, dev, func -- then fail. */
644 + /* Populate the results. */
645 + info->domain = domain;
652 #elif defined(__OpenBSD__) || defined(__DragonFly__)
653 struct drm_pciinfo pinfo;
655 @@ -3857,6 +4000,48 @@ static int drmParsePciDeviceInfo(int maj
656 return parse_config_sysfs_file(maj, min, device);
659 +#elif defined(__NetBSD__)
660 + drmPciBusInfo businfo;
661 + char fname[PATH_MAX];
663 + pcireg_t id, class, subsys;
666 + /* Find where on the bus the device lives. */
667 + ret = drmParsePciBusInfo(maj, min, &businfo);
671 + /* Open the pciN device node to get at its config registers. */
672 + if (snprintf(fname, sizeof fname, "/dev/pci%u", businfo.domain)
675 + if ((pcifd = open(fname, O_RDONLY)) == -1)
679 + /* Read the id and class pci config registers. */
680 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
681 + PCI_ID_REG, &id) == -1)
683 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
684 + PCI_CLASS_REG, &class) == -1)
686 + if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
687 + PCI_SUBSYS_ID_REG, &subsys) == -1)
691 + device->vendor_id = PCI_VENDOR(id);
692 + device->device_id = PCI_PRODUCT(id);
693 + device->subvendor_id = PCI_SUBSYS_VENDOR(subsys);
694 + device->subdevice_id = PCI_SUBSYS_ID(subsys);
695 + device->revision_id = PCI_REVISION(class);
701 #elif defined(__OpenBSD__) || defined(__DragonFly__)
702 struct drm_pciinfo pinfo;
706 [FILE:397:patches/patch-xf86drm.h]
707 --- xf86drm.h.orig 2022-11-03 08:33:36 UTC
709 @@ -59,6 +59,9 @@ extern "C" {
710 #else /* One of the *BSDs */
712 #include <sys/ioccom.h>
714 +#define _IOC(inout,group,num,len) (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
716 #define DRM_IOCTL_NR(n) ((n) & 0xff)
717 #define DRM_IOC_VOID IOC_VOID
718 #define DRM_IOC_READ IOC_OUT
721 [FILE:635:patches/patch-xf86drmMode.c]
722 --- xf86drmMode.c.orig 2022-11-03 08:33:36 UTC
726 #include <sys/ioctl.h>
727 #if HAVE_SYS_SYSCTL_H
729 #include <sys/types.h>
731 #include <sys/sysctl.h>
734 @@ -1119,7 +1117,7 @@ drm_public int drmModePageFlipTarget(int
736 drm_public int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
737 uint32_t fb_id, uint32_t flags,
738 - int32_t crtc_x, int32_t crtc_y,
739 + uint32_t crtc_x, int32_t crtc_y,
740 uint32_t crtc_w, uint32_t crtc_h,
741 uint32_t src_x, uint32_t src_y,
742 uint32_t src_w, uint32_t src_h)
745 [FILE:505:patches/patch-xf86drmMode.h]
746 --- xf86drmMode.h.orig 2022-11-03 08:33:36 UTC
748 @@ -429,7 +429,7 @@ extern drmModePlaneResPtr drmModeGetPlan
749 extern drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id);
750 extern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
751 uint32_t fb_id, uint32_t flags,
752 - int32_t crtc_x, int32_t crtc_y,
753 + uint32_t crtc_x, int32_t crtc_y,
754 uint32_t crtc_w, uint32_t crtc_h,
755 uint32_t src_x, uint32_t src_y,
756 uint32_t src_w, uint32_t src_h);