-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
199 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- mesa-23.3.5/meson.build 2024-02-01 04:00:16.000000000 +0300 | ||
+++ mesa-23.3.5/meson.build.patch 2024-02-05 13:38:19.684985105 +0300 | ||
@@ -1031,7 +1031,6 @@ | ||
else | ||
_trial_c = [ | ||
'-Werror=implicit-function-declaration', | ||
- '-Werror=missing-prototypes', | ||
'-Werror=return-type', | ||
'-Werror=empty-body', | ||
'-Werror=incompatible-pointer-types', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
diff --git a/src/drm-shim/drm_shim.c b/src/drm-shim/drm_shim.c | ||
index f7481aa..6aef76b 100644 | ||
--- a/src/drm-shim/drm_shim.c | ||
+++ b/src/drm-shim/drm_shim.c | ||
@@ -94,7 +94,20 @@ REAL_FUNCTION_POINTER(fstat); | ||
REAL_FUNCTION_POINTER(fstat64); | ||
#endif | ||
|
||
-static char render_node_dir[] = "/dev/dri/"; | ||
+char* get_path_dev_dri(const char* value) { | ||
+ static char path_dev_dri[PATH_MAX] = "/dev/dri"; | ||
+ struct stat sb; | ||
+ | ||
+ if (stat(path_dev_dri, &sb) != 0 && !S_ISDIR(sb.st_mode)) { | ||
+ strcpy(path_dev_dri, "@TERMUX_PREFIX@/dev/dri"); | ||
+ } | ||
+ | ||
+ if (value) | ||
+ strcat(path_dev_dri, value); | ||
+ | ||
+ return path_dev_dri; | ||
+} | ||
+ | ||
/* Full path of /dev/dri/renderD* */ | ||
static char *render_node_path; | ||
/* renderD* */ | ||
@@ -145,7 +158,7 @@ get_dri_render_node_minor(void) | ||
for (int i = 0; i < 10; i++) { | ||
UNUSED int minor = 128 + i; | ||
nfasprintf(&render_node_dirent_name, "renderD%d", minor); | ||
- nfasprintf(&render_node_path, "/dev/dri/%s", | ||
+ nfasprintf(&render_node_path, get_path_dev_dri("/%s"), | ||
render_node_dirent_name); | ||
struct stat st; | ||
if (drm_shim_driver_prefers_first_render_node || | ||
@@ -289,6 +302,7 @@ static bool hide_drm_device_path(const char *path) | ||
/* String starts with /dev/dri/ but is not the fake render node. We want to | ||
* hide all other drm devices for the shim. | ||
*/ | ||
+ const char *render_node_dir = get_path_dev_dri("/"); | ||
if (strncmp(path, render_node_dir, sizeof(render_node_dir) - 1) == 0) | ||
return true; | ||
|
||
@@ -600,7 +614,7 @@ opendir(const char *name) | ||
init_shim(); | ||
|
||
DIR *dir = real_opendir(name); | ||
- if (strcmp(name, "/dev/dri") == 0) { | ||
+ if (strcmp(name, get_path_dev_dri(NULL)) == 0) { | ||
if (!dir) { | ||
/* If /dev/dri didn't exist, we still want to be able to return our | ||
* fake /dev/dri/render* even though we probably can't | ||
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c | ||
index 9ae16f3..7185d54 100644 | ||
--- a/src/egl/drivers/dri2/platform_drm.c | ||
+++ b/src/egl/drivers/dri2/platform_drm.c | ||
@@ -42,6 +42,20 @@ | ||
#include "egldevice.h" | ||
#include "loader.h" | ||
|
||
+char* get_path_dev_dri(const char* value) { | ||
+ static char path_dev_dri[PATH_MAX] = "/dev/dri"; | ||
+ struct stat sb; | ||
+ | ||
+ if (stat(path_dev_dri, &sb) != 0 && !S_ISDIR(sb.st_mode)) { | ||
+ strcpy(path_dev_dri, "@TERMUX_PREFIX@/dev/dri"); | ||
+ } | ||
+ | ||
+ if (value) | ||
+ strcat(path_dev_dri, value); | ||
+ | ||
+ return path_dev_dri; | ||
+} | ||
+ | ||
static struct gbm_bo * | ||
lock_front_buffer(struct gbm_surface *_surf) | ||
{ | ||
@@ -606,7 +620,7 @@ dri2_initialize_drm(_EGLDisplay *disp) | ||
loader_open_device(drm->nodes[DRM_NODE_PRIMARY]); | ||
} else { | ||
char buf[64]; | ||
- int n = snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, 0); | ||
+ int n = snprintf(buf, sizeof(buf), DRM_DEV_NAME, get_path_dev_dri(NULL), 0); | ||
if (n != -1 && n < sizeof(buf)) | ||
dri2_dpy->fd_display_gpu = loader_open_device(buf); | ||
} | ||
diff --git a/src/etnaviv/drm/tests/etnaviv_bo_cache_test.c b/src/etnaviv/drm/tests/etnaviv_bo_cache_test.c | ||
index 2569601..9066078 100644 | ||
--- a/src/etnaviv/drm/tests/etnaviv_bo_cache_test.c | ||
+++ b/src/etnaviv/drm/tests/etnaviv_bo_cache_test.c | ||
@@ -35,6 +35,20 @@ | ||
#include "drm/etnaviv_drmif.h" | ||
#include "drm-uapi/etnaviv_drm.h" | ||
|
||
+char* get_path_dev_dri(const char* value) { | ||
+ static char path_dev_dri[PATH_MAX] = "/dev/dri"; | ||
+ struct stat sb; | ||
+ | ||
+ if (stat(path_dev_dri, &sb) != 0 && !S_ISDIR(sb.st_mode)) { | ||
+ strcpy(path_dev_dri, "@TERMUX_PREFIX@/dev/dri"); | ||
+ } | ||
+ | ||
+ if (value) | ||
+ strcat(path_dev_dri, value); | ||
+ | ||
+ return path_dev_dri; | ||
+} | ||
+ | ||
static void test_cache(struct etna_device *dev) | ||
{ | ||
struct etna_bo *bo, *tmp; | ||
@@ -83,7 +97,7 @@ int main(int argc, char *argv[]) | ||
|
||
drmVersionPtr version; | ||
int fd, ret = 0; | ||
- const char *node = "/dev/dri/renderD128"; | ||
+ const char *node = get_path_dev_dri("/renderD128"); | ||
|
||
if (argc > 1) | ||
node = argv[1]; | ||
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | ||
index 055c637..3dbcf7e 100644 | ||
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | ||
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | ||
@@ -53,6 +53,20 @@ | ||
#define DRM_RENDER_NODE_MIN_MINOR 128 | ||
#define DRM_RENDER_NODE_MAX_MINOR (DRM_RENDER_NODE_MIN_MINOR + DRM_RENDER_NODE_MAX_NODES) | ||
|
||
+char* get_path_dev_dri(const char* value) { | ||
+ static char path_dev_dri[PATH_MAX] = "/dev/dri"; | ||
+ struct stat sb; | ||
+ | ||
+ if (stat(path_dev_dri, &sb) != 0 && !S_ISDIR(sb.st_mode)) { | ||
+ strcpy(path_dev_dri, "@TERMUX_PREFIX@/dev/dri"); | ||
+ } | ||
+ | ||
+ if (value) | ||
+ strcat(path_dev_dri, value); | ||
+ | ||
+ return path_dev_dri; | ||
+} | ||
+ | ||
struct pipe_loader_drm_device { | ||
struct pipe_loader_device base; | ||
const struct drm_driver_descriptor *dd; | ||
@@ -205,7 +219,7 @@ static int | ||
open_drm_render_node_minor(int minor) | ||
{ | ||
char path[PATH_MAX]; | ||
- snprintf(path, sizeof(path), DRM_RENDER_NODE_DEV_NAME_FORMAT, DRM_DIR_NAME, | ||
+ snprintf(path, sizeof(path), DRM_RENDER_NODE_DEV_NAME_FORMAT, get_path_dev_dri(NULL), | ||
minor); | ||
return loader_open_device(path); | ||
} | ||
diff --git a/src/gallium/drivers/radeonsi/glsl_tests/amdgcn_glslc.c b/src/gallium/drivers/radeonsi/glsl_tests/amdgcn_glslc.c | ||
index c45383c..7f906d0 100644 | ||
--- a/src/gallium/drivers/radeonsi/glsl_tests/amdgcn_glslc.c | ||
+++ b/src/gallium/drivers/radeonsi/glsl_tests/amdgcn_glslc.c | ||
@@ -39,6 +39,20 @@ static int fd; | ||
static EGLDisplay egl_dpy; | ||
static EGLContext ctx; | ||
|
||
+char* get_path_dev_dri(const char* value) { | ||
+ static char path_dev_dri[PATH_MAX] = "/dev/dri"; | ||
+ struct stat sb; | ||
+ | ||
+ if (stat(path_dev_dri, &sb) != 0 && !S_ISDIR(sb.st_mode)) { | ||
+ strcpy(path_dev_dri, "@TERMUX_PREFIX@/dev/dri"); | ||
+ } | ||
+ | ||
+ if (value) | ||
+ strcat(path_dev_dri, value); | ||
+ | ||
+ return path_dev_dri; | ||
+} | ||
+ | ||
static void | ||
create_gl_core_context() | ||
{ | ||
@@ -54,7 +68,7 @@ create_gl_core_context() | ||
exit(1); | ||
} | ||
|
||
- fd = open("/dev/dri/renderD128", O_RDWR); | ||
+ fd = open(get_path_dev_dri("/renderD128"), O_RDWR); | ||
if (unlikely(fd < 0)) { | ||
fprintf(stderr, "ERROR: Couldn't open /dev/dri/renderD128\n"); | ||
exit(1); |