Ravenports generated: 23 Jan 2023 14:49
[ravenports.git] / bucket_CD / libdrm
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               libdrm
4 VERSION=                2.4.114
5 KEYWORDS=               graphics x11
6 VARIANTS=               standard
7 SDESC[standard]=        Direct Rendering Module services kernel interface
8 HOMEPAGE=               https://dri.freedesktop.org
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            https://dri.freedesktop.org/libdrm/
13 DISTFILE[1]=            libdrm-2.4.114.tar.xz:main
14 DF_INDEX=               1
15 SPKGS[standard]=        single
16
17 OPTIONS_AVAILABLE=      ARM X86
18 OPTIONS_STANDARD=       ARM X86
19 OPT_ON[aarch64]=        ARM
20 OPT_ON[x86_64]=         X86
21 OPT_ON[i386]=           X86
22
23 BUILD_DEPENDS=          libpthread-stubs:single:standard
24                         libxslt:single:standard
25                         libxml2:single:standard
26                         python-docutils:single:python_default
27
28 USES=                   gmake pkgconfig solaris-funcs meson
29 XORG_COMPONENTS=        pciaccess
30
31 LICENSE=                MIT:single
32 LICENSE_FILE=           MIT:{{WRKDIR}}/LICENSE_MIT
33 LICENSE_AWK=            MIT:"_XF86DRM_H_"
34 LICENSE_SOURCE=         MIT:{{WRKSRC}}/xf86drm.h
35 LICENSE_SCHEME=         solo
36
37 FPC_EQUIVALENT=         graphics/libdrm
38 MESON_ARGS=             -Dman-pages=enabled
39                         -Dinstall-test-programs=true
40                         -Dcairo-tests=disabled
41                         -Dradeon=enabled
42                         -Damdgpu=enabled
43                         -Dnouveau=enabled
44 SOL_FUNCTIONS=          getline:amdgpu/amdgpu_asic_id.c
45                         asprintf:xf86drm.c
46                         asprintf:tests/modetest/modetest.c
47                         strndup:tests/modetest/modetest.c
48
49 INSTALL_TARGET=         install-strip
50 INSTALL_REQ_TOOLCHAIN=  yes
51
52 VAR_OPSYS[sunos]=       LDFLAGS=-lrt
53 VAR_OPSYS[netbsd]=      LDFLAGS=-lpci
54
55 [X86].DESCRIPTION=                      DRM Drivers for amd64 and i386 architectures
56 [X86].CONFIGURE_ARGS_OFF=               -Dintel=disabled
57                                         -Dvmwgfx=disabled
58 [X86].CONFIGURE_ARGS_ON=                -Dintel=enabled
59                                         -Dvmwgfx=enabled
60
61 [ARM].DESCRIPTION=                      DRM Drivers for AARCH64 architecture
62 [ARM].CONFIGURE_ARGS_OFF=               -Detnaviv=disabled
63                                         -Dexynos=disabled
64                                         -Dfreedreno=disabled
65                                         -Domap=disabled
66                                         -Dtegra=disabled
67                                         -Dvc4=disabled
68 [ARM].CONFIGURE_ARGS_ON=                -Detnaviv=enabled
69                                         -Dexynos=enabled
70                                         -Dfreedreno=enabled
71                                         -Domap=enabled
72                                         -Dtegra=enabled
73                                         -Dvc4=enabled
74
75 [FILE:70:descriptions/desc.single]
76 Userspace interface to kernel DRM (Direct Rendering Module) services.
77
78
79 [FILE:100:distinfo]
80 3049cf843a47d12e5eeefbc3be3496d782fa09f42346bf0b7defe3d1e598d026       471664 libdrm-2.4.114.tar.xz
81
82
83 [FILE:1634:manifests/plist.single]
84 %%ARM-ON%%include/freedreno/
85  freedreno_drmif.h
86  freedreno_ringbuffer.h
87 %%ARM-ON%%include/libdrm/
88  vc4_packet.h
89  vc4_qpu_defines.h
90 %%ARM-ON%%lib/
91  libdrm_freedreno.so
92  libdrm_freedreno.so.1
93  libdrm_freedreno.so.1.0.0
94 %%ARM-ON%%lib/pkgconfig/
95  libdrm_freedreno.pc
96  libdrm_vc4.pc
97 %%X86-ON%%bin/amdgpu_stress
98 %%X86-ON%%include/libdrm/
99  amdgpu.h
100  amdgpu_drm.h
101  intel_aub.h
102  intel_bufmgr.h
103  intel_debug.h
104  r600_pci_ids.h
105  radeon_bo.h
106  radeon_bo_gem.h
107  radeon_bo_int.h
108  radeon_cs.h
109  radeon_cs_gem.h
110  radeon_cs_int.h
111  radeon_surface.h
112 %%X86-ON%%include/libdrm/nouveau/nouveau.h
113 %%X86-ON%%include/libdrm/nouveau/nvif/
114  cl0080.h
115  cl9097.h
116  class.h
117  if0002.h
118  if0003.h
119  ioctl.h
120  unpack.h
121 %%X86-ON%%lib/
122  libdrm_amdgpu.so
123  libdrm_amdgpu.so.1
124  libdrm_amdgpu.so.1.0.0
125  libdrm_intel.so
126  libdrm_intel.so.1
127  libdrm_intel.so.1.0.0
128  libdrm_nouveau.so
129  libdrm_nouveau.so.2
130  libdrm_nouveau.so.2.0.0
131  libdrm_radeon.so
132  libdrm_radeon.so.1
133  libdrm_radeon.so.1.0.1
134 %%X86-ON%%lib/pkgconfig/
135  libdrm_amdgpu.pc
136  libdrm_intel.pc
137  libdrm_nouveau.pc
138  libdrm_radeon.pc
139 %%X86-ON%%share/libdrm/amdgpu.ids
140 bin/
141  drmdevice
142  modeprint
143  modetest
144  proptest
145  vbltest
146 include/
147  libsync.h
148  xf86drm.h
149  xf86drmMode.h
150 include/libdrm/
151  drm.h
152  drm_fourcc.h
153  drm_mode.h
154  drm_sarea.h
155  i915_drm.h
156  mach64_drm.h
157  mga_drm.h
158  msm_drm.h
159  nouveau_drm.h
160  qxl_drm.h
161  r128_drm.h
162  radeon_drm.h
163  savage_drm.h
164  sis_drm.h
165  tegra_drm.h
166  vc4_drm.h
167  via_drm.h
168  virtgpu_drm.h
169  vmwgfx_drm.h
170 lib/
171  libdrm.so
172  libdrm.so.2
173  libdrm.so.2.4.0
174 lib/pkgconfig/libdrm.pc
175 share/man/man3/
176  drmAvailable.3.gz
177  drmHandleEvent.3.gz
178  drmModeGetResources.3.gz
179 share/man/man7/
180  drm-kms.7.gz
181  drm-memory.7.gz
182  drm.7.gz
183
184
185 [FILE:425:patches/patch-amdgpu_amdgpu__cs.c]
186 $NetBSD: patch-amdgpu_amdgpu__cs.c,v 1.3 2022/03/13 15:20:01 tnn Exp $
187
188 libc-supplied compat alloca(3) should not be used
189
190 --- amdgpu/amdgpu_cs.c.orig     2022-11-03 08:33:36 UTC
191 +++ amdgpu/amdgpu_cs.c
192 @@ -28,9 +28,7 @@
193  #include <pthread.h>
194  #include <sched.h>
195  #include <sys/ioctl.h>
196 -#if HAVE_ALLOCA_H
197 -# include <alloca.h>
198 -#endif
199 +#define alloca(size) __builtin_alloca(size)
200  
201  #include "xf86drm.h"
202  #include "amdgpu_drm.h"
203
204
205 [FILE:834:patches/patch-amdgpu_amdgpu__device.c]
206 --- amdgpu/amdgpu_device.c.orig 2022-11-03 08:33:36 UTC
207 +++ amdgpu/amdgpu_device.c
208 @@ -177,7 +177,12 @@ drm_public int amdgpu_device_initialize(
209                         return r;
210                 }
211                 if ((flag_auth) && (!flag_authexist)) {
212 +#ifdef F_DUPFD_CLOEXEC
213                         dev->flink_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
214 +#else
215 +                       dev->flink_fd = fcntl(fd, F_DUPFD, 0);
216 +                       fcntl(dev->flink_fd, F_SETFD, FD_CLOEXEC);
217 +#endif
218                 }
219                 *major_version = dev->major_version;
220                 *minor_version = dev->minor_version;
221 @@ -211,7 +216,12 @@ drm_public int amdgpu_device_initialize(
222                 goto cleanup;
223         }
224  
225 +#ifdef F_DUPFD_CLOEXEC
226         dev->fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
227 +#else
228 +       dev->fd = fcntl(fd, F_DUPFD, 0);
229 +       fcntl(dev->fd, F_SETFD, FD_CLOEXEC);
230 +#endif
231         dev->flink_fd = dev->fd;
232         dev->major_version = version->version_major;
233         dev->minor_version = version->version_minor;
234
235
236 [FILE:283:patches/patch-include_drm_drm.h]
237 --- include/drm/drm.h.orig      2022-11-03 08:33:36 UTC
238 +++ include/drm/drm.h
239 @@ -837,7 +837,11 @@ struct drm_set_client_cap {
240  };
241  
242  #define DRM_RDWR O_RDWR
243 +#ifdef __sun__
244 +#define DRM_CLOEXEC 0
245 +#else
246  #define DRM_CLOEXEC O_CLOEXEC
247 +#endif
248  struct drm_prime_handle {
249         __u32 handle;
250  
251
252
253 [FILE:689:patches/patch-intel_intel__bufmgr__gem.c]
254 --- intel/intel_bufmgr_gem.c.orig       2022-11-03 08:33:36 UTC
255 +++ intel/intel_bufmgr_gem.c
256 @@ -966,6 +966,27 @@ drm_intel_gem_bo_alloc_userptr(drm_intel
257         return &bo_gem->bo;
258  }
259  
260 +#ifdef __sun__
261 +#define posix_memalign illumos_memalign
262 +static int
263 +posix_memalign(void **memptr, size_t alignment, size_t size)
264 +{
265 +       void *ptr = NULL;
266 +       int error = 0;
267 +
268 +       if (alignment == 0 ||
269 +           (alignment & (sizeof (void *) - 1)) != 0 ||
270 +           (alignment & (alignment - 1)) != 0)
271 +               error = EINVAL;
272 +       else if (size != 0 &&
273 +           (ptr = memalign(alignment, size)) == NULL)
274 +               error = ENOMEM;
275 +
276 +       *memptr = ptr;
277 +       return (error);
278 +}
279 +#endif
280 +
281  static bool
282  has_userptr(drm_intel_bufmgr_gem *bufmgr_gem)
283  {
284
285
286 [FILE:379:patches/patch-intel_test__decode.c]
287 --- intel/test_decode.c.orig    2022-11-03 08:33:36 UTC
288 +++ intel/test_decode.c
289 @@ -28,7 +28,13 @@
290  #include <fcntl.h>
291  #include <sys/types.h>
292  #include <sys/stat.h>
293 +#ifdef __sun__
294 +#define errx(exitcode, format, args...) \
295 +       { fprintf(stderr, format "\n", ## args); \
296 +         exit(exitcode); }
297 +#else
298  #include <err.h>
299 +#endif
300  
301  #include "libdrm_macros.h"
302  #include "intel_bufmgr.h"
303
304
305 [FILE:521:patches/patch-libsync.h]
306 define ETIME as ETIMEOUT same as done in mesa
307
308 --- libsync.h.orig      2022-11-03 08:33:36 UTC
309 +++ libsync.h
310 @@ -35,6 +35,9 @@
311  #include <sys/ioctl.h>
312  #include <sys/poll.h>
313  #include <unistd.h>
314 +#ifndef ETIME
315 +#define ETIME ETIMEDOUT
316 +#endif
317  
318  #if defined(__cplusplus)
319  extern "C" {
320 @@ -53,6 +56,9 @@ struct sync_merge_data {
321         uint32_t        flags;
322         uint32_t        pad;
323  };
324 +#ifdef __sun__
325 +#include <sys/ioccom.h>
326 +#endif
327  #define SYNC_IOC_MAGIC         '>'
328  #define SYNC_IOC_MERGE         _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
329  #endif
330
331
332 [FILE:542:patches/patch-meson.build]
333 $NetBSD: patch-meson.build,v 1.3 2022/11/03 20:52:29 triaxx Exp $
334
335 xxx how to deal with this properly?
336
337 --- meson.build.orig    2022-11-03 08:33:36 UTC
338 +++ meson.build
339 @@ -40,7 +40,7 @@ with_freedreno_kgsl = get_option('freedr
340  with_install_tests = get_option('install-test-programs')
341  with_tests = get_option('tests')
342  
343 -if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system())
344 +if ['dragonfly'].contains(host_machine.system())
345    dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
346  else
347    dep_pthread_stubs = []
348
349
350 [FILE:267:patches/patch-tests_drmdevice.c]
351 --- tests/drmdevice.c.orig      2022-11-03 08:33:36 UTC
352 +++ tests/drmdevice.c
353 @@ -31,6 +31,9 @@
354  #include <unistd.h>
355  #include <xf86drm.h>
356  
357 +#ifndef O_CLOEXEC
358 +#define O_CLOEXEC 0
359 +#endif
360  
361  static void
362  print_device_info(drmDevicePtr device, int i, bool print_revision)
363
364
365 [FILE:333:patches/patch-tests_modetest_meson.build]
366 --- tests/modetest/meson.build.orig     2022-11-03 08:33:36 UTC
367 +++ tests/modetest/meson.build
368 @@ -25,5 +25,6 @@ modetest = executable(
369    include_directories : [inc_root, inc_tests, inc_drm],
370    dependencies : [dep_threads, dep_cairo],
371    link_with : [libdrm, libutil],
372 +  link_args : ['-lpthread'],
373    install : with_install_tests,
374  )
375
376
377 [FILE:358:patches/patch-tests_nouveau_meson.build]
378 --- tests/nouveau/meson.build.orig      2022-11-03 08:33:36 UTC
379 +++ tests/nouveau/meson.build
380 @@ -24,6 +24,7 @@ threaded = executable(
381    dependencies : [dep_dl, dep_threads],
382    include_directories : [inc_root, inc_drm, include_directories('../../nouveau')],
383    link_with : [libdrm, libdrm_nouveau],
384 +  link_args : ['-lpthread'],
385    c_args : libdrm_c_args,
386  )
387  
388
389
390 [FILE:387:patches/patch-tests_nouveau_threaded.c]
391 --- tests/nouveau/threaded.c.orig       2022-11-03 08:33:36 UTC
392 +++ tests/nouveau/threaded.c
393 @@ -36,7 +36,7 @@ static int failed;
394  
395  static int import_fd;
396  
397 -#if defined(__GLIBC__) || defined(__FreeBSD__)
398 +#if defined(__GLIBC__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
399  int ioctl(int fd, unsigned long request, ...)
400  #else
401  int ioctl(int fd, int request, ...)
402
403
404 [FILE:7504:patches/patch-xf86drm.c]
405 --- xf86drm.c.orig      2022-11-03 08:33:36 UTC
406 +++ xf86drm.c
407 @@ -63,7 +63,17 @@
408  #include <math.h>
409  #include <inttypes.h>
410  
411 -#if defined(__FreeBSD__)
412 +#ifndef O_CLOEXEC
413 +#define O_CLOEXEC 0
414 +#endif
415 +
416 +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
417 +#define FREEDFLY 1
418 +#else
419 +#define FREEDFLY 0
420 +#endif
421 +
422 +#if FREEDFLY
423  #include <sys/param.h>
424  #include <sys/pciio.h>
425  #endif
426 @@ -86,7 +96,10 @@
427  #endif
428  
429  #ifdef __NetBSD__
430 -#define DRM_MAJOR 34
431 +#define DRM_MAJOR 180
432 +#include <sys/param.h>
433 +#include <dev/pci/pcireg.h>
434 +#include <pci.h>
435  #endif
436  
437  #ifdef __OpenBSD__
438 @@ -313,8 +326,10 @@ drmGetFormatModifierNameFromArm(uint64_t
439      char *modifier_name = NULL;
440      bool result = false;
441  
442 +#ifndef __sun
443      fp = open_memstream(&modifier_name, &size);
444      if (!fp)
445 +#endif
446          return NULL;
447  
448      switch (type) {
449 @@ -459,8 +474,10 @@ drmGetFormatModifierNameFromAmd(uint64_t
450      tile_version = AMD_FMT_MOD_GET(TILE_VERSION, modifier);
451      dcc = AMD_FMT_MOD_GET(DCC, modifier);
452  
453 +#ifndef __sun
454      fp = open_memstream(&mod_amd, &size);
455      if (!fp)
456 +#endif
457          return NULL;
458  
459      /* add tile  */
460 @@ -963,7 +980,7 @@ static int drmGetMinorBase(int type)
461  
462  static int drmGetMinorType(int major, int minor)
463  {
464 -#ifdef __FreeBSD__
465 +#if FREEDFLY
466      char name[SPECNAMELEN];
467      int id;
468  
469 @@ -3219,7 +3236,7 @@ drm_public int drmIsMaster(int fd)
470  
471  drm_public char *drmGetDeviceNameFromFd(int fd)
472  {
473 -#ifdef __FreeBSD__
474 +#if FREEDFLY
475      struct stat sbuf;
476      int maj, min;
477      int nodetype;
478 @@ -3266,7 +3283,7 @@ static bool drmNodeIsDRM(int maj, int mi
479      snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device/drm",
480               maj, min);
481      return stat(path, &sbuf) == 0;
482 -#elif defined(__FreeBSD__)
483 +#elif FREEDFLY
484      char name[SPECNAMELEN];
485  
486      if (!devname_r(makedev(maj, min), S_IFCHR, name, sizeof(name)))
487 @@ -3389,7 +3406,7 @@ static char *drmGetMinorNameForFD(int fd
488  
489      closedir(sysdir);
490      return NULL;
491 -#elif defined(__FreeBSD__)
492 +#elif FREEDFLY
493      struct stat sbuf;
494      char dname[SPECNAMELEN];
495      const char *mname;
496 @@ -3574,6 +3591,65 @@ static int drmParseSubsystemType(int maj
497              return DRM_BUS_VIRTIO;
498       }
499      return subsystem_type;
500 +#elif defined(__NetBSD__)
501 +    int type, fd;
502 +    drmSetVersion sv;
503 +    char *buf;
504 +    unsigned domain, bus, dev;
505 +    int func;
506 +    int ret;
507 +
508 +    /* Get the type of device we're looking for to pick the right pathname.  */
509 +    type = drmGetMinorType(maj, min);
510 +    if (type == -1)
511 +       return -ENODEV;
512 +
513 +    /* Open the device.  Don't try to create it if it's not there.  */
514 +    fd = drmOpenMinor(min, 0, type);
515 +    if (fd < 0)
516 +       return -errno;
517 +
518 +    /*
519 +     * Set the interface version to 1.4 or 1.1, which has the effect of
520 +     * populating the bus id for us.
521 +     */
522 +    sv.drm_di_major = 1;
523 +    sv.drm_di_minor = 4;
524 +    sv.drm_dd_major = -1;
525 +    sv.drm_dd_minor = -1;
526 +    if (drmSetInterfaceVersion(fd, &sv)) {
527 +       sv.drm_di_major = 1;
528 +       sv.drm_di_minor = 1;
529 +       sv.drm_dd_major = -1;
530 +       sv.drm_dd_minor = -1;
531 +       if (drmSetInterfaceVersion(fd, &sv)) {
532 +           /*
533 +            * We're probably not the master.  Hope the master already
534 +            * set the version to >=1.1 so that we can get the busid.
535 +            */
536 +       }
537 +     }
538 +
539 +    /* Get the bus id.  */
540 +    buf = drmGetBusid(fd);
541 +
542 +    /* We're done with the device now.  */
543 +    (void)close(fd);
544 +
545 +    /* If there is no bus id, fail.  */
546 +    if (buf == NULL)
547 +       return -ENODEV;
548 +
549 +    /* Find a string we know about; otherwise -EINVAL.  */
550 +    ret = -EINVAL;
551 +    if (strncmp(buf, "pci:", 4) == 0)
552 +       ret = DRM_BUS_PCI;
553 +
554 +    /* We're done with the bus id.  */
555 +    free(buf);
556 +
557 +    /* Success or not, we're done.  */
558 +    return ret;
559  #elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
560      return DRM_BUS_PCI;
561  #else
562 @@ -3600,7 +3676,7 @@ get_pci_path(int maj, int min, char *pci
563  }
564  #endif
565  
566 -#ifdef __FreeBSD__
567 +#if FREEDFLY
568  static int get_sysctl_pci_bus_info(int maj, int min, drmPciBusInfoPtr info)
569  {
570      char dname[SPECNAMELEN];
571 @@ -3685,6 +3761,73 @@ static int drmParsePciBusInfo(int maj, i
572      info->func = func;
573  
574      return 0;
575 +#elif defined(__NetBSD__)
576 +    int type, fd;
577 +    drmSetVersion sv;
578 +    char *buf;
579 +    unsigned domain, bus, dev;
580 +    int func;
581 +    int ret;
582 +
583 +    /* Get the type of device we're looking for to pick the right pathname.  */
584 +    type = drmGetMinorType(maj, min);
585 +    if (type == -1)
586 +       return -ENODEV;
587 +
588 +    /* Open the device.  Don't try to create it if it's not there.  */
589 +    fd = drmOpenMinor(min, 0, type);
590 +    if (fd < 0)
591 +       return -errno;
592 +
593 +    /*
594 +     * Set the interface version to 1.4 or 1.1, which has the effect of
595 +     * populating the bus id for us.
596 +     */
597 +    sv.drm_di_major = 1;
598 +    sv.drm_di_minor = 4;
599 +    sv.drm_dd_major = -1;
600 +    sv.drm_dd_minor = -1;
601 +    if (drmSetInterfaceVersion(fd, &sv)) {
602 +       sv.drm_di_major = 1;
603 +       sv.drm_di_minor = 1;
604 +       sv.drm_dd_major = -1;
605 +       sv.drm_dd_minor = -1;
606 +       if (drmSetInterfaceVersion(fd, &sv)) {
607 +            /*
608 +            * We're probably not the master.  Hope the master already
609 +            * set the version to >=1.1 so that we can get the busid.
610 +            */
611 +       }
612 +    }
613 +
614 +    /* Get the bus id.  */
615 +    buf = drmGetBusid(fd);
616 +
617 +    /* We're done with the device now.  */
618 +    (void)close(fd);
619 +
620 +    /* If there is no bus id, fail.  */
621 +    if (buf == NULL)
622 +       return -ENODEV;
623 +
624 +    /* Parse the bus id.  */
625 +    ret = sscanf(buf, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, &func);
626 +
627 +    /* We're done with the bus id.  */
628 +    free(buf);
629 +
630 +    /* If scanf didn't return 4 -- domain, bus, dev, func -- then fail.  */
631 +    if (ret != 4)
632 +       return -ENODEV;
633 +
634 +    /* Populate the results.  */
635 +    info->domain = domain;
636 +    info->bus = bus;
637 +    info->dev = dev;
638 +    info->func = func;
639 +
640 +    /* Success!  */
641 +    return 0;
642  #elif defined(__OpenBSD__) || defined(__DragonFly__)
643      struct drm_pciinfo pinfo;
644      int fd, type;
645 @@ -3857,6 +4000,48 @@ static int drmParsePciDeviceInfo(int maj
646          return parse_config_sysfs_file(maj, min, device);
647  
648      return 0;
649 +#elif defined(__NetBSD__)
650 +    drmPciBusInfo businfo;
651 +    char fname[PATH_MAX];
652 +    int pcifd;
653 +    pcireg_t id, class, subsys;
654 +    int ret;
655 +
656 +    /* Find where on the bus the device lives.  */
657 +    ret = drmParsePciBusInfo(maj, min, &businfo);
658 +    if (ret)
659 +       return ret;
660 +
661 +    /* Open the pciN device node to get at its config registers.  */
662 +    if (snprintf(fname, sizeof fname, "/dev/pci%u", businfo.domain)
663 +       >= sizeof fname)
664 +       return -ENODEV;
665 +    if ((pcifd = open(fname, O_RDONLY)) == -1)
666 +       return -errno;
667 +
668 +    ret = -1;
669 +    /* Read the id and class pci config registers.  */
670 +    if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
671 +           PCI_ID_REG, &id) == -1)
672 +       goto out;
673 +    if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
674 +           PCI_CLASS_REG, &class) == -1)
675 +       goto out;
676 +    if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
677 +           PCI_SUBSYS_ID_REG, &subsys) == -1)
678 +       goto out;
679 +
680 +    ret = 0;
681 +    device->vendor_id = PCI_VENDOR(id);
682 +    device->device_id = PCI_PRODUCT(id);
683 +    device->subvendor_id = PCI_SUBSYS_VENDOR(subsys);
684 +    device->subdevice_id = PCI_SUBSYS_ID(subsys);
685 +    device->revision_id = PCI_REVISION(class);
686 +out:
687 +    if (ret == -1)
688 +       ret = -errno;
689 +    close(pcifd);
690 +    return ret;
691  #elif defined(__OpenBSD__) || defined(__DragonFly__)
692      struct drm_pciinfo pinfo;
693      int fd, type;
694
695
696 [FILE:397:patches/patch-xf86drm.h]
697 --- xf86drm.h.orig      2022-11-03 08:33:36 UTC
698 +++ xf86drm.h
699 @@ -59,6 +59,9 @@ extern "C" {
700  #else /* One of the *BSDs */
701  
702  #include <sys/ioccom.h>
703 +#ifdef __sun__
704 +#define _IOC(inout,group,num,len)      (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
705 +#endif
706  #define DRM_IOCTL_NR(n)         ((n) & 0xff)
707  #define DRM_IOC_VOID            IOC_VOID
708  #define DRM_IOC_READ            IOC_OUT
709
710
711 [FILE:635:patches/patch-xf86drmMode.c]
712 --- xf86drmMode.c.orig  2022-11-03 08:33:36 UTC
713 +++ xf86drmMode.c
714 @@ -39,9 +39,7 @@
715  #include <stdlib.h>
716  #include <sys/ioctl.h>
717  #if HAVE_SYS_SYSCTL_H
718 -#ifdef __FreeBSD__
719  #include <sys/types.h>
720 -#endif
721  #include <sys/sysctl.h>
722  #endif
723  #include <stdio.h>
724 @@ -1119,7 +1117,7 @@ drm_public int drmModePageFlipTarget(int
725  
726  drm_public int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
727                     uint32_t fb_id, uint32_t flags,
728 -                   int32_t crtc_x, int32_t crtc_y,
729 +                   uint32_t crtc_x, int32_t crtc_y,
730                     uint32_t crtc_w, uint32_t crtc_h,
731                     uint32_t src_x, uint32_t src_y,
732                     uint32_t src_w, uint32_t src_h)
733
734
735 [FILE:505:patches/patch-xf86drmMode.h]
736 --- xf86drmMode.h.orig  2022-11-03 08:33:36 UTC
737 +++ xf86drmMode.h
738 @@ -429,7 +429,7 @@ extern drmModePlaneResPtr drmModeGetPlan
739  extern drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id);
740  extern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
741                            uint32_t fb_id, uint32_t flags,
742 -                          int32_t crtc_x, int32_t crtc_y,
743 +                          uint32_t crtc_x, int32_t crtc_y,
744                            uint32_t crtc_w, uint32_t crtc_h,
745                            uint32_t src_x, uint32_t src_y,
746                            uint32_t src_w, uint32_t src_h);
747