-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmesa-zink.diff
233 lines (215 loc) · 7.8 KB
/
mesa-zink.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
diff --git a/meson.build b/meson.build
index b2cd74e..299d79d 100644
--- a/meson.build
+++ b/meson.build
@@ -1962,9 +1962,9 @@ if dep_unwind.found()
endif
if with_osmesa
- if not with_gallium_softpipe
- error('OSMesa gallium requires gallium softpipe or llvmpipe.')
- endif
+# if not with_gallium_softpipe
+# error('OSMesa gallium requires gallium softpipe or llvmpipe.')
+# endif
if host_machine.system() == 'windows'
osmesa_lib_name = 'osmesa'
else
diff --git a/src/android_stub/meson.build b/src/android_stub/meson.build
index 6097ae8..0e3f27b 100644
--- a/src/android_stub/meson.build
+++ b/src/android_stub/meson.build
@@ -1,6 +1,6 @@
if with_android_stub
stub_libs = []
- lib_names = ['cutils', 'hardware', 'log', 'nativewindow', 'sync']
+ lib_names = ['hardware', 'log', 'nativewindow', 'sync']
if with_libbacktrace
lib_names += ['backtrace']
diff --git a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h
index ddb67b3..1937459 100644
--- a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h
@@ -29,6 +29,10 @@
#include "d3d12/d3d12_public.h"
#endif
+#ifdef GALLIUM_ZINK
+#include "zink/zink_public.h"
+#endif
+
static inline struct pipe_screen *
sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
{
diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c
index 0ba1e19..d8de94c 100644
--- a/src/gallium/drivers/zink/zink_bo.c
+++ b/src/gallium/drivers/zink/zink_bo.c
@@ -35,7 +35,7 @@
#include "zink_screen.h"
#include "util/u_hash_table.h"
-#if !defined(__APPLE__) && !defined(_WIN32)
+#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__ANDROID__)
#define ZINK_USE_DMABUF
#include <xf86drm.h>
#endif
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index f42f340..3146baf 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -269,9 +269,11 @@ disk_cache_init(struct zink_screen *screen)
/* Hash in the zink driver build. */
const struct build_id_note *note =
build_id_find_nhdr_for_addr(disk_cache_init);
- unsigned build_id_len = build_id_length(note);
- assert(note && build_id_len == 20); /* sha1 */
- _mesa_sha1_update(&ctx, build_id_data(note), build_id_len);
+ if(note != NULL) {
+ unsigned build_id_len = build_id_length(note);
+ assert(note && build_id_len == 20); /* sha1 */
+ _mesa_sha1_update(&ctx, build_id_data(note), build_id_len);
+ }
#endif
/* Hash in the Vulkan pipeline cache UUID to identify the combination of
@@ -2852,6 +2854,11 @@ init_driver_workarounds(struct zink_screen *screen)
abort();
}
+ // Comment in Mesa 23.0.4:
+ /* once more testing has been done, use the #if 0 block */
+ // Seems like there was not enough testing, reverting to legacy behaviour
+
+#if 0
/* these drivers benefit from renderpass optimization */
switch (screen->info.driver_props.driverID) {
case VK_DRIVER_ID_MESA_LLVMPIPE:
@@ -2867,6 +2874,7 @@ init_driver_workarounds(struct zink_screen *screen)
default:
break;
}
+#endif
if (zink_debug & ZINK_DEBUG_RP)
screen->driver_workarounds.track_renderpasses = true;
else if (zink_debug & ZINK_DEBUG_NORP)
@@ -3143,7 +3151,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
u_trace_state_init();
- screen->loader_lib = util_dl_open(VK_LIBNAME);
+ screen->loader_lib = (void*) strtoul(getenv("VULKAN_PTR"), NULL, 0x10);
if (!screen->loader_lib) {
mesa_loge("ZINK: failed to load "VK_LIBNAME);
goto fail;
@@ -3158,7 +3166,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
}
screen->instance_info.loader_version = zink_get_loader_version(screen);
- if (config) {
+ /*if (config) {
driParseConfigFiles(config->options, config->options_info, 0, "zink",
NULL, NULL, NULL, 0, NULL, 0);
screen->driconf.dual_color_blend_by_location = driQueryOptionb(config->options, "dual_color_blend_by_location");
@@ -3166,7 +3174,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
//screen->driconf.inline_uniforms = driQueryOptionb(config->options, "radeonsi_inline_uniforms");
screen->driconf.emulate_point_smooth = driQueryOptionb(config->options, "zink_emulate_point_smooth");
screen->driconf.zink_shader_object_enable = driQueryOptionb(config->options, "zink_shader_object_enable");
- }
+ }*/
if (!zink_create_instance(screen, dev_major > 0 && dev_major < 255))
goto fail;
diff --git a/src/gallium/targets/osmesa/meson.build b/src/gallium/targets/osmesa/meson.build
index d16e785..0652936 100644
--- a/src/gallium/targets/osmesa/meson.build
+++ b/src/gallium/targets/osmesa/meson.build
@@ -55,10 +55,10 @@ libosmesa = shared_library(
libmesa, libgallium, libws_null, osmesa_link_with,
],
dependencies : [
- dep_ws2_32, dep_selinux, dep_thread, dep_clock, dep_unwind, driver_swrast
+ dep_ws2_32, dep_selinux, dep_thread, dep_clock, dep_unwind, driver_zink
],
name_prefix : host_machine.system() == 'windows' ? '' : [], # otherwise mingw will create libosmesa.dll
- soversion : host_machine.system() == 'windows' ? '' : '8',
+ soversion : '',
version : '8.0.0',
darwin_versions : '9.0.0',
install : true,
diff --git a/src/util/os_misc.c b/src/util/os_misc.c
index 7261577..f2ceb88 100644
--- a/src/util/os_misc.c
+++ b/src/util/os_misc.c
@@ -128,52 +128,7 @@ os_log_message(const char *message)
#endif
}
-#if DETECT_OS_ANDROID
-# include <ctype.h>
-# include "c11/threads.h"
-
-/**
- * Get an option value from android's property system, as a fallback to
- * getenv() (which is generally less useful on android due to processes
- * typically being forked from the zygote.
- *
- * The option name used for getenv is translated into a property name
- * by:
- *
- * 1) convert to lowercase
- * 2) replace '_' with '.'
- * 3) if necessary, prepend "mesa."
- *
- * For example:
- * - MESA_EXTENSION_OVERRIDE -> mesa.extension.override
- * - GALLIUM_HUD -> mesa.gallium.hud
- *
- */
-static char *
-os_get_android_option(const char *name)
-{
- static thread_local char os_android_option_value[PROPERTY_VALUE_MAX];
- char key[PROPERTY_KEY_MAX];
- char *p = key, *end = key + PROPERTY_KEY_MAX;
- /* add "mesa." prefix if necessary: */
- if (strstr(name, "MESA_") != name)
- p += strlcpy(p, "mesa.", end - p);
- p += strlcpy(p, name, end - p);
- for (int i = 0; key[i]; i++) {
- if (key[i] == '_') {
- key[i] = '.';
- } else {
- key[i] = tolower(key[i]);
- }
- }
- int len = property_get(key, os_android_option_value, NULL);
- if (len > 1) {
- return os_android_option_value;
- }
- return NULL;
-}
-#endif
#if DETECT_OS_WINDOWS
@@ -195,11 +150,7 @@ const char *
os_get_option(const char *name)
{
const char *opt = getenv(name);
-#if DETECT_OS_ANDROID
- if (!opt) {
- opt = os_get_android_option(name);
- }
-#endif
+
return opt;
}
diff --git a/src/util/perf/cpu_trace.h b/src/util/perf/cpu_trace.h
index 6cebb51..c1726b1 100644
--- a/src/util/perf/cpu_trace.h
+++ b/src/util/perf/cpu_trace.h
@@ -28,18 +28,6 @@
util_perfetto_trace_end(); \
} while (0)
-/* NOTE: for now disable atrace for C++ to workaround a ndk bug with ordering
- * between stdatomic.h and atomic.h. See:
- *
- * https://github.com/android/ndk/issues/1178
- */
-#elif defined(ANDROID) && !defined(__cplusplus)
-
-#include <cutils/trace.h>
-
-#define _MESA_TRACE_BEGIN(name) \
- atrace_begin(ATRACE_TAG_GRAPHICS, name)
-#define _MESA_TRACE_END() atrace_end(ATRACE_TAG_GRAPHICS)
#else