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