From ebd67725099030829fcdd4bed215e23fbceab072 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Mon, 1 Sep 2014 19:15:42 +0000 Subject: [PATCH] mesa: build libgallium.a git-svn-id: svn://kolibrios.org@5080 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/sdk/sources/Mesa/Makefile | 2 +- contrib/sdk/sources/Mesa/src/gallium/Makefile | 195 ++++++++++++++++++ .../Mesa/src/gallium/auxiliary/os/os_time.c | 6 + .../auxiliary/pipe-loader/pipe_loader_drm.c | 141 ++++--------- .../auxiliary/pipe-loader/pipe_loader_sw.c | 2 +- .../Mesa/src/gallium/auxiliary/util/u_dl.c | 36 +--- contrib/sdk/sources/Mesa/src/gallium/dri.def | 4 + .../include/state_tracker/xlib_sw_winsys.h | 2 +- .../sdk/sources/Mesa/src/gallium/osmesa.def | 16 ++ .../state_trackers/egl/common/egl_g3d.c | 61 +----- .../gallium/state_trackers/egl/drm/modeset.c | 72 ++++--- .../state_trackers/egl/drm/native_drm.c | 51 +---- .../Mesa/src/gallium/targets/egl-static/egl.c | 167 +++++++++++++++ .../Mesa/src/gallium/targets/gbm/gbm.c | 8 +- .../sdk/sources/Mesa/src/gbm/main/backend.c | 4 +- 15 files changed, 493 insertions(+), 274 deletions(-) create mode 100644 contrib/sdk/sources/Mesa/src/gallium/Makefile create mode 100644 contrib/sdk/sources/Mesa/src/gallium/dri.def create mode 100644 contrib/sdk/sources/Mesa/src/gallium/osmesa.def diff --git a/contrib/sdk/sources/Mesa/Makefile b/contrib/sdk/sources/Mesa/Makefile index 174d9dc0de..c068332bd3 100644 --- a/contrib/sdk/sources/Mesa/Makefile +++ b/contrib/sdk/sources/Mesa/Makefile @@ -29,7 +29,7 @@ MESA_DEFS+= -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDI EGL_DEFS = -DHAVE_DRM_PLATFORM -D__unix__ -DMESA_EGL_NO_X11_HEADERS -D_EGL_BUILT_IN_DRIVER_DRI2 -SUBDIRS = src/egl src/glsl src/mapi src/mesa +SUBDIRS = src/glsl src/mapi src/gallium src/egl src/mesa # targets diff --git a/contrib/sdk/sources/Mesa/src/gallium/Makefile b/contrib/sdk/sources/Mesa/src/gallium/Makefile new file mode 100644 index 0000000000..f40f466237 --- /dev/null +++ b/contrib/sdk/sources/Mesa/src/gallium/Makefile @@ -0,0 +1,195 @@ + +SRC_DIR:=$(SDK_DIR)/sources +MESA_SRC:= $(SRC_DIR)/Mesa/src + +CFLAGS_OPT = -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U_MSC_VER -Os +CFLAGS_OPT+= -fomit-frame-pointer -fno-ident -msse2 -mno-ms-bitfields +CFLAGS = -c $(CFLAGS_OPT) + +LDFLAGS = -nostdlib -shared -s --image-base 0 -T $(SRC_DIR)/newlib/dll.lds -e _DllStartup + +INC_MESA:= -I$(SRC_DIR)/newlib/libc/include -I$(SRC_DIR)/Mesa/include -I$(MESA_SRC)/mesa +INC_MESA+= -I$(MESA_SRC)/gallium/include -I$(MESA_SRC)/gallium/auxiliary +INC_MESA+= -I$(MESA_SRC)/gallium/winsys -I$(MESA_SRC)/gallium/drivers +INC_MESA+= -I$(MESA_SRC)/gallium/state_trackers/gbm -I$(MESA_SRC)/gbm/main +INC_MESA+= -I$(SRC_DIR)/libdrm +INC_I965:= -I$(SRC_DIR)/libdrm/intel -I$(SRC_DIR)/libdrm/include/drm + +LIBPATH:= -L$(SDK_DIR)/lib -L/home/autobuild/tools/win32/mingw32/lib + +LIBS:= -ldll -lglsl -lGL.dll -lsupc++ -lgcc_eh -ldrm.dll -lexpat -lc.dll -lgcc + +MESA_DEFS= -DMESA_DLL -DBUILD_GL32 -DMAPI_MODE_UTIL -DMAPI_TABLE_NUM_STATIC=87 -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_SSE_ASM -DMAPI_TABLE_NUM_DYNAMIC=256 +MESA_DEFS+= -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_VERSION=\"9.2.5\" -DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi\?product=Mesa\" +MESA_DEFS+= -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"9.2.5\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 +MESA_DEFS+= -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -D_GLAPI_DLL_EXPORTS + + +GALLIUM_SRC:= \ + auxiliary/cso_cache/cso_cache.c \ + auxiliary/cso_cache/cso_context.c \ + auxiliary/cso_cache/cso_hash.c \ + auxiliary/draw/draw_context.c \ + auxiliary/draw/draw_fs.c \ + auxiliary/draw/draw_gs.c \ + auxiliary/draw/draw_pipe.c \ + auxiliary/draw/draw_pipe_aaline.c \ + auxiliary/draw/draw_pipe_aapoint.c \ + auxiliary/draw/draw_pipe_clip.c \ + auxiliary/draw/draw_pipe_cull.c \ + auxiliary/draw/draw_pipe_flatshade.c \ + auxiliary/draw/draw_pipe_offset.c \ + auxiliary/draw/draw_pipe_pstipple.c \ + auxiliary/draw/draw_pipe_stipple.c \ + auxiliary/draw/draw_pipe_twoside.c \ + auxiliary/draw/draw_pipe_unfilled.c \ + auxiliary/draw/draw_pipe_util.c \ + auxiliary/draw/draw_pipe_validate.c \ + auxiliary/draw/draw_pipe_vbuf.c \ + auxiliary/draw/draw_pipe_wide_line.c \ + auxiliary/draw/draw_pipe_wide_point.c \ + auxiliary/draw/draw_prim_assembler.c \ + auxiliary/draw/draw_pt.c \ + auxiliary/draw/draw_pt_emit.c \ + auxiliary/draw/draw_pt_fetch.c \ + auxiliary/draw/draw_pt_fetch_emit.c \ + auxiliary/draw/draw_pt_fetch_shade_emit.c \ + auxiliary/draw/draw_pt_fetch_shade_pipeline.c \ + auxiliary/draw/draw_pt_post_vs.c \ + auxiliary/draw/draw_pt_so_emit.c \ + auxiliary/draw/draw_pt_util.c \ + auxiliary/draw/draw_pt_vsplit.c \ + auxiliary/draw/draw_vertex.c \ + auxiliary/draw/draw_vs.c \ + auxiliary/draw/draw_vs_exec.c \ + auxiliary/draw/draw_vs_variant.c \ + auxiliary/os/os_misc.c \ + auxiliary/os/os_time.c \ + auxiliary/rtasm/rtasm_cpu.c \ + auxiliary/rtasm/rtasm_execmem.c \ + auxiliary/rtasm/rtasm_x86sse.c \ + auxiliary/tgsi/tgsi_build.c \ + auxiliary/tgsi/tgsi_dump.c \ + auxiliary/tgsi/tgsi_exec.c \ + auxiliary/tgsi/tgsi_info.c \ + auxiliary/tgsi/tgsi_iterate.c \ + auxiliary/tgsi/tgsi_parse.c \ + auxiliary/tgsi/tgsi_sanity.c \ + auxiliary/tgsi/tgsi_scan.c \ + auxiliary/tgsi/tgsi_strings.c \ + auxiliary/tgsi/tgsi_text.c \ + auxiliary/tgsi/tgsi_transform.c \ + auxiliary/tgsi/tgsi_ureg.c \ + auxiliary/tgsi/tgsi_util.c \ + auxiliary/translate/translate.c \ + auxiliary/translate/translate_cache.c \ + auxiliary/translate/translate_generic.c \ + auxiliary/translate/translate_sse.c \ + auxiliary/util/u_debug.c \ + auxiliary/util/u_debug_describe.c \ + auxiliary/util/u_debug_memory.c \ + auxiliary/util/u_debug_refcnt.c \ + auxiliary/util/u_debug_stack.c \ + auxiliary/util/u_debug_symbol.c \ + auxiliary/util/u_dump_defines.c \ + auxiliary/util/u_dump_state.c \ + auxiliary/util/u_bitmask.c \ + auxiliary/util/u_blit.c \ + auxiliary/util/u_blitter.c \ + auxiliary/util/u_cache.c \ + auxiliary/util/u_caps.c \ + auxiliary/util/u_cpu_detect.c \ + auxiliary/util/u_dl.c \ + auxiliary/util/u_draw.c \ + auxiliary/util/u_draw_quad.c \ + auxiliary/util/u_format.c \ + auxiliary/util/u_format_other.c \ + auxiliary/util/u_format_latc.c \ + auxiliary/util/u_format_srgb.c \ + auxiliary/util/u_format_table.c \ + auxiliary/util/u_format_s3tc.c \ + auxiliary/util/u_format_rgtc.c \ + auxiliary/util/u_format_etc.c \ + auxiliary/util/u_format_tests.c \ + auxiliary/util/u_format_yuv.c \ + auxiliary/util/u_format_zs.c \ + auxiliary/util/u_framebuffer.c \ + auxiliary/util/u_gen_mipmap.c \ + auxiliary/util/u_handle_table.c \ + auxiliary/util/u_hash.c \ + auxiliary/util/u_hash_table.c \ + auxiliary/util/u_helpers.c \ + auxiliary/util/u_index_modify.c \ + auxiliary/util/u_keymap.c \ + auxiliary/util/u_linear.c \ + auxiliary/util/u_linkage.c \ + auxiliary/util/u_network.c \ + auxiliary/util/u_math.c \ + auxiliary/util/u_mm.c \ + auxiliary/util/u_pstipple.c \ + auxiliary/util/u_ringbuffer.c \ + auxiliary/util/u_sampler.c \ + auxiliary/util/u_simple_shaders.c \ + auxiliary/util/u_slab.c \ + auxiliary/util/u_snprintf.c \ + auxiliary/util/u_staging.c \ + auxiliary/util/u_suballoc.c \ + auxiliary/util/u_surface.c \ + auxiliary/util/u_surfaces.c \ + auxiliary/util/u_texture.c \ + auxiliary/util/u_tile.c \ + auxiliary/util/u_transfer.c \ + auxiliary/util/u_resource.c \ + auxiliary/util/u_upload_mgr.c \ + auxiliary/util/u_vbuf.c \ + auxiliary/vl/vl_csc.c \ + auxiliary/vl/vl_compositor.c \ + auxiliary/vl/vl_matrix_filter.c \ + auxiliary/vl/vl_median_filter.c \ + auxiliary/vl/vl_decoder.c \ + auxiliary/vl/vl_mpeg12_decoder.c \ + auxiliary/vl/vl_mpeg12_bitstream.c \ + auxiliary/vl/vl_zscan.c \ + auxiliary/vl/vl_idct.c \ + auxiliary/vl/vl_mc.c \ + auxiliary/vl/vl_vertex_buffers.c \ + auxiliary/vl/vl_video_buffer.c + +GBM_SRC = \ + state_trackers/gbm/gbm_drm.c \ + targets/gbm/gbm.c + +WINSYS_SRC = \ + winsys/sw/null/null_sw_winsys.c + +I965_SRC = \ + $(NULL) + +GALLIUM_OBJS = $(patsubst %.c, %.o, $(patsubst %.S, %.o, $(patsubst %.cpp, %.o, $(GALLIUM_SRC)))) +OSMESA_OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(OSMESA_SRC))) +I965_OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(I965_SRC))) + +# targets + +all: libgallium.a + +libgallium.a: $(GALLIUM_OBJS) Makefile + $(AR) crs $@ $(GALLIUM_OBJS) + mv -f $@ $(SDK_DIR)/lib + +i965_dri.drv: $(I965_OBJS) $(MESA_OBJS) dri.def Makefile + $(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(I965_OBJS) $(MESA_OBJS) dri.def $(LIBS) + mv -f $@ $(SDK_DIR)/bin + +osmesa.dll: $(MESA_OBJS) $(OSMESA_OBJS) osmesa.def Makefile + $(LD) $(LDFLAGS) $(LIBPATH) --out-implib libosmesa.dll.a -o $@ $(MESA_OBJS) $(OSMESA_OBJS) osmesa.def $(LIBS) + mv -f libosmesa.dll.a $(SDK_DIR)/lib + mv -f $@ $(SDK_DIR)/bin + +%.o : %.c Makefile + $(CC) $(CFLAGS) -std=c99 $(MESA_DEFS) $(INC_MESA) $(INC_I965) -o $@ $< + + +%.o : %.cpp Makefile + $(CC) $(CFLAGS) $(MESA_DEFS) $(INC_MESA) $(INC_I965) -o $@ $< + diff --git a/contrib/sdk/sources/Mesa/src/gallium/auxiliary/os/os_time.c b/contrib/sdk/sources/Mesa/src/gallium/auxiliary/os/os_time.c index abcba63fe1..21a1a53823 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/auxiliary/os/os_time.c +++ b/contrib/sdk/sources/Mesa/src/gallium/auxiliary/os/os_time.c @@ -62,3 +62,9 @@ os_time_sleep(int64_t usecs) } #endif + +void +os_time_sleep(int64_t usecs) +{ + +} diff --git a/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index 339d7bf10b..9eb53df937 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -32,7 +32,7 @@ #include #include -#include +//#include #include #ifdef HAVE_PIPE_LOADER_XCB @@ -50,6 +50,20 @@ #define DRIVER_MAP_GALLIUM_ONLY #include "pci_ids/pci_id_driver_map.h" +#include + +struct pci_device { + uint16_t domain; + uint8_t bus; + uint8_t dev; + uint8_t func; + uint16_t vendor_id; + uint16_t device_id; + uint16_t subvendor_id; + uint16_t subdevice_id; + uint32_t device_class; + uint8_t revision; +}; struct pipe_loader_drm_device { struct pipe_loader_device base; @@ -62,41 +76,23 @@ struct pipe_loader_drm_device { static boolean find_drm_pci_id(struct pipe_loader_drm_device *ddev) { - struct udev *udev = NULL; - struct udev_device *parent, *device = NULL; - struct stat stat; - const char *pci_id; - - if (fstat(ddev->fd, &stat) < 0) - goto fail; - - udev = udev_new(); - if (!udev) - goto fail; - - device = udev_device_new_from_devnum(udev, 'c', stat.st_rdev); - if (!device) - goto fail; - - parent = udev_device_get_parent(device); - if (!parent) - goto fail; - - pci_id = udev_device_get_property_value(parent, "PCI_ID"); - if (!pci_id || - sscanf(pci_id, "%x:%x", &ddev->base.u.pci.vendor_id, - &ddev->base.u.pci.chip_id) != 2) - goto fail; + struct pci_device device; + ioctl_t io; + + io.handle = ddev->fd; + io.io_code = SRV_GET_PCI_INFO; + io.input = &device; + io.inp_size = sizeof(device); + io.output = NULL; + io.out_size = 0; + + if (call_service(&io)!=0) + return FALSE; + + ddev->base.u.pci.vendor_id = device.vendor_id; + ddev->base.u.pci.chip_id = device.device_id; return TRUE; - - fail: - if (device) - udev_device_unref(device); - if (udev) - udev_unref(udev); - - return FALSE; } static boolean @@ -130,58 +126,6 @@ find_drm_driver_name(struct pipe_loader_drm_device *ddev) static struct pipe_loader_ops pipe_loader_drm_ops; -static void -pipe_loader_drm_x_auth(int fd) -{ -#if HAVE_PIPE_LOADER_XCB - /* Try authenticate with the X server to give us access to devices that X - * is running on. */ - xcb_connection_t *xcb_conn; - const xcb_setup_t *xcb_setup; - xcb_screen_iterator_t s; - xcb_dri2_connect_cookie_t connect_cookie; - xcb_dri2_connect_reply_t *connect; - drm_magic_t magic; - xcb_dri2_authenticate_cookie_t authenticate_cookie; - xcb_dri2_authenticate_reply_t *authenticate; - - xcb_conn = xcb_connect(NULL, NULL); - - if(!xcb_conn) - return; - - xcb_setup = xcb_get_setup(xcb_conn); - - if (!xcb_setup) - goto disconnect; - - s = xcb_setup_roots_iterator(xcb_setup); - connect_cookie = xcb_dri2_connect_unchecked(xcb_conn, s.data->root, - XCB_DRI2_DRIVER_TYPE_DRI); - connect = xcb_dri2_connect_reply(xcb_conn, connect_cookie, NULL); - - if (!connect || connect->driver_name_length - + connect->device_name_length == 0) { - - goto disconnect; - } - - if (drmGetMagic(fd, &magic)) - goto disconnect; - - authenticate_cookie = xcb_dri2_authenticate_unchecked(xcb_conn, - s.data->root, - magic); - authenticate = xcb_dri2_authenticate_reply(xcb_conn, - authenticate_cookie, - NULL); - FREE(authenticate); - -disconnect: - xcb_disconnect(xcb_conn); - -#endif -} boolean pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd) @@ -192,8 +136,6 @@ pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd) ddev->base.ops = &pipe_loader_drm_ops; ddev->fd = fd; - pipe_loader_drm_x_auth(fd); - if (!find_drm_pci_id(ddev)) goto fail; @@ -208,26 +150,19 @@ pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd) return FALSE; } -static int -open_drm_minor(int minor) -{ - char path[PATH_MAX]; - snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor); - return open(path, O_RDWR, 0); -} int pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev) { int i, j, fd; - - for (i = 0, j = 0; i < DRM_MAX_MINOR; i++) { - fd = open_drm_minor(i); - if (fd < 0) - continue; + + for (i = 0, j = 0; i < 1; i++) { + fd = get_service("DISPLAY"); + if (fd == 0) + continue; if (j >= ndev || !pipe_loader_drm_probe_fd(&devs[j], fd)) - close(fd); + ; j++; } @@ -240,10 +175,6 @@ pipe_loader_drm_release(struct pipe_loader_device **dev) { struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(*dev); - if (ddev->lib) - util_dl_close(ddev->lib); - - close(ddev->fd); FREE(ddev); *dev = NULL; } diff --git a/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c index c2b78c636a..667f570fdf 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c +++ b/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c @@ -31,7 +31,7 @@ #include "util/u_dl.h" #include "sw/null/null_sw_winsys.h" #include "target-helpers/inline_sw_helper.h" -#include "state_tracker/xlib_sw_winsys.h" +//#include "state_tracker/xlib_sw_winsys.h" struct pipe_loader_sw_device { struct pipe_loader_device base; diff --git a/contrib/sdk/sources/Mesa/src/gallium/auxiliary/util/u_dl.c b/contrib/sdk/sources/Mesa/src/gallium/auxiliary/util/u_dl.c index aca435d6ca..0579be988f 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/auxiliary/util/u_dl.c +++ b/contrib/sdk/sources/Mesa/src/gallium/auxiliary/util/u_dl.c @@ -30,27 +30,17 @@ #include "pipe/p_config.h" #include "pipe/p_compiler.h" -#if defined(PIPE_OS_UNIX) -#include -#endif -#if defined(PIPE_OS_WINDOWS) -#include -#endif #include "u_dl.h" #include "u_pointer.h" +void* load_library(const char *name); +void *get_proc_address(void *module, const char *proc_name); struct util_dl_library * util_dl_open(const char *filename) { -#if defined(PIPE_OS_UNIX) - return (struct util_dl_library *)dlopen(filename, RTLD_LAZY | RTLD_GLOBAL); -#elif defined(PIPE_OS_WINDOWS) - return (struct util_dl_library *)LoadLibraryA(filename); -#else - return NULL; -#endif + return (struct util_dl_library *)load_library(filename); } @@ -58,37 +48,19 @@ util_dl_proc util_dl_get_proc_address(struct util_dl_library *library, const char *procname) { -#if defined(PIPE_OS_UNIX) - return (util_dl_proc) pointer_to_func(dlsym((void *)library, procname)); -#elif defined(PIPE_OS_WINDOWS) - return (util_dl_proc)GetProcAddress((HMODULE)library, procname); -#else - return (util_dl_proc)NULL; -#endif + return (util_dl_proc)get_proc_address(library, procname); } void util_dl_close(struct util_dl_library *library) { -#if defined(PIPE_OS_UNIX) - dlclose((void *)library); -#elif defined(PIPE_OS_WINDOWS) - FreeLibrary((HMODULE)library); -#else (void)library; -#endif } const char * util_dl_error(void) { -#if defined(PIPE_OS_UNIX) - return dlerror(); -#elif defined(PIPE_OS_WINDOWS) return "unknown error"; -#else - return "unknown error"; -#endif } diff --git a/contrib/sdk/sources/Mesa/src/gallium/dri.def b/contrib/sdk/sources/Mesa/src/gallium/dri.def new file mode 100644 index 0000000000..6d5390f91e --- /dev/null +++ b/contrib/sdk/sources/Mesa/src/gallium/dri.def @@ -0,0 +1,4 @@ +VERSION 6.5 +EXPORTS + DllStartup + __driDriverExtensions diff --git a/contrib/sdk/sources/Mesa/src/gallium/include/state_tracker/xlib_sw_winsys.h b/contrib/sdk/sources/Mesa/src/gallium/include/state_tracker/xlib_sw_winsys.h index 4e7ccc13ac..c8a4187bf9 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/include/state_tracker/xlib_sw_winsys.h +++ b/contrib/sdk/sources/Mesa/src/gallium/include/state_tracker/xlib_sw_winsys.h @@ -2,7 +2,7 @@ #define XLIB_SW_WINSYS_H #include "state_tracker/sw_winsys.h" -#include +//#include struct pipe_screen; diff --git a/contrib/sdk/sources/Mesa/src/gallium/osmesa.def b/contrib/sdk/sources/Mesa/src/gallium/osmesa.def new file mode 100644 index 0000000000..9486dc2291 --- /dev/null +++ b/contrib/sdk/sources/Mesa/src/gallium/osmesa.def @@ -0,0 +1,16 @@ +;DESCRIPTION 'Mesa OSMesa lib for Win32' +VERSION 4.1 + +EXPORTS + DllStartup + OSMesaColorClamp + OSMesaCreateContext + OSMesaCreateContextExt + OSMesaDestroyContext + OSMesaMakeCurrent + OSMesaGetCurrentContext + OSMesaPixelStore + OSMesaGetIntegerv + OSMesaGetDepthBuffer + OSMesaGetColorBuffer + OSMesaGetProcAddress diff --git a/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/common/egl_g3d.c b/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/common/egl_g3d.c index 7cc4e8f6cb..6b2d8ad51c 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -100,52 +100,8 @@ egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat) const char *plat_name = NULL; const struct native_platform *nplat = NULL; - switch (plat) { - case _EGL_PLATFORM_WINDOWS: - plat_name = "Windows"; -#ifdef HAVE_GDI_BACKEND - nplat = native_get_gdi_platform(&egl_g3d_native_event_handler); -#endif - break; - case _EGL_PLATFORM_X11: - plat_name = "X11"; -#ifdef HAVE_X11_BACKEND - nplat = native_get_x11_platform(&egl_g3d_native_event_handler); -#endif - break; - case _EGL_PLATFORM_WAYLAND: - plat_name = "wayland"; -#ifdef HAVE_WAYLAND_BACKEND - nplat = native_get_wayland_platform(&egl_g3d_native_event_handler); -#endif - break; - case _EGL_PLATFORM_DRM: - plat_name = "DRM"; -#ifdef HAVE_DRM_BACKEND - nplat = native_get_drm_platform(&egl_g3d_native_event_handler); -#endif - break; - case _EGL_PLATFORM_FBDEV: - plat_name = "FBDEV"; -#ifdef HAVE_FBDEV_BACKEND - nplat = native_get_fbdev_platform(&egl_g3d_native_event_handler); -#endif - break; - case _EGL_PLATFORM_NULL: - plat_name = "NULL"; -#ifdef HAVE_NULL_BACKEND - nplat = native_get_null_platform(&egl_g3d_native_event_handler); -#endif - break; - case _EGL_PLATFORM_ANDROID: - plat_name = "Android"; -#ifdef HAVE_ANDROID_BACKEND - nplat = native_get_android_platform(&egl_g3d_native_event_handler); -#endif - break; - default: - break; - } + plat_name = "DRM"; + nplat = native_get_drm_platform(&egl_g3d_native_event_handler); if (!nplat) _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name); @@ -587,18 +543,9 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy) dpy->Extensions.MESA_drm_image = EGL_TRUE; } - if (dpy->Platform == _EGL_PLATFORM_WAYLAND && gdpy->native->buffer) - dpy->Extensions.MESA_drm_image = EGL_TRUE; +// if (dpy->Platform == _EGL_PLATFORM_WAYLAND && gdpy->native->buffer) +// dpy->Extensions.MESA_drm_image = EGL_TRUE; -#ifdef EGL_ANDROID_image_native_buffer - if (dpy->Platform == _EGL_PLATFORM_ANDROID && gdpy->native->buffer) - dpy->Extensions.ANDROID_image_native_buffer = EGL_TRUE; -#endif - -#ifdef EGL_WL_bind_wayland_display - if (gdpy->native->wayland_bufmgr) - dpy->Extensions.WL_bind_wayland_display = EGL_TRUE; -#endif if (gdpy->native->get_param(gdpy->native, NATIVE_PARAM_PRESENT_REGION) && gdpy->native->get_param(gdpy->native, NATIVE_PARAM_PRESERVE_BUFFER)) { diff --git a/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/modeset.c b/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/modeset.c index dc71a76105..b7baa31bc4 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/modeset.c +++ b/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/modeset.c @@ -60,7 +60,8 @@ drm_surface_validate(struct native_surface *nsurf, uint attachment_mask, */ static boolean drm_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) -{ +{ +#if 0 struct drm_surface *drmsurf = drm_surface(nsurf); struct drm_display *drmdpy = drmsurf->drmdpy; int num_framebuffers = (need_back) ? 2 : 1; @@ -114,18 +115,15 @@ drm_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back) } } - return TRUE; + return TRUE; +#endif + return FALSE; } static boolean drm_surface_flush_frontbuffer(struct native_surface *nsurf) { #ifdef DRM_MODE_FEATURE_DIRTYFB - struct drm_surface *drmsurf = drm_surface(nsurf); - struct drm_display *drmdpy = drmsurf->drmdpy; - - if (drmsurf->front_fb.is_passive) - drmModeDirtyFB(drmdpy->fd, drmsurf->front_fb.buffer_id, NULL, 0); #endif return TRUE; @@ -152,7 +150,8 @@ drm_surface_copy_swap(struct native_surface *nsurf) static boolean drm_surface_swap_buffers(struct native_surface *nsurf) -{ +{ +#if 0 struct drm_surface *drmsurf = drm_surface(nsurf); struct drm_crtc *drmcrtc = &drmsurf->current_crtc; struct drm_display *drmdpy = drmsurf->drmdpy; @@ -187,6 +186,7 @@ drm_surface_swap_buffers(struct native_surface *nsurf) drmsurf->sequence_number++; drmdpy->event_handler->invalid_surface(&drmdpy->base, &drmsurf->base, drmsurf->sequence_number); +#endif return TRUE; } @@ -228,7 +228,8 @@ drm_surface_wait(struct native_surface *nsurf) static void drm_surface_destroy(struct native_surface *nsurf) -{ +{ +#if 0 struct drm_surface *drmsurf = drm_surface(nsurf); resource_surface_wait(drmsurf->rsurf); @@ -244,7 +245,8 @@ drm_surface_destroy(struct native_surface *nsurf) pipe_resource_reference(&drmsurf->back_fb.texture, NULL); resource_surface_destroy(drmsurf->rsurf); - FREE(drmsurf); + FREE(drmsurf); +#endif } static struct drm_surface * @@ -311,7 +313,7 @@ drm_display_create_surface_from_resource(struct native_display *ndpy, PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT); - + resource_surface_import_resource(drmsurf->rsurf, natt, resource); drmsurf->base.destroy = drm_surface_destroy; @@ -321,7 +323,7 @@ drm_display_create_surface_from_resource(struct native_display *ndpy, return &drmsurf->base; } - + /** * Choose a CRTC that supports all given connectors. @@ -332,7 +334,7 @@ drm_display_choose_crtc(struct native_display *ndpy, { struct drm_display *drmdpy = drm_display(ndpy); int idx; - +#if 0 for (idx = 0; idx < drmdpy->resources->count_crtcs; idx++) { boolean found_crtc = TRUE; int i, j; @@ -376,7 +378,9 @@ drm_display_choose_crtc(struct native_display *ndpy, return 0; } - return drmdpy->resources->crtcs[idx]; + return drmdpy->resources->crtcs[idx]; +#endif + return 0; } /** @@ -392,7 +396,7 @@ drm_display_set_crtc(struct native_display *ndpy, int crtc_idx, struct drm_crtc *drmcrtc = &drmdpy->saved_crtcs[crtc_idx]; uint32_t crtc_id; int err; - +#if 0 if (drmcrtc->crtc) { crtc_id = drmcrtc->crtc->crtc_id; } @@ -440,7 +444,10 @@ drm_display_set_crtc(struct native_display *ndpy, int crtc_idx, return FALSE; } - return TRUE; + return TRUE; +#endif + return FALSE; + } static boolean @@ -448,7 +455,8 @@ drm_display_program(struct native_display *ndpy, int crtc_idx, struct native_surface *nsurf, uint x, uint y, const struct native_connector **nconns, int num_nconns, const struct native_mode *nmode) -{ +{ +#if 0 struct drm_display *drmdpy = drm_display(ndpy); struct drm_surface *drmsurf = drm_surface(nsurf); const struct drm_mode *drmmode = drm_mode(nmode); @@ -511,14 +519,18 @@ drm_display_program(struct native_display *ndpy, int crtc_idx, drmsurf->is_shown = TRUE; } - return TRUE; + return TRUE; +#endif + return FALSE; + } static const struct native_mode ** drm_display_get_modes(struct native_display *ndpy, const struct native_connector *nconn, int *num_modes) -{ +{ +#if 0 struct drm_display *drmdpy = drm_display(ndpy); struct drm_connector *drmconn = drm_connector(nconn); const struct native_mode **nmodes_return; @@ -571,13 +583,16 @@ drm_display_get_modes(struct native_display *ndpy, *num_modes = count; } - return nmodes_return; + return nmodes_return; +#endif + return NULL; } static const struct native_connector ** drm_display_get_connectors(struct native_display *ndpy, int *num_connectors, int *num_crtc) -{ +{ +#if 0 struct drm_display *drmdpy = drm_display(ndpy); const struct native_connector **connectors; int i; @@ -609,7 +624,9 @@ drm_display_get_connectors(struct native_display *ndpy, int *num_connectors, if (num_crtc) *num_crtc = drmdpy->resources->count_crtcs; - return connectors; + return connectors; +#endif + return NULL; } static struct native_surface * @@ -632,7 +649,8 @@ static struct native_display_modeset drm_display_modeset = { void drm_display_fini_modeset(struct native_display *ndpy) -{ +{ +#if 0 struct drm_display *drmdpy = drm_display(ndpy); int i; @@ -672,12 +690,14 @@ drm_display_fini_modeset(struct native_display *ndpy) drmdpy->resources = NULL; } - drmdpy->base.modeset = NULL; + drmdpy->base.modeset = NULL; +#endif } boolean drm_display_init_modeset(struct native_display *ndpy) -{ +{ +#if 0 struct drm_display *drmdpy = drm_display(ndpy); /* resources are fixed, unlike crtc, connector, or encoder */ @@ -702,6 +722,6 @@ drm_display_init_modeset(struct native_display *ndpy) } drmdpy->base.modeset = &drm_display_modeset; - +#endif return TRUE; } diff --git a/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/native_drm.c b/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/native_drm.c index 2e9f388f0c..c2a574a6e0 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/native_drm.c +++ b/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/native_drm.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "util/u_memory.h" #include "egllog.h" @@ -138,8 +139,6 @@ drm_display_destroy(struct native_display *ndpy) if (drmdpy->own_gbm) { gbm_device_destroy(&drmdpy->gbmdrm->base.base); - if (drmdpy->fd >= 0) - close(drmdpy->fd); } FREE(drmdpy); @@ -156,34 +155,6 @@ drm_get_device_name(int fd) { char *device_name = NULL; #ifdef HAVE_LIBUDEV - struct udev *udev; - struct udev_device *device; - struct stat buf; - const char *tmp; - - udev = udev_new(); - if (fstat(fd, &buf) < 0) { - _eglLog(_EGL_WARNING, "failed to stat fd %d", fd); - goto outudev; - } - - device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev); - if (device == NULL) { - _eglLog(_EGL_WARNING, - "could not create udev device for fd %d", fd); - goto outdevice; - } - - tmp = udev_device_get_devnode(device); - if (!tmp) - goto outdevice; - device_name = strdup(tmp); - -outdevice: - udev_device_unref(device); -outudev: - udev_unref(udev); - #endif return device_name; } @@ -220,7 +191,7 @@ drm_display_bind_wayland_display(struct native_display *ndpy, if (!ndpy->wl_server_drm) return FALSE; - + return TRUE; } @@ -314,26 +285,20 @@ native_create_display(void *dpy, boolean use_sw) gbm = dpy; if (gbm == NULL) { - const char *device_name="/dev/dri/card0"; -#ifdef O_CLOEXEC - fd = open(device_name, O_RDWR | O_CLOEXEC); - if (fd == -1 && errno == EINVAL) -#endif - { - fd = open(device_name, O_RDWR); - if (fd != -1) - fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); - } + fd = get_service("DISPLAY"); + if (fd == NULL) + return NULL; + /* FIXME: Use an internal constructor to create a gbm * device with gallium backend directly, without setenv */ - setenv("GBM_BACKEND", "gbm_gallium_drm.so", 1); +// setenv("GBM_BACKEND", "gbm_gallium_drm.so", 1); gbm = gbm_gallium_drm_device(gbm_create_device(fd)); own_gbm = 1; } if (gbm == NULL) return NULL; - + if (strcmp(gbm_device_get_backend_name(&gbm->base.base), "drm") != 0 || gbm->base.type != GBM_DRM_DRIVER_TYPE_GALLIUM) { if (own_gbm) diff --git a/contrib/sdk/sources/Mesa/src/gallium/targets/egl-static/egl.c b/contrib/sdk/sources/Mesa/src/gallium/targets/egl-static/egl.c index 0b59bdb521..dcbea651a3 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/targets/egl-static/egl.c +++ b/contrib/sdk/sources/Mesa/src/gallium/targets/egl-static/egl.c @@ -309,3 +309,170 @@ _EGL_MAIN(const char *args) return drv; } + +EGLBoolean +_eglError(EGLint errCode, const char *msg) +{ + return EGL_FALSE; +} + +void +_eglLog(EGLint level, const char *fmtStr, ...) +{ + +} + +void +_eglDestroyArray(_EGLArray *array, void (*free_cb)(void *)) +{ + +} + +void +_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes) +{ +} + +void +_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) +{ + +} + +EGLScreenMESA +_eglLinkScreen(_EGLScreen *screen) +{ +} + +EGLBoolean +_eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching) +{ + return EGL_FALSE; +} + +void +_eglInitConfig(_EGLConfig *conf, _EGLDisplay *dpy, EGLint id) +{ +} +void +_eglCleanupDisplay(_EGLDisplay *disp) +{ + +} + +PUBLIC EGLConfig +_eglLinkConfig(_EGLConfig *conf) +{ + +} + +EGLBoolean +_eglPutResource(_EGLResource *res) +{ + return EGL_FALSE; +} + +_EGLContext * +_eglGetCurrentContext(void) +{ + return NULL; +} + +EGLBoolean +_eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type, + _EGLConfig *conf, const EGLint *attrib_list) +{ + return EGL_FALSE; +} + +EGLBoolean +_eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read, + _EGLContext **old_ctx, + _EGLSurface **old_draw, _EGLSurface **old_read) +{ + return EGL_FALSE; +} + +PUBLIC _EGLContext * +_eglGetAPIContext(EGLenum api) +{ + return NULL; +} + +EGLBoolean +_eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf, + const EGLint *attrib_list) +{ + return EGL_FALSE; +} + +EGLint +_eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2, + const _EGLConfig *criteria, EGLBoolean compare_id) +{ + return 0; +} + +EGLBoolean +_eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria) +{ + return EGL_FALSE; +} + +EGLBoolean +_eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy, + const EGLint *attrib_list) +{ + return EGL_FALSE; +} + +EGLBoolean +_eglFilterConfigArray(_EGLArray *array, EGLConfig *configs, + EGLint config_size, EGLint *num_configs, + EGLBoolean (*match)(const _EGLConfig *, void *), + EGLint (*compare)(const _EGLConfig *, const _EGLConfig *, + void *), + void *priv_data) +{ + return EGL_FALSE; +} + +EGLBoolean +_eglInitImage(_EGLImage *img, _EGLDisplay *dpy) +{ + + return EGL_TRUE; +} + +EGLint +_eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, + const EGLint *attrib_list) +{ + return 0; +} + +EGLBoolean +_eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, + const EGLint *attrib_list) +{ + + return EGL_TRUE; +} + +void +_eglGetResource(_EGLResource *res) +{ +} + +EGLBoolean +_eglCheckResource(void *res, int type, _EGLDisplay *dpy) +{ + + return EGL_TRUE; +} + +void +_eglInitDriverFallbacks(_EGLDriver *drv) +{ +} + diff --git a/contrib/sdk/sources/Mesa/src/gallium/targets/gbm/gbm.c b/contrib/sdk/sources/Mesa/src/gallium/targets/gbm/gbm.c index 8f460573b5..06b0661f42 100644 --- a/contrib/sdk/sources/Mesa/src/gallium/targets/gbm/gbm.c +++ b/contrib/sdk/sources/Mesa/src/gallium/targets/gbm/gbm.c @@ -34,13 +34,9 @@ static const char * get_library_search_path(void) { - const char *search_path = NULL; + const char *search_path; - /* don't allow setuid apps to use GBM_BACKENDS_PATH */ - if (geteuid() == getuid()) - search_path = getenv("GBM_BACKENDS_PATH"); - if (search_path == NULL) - search_path = PIPE_SEARCH_DIR; + search_path = "/kolibrios/drivers/gallium-pipe/"; return search_path; } diff --git a/contrib/sdk/sources/Mesa/src/gbm/main/backend.c b/contrib/sdk/sources/Mesa/src/gbm/main/backend.c index cb73dbf85d..122b820346 100644 --- a/contrib/sdk/sources/Mesa/src/gbm/main/backend.c +++ b/contrib/sdk/sources/Mesa/src/gbm/main/backend.c @@ -44,8 +44,8 @@ struct backend_desc { }; static const struct backend_desc backends[] = { - { "gbm_dri.so", &gbm_dri_backend } -// { "gbm_gallium_drm.so", NULL }, + { "gbm_dri.dll", &gbm_dri_backend }, + { "gbm_gallium_drm.dll", NULL }, }; #if 0