mesa/libdrm: move fd's out of libc's range

Move hard coded fd's out of the libc range in order to avoid possible
hard to find conflicts.

issue #5224
This commit is contained in:
Sebastian Sumpf 2024-05-31 21:24:21 +02:00 committed by Norman Feske
parent 7c32af9d99
commit c85e53cb2a
8 changed files with 28 additions and 25 deletions

View File

@ -770,7 +770,7 @@ CC_OPT += -DMAPI_ABI_HEADER=\"glapi/gen/glapi_mapi_tmp.h\" \
-DMAPI_MODE_BRIDGE -DMAPI_MODE_BRIDGE
CC_OPT += -Wno-unused-function CC_OPT += -Wno-unused-function
CC_OPT_loader/loader = -DDEFAULT_DRIVER_DIR='"/drivers"' CC_OPT_loader/loader = -DDEFAULT_DRIVER_DIR='"/drivers"' -include platform.h
CC_OPT_compiler/glsl/glsl_lexer = -include "stdint.h" CC_OPT_compiler/glsl/glsl_lexer = -include "stdint.h"
CC_OPT_gallium/auxiliary/pipe-loader/pipe_loader_sw = -DPIPE_SEARCH_DIR='"/pipe"' -DGALLIUM_STATIC_TARGETS=1 CC_OPT_gallium/auxiliary/pipe-loader/pipe_loader_sw = -DPIPE_SEARCH_DIR='"/pipe"' -DGALLIUM_STATIC_TARGETS=1
CC_OPT_gallium/auxiliary/pipe-loader/pipe_loader = -DGALLIUM_STATIC_TARGETS=1 CC_OPT_gallium/auxiliary/pipe-loader/pipe_loader = -DGALLIUM_STATIC_TARGETS=1

View File

@ -1 +1 @@
aa79191d2f974902ddcf8f081ca84955037f33c9 3aef4a625536591a08a8579caec868abe0115106

View File

@ -1613,9 +1613,10 @@ extern "C" int genode_drmGetPciDevice(int fd, uint32_t flags, drmDevicePtr devi
{ {
if (_call.constructed() == false) { errno = EIO; return -1; } if (_call.constructed() == false) { errno = EIO; return -1; }
/* TODO create constant */ enum { IRIS_FD = 10043 };
if (fd != 43) {
Genode::error(__func__, " fd is not Genode Iris (43)"); if (fd != IRIS_FD) {
Genode::error(__func__, " fd is not Genode Iris (", unsigned(IRIS_FD), ")");
return -ENODEV; return -ENODEV;
} }

View File

@ -204,7 +204,7 @@ static EGLBoolean dri2_initialize_genode_etnaviv(_EGLDisplay *disp)
if (!dri2_dpy) if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); return _eglError(EGL_BAD_ALLOC, "eglInitialize");
dri2_dpy->fd_render_gpu = 42; dri2_dpy->fd_render_gpu = ETNAVIV_FD;
dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu; dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu;
dri2_dpy->driver_name = strdup("etnaviv"); dri2_dpy->driver_name = strdup("etnaviv");

View File

@ -21,29 +21,31 @@ extern Genode::Env *genode_env;
#include <EGL/egl.h> #include <EGL/egl.h>
enum {
ETNAVIV_FD = 10042,
IRIS_FD = 10043,
LIMA_FD = 10044
};
struct Genode_egl_window; struct Genode_egl_window;
void genode_blit(void const *src, unsigned src_w, void *dst, unsigned dst_w, int w, int h); void genode_blit(void const *src, unsigned src_w, void *dst, unsigned dst_w, int w, int h);
void genode_drm_init(); void genode_drm_init();
void genode_drm_complete(); void genode_drm_complete();
struct _EGLSurface; EGLSurface *
struct _EGLConfig; dri2_genode_create_window_surface(EGLDisplay *disp,
struct _EGLDisplay; EGLConfig *conf, void *native_window,
_EGLSurface *
dri2_genode_create_window_surface(_EGLDisplay *disp,
_EGLConfig *conf, void *native_window,
const EGLint *attrib_list); const EGLint *attrib_list);
EGLBoolean EGLBoolean
dri2_genode_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf); dri2_genode_destroy_surface(EGLDisplay *disp, EGLSurface *surf);
_EGLSurface * EGLSurface *
dri2_genode_create_pixmap_surface(_EGLDisplay *disp, dri2_genode_create_pixmap_surface(EGLDisplay *disp,
_EGLConfig *conf, void *native_window, EGLConfig *conf, void *native_window,
const EGLint *attrib_list); const EGLint *attrib_list);
EGLBoolean EGLBoolean
dri2_genode_swap_interval(_EGLDisplay *disp, dri2_genode_swap_interval(EGLDisplay *disp,
_EGLSurface *surf, EGLint interval); EGLSurface *surf, EGLint interval);
#endif #endif

View File

@ -213,7 +213,7 @@ EGLBoolean dri2_initialize_genode_backend(_EGLDisplay *disp)
if (!dri2_dpy) if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); return _eglError(EGL_BAD_ALLOC, "eglInitialize");
dri2_dpy->fd_render_gpu = 43; dri2_dpy->fd_render_gpu = IRIS_FD;
dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu; dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu;
dri2_dpy->driver_name = strdup("iris"); dri2_dpy->driver_name = strdup("iris");

View File

@ -205,7 +205,7 @@ static EGLBoolean dri2_initialize_genode_lima(_EGLDisplay *disp)
if (!dri2_dpy) if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); return _eglError(EGL_BAD_ALLOC, "eglInitialize");
dri2_dpy->fd_render_gpu = 44; dri2_dpy->fd_render_gpu = LIMA_FD;
dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu; dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu;
dri2_dpy->driver_name = strdup("lima"); dri2_dpy->driver_name = strdup("lima");

View File

@ -6,13 +6,13 @@ index bf90afe..3cce4ce 100644
{ {
char *driver; char *driver;
+ if (fd == 42) { + if (fd == ETNAVIV_FD) {
+ return strdup("etnaviv"); + return strdup("etnaviv");
+ } + }
+ if (fd == 43) { + if (fd == IRIS_FD) {
+ return strdup("iris"); + return strdup("iris");
+ } + }
+ if (fd == 44) { + if (fd == LIMA_FD) {
+ return strdup("lima"); + return strdup("lima");
+ } + }
+ +