From 31cd2d75dc3844e40143f649fe383de17c152a13 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 15 May 2015 19:05:45 -0700 Subject: swrast: Build fix for Solaris Fixes regression from commit 5b2d3480f57168d50ad24cf0b8c9244414bd3701 Cc: "10.5 10.6" Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston Sequoia --- configure.ac | 1 + 1 file changed, 1 insertion(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 095e23e69b6..5594548ddfd 100644 --- a/configure.ac +++ b/configure.ac @@ -649,6 +649,7 @@ if test "x$enable_asm" = xyes; then fi AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) +AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) dnl Check to see if dlopen is in default libraries (like Solaris, which -- cgit v1.2.3 From dd048543e944d95b4471572454cfa902392e3f61 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 26 May 2015 12:47:03 +0200 Subject: configure.ac: enable building GLES1 and GLES2 by default Reviewed-by: Matt Turner Reviewed-by: Emil Velikov --- configure.ac | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 5594548ddfd..84b404eb8b2 100644 --- a/configure.ac +++ b/configure.ac @@ -714,15 +714,15 @@ AC_ARG_ENABLE([opengl], [enable_opengl="$enableval"], [enable_opengl=yes]) AC_ARG_ENABLE([gles1], - [AS_HELP_STRING([--enable-gles1], - [enable support for OpenGL ES 1.x API @<:@default=disabled@:>@])], + [AS_HELP_STRING([--disable-gles1], + [disable support for OpenGL ES 1.x API @<:@default=enabled@:>@])], [enable_gles1="$enableval"], - [enable_gles1=no]) + [enable_gles1=yes]) AC_ARG_ENABLE([gles2], - [AS_HELP_STRING([--enable-gles2], - [enable support for OpenGL ES 2.x API @<:@default=disabled@:>@])], + [AS_HELP_STRING([--disable-gles2], + [disable support for OpenGL ES 2.x API @<:@default=enabled@:>@])], [enable_gles2="$enableval"], - [enable_gles2=no]) + [enable_gles2=yes]) AC_ARG_ENABLE([dri], [AS_HELP_STRING([--enable-dri], -- cgit v1.2.3 From 9119cd7d2c959e437c40c86f214d08dc198bfa69 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 29 May 2015 11:58:58 +0100 Subject: configure.ac: Don't bother checking whether LLVM's MCJIT component is available. Now that we require LLVM 3.3, MCJIT is guaranteed to be available. Trvial. --- configure.ac | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 84b404eb8b2..e49473b0f7e 100644 --- a/configure.ac +++ b/configure.ac @@ -1921,10 +1921,7 @@ if test "x$enable_gallium_llvm" = xyes; then AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required]) fi - LLVM_COMPONENTS="engine bitwriter" - if $LLVM_CONFIG --components | grep -qw 'mcjit'; then - LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit" - fi + LLVM_COMPONENTS="engine bitwriter mcjit" if test "x$enable_opencl" = xyes; then llvm_check_version_for "3" "5" "0" "opencl" -- cgit v1.2.3 From 0ad15e55bfbca3d6b829b985f9e7ea7e3e69bc61 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 29 May 2015 12:13:36 +0100 Subject: configure.ac: Link mcdisassembler component. gallivm now depends on it. And depending on particular LLVM version / configure options, the build can fail without this change due to undefined reference to `LLVM*Disasm*' symbols. Trivial. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e49473b0f7e..d32aa2492cc 100644 --- a/configure.ac +++ b/configure.ac @@ -1921,7 +1921,7 @@ if test "x$enable_gallium_llvm" = xyes; then AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required]) fi - LLVM_COMPONENTS="engine bitwriter mcjit" + LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler" if test "x$enable_opencl" = xyes; then llvm_check_version_for "3" "5" "0" "opencl" -- cgit v1.2.3 From 8d10b2a0460ca01a5c65a87184717c6c2e4bcaeb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 3 Jun 2015 10:18:04 -0700 Subject: vc4: Drop subdirectory in vc4 build. Just because we put the source in a subdir, doesn't mean we need helper libraries in the build. This will also simplify the Android build setup. --- configure.ac | 1 - src/gallium/drivers/vc4/Makefile.am | 4 +-- src/gallium/drivers/vc4/Makefile.sources | 4 +++ src/gallium/drivers/vc4/kernel/Makefile.am | 40 ------------------------- src/gallium/drivers/vc4/kernel/Makefile.sources | 6 ---- 5 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 src/gallium/drivers/vc4/kernel/Makefile.am delete mode 100644 src/gallium/drivers/vc4/kernel/Makefile.sources (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index d32aa2492cc..be0cd7dd7d9 100644 --- a/configure.ac +++ b/configure.ac @@ -2350,7 +2350,6 @@ AC_CONFIG_FILES([Makefile src/gallium/drivers/svga/Makefile src/gallium/drivers/trace/Makefile src/gallium/drivers/vc4/Makefile - src/gallium/drivers/vc4/kernel/Makefile src/gallium/state_trackers/clover/Makefile src/gallium/state_trackers/dri/Makefile src/gallium/state_trackers/glx/xlib/Makefile diff --git a/src/gallium/drivers/vc4/Makefile.am b/src/gallium/drivers/vc4/Makefile.am index 3fc591f10c1..774463138d0 100644 --- a/src/gallium/drivers/vc4/Makefile.am +++ b/src/gallium/drivers/vc4/Makefile.am @@ -19,8 +19,6 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -SUBDIRS = kernel - include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc @@ -39,5 +37,5 @@ AM_CFLAGS = \ noinst_LTLIBRARIES = libvc4.la libvc4_la_SOURCES = $(C_SOURCES) -libvc4_la_LIBADD = $(SIM_LIB) kernel/libvc4_kernel.la +libvc4_la_LIBADD = $(SIM_LIB) libvc4_la_LDFLAGS = $(SIM_LDFLAGS) diff --git a/src/gallium/drivers/vc4/Makefile.sources b/src/gallium/drivers/vc4/Makefile.sources index 49474df3548..f678b2fc0d3 100644 --- a/src/gallium/drivers/vc4/Makefile.sources +++ b/src/gallium/drivers/vc4/Makefile.sources @@ -1,4 +1,8 @@ C_SOURCES := \ + kernel/vc4_drv.h \ + kernel/vc4_gem.c \ + kernel/vc4_validate.c \ + kernel/vc4_validate_shaders.c \ vc4_blit.c \ vc4_bufmgr.c \ vc4_bufmgr.h \ diff --git a/src/gallium/drivers/vc4/kernel/Makefile.am b/src/gallium/drivers/vc4/kernel/Makefile.am deleted file mode 100644 index 1ae5f1c2e83..00000000000 --- a/src/gallium/drivers/vc4/kernel/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright © 2014 Broadcom -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -include Makefile.sources -include $(top_srcdir)/src/gallium/Automake.inc - -if USE_VC4_SIMULATOR -SIM_CFLAGS = -DUSE_VC4_SIMULATOR=1 -endif - -AM_CFLAGS = \ - $(LIBDRM_CFLAGS) \ - $(GALLIUM_DRIVER_CFLAGS) \ - $(SIM_CFLAGS) \ - -I$(top_srcdir)/src/mesa/ \ - -I$(srcdir)/../ \ - $() - -noinst_LTLIBRARIES = libvc4_kernel.la - -libvc4_kernel_la_SOURCES = $(C_SOURCES) -libvc4_kernel_la_LDFLAGS = $(SIM_LDFLAGS) diff --git a/src/gallium/drivers/vc4/kernel/Makefile.sources b/src/gallium/drivers/vc4/kernel/Makefile.sources deleted file mode 100644 index 7d17a898ebf..00000000000 --- a/src/gallium/drivers/vc4/kernel/Makefile.sources +++ /dev/null @@ -1,6 +0,0 @@ -C_SOURCES := \ - vc4_drv.h \ - vc4_gem.c \ - vc4_validate.c \ - vc4_validate_shaders.c \ - $() -- cgit v1.2.3 From 4d35eef326e49cc8da50879d30a1c5088d4775e1 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 11 Jun 2015 15:42:25 +0000 Subject: radeon/llvm: Handle LLVM backend rename from R600 to AMDGPU MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- configure.ac | 13 ++++++++----- src/gallium/drivers/radeon/radeon_llvm_emit.c | 8 ++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index be0cd7dd7d9..34d1ac988f6 100644 --- a/configure.ac +++ b/configure.ac @@ -2048,16 +2048,19 @@ require_egl_drm() { } radeon_llvm_check() { + if test ${LLVM_VERSION_INT} -lt 307; then + amdgpu_llvm_target_name='r600' + else + amdgpu_llvm_target_name='amdgpu' + fi if test "x$enable_gallium_llvm" != "xyes"; then AC_MSG_ERROR([--enable-gallium-llvm is required when building $1]) fi llvm_check_version_for "3" "4" "2" $1 - if test true && $LLVM_CONFIG --targets-built | grep -qvw 'R600' ; then - AC_MSG_ERROR([LLVM R600 Target not enabled. You can enable it when building the LLVM - sources with the --enable-experimental-targets=R600 - configure flag]) + if test true && $LLVM_CONFIG --targets-built | grep -iqvw $amdgpu_llvm_target_name ; then + AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM build.]) fi - LLVM_COMPONENTS="${LLVM_COMPONENTS} r600 bitreader ipo" + LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo" NEED_RADEON_LLVM=yes if test "x$have_libelf" != xyes; then AC_MSG_ERROR([$1 requires libelf when using llvm]) diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c index 624077c7465..25580b6bd4c 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c @@ -86,10 +86,18 @@ static void init_r600_target() { static unsigned initialized = 0; if (!initialized) { +#if HAVE_LLVM < 0x0307 LLVMInitializeR600TargetInfo(); LLVMInitializeR600Target(); LLVMInitializeR600TargetMC(); LLVMInitializeR600AsmPrinter(); +#else + LLVMInitializeAMDGPUTargetInfo(); + LLVMInitializeAMDGPUTarget(); + LLVMInitializeAMDGPUTargetMC(); + LLVMInitializeAMDGPUAsmPrinter(); + +#endif initialized = 1; } } -- cgit v1.2.3 From 797f4eacea8a6b08b7c9143a74c7f2b422d1535d Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 6 Jun 2015 13:24:11 +0200 Subject: configure.ac: rename LLVM_VERSION_PATCH to avoid conflict with llvm-config.h Reviewed-by: Tom Stellard --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 34d1ac988f6..e6d947e5fc3 100644 --- a/configure.ac +++ b/configure.ac @@ -1929,7 +1929,7 @@ if test "x$enable_gallium_llvm" = xyes; then LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation" LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata" fi - DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DLLVM_VERSION_PATCH=$LLVM_VERSION_PATCH" + DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH" MESA_LLVM=1 dnl Check for Clang internal headers -- cgit v1.2.3 From 6b8accb36b541f77774109ea42533c02bb90bc68 Mon Sep 17 00:00:00 2001 From: Haixia Shi Date: Fri, 12 Jun 2015 10:10:58 -0700 Subject: egl/dri2: implement platform_surfaceless The surfaceless platform is for off-screen rendering only. Render node support is required. Only consider the render nodes. Do not use normal nodes as they require auth hooks. v3: change platform_null to platform_surfaceless v4: make libdrm required for surfaceless v5: remove modified include guards with defined(HAVE_SURFACELESS_PLATFORM) v6: use O_CLOEXEC for drm fd Signed-off-by: Haixia Shi Signed-off-by: Zach Reizner Reviewed-by: Emil Velikov Reviewed-by: Chad Versace --- configure.ac | 6 + src/egl/drivers/dri2/Makefile.am | 5 + src/egl/drivers/dri2/egl_dri2.c | 7 ++ src/egl/drivers/dri2/egl_dri2.h | 3 + src/egl/drivers/dri2/platform_surfaceless.c | 171 ++++++++++++++++++++++++++++ src/egl/main/Makefile.am | 4 + src/egl/main/egldisplay.c | 3 +- src/egl/main/egldisplay.h | 1 + 8 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 src/egl/drivers/dri2/platform_surfaceless.c (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e6d947e5fc3..3c763c27b9f 100644 --- a/configure.ac +++ b/configure.ac @@ -1777,6 +1777,11 @@ for plat in $egl_platforms; do AC_MSG_ERROR([EGL platform drm requires libdrm >= $LIBDRM_REQUIRED]) ;; + surfaceless) + test "x$have_libdrm" != xyes && + AC_MSG_ERROR([EGL platform surfaceless requires libdrm >= $LIBDRM_REQUIRED]) + ;; + android|gdi|null) ;; @@ -1806,6 +1811,7 @@ fi AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11') AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland') AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm') +AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 'surfaceless') AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null') AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x") diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am index f589600be0f..55be4a75ba5 100644 --- a/src/egl/drivers/dri2/Makefile.am +++ b/src/egl/drivers/dri2/Makefile.am @@ -65,4 +65,9 @@ libegl_dri2_la_SOURCES += platform_drm.c AM_CFLAGS += -DHAVE_DRM_PLATFORM endif +if HAVE_EGL_PLATFORM_SURFACELESS +libegl_dri2_la_SOURCES += platform_surfaceless.c +AM_CFLAGS += -DHAVE_SURFACELESS_PLATFORM +endif + EXTRA_DIST = SConscript diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index dceb9a011d9..a1cbd437f53 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -667,6 +667,13 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp) return EGL_FALSE; switch (disp->Platform) { +#ifdef HAVE_SURFACELESS_PLATFORM + case _EGL_PLATFORM_SURFACELESS: + if (disp->Options.TestOnly) + return EGL_TRUE; + return dri2_initialize_surfaceless(drv, disp); +#endif + #ifdef HAVE_X11_PLATFORM case _EGL_PLATFORM_X11: if (disp->Options.TestOnly) diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index adade3db9cc..9985c49f984 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -351,6 +351,9 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp); EGLBoolean dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp); +EGLBoolean +dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp); + void dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw); diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c new file mode 100644 index 00000000000..30cea368554 --- /dev/null +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -0,0 +1,171 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (c) 2014 The Chromium OS Authors. + * Copyright © 2011 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "egl_dri2.h" +#include "egl_dri2_fallbacks.h" +#include "loader.h" + +static struct dri2_egl_display_vtbl dri2_surfaceless_display_vtbl = { + .create_pixmap_surface = dri2_fallback_create_pixmap_surface, + .create_image = dri2_create_image_khr, + .swap_interval = dri2_fallback_swap_interval, + .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage, + .swap_buffers_region = dri2_fallback_swap_buffers_region, + .post_sub_buffer = dri2_fallback_post_sub_buffer, + .copy_buffers = dri2_fallback_copy_buffers, + .query_buffer_age = dri2_fallback_query_buffer_age, + .create_wayland_buffer_from_image = dri2_fallback_create_wayland_buffer_from_image, + .get_sync_values = dri2_fallback_get_sync_values, +}; + +static void +surfaceless_flush_front_buffer(__DRIdrawable *driDrawable, void *loaderPrivate) +{ +} + +static __DRIbuffer * +surfaceless_get_buffers_with_format(__DRIdrawable * driDrawable, + int *width, int *height, + unsigned int *attachments, int count, + int *out_count, void *loaderPrivate) +{ + struct dri2_egl_surface *dri2_surf = loaderPrivate; + + dri2_surf->buffer_count = 1; + if (width) + *width = dri2_surf->base.Width; + if (height) + *height = dri2_surf->base.Height; + *out_count = dri2_surf->buffer_count;; + return dri2_surf->buffers; +} + +#define DRM_RENDER_DEV_NAME "%s/renderD%d" + +EGLBoolean +dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp) +{ + struct dri2_egl_display *dri2_dpy; + const char* err; + int i; + int driver_loaded = 0; + + loader_set_logger(_eglLog); + + dri2_dpy = calloc(1, sizeof *dri2_dpy); + if (!dri2_dpy) + return _eglError(EGL_BAD_ALLOC, "eglInitialize"); + + disp->DriverData = (void *) dri2_dpy; + + const int limit = 64; + const int base = 128; + for (i = 0; i < limit; ++i) { + char *card_path; + if (asprintf(&card_path, DRM_RENDER_DEV_NAME, DRM_DIR_NAME, base + i) < 0) + continue; + +#ifdef O_CLOEXEC + dri2_dpy->fd = open(card_path, O_RDWR | O_CLOEXEC); + if (dri2_dpy->fd < 0 && errno == EINVAL) +#endif + { + dri2_dpy->fd = open(card_path, O_RDWR); + if (dri2_dpy->fd >= 0) + fcntl(dri2_dpy->fd, F_SETFD, fcntl(dri2_dpy->fd, F_GETFD) | + FD_CLOEXEC); + } + + free(card_path); + if (dri2_dpy->fd < 0) + continue; + + dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd, 0); + if (dri2_dpy->driver_name) { + if (dri2_load_driver(disp)) { + driver_loaded = 1; + break; + } + free(dri2_dpy->driver_name); + } + close(dri2_dpy->fd); + } + + if (!driver_loaded) { + err = "DRI2: failed to load driver"; + goto cleanup_display; + } + + dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER; + dri2_dpy->dri2_loader_extension.base.version = 3; + dri2_dpy->dri2_loader_extension.getBuffers = NULL; + dri2_dpy->dri2_loader_extension.flushFrontBuffer = + surfaceless_flush_front_buffer; + dri2_dpy->dri2_loader_extension.getBuffersWithFormat = + surfaceless_get_buffers_with_format; + + dri2_dpy->extensions[0] = &dri2_dpy->dri2_loader_extension.base; + dri2_dpy->extensions[1] = &image_lookup_extension.base; + dri2_dpy->extensions[2] = &use_invalidate.base; + dri2_dpy->extensions[3] = NULL; + + if (!dri2_create_screen(disp)) { + err = "DRI2: failed to create screen"; + goto cleanup_driver; + } + + for (i = 0; dri2_dpy->driver_configs[i]; i++) { + dri2_add_config(disp, dri2_dpy->driver_configs[i], + i + 1, EGL_WINDOW_BIT, NULL, NULL); + } + + disp->Extensions.KHR_image_base = EGL_TRUE; + + /* Fill vtbl last to prevent accidentally calling virtual function during + * initialization. + */ + dri2_dpy->vtbl = &dri2_surfaceless_display_vtbl; + + return EGL_TRUE; + +cleanup_driver: + dlclose(dri2_dpy->driver); + free(dri2_dpy->driver_name); + close(dri2_dpy->fd); +cleanup_display: + free(dri2_dpy); + + return _eglError(EGL_NOT_INITIALIZED, err); +} diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am index b6617366c7e..9030d272b53 100644 --- a/src/egl/main/Makefile.am +++ b/src/egl/main/Makefile.am @@ -68,6 +68,10 @@ if HAVE_EGL_PLATFORM_NULL AM_CFLAGS += -DHAVE_NULL_PLATFORM endif +if HAVE_EGL_PLATFORM_SURFACELESS +AM_CFLAGS += -DHAVE_SURFACELESS_PLATFORM +endif + if HAVE_EGL_DRIVER_DRI2 AM_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2 AM_CFLAGS += -DHAVE_XCB_DRI2 diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index a3ecba8c41e..24a0c7e61a7 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -71,7 +71,8 @@ static const struct { { _EGL_PLATFORM_DRM, "drm" }, { _EGL_PLATFORM_NULL, "null" }, { _EGL_PLATFORM_ANDROID, "android" }, - { _EGL_PLATFORM_HAIKU, "haiku" } + { _EGL_PLATFORM_HAIKU, "haiku" }, + { _EGL_PLATFORM_SURFACELESS, "surfaceless" }, }; diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 84cfbe19f7e..0b50a36a098 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -51,6 +51,7 @@ enum _egl_platform_type { _EGL_PLATFORM_NULL, _EGL_PLATFORM_ANDROID, _EGL_PLATFORM_HAIKU, + _EGL_PLATFORM_SURFACELESS, _EGL_NUM_PLATFORMS, _EGL_INVALID_PLATFORM = -1 -- cgit v1.2.3 From 6d744aaf4e427b6b0b3d8d35d756592a50abbb97 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Fri, 19 Jun 2015 17:19:46 +0100 Subject: configure: warn about shared_glapi & xlib-glx only when both are set Printing out the message when shared_glapi is disabled only leads to confusion. Cc: "10.5 10.6" Signed-off-by: Emil Velikov Reviewed-by: Eric Anholt --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 3c763c27b9f..5161361908d 100644 --- a/configure.ac +++ b/configure.ac @@ -942,7 +942,7 @@ x*yes*yes*) esac # Building Xlib-GLX requires shared glapi to be disabled. -if test "x$enable_xlib_glx" = xyes; then +if test "x$enable_shared_glapi$enable_xlib_glx" = xyesyes; then AC_MSG_NOTICE([Shared GLAPI should not used with Xlib-GLX, disabling]) enable_shared_glapi=no fi -- cgit v1.2.3 From 92dc50786224411dc0aeff18b80a1995fcb04dc1 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Fri, 19 Jun 2015 19:43:23 +0100 Subject: configure: allow building shared-glapi powered libgl-xlib Cc: Brian Paul Cc: Adam Jackson Signed-off-by: Emil Velikov Reviewed-by: Eric Anholt Acked-by: Jose Fonseca --- configure.ac | 6 ------ 1 file changed, 6 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 5161361908d..677fb5bbb89 100644 --- a/configure.ac +++ b/configure.ac @@ -941,12 +941,6 @@ x*yes*yes*) ;; esac -# Building Xlib-GLX requires shared glapi to be disabled. -if test "x$enable_shared_glapi$enable_xlib_glx" = xyesyes; then - AC_MSG_NOTICE([Shared GLAPI should not used with Xlib-GLX, disabling]) - enable_shared_glapi=no -fi - AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes) # Build the pipe-drivers as separate libraries/modules. -- cgit v1.2.3 From ddc886b5bfe5976fa2e5f49eeefa918736f1aa97 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Fri, 19 Jun 2015 17:44:02 +0100 Subject: configure: error out when building backend-less libEGL Cc: "10.5 10.6" Signed-off-by: Emil Velikov Reviewed-by: Eric Anholt --- configure.ac | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 677fb5bbb89..8e62bd893ee 100644 --- a/configure.ac +++ b/configure.ac @@ -1542,8 +1542,12 @@ if test "x$enable_egl" = xyes; then if test "$enable_static" != yes; then if test "x$enable_dri" = xyes; then - HAVE_EGL_DRIVER_DRI2=1 - fi + HAVE_EGL_DRIVER_DRI2=1 + else + # Avoid building an "empty" libEGL. Drop/update this + # when other backends (haiku?) come along. + AC_MSG_ERROR([egl requires --enable-dri]) + fi fi fi -- cgit v1.2.3 From 994be5143a097ae2cf504ba344362edfee388ac3 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Fri, 19 Jun 2015 17:46:41 +0100 Subject: configure: error out when building libEGL without shared-glapi The latter is a hard requirement and without it we'll error out later on in the build. Cc: "10.5 10.6" Signed-off-by: Emil Velikov Reviewed-by: Eric Anholt --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 8e62bd893ee..56095baa7e8 100644 --- a/configure.ac +++ b/configure.ac @@ -1543,6 +1543,9 @@ if test "x$enable_egl" = xyes; then if test "$enable_static" != yes; then if test "x$enable_dri" = xyes; then HAVE_EGL_DRIVER_DRI2=1 + if test "x$enable_shared_glapi" = xno; then + AC_MSG_ERROR([egl_dri2 requires --enable-shared-glapi]) + fi else # Avoid building an "empty" libEGL. Drop/update this # when other backends (haiku?) come along. -- cgit v1.2.3 From 6ed52f78a05a2b56eb521c50767b7a991df51564 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Fri, 19 Jun 2015 17:48:30 +0100 Subject: configure: drop unused variable GBM_BACKEND_DIRS Signed-off-by: Emil Velikov Reviewed-by: Eric Anholt --- configure.ac | 1 - 1 file changed, 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 56095baa7e8..ddc757e1629 100644 --- a/configure.ac +++ b/configure.ac @@ -1507,7 +1507,6 @@ if test "x$enable_gbm" = xyes; then fi if test "x$enable_dri" = xyes; then - GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri" if test "x$enable_shared_glapi" = xno; then AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi]) fi -- cgit v1.2.3