Skip to content

Commit 88da1c1

Browse files
bootstrap: add libdrm
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent 53034ec commit 88da1c1

File tree

2 files changed

+181
-0
lines changed

2 files changed

+181
-0
lines changed

bootstrap.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,40 @@ packages:
508508
environ:
509509
DESTDIR: '@THIS_COLLECT_DIR@'
510510

511+
- name: libdrm
512+
source:
513+
subdir: 'bundled'
514+
git: 'https://gitlab.freedesktop.org/mesa/drm'
515+
tag: 'libdrm-2.4.110'
516+
version: '2.4.110'
517+
tools_required:
518+
- host-gcc
519+
pkgs_required:
520+
- mlibc
521+
configure:
522+
- args:
523+
- 'meson'
524+
- '--cross-file'
525+
- '@SOURCE_ROOT@/userland/cross-file.ini'
526+
- '--prefix=/usr'
527+
- '--libdir=lib'
528+
- '--buildtype=debugoptimized'
529+
- '-Dintel=false'
530+
- '-Dvmwgfx=false'
531+
- '-Dradeon=false'
532+
- '-Damdgpu=false'
533+
- '-Dnouveau=false'
534+
- '-Dman-pages=false'
535+
# We might want to build cairo with OpenGL support.
536+
# Doing so would introduce a circular dependency here.
537+
- '-Dcairo-tests=false'
538+
- '@THIS_SOURCE_DIR@'
539+
build:
540+
- args: ['ninja']
541+
- args: ['ninja', 'install']
542+
environ:
543+
DESTDIR: '@THIS_COLLECT_DIR@'
544+
511545
- name: nyancat
512546
source:
513547
subdir: 'bundled'

patches/libdrm/libdrm.patch

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
From c1dbfc87b74825c0f21b9031fc932d27908fcc71 Mon Sep 17 00:00:00 2001
2+
From: Andy-Python-Programmer <[email protected]>
3+
Date: Sat, 14 May 2022 14:42:38 +1000
4+
Subject: [PATCH] drm: aero specific changes
5+
6+
Signed-off-by: Andy-Python-Programmer <[email protected]>
7+
---
8+
.gitignore | 1 +
9+
include/drm/drm.h | 4 ++--
10+
xf86drm.c | 20 ++++++++++----------
11+
xf86drm.h | 2 +-
12+
4 files changed, 14 insertions(+), 13 deletions(-)
13+
14+
diff --git a/.gitignore b/.gitignore
15+
index 0ec9e7f..e0c197e 100644
16+
--- a/.gitignore
17+
+++ b/.gitignore
18+
@@ -1 +1,2 @@
19+
/build*
20+
+.vscode
21+
diff --git a/include/drm/drm.h b/include/drm/drm.h
22+
index 398c396..3e35299 100644
23+
--- a/include/drm/drm.h
24+
+++ b/include/drm/drm.h
25+
@@ -35,10 +35,10 @@
26+
#ifndef _DRM_H_
27+
#define _DRM_H_
28+
29+
-#if defined(__linux__)
30+
+#if defined(__linux__) || defined(__aero__)
31+
32+
+#include <sys/ioctl.h>
33+
#include <linux/types.h>
34+
-#include <asm/ioctl.h>
35+
typedef unsigned int drm_handle_t;
36+
37+
#else /* One of the BSDs */
38+
diff --git a/xf86drm.c b/xf86drm.c
39+
index 5933e4b..2b79641 100644
40+
--- a/xf86drm.c
41+
+++ b/xf86drm.c
42+
@@ -3346,7 +3346,7 @@ drm_public int drmCloseBufferHandle(int fd, uint32_t handle)
43+
44+
static char *drmGetMinorNameForFD(int fd, int type)
45+
{
46+
-#ifdef __linux__
47+
+#if defined(__linux__) || defined(__aero__)
48+
DIR *sysdir;
49+
struct dirent *ent;
50+
struct stat sbuf;
51+
@@ -3468,7 +3468,7 @@ drm_public char *drmGetRenderDeviceNameFromFd(int fd)
52+
return drmGetMinorNameForFD(fd, DRM_NODE_RENDER);
53+
}
54+
55+
-#ifdef __linux__
56+
+#if defined(__linux__) || defined(__aero__)
57+
static char * DRM_PRINTFLIKE(2, 3)
58+
sysfs_uevent_get(const char *path, const char *fmt, ...)
59+
{
60+
@@ -3515,7 +3515,7 @@ sysfs_uevent_get(const char *path, const char *fmt, ...)
61+
/* Little white lie to avoid major rework of the existing code */
62+
#define DRM_BUS_VIRTIO 0x10
63+
64+
-#ifdef __linux__
65+
+#if defined(__linux__) || defined(__aero__)
66+
static int get_subsystem_type(const char *device_path)
67+
{
68+
char path[PATH_MAX + 1] = "";
69+
@@ -3581,7 +3581,7 @@ static int drmParseSubsystemType(int maj, int min)
70+
#endif
71+
}
72+
73+
-#ifdef __linux__
74+
+#if defined(__linux__) || defined(__aero__)
75+
static void
76+
get_pci_path(int maj, int min, char *pci_path)
77+
{
78+
@@ -3661,7 +3661,7 @@ static int get_sysctl_pci_bus_info(int maj, int min, drmPciBusInfoPtr info)
79+
80+
static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
81+
{
82+
-#ifdef __linux__
83+
+#if defined(__linux__) || defined(__aero__)
84+
unsigned int ___domain, bus, dev, func;
85+
char pci_path[PATH_MAX + 1], *value;
86+
int num;
87+
@@ -3770,7 +3770,7 @@ static int drmGetMaxNodeName(void)
88+
3 /* length of the node number */;
89+
}
90+
91+
-#ifdef __linux__
92+
+#if defined(__linux__) || defined(__aero__)
93+
static int parse_separate_sysfs_files(int maj, int min,
94+
drmPciDeviceInfoPtr device,
95+
bool ignore_revision)
96+
@@ -3848,7 +3848,7 @@ static int drmParsePciDeviceInfo(int maj, int min,
97+
drmPciDeviceInfoPtr device,
98+
uint32_t flags)
99+
{
100+
-#ifdef __linux__
101+
+#if defined(__linux__) || defined(__aero__)
102+
if (!(flags & DRM_DEVICE_GET_PCI_REVISION))
103+
return parse_separate_sysfs_files(maj, min, device, true);
104+
105+
@@ -4072,7 +4072,7 @@ free_device:
106+
return ret;
107+
}
108+
109+
-#ifdef __linux__
110+
+#if defined(__linux__) || defined(__aero__)
111+
static int drm_usb_dev_path(int maj, int min, char *path, size_t len)
112+
{
113+
char *value, *tmp_path, *slash;
114+
@@ -4160,7 +4160,7 @@ static int drmParseUsbBusInfo(int maj, int min, drmUsbBusInfoPtr info)
115+
116+
static int drmParseUsbDeviceInfo(int maj, int min, drmUsbDeviceInfoPtr info)
117+
{
118+
-#ifdef __linux__
119+
+#if defined(__linux__) || defined(__aero__)
120+
char path[PATH_MAX + 1], *value;
121+
unsigned int vendor, product;
122+
int ret;
123+
@@ -4760,7 +4760,7 @@ drm_public int drmGetDevices(drmDevicePtr devices[], int max_devices)
124+
125+
drm_public char *drmGetDeviceNameFromFd2(int fd)
126+
{
127+
-#ifdef __linux__
128+
+#if defined(__linux__) || defined(__aero__)
129+
struct stat sbuf;
130+
char path[PATH_MAX + 1], *value;
131+
unsigned int maj, min;
132+
diff --git a/xf86drm.h b/xf86drm.h
133+
index 1631396..a2118f1 100644
134+
--- a/xf86drm.h
135+
+++ b/xf86drm.h
136+
@@ -47,7 +47,7 @@ extern "C" {
137+
#define DRM_MAX_MINOR 16
138+
#endif
139+
140+
-#if defined(__linux__)
141+
+#if defined(__linux__) || defined(__aero__)
142+
143+
#define DRM_IOCTL_NR(n) _IOC_NR(n)
144+
#define DRM_IOC_VOID _IOC_NONE
145+
--
146+
2.25.1
147+

0 commit comments

Comments
 (0)