Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4357 → Rev 4358

/contrib/sdk/sources/Mesa/src/egl/drivers/glx/Makefile.am
0,0 → 1,34
# Copyright © 2012 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 (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.
 
AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/egl/main \
$(VISIBILITY_CFLAGS) \
$(X11_CFLAGS) \
$(DEFINES)
 
noinst_LTLIBRARIES = libegl_glx.la
 
libegl_glx_la_SOURCES = egl_glx.c
 
libegl_glx_la_LIBADD = \
$(EGL_LIB_DEPS)
/contrib/sdk/sources/Mesa/src/egl/drivers/glx/Makefile.in
0,0 → 1,775
# Makefile.in generated by automake 1.14 from Makefile.am.
# @configure_input@
 
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
 
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
 
@SET_MAKE@
 
# Copyright © 2012 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 (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.
 
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = src/egl/drivers/glx
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/bin/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_prog_bison.m4 \
$(top_srcdir)/m4/ax_prog_cc_for_build.m4 \
$(top_srcdir)/m4/ax_prog_cxx_for_build.m4 \
$(top_srcdir)/m4/ax_prog_flex.m4 \
$(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/ax_python_module.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
libegl_glx_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_libegl_glx_la_OBJECTS = egl_glx.lo
libegl_glx_la_OBJECTS = $(am_libegl_glx_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libegl_glx_la_SOURCES)
DIST_SOURCES = $(libegl_glx_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_EXEEXT = @BUILD_EXEEXT@
BUILD_OBJEXT = @BUILD_OBJEXT@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS = @CFLAGS@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CLANG_RESOURCE_DIR = @CLANG_RESOURCE_DIR@
CLOCK_LIB = @CLOCK_LIB@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
CPP_FOR_BUILD = @CPP_FOR_BUILD@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXCPPFLAGS_FOR_BUILD = @CXXCPPFLAGS_FOR_BUILD@
CXXCPP_FOR_BUILD = @CXXCPP_FOR_BUILD@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
CXX_FOR_BUILD = @CXX_FOR_BUILD@
CYGPATH_W = @CYGPATH_W@
DEFINES = @DEFINES@
DEFINES_FOR_BUILD = @DEFINES_FOR_BUILD@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DLOPEN_LIBS = @DLOPEN_LIBS@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
DRIGL_CFLAGS = @DRIGL_CFLAGS@
DRIGL_LIBS = @DRIGL_LIBS@
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@
DRI_LIB_DEPS = @DRI_LIB_DEPS@
DRI_PC_REQ_PRIV = @DRI_PC_REQ_PRIV@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGL_CFLAGS = @EGL_CFLAGS@
EGL_CLIENT_APIS = @EGL_CLIENT_APIS@
EGL_DRIVER_INSTALL_DIR = @EGL_DRIVER_INSTALL_DIR@
EGL_LIB_DEPS = @EGL_LIB_DEPS@
EGL_LIB_GLOB = @EGL_LIB_GLOB@
EGL_LIB_NAME = @EGL_LIB_NAME@
EGL_NATIVE_PLATFORM = @EGL_NATIVE_PLATFORM@
EGL_PLATFORMS = @EGL_PLATFORMS@
EGREP = @EGREP@
ELF_LIB = @ELF_LIB@
EXEEXT = @EXEEXT@
EXPAT_INCLUDES = @EXPAT_INCLUDES@
FGREP = @FGREP@
FREEDRENO_CFLAGS = @FREEDRENO_CFLAGS@
FREEDRENO_LIBS = @FREEDRENO_LIBS@
GALLIUM_DRI_LIB_DEPS = @GALLIUM_DRI_LIB_DEPS@
GALLIUM_PIPE_LOADER_DEFINES = @GALLIUM_PIPE_LOADER_DEFINES@
GALLIUM_PIPE_LOADER_LIBS = @GALLIUM_PIPE_LOADER_LIBS@
GALLIUM_PIPE_LOADER_XCB_CFLAGS = @GALLIUM_PIPE_LOADER_XCB_CFLAGS@
GALLIUM_PIPE_LOADER_XCB_LIBS = @GALLIUM_PIPE_LOADER_XCB_LIBS@
GBM_PC_LIB_PRIV = @GBM_PC_LIB_PRIV@
GBM_PC_REQ_PRIV = @GBM_PC_REQ_PRIV@
GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@
GLAPI_LIB_NAME = @GLAPI_LIB_NAME@
GLESv1_CM_LIB_DEPS = @GLESv1_CM_LIB_DEPS@
GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@
GLESv1_CM_PC_LIB_PRIV = @GLESv1_CM_PC_LIB_PRIV@
GLESv2_LIB_DEPS = @GLESv2_LIB_DEPS@
GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
GLESv2_LIB_NAME = @GLESv2_LIB_NAME@
GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@
GLPROTO_CFLAGS = @GLPROTO_CFLAGS@
GLPROTO_LIBS = @GLPROTO_LIBS@
GLX_TLS = @GLX_TLS@
GL_LIB = @GL_LIB@
GL_LIB_DEPS = @GL_LIB_DEPS@
GL_LIB_GLOB = @GL_LIB_GLOB@
GL_LIB_NAME = @GL_LIB_NAME@
GL_PC_CFLAGS = @GL_PC_CFLAGS@
GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
GREP = @GREP@
HAVE_XF86VIDMODE = @HAVE_XF86VIDMODE@
INDENT = @INDENT@
INDENT_FLAGS = @INDENT_FLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTEL_CFLAGS = @INTEL_CFLAGS@
INTEL_LIBS = @INTEL_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBCLC_INCLUDEDIR = @LIBCLC_INCLUDEDIR@
LIBCLC_LIBEXECDIR = @LIBCLC_LIBEXECDIR@
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
LIBDRM_LIBS = @LIBDRM_LIBS@
LIBDRM_XORG_CFLAGS = @LIBDRM_XORG_CFLAGS@
LIBDRM_XORG_LIBS = @LIBDRM_XORG_LIBS@
LIBKMS_XORG_CFLAGS = @LIBKMS_XORG_CFLAGS@
LIBKMS_XORG_LIBS = @LIBKMS_XORG_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@
LIBUDEV_LIBS = @LIBUDEV_LIBS@
LIB_DIR = @LIB_DIR@
LIPO = @LIPO@
LLVM_BINDIR = @LLVM_BINDIR@
LLVM_CFLAGS = @LLVM_CFLAGS@
LLVM_CONFIG = @LLVM_CONFIG@
LLVM_CPPFLAGS = @LLVM_CPPFLAGS@
LLVM_CXXFLAGS = @LLVM_CXXFLAGS@
LLVM_INCLUDEDIR = @LLVM_INCLUDEDIR@
LLVM_LDFLAGS = @LLVM_LDFLAGS@
LLVM_LIBDIR = @LLVM_LIBDIR@
LLVM_LIBS = @LLVM_LIBS@
LLVM_VERSION = @LLVM_VERSION@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MESA_LLVM = @MESA_LLVM@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
NOUVEAU_CFLAGS = @NOUVEAU_CFLAGS@
NOUVEAU_LIBS = @NOUVEAU_LIBS@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPENCL_LIB_INSTALL_DIR = @OPENCL_LIB_INSTALL_DIR@
OSMESA_LIB = @OSMESA_LIB@
OSMESA_LIB_DEPS = @OSMESA_LIB_DEPS@
OSMESA_LIB_NAME = @OSMESA_LIB_NAME@
OSMESA_MESA_DEPS = @OSMESA_MESA_DEPS@
OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@
OSMESA_PC_REQ = @OSMESA_PC_REQ@
OSMESA_VERSION = @OSMESA_VERSION@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POSIX_SHELL = @POSIX_SHELL@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
PYTHON2 = @PYTHON2@
RADEON_CFLAGS = @RADEON_CFLAGS@
RADEON_LIBS = @RADEON_LIBS@
RANLIB = @RANLIB@
SED = @SED@
SELINUX_LIBS = @SELINUX_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VDPAU_CFLAGS = @VDPAU_CFLAGS@
VDPAU_LIBS = @VDPAU_LIBS@
VDPAU_LIB_INSTALL_DIR = @VDPAU_LIB_INSTALL_DIR@
VDPAU_MAJOR = @VDPAU_MAJOR@
VDPAU_MINOR = @VDPAU_MINOR@
VERSION = @VERSION@
VG_LIB_DEPS = @VG_LIB_DEPS@
VG_LIB_GLOB = @VG_LIB_GLOB@
VG_LIB_NAME = @VG_LIB_NAME@
VG_PC_LIB_PRIV = @VG_PC_LIB_PRIV@
VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
VISIBILITY_CXXFLAGS = @VISIBILITY_CXXFLAGS@
WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
WAYLAND_LIBS = @WAYLAND_LIBS@
WAYLAND_SCANNER = @WAYLAND_SCANNER@
X11_INCLUDES = @X11_INCLUDES@
XA_MAJOR = @XA_MAJOR@
XA_MINOR = @XA_MINOR@
XA_TINY = @XA_TINY@
XA_VERSION = @XA_VERSION@
XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@
XCB_DRI2_LIBS = @XCB_DRI2_LIBS@
XEXT_CFLAGS = @XEXT_CFLAGS@
XEXT_LIBS = @XEXT_LIBS@
XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
XLIBGL_CFLAGS = @XLIBGL_CFLAGS@
XLIBGL_LIBS = @XLIBGL_LIBS@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@
XORG_LIBS = @XORG_LIBS@
XVMC_CFLAGS = @XVMC_CFLAGS@
XVMC_LIBS = @XVMC_LIBS@
XVMC_LIB_INSTALL_DIR = @XVMC_LIB_INSTALL_DIR@
XVMC_MAJOR = @XVMC_MAJOR@
XVMC_MINOR = @XVMC_MINOR@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CC_FOR_BUILD = @ac_ct_CC_FOR_BUILD@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_CXX_FOR_BUILD = @ac_ct_CXX_FOR_BUILD@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/egl/main \
$(VISIBILITY_CFLAGS) \
$(X11_CFLAGS) \
$(DEFINES)
 
noinst_LTLIBRARIES = libegl_glx.la
libegl_glx_la_SOURCES = egl_glx.c
libegl_glx_la_LIBADD = \
$(EGL_LIB_DEPS)
 
all: all-am
 
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/egl/drivers/glx/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/egl/drivers/glx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
 
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
 
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
 
libegl_glx.la: $(libegl_glx_la_OBJECTS) $(libegl_glx_la_DEPENDENCIES) $(EXTRA_libegl_glx_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(libegl_glx_la_OBJECTS) $(libegl_glx_la_LIBADD) $(LIBS)
 
mostlyclean-compile:
-rm -f *.$(OBJEXT)
 
distclean-compile:
-rm -f *.tab.c
 
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egl_glx.Plo@am__quote@
 
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
 
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
mostlyclean-libtool:
-rm -f *.lo
 
clean-libtool:
-rm -rf .libs _libs
 
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
 
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
 
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
 
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
 
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
 
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
 
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
 
clean-generic:
 
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
 
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
 
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
 
dvi: dvi-am
 
dvi-am:
 
html: html-am
 
html-am:
 
info: info-am
 
info-am:
 
install-data-am:
 
install-dvi: install-dvi-am
 
install-dvi-am:
 
install-exec-am:
 
install-html: install-html-am
 
install-html-am:
 
install-info: install-info-am
 
install-info-am:
 
install-man:
 
install-pdf: install-pdf-am
 
install-pdf-am:
 
install-ps: install-ps-am
 
install-ps-am:
 
installcheck-am:
 
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
 
mostlyclean: mostlyclean-am
 
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
 
pdf: pdf-am
 
pdf-am:
 
ps: ps-am
 
ps-am:
 
uninstall-am:
 
.MAKE: install-am install-strip
 
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
 
 
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
/contrib/sdk/sources/Mesa/src/egl/drivers/glx/egl_glx.c
0,0 → 1,1182
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
* Copyright 2010-2011 LunarG, Inc.
* All Rights Reserved.
*
* 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, sub license, 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.
*
**************************************************************************/
 
 
/**
* This is an EGL driver that wraps GLX. This gives the benefit of being
* completely agnostic of the direct rendering implementation.
*
* Authors: Alan Hourihane <alanh@tungstengraphics.com>
*/
 
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <dlfcn.h>
#include "GL/glx.h"
 
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldefines.h"
#include "egldisplay.h"
#include "egldriver.h"
#include "eglcurrent.h"
#include "egllog.h"
#include "eglsurface.h"
 
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
 
#ifndef GLX_VERSION_1_4
#error "GL/glx.h must be equal to or greater than GLX 1.4"
#endif
 
/* GLX 1.0 */
typedef GLXContext (*GLXCREATECONTEXTPROC)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
typedef void (*GLXDESTROYCONTEXTPROC)( Display *dpy, GLXContext ctx );
typedef Bool (*GLXMAKECURRENTPROC)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
typedef void (*GLXSWAPBUFFERSPROC)( Display *dpy, GLXDrawable drawable );
typedef GLXPixmap (*GLXCREATEGLXPIXMAPPROC)( Display *dpy, XVisualInfo *visual, Pixmap pixmap );
typedef void (*GLXDESTROYGLXPIXMAPPROC)( Display *dpy, GLXPixmap pixmap );
typedef Bool (*GLXQUERYVERSIONPROC)( Display *dpy, int *maj, int *min );
typedef int (*GLXGETCONFIGPROC)( Display *dpy, XVisualInfo *visual, int attrib, int *value );
typedef void (*GLXWAITGLPROC)( void );
typedef void (*GLXWAITXPROC)( void );
 
/* GLX 1.1 */
typedef const char *(*GLXQUERYEXTENSIONSSTRINGPROC)( Display *dpy, int screen );
typedef const char *(*GLXQUERYSERVERSTRINGPROC)( Display *dpy, int screen, int name );
typedef const char *(*GLXGETCLIENTSTRINGPROC)( Display *dpy, int name );
 
/** subclass of _EGLDriver */
struct GLX_egl_driver
{
_EGLDriver Base; /**< base class */
 
void *handle;
 
/* GLX 1.0 */
GLXCREATECONTEXTPROC glXCreateContext;
GLXDESTROYCONTEXTPROC glXDestroyContext;
GLXMAKECURRENTPROC glXMakeCurrent;
GLXSWAPBUFFERSPROC glXSwapBuffers;
GLXCREATEGLXPIXMAPPROC glXCreateGLXPixmap;
GLXDESTROYGLXPIXMAPPROC glXDestroyGLXPixmap;
GLXQUERYVERSIONPROC glXQueryVersion;
GLXGETCONFIGPROC glXGetConfig;
GLXWAITGLPROC glXWaitGL;
GLXWAITXPROC glXWaitX;
 
/* GLX 1.1 */
GLXQUERYEXTENSIONSSTRINGPROC glXQueryExtensionsString;
GLXQUERYSERVERSTRINGPROC glXQueryServerString;
GLXGETCLIENTSTRINGPROC glXGetClientString;
 
/* GLX 1.3 or (GLX_SGI_make_current_read and GLX_SGIX_fbconfig) */
PFNGLXGETFBCONFIGSPROC glXGetFBConfigs;
PFNGLXGETFBCONFIGATTRIBPROC glXGetFBConfigAttrib;
PFNGLXGETVISUALFROMFBCONFIGPROC glXGetVisualFromFBConfig;
PFNGLXCREATEWINDOWPROC glXCreateWindow;
PFNGLXDESTROYWINDOWPROC glXDestroyWindow;
PFNGLXCREATEPIXMAPPROC glXCreatePixmap;
PFNGLXDESTROYPIXMAPPROC glXDestroyPixmap;
PFNGLXCREATEPBUFFERPROC glXCreatePbuffer;
PFNGLXDESTROYPBUFFERPROC glXDestroyPbuffer;
PFNGLXCREATENEWCONTEXTPROC glXCreateNewContext;
PFNGLXMAKECONTEXTCURRENTPROC glXMakeContextCurrent;
 
/* GLX 1.4 or GLX_ARB_get_proc_address */
PFNGLXGETPROCADDRESSPROC glXGetProcAddress;
 
/* GLX_SGIX_pbuffer */
PFNGLXCREATEGLXPBUFFERSGIXPROC glXCreateGLXPbufferSGIX;
PFNGLXDESTROYGLXPBUFFERSGIXPROC glXDestroyGLXPbufferSGIX;
};
 
 
/** driver data of _EGLDisplay */
struct GLX_egl_display
{
Display *dpy;
XVisualInfo *visuals;
GLXFBConfig *fbconfigs;
 
int glx_maj, glx_min;
 
const char *extensions;
EGLBoolean have_1_3;
EGLBoolean have_make_current_read;
EGLBoolean have_fbconfig;
EGLBoolean have_pbuffer;
 
/* workaround quirks of different GLX implementations */
EGLBoolean single_buffered_quirk;
EGLBoolean glx_window_quirk;
};
 
 
/** subclass of _EGLContext */
struct GLX_egl_context
{
_EGLContext Base; /**< base class */
 
GLXContext context;
};
 
 
/** subclass of _EGLSurface */
struct GLX_egl_surface
{
_EGLSurface Base; /**< base class */
 
Drawable drawable;
GLXDrawable glx_drawable;
 
void (*destroy)(Display *, GLXDrawable);
};
 
 
/** subclass of _EGLConfig */
struct GLX_egl_config
{
_EGLConfig Base; /**< base class */
EGLBoolean double_buffered;
int index;
};
 
/* standard typecasts */
_EGL_DRIVER_STANDARD_TYPECASTS(GLX_egl)
 
static int
GLX_egl_config_index(_EGLConfig *conf)
{
struct GLX_egl_config *GLX_conf = GLX_egl_config(conf);
return GLX_conf->index;
}
 
 
static const struct {
int attr;
int egl_attr;
} fbconfig_attributes[] = {
/* table 3.1 of GLX 1.4 */
{ GLX_FBCONFIG_ID, 0 },
{ GLX_BUFFER_SIZE, EGL_BUFFER_SIZE },
{ GLX_LEVEL, EGL_LEVEL },
{ GLX_DOUBLEBUFFER, 0 },
{ GLX_STEREO, 0 },
{ GLX_AUX_BUFFERS, 0 },
{ GLX_RED_SIZE, EGL_RED_SIZE },
{ GLX_GREEN_SIZE, EGL_GREEN_SIZE },
{ GLX_BLUE_SIZE, EGL_BLUE_SIZE },
{ GLX_ALPHA_SIZE, EGL_ALPHA_SIZE },
{ GLX_DEPTH_SIZE, EGL_DEPTH_SIZE },
{ GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
{ GLX_ACCUM_RED_SIZE, 0 },
{ GLX_ACCUM_GREEN_SIZE, 0 },
{ GLX_ACCUM_BLUE_SIZE, 0 },
{ GLX_ACCUM_ALPHA_SIZE, 0 },
{ GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS },
{ GLX_SAMPLES, EGL_SAMPLES },
{ GLX_RENDER_TYPE, 0 },
{ GLX_DRAWABLE_TYPE, EGL_SURFACE_TYPE },
{ GLX_X_RENDERABLE, EGL_NATIVE_RENDERABLE },
{ GLX_X_VISUAL_TYPE, EGL_NATIVE_VISUAL_TYPE },
{ GLX_CONFIG_CAVEAT, EGL_CONFIG_CAVEAT },
{ GLX_TRANSPARENT_TYPE, EGL_TRANSPARENT_TYPE },
{ GLX_TRANSPARENT_INDEX_VALUE, 0 },
{ GLX_TRANSPARENT_RED_VALUE, EGL_TRANSPARENT_RED_VALUE },
{ GLX_TRANSPARENT_GREEN_VALUE, EGL_TRANSPARENT_GREEN_VALUE },
{ GLX_TRANSPARENT_BLUE_VALUE, EGL_TRANSPARENT_BLUE_VALUE },
{ GLX_MAX_PBUFFER_WIDTH, EGL_MAX_PBUFFER_WIDTH },
{ GLX_MAX_PBUFFER_HEIGHT, EGL_MAX_PBUFFER_HEIGHT },
{ GLX_MAX_PBUFFER_PIXELS, EGL_MAX_PBUFFER_PIXELS },
{ GLX_VISUAL_ID, EGL_NATIVE_VISUAL_ID }
};
 
 
static EGLBoolean
convert_fbconfig(struct GLX_egl_driver *GLX_drv,
struct GLX_egl_display *GLX_dpy, GLXFBConfig fbconfig,
struct GLX_egl_config *GLX_conf)
{
Display *dpy = GLX_dpy->dpy;
int err, attr, val;
unsigned i;
 
/* must have rgba bit */
err = GLX_drv->glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &val);
if (err || !(val & GLX_RGBA_BIT))
return EGL_FALSE;
 
/* must know whether it is double-buffered */
err = GLX_drv->glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &val);
if (err)
return EGL_FALSE;
GLX_conf->double_buffered = val;
 
GLX_conf->Base.RenderableType = EGL_OPENGL_BIT;
GLX_conf->Base.Conformant = EGL_OPENGL_BIT;
 
for (i = 0; i < ARRAY_SIZE(fbconfig_attributes); i++) {
EGLint egl_attr, egl_val;
 
attr = fbconfig_attributes[i].attr;
egl_attr = fbconfig_attributes[i].egl_attr;
if (!egl_attr)
continue;
 
err = GLX_drv->glXGetFBConfigAttrib(dpy, fbconfig, attr, &val);
if (err) {
if (err == GLX_BAD_ATTRIBUTE) {
err = 0;
continue;
}
break;
}
 
switch (egl_attr) {
case EGL_SURFACE_TYPE:
egl_val = 0;
if (val & GLX_WINDOW_BIT)
egl_val |= EGL_WINDOW_BIT;
/* pixmap and pbuffer surfaces must be single-buffered in EGL */
if (!GLX_conf->double_buffered) {
if (val & GLX_PIXMAP_BIT)
egl_val |= EGL_PIXMAP_BIT;
if (val & GLX_PBUFFER_BIT)
egl_val |= EGL_PBUFFER_BIT;
}
break;
case EGL_NATIVE_VISUAL_TYPE:
switch (val) {
case GLX_TRUE_COLOR:
egl_val = TrueColor;
break;
case GLX_DIRECT_COLOR:
egl_val = DirectColor;
break;
case GLX_PSEUDO_COLOR:
egl_val = PseudoColor;
break;
case GLX_STATIC_COLOR:
egl_val = StaticColor;
break;
case GLX_GRAY_SCALE:
egl_val = GrayScale;
break;
case GLX_STATIC_GRAY:
egl_val = StaticGray;
break;
default:
egl_val = EGL_NONE;
break;
}
break;
case EGL_CONFIG_CAVEAT:
egl_val = EGL_NONE;
if (val == GLX_SLOW_CONFIG) {
egl_val = EGL_SLOW_CONFIG;
}
else if (val == GLX_NON_CONFORMANT_CONFIG) {
GLX_conf->Base.Conformant &= ~EGL_OPENGL_BIT;
egl_val = EGL_NONE;
}
break;
case EGL_TRANSPARENT_TYPE:
egl_val = (val == GLX_TRANSPARENT_RGB) ?
EGL_TRANSPARENT_RGB : EGL_NONE;
break;
default:
egl_val = val;
break;
}
 
_eglSetConfigKey(&GLX_conf->Base, egl_attr, egl_val);
}
if (err)
return EGL_FALSE;
 
if (!GLX_conf->Base.SurfaceType)
return EGL_FALSE;
 
return EGL_TRUE;
}
 
static const struct {
int attr;
int egl_attr;
} visual_attributes[] = {
/* table 3.7 of GLX 1.4 */
{ GLX_USE_GL, 0 },
{ GLX_BUFFER_SIZE, EGL_BUFFER_SIZE },
{ GLX_LEVEL, EGL_LEVEL },
{ GLX_RGBA, 0 },
{ GLX_DOUBLEBUFFER, 0 },
{ GLX_STEREO, 0 },
{ GLX_AUX_BUFFERS, 0 },
{ GLX_RED_SIZE, EGL_RED_SIZE },
{ GLX_GREEN_SIZE, EGL_GREEN_SIZE },
{ GLX_BLUE_SIZE, EGL_BLUE_SIZE },
{ GLX_ALPHA_SIZE, EGL_ALPHA_SIZE },
{ GLX_DEPTH_SIZE, EGL_DEPTH_SIZE },
{ GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
{ GLX_ACCUM_RED_SIZE, 0 },
{ GLX_ACCUM_GREEN_SIZE, 0 },
{ GLX_ACCUM_BLUE_SIZE, 0 },
{ GLX_ACCUM_ALPHA_SIZE, 0 },
{ GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS },
{ GLX_SAMPLES, EGL_SAMPLES },
{ GLX_FBCONFIG_ID, 0 },
/* GLX_EXT_visual_rating */
{ GLX_VISUAL_CAVEAT_EXT, EGL_CONFIG_CAVEAT }
};
 
static EGLBoolean
convert_visual(struct GLX_egl_driver *GLX_drv,
struct GLX_egl_display *GLX_dpy, XVisualInfo *vinfo,
struct GLX_egl_config *GLX_conf)
{
Display *dpy = GLX_dpy->dpy;
int err, attr, val;
unsigned i;
 
/* the visual must support OpenGL and RGBA buffer */
err = GLX_drv->glXGetConfig(dpy, vinfo, GLX_USE_GL, &val);
if (!err && val)
err = GLX_drv->glXGetConfig(dpy, vinfo, GLX_RGBA, &val);
if (err || !val)
return EGL_FALSE;
 
/* must know whether it is double-buffered */
err = GLX_drv->glXGetConfig(dpy, vinfo, GLX_DOUBLEBUFFER, &val);
if (err)
return EGL_FALSE;
GLX_conf->double_buffered = val;
 
GLX_conf->Base.RenderableType = EGL_OPENGL_BIT;
GLX_conf->Base.Conformant = EGL_OPENGL_BIT;
GLX_conf->Base.SurfaceType = EGL_WINDOW_BIT;
/* pixmap surfaces must be single-buffered in EGL */
if (!GLX_conf->double_buffered)
GLX_conf->Base.SurfaceType |= EGL_PIXMAP_BIT;
 
GLX_conf->Base.NativeVisualID = vinfo->visualid;
GLX_conf->Base.NativeVisualType = vinfo->class;
GLX_conf->Base.NativeRenderable = EGL_TRUE;
 
for (i = 0; i < ARRAY_SIZE(visual_attributes); i++) {
EGLint egl_attr, egl_val;
 
attr = visual_attributes[i].attr;
egl_attr = visual_attributes[i].egl_attr;
if (!egl_attr)
continue;
 
err = GLX_drv->glXGetConfig(dpy, vinfo, attr, &val);
if (err) {
if (err == GLX_BAD_ATTRIBUTE) {
err = 0;
continue;
}
break;
}
 
switch (egl_attr) {
case EGL_CONFIG_CAVEAT:
egl_val = EGL_NONE;
if (val == GLX_SLOW_VISUAL_EXT) {
egl_val = EGL_SLOW_CONFIG;
}
else if (val == GLX_NON_CONFORMANT_VISUAL_EXT) {
GLX_conf->Base.Conformant &= ~EGL_OPENGL_BIT;
egl_val = EGL_NONE;
}
break;
break;
default:
egl_val = val;
break;
}
_eglSetConfigKey(&GLX_conf->Base, egl_attr, egl_val);
}
 
return (err) ? EGL_FALSE : EGL_TRUE;
}
 
 
static void
fix_config(struct GLX_egl_display *GLX_dpy, struct GLX_egl_config *GLX_conf)
{
_EGLConfig *conf = &GLX_conf->Base;
 
if (!GLX_conf->double_buffered && GLX_dpy->single_buffered_quirk) {
/* some GLX impls do not like single-buffered window surface */
conf->SurfaceType &= ~EGL_WINDOW_BIT;
/* pbuffer bit is usually not set */
if (GLX_dpy->have_pbuffer)
conf->SurfaceType |= EGL_PBUFFER_BIT;
}
 
/* no visual attribs unless window bit is set */
if (!(conf->SurfaceType & EGL_WINDOW_BIT)) {
conf->NativeVisualID = 0;
conf->NativeVisualType = EGL_NONE;
}
 
if (conf->TransparentType != EGL_TRANSPARENT_RGB) {
/* some impls set them to -1 (GLX_DONT_CARE) */
conf->TransparentRedValue = 0;
conf->TransparentGreenValue = 0;
conf->TransparentBlueValue = 0;
}
 
/* make sure buffer size is set correctly */
conf->BufferSize =
conf->RedSize + conf->GreenSize + conf->BlueSize + conf->AlphaSize;
}
 
 
static EGLBoolean
create_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint screen)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy = GLX_egl_display(dpy);
EGLint num_configs = 0, i;
EGLint id = 1;
 
if (GLX_dpy->have_fbconfig) {
GLX_dpy->fbconfigs =
GLX_drv->glXGetFBConfigs(GLX_dpy->dpy, screen, &num_configs);
}
else {
XVisualInfo vinfo_template;
long mask;
 
vinfo_template.screen = screen;
mask = VisualScreenMask;
GLX_dpy->visuals = XGetVisualInfo(GLX_dpy->dpy, mask, &vinfo_template,
&num_configs);
}
 
if (!num_configs)
return EGL_FALSE;
 
for (i = 0; i < num_configs; i++) {
struct GLX_egl_config *GLX_conf, template;
EGLBoolean ok;
 
memset(&template, 0, sizeof(template));
_eglInitConfig(&template.Base, dpy, id);
if (GLX_dpy->have_fbconfig) {
ok = convert_fbconfig(GLX_drv, GLX_dpy,
GLX_dpy->fbconfigs[i], &template);
}
else {
ok = convert_visual(GLX_drv, GLX_dpy,
&GLX_dpy->visuals[i], &template);
}
if (!ok)
continue;
 
fix_config(GLX_dpy, &template);
if (!_eglValidateConfig(&template.Base, EGL_FALSE)) {
_eglLog(_EGL_DEBUG, "GLX: failed to validate config %d", i);
continue;
}
 
GLX_conf = CALLOC_STRUCT(GLX_egl_config);
if (GLX_conf) {
memcpy(GLX_conf, &template, sizeof(template));
GLX_conf->index = i;
 
_eglLinkConfig(&GLX_conf->Base);
id++;
}
}
 
return EGL_TRUE;
}
 
 
static void
check_extensions(struct GLX_egl_driver *GLX_drv,
struct GLX_egl_display *GLX_dpy, EGLint screen)
{
GLX_dpy->extensions =
GLX_drv->glXQueryExtensionsString(GLX_dpy->dpy, screen);
if (GLX_dpy->extensions) {
if (strstr(GLX_dpy->extensions, "GLX_SGI_make_current_read")) {
/* GLX 1.3 entry points are used */
GLX_dpy->have_make_current_read = EGL_TRUE;
}
 
if (strstr(GLX_dpy->extensions, "GLX_SGIX_fbconfig")) {
/* GLX 1.3 entry points are used */
GLX_dpy->have_fbconfig = EGL_TRUE;
}
 
if (strstr(GLX_dpy->extensions, "GLX_SGIX_pbuffer")) {
if (GLX_drv->glXCreateGLXPbufferSGIX &&
GLX_drv->glXDestroyGLXPbufferSGIX &&
GLX_dpy->have_fbconfig)
GLX_dpy->have_pbuffer = EGL_TRUE;
}
}
 
if (GLX_dpy->glx_maj == 1 && GLX_dpy->glx_min >= 3) {
GLX_dpy->have_1_3 = EGL_TRUE;
GLX_dpy->have_make_current_read = EGL_TRUE;
GLX_dpy->have_fbconfig = EGL_TRUE;
GLX_dpy->have_pbuffer = EGL_TRUE;
}
}
 
 
static void
check_quirks(struct GLX_egl_driver *GLX_drv,
struct GLX_egl_display *GLX_dpy, EGLint screen)
{
const char *vendor;
 
GLX_dpy->single_buffered_quirk = EGL_TRUE;
GLX_dpy->glx_window_quirk = EGL_TRUE;
 
vendor = GLX_drv->glXGetClientString(GLX_dpy->dpy, GLX_VENDOR);
if (vendor && strstr(vendor, "NVIDIA")) {
vendor = GLX_drv->glXQueryServerString(GLX_dpy->dpy, screen, GLX_VENDOR);
if (vendor && strstr(vendor, "NVIDIA")) {
_eglLog(_EGL_DEBUG, "disable quirks");
GLX_dpy->single_buffered_quirk = EGL_FALSE;
GLX_dpy->glx_window_quirk = EGL_FALSE;
}
}
}
 
 
/**
* Called via eglInitialize(), GLX_drv->API.Initialize().
*/
static EGLBoolean
GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy;
 
if (disp->Platform != _EGL_PLATFORM_X11)
return EGL_FALSE;
 
/* this is a fallback driver */
if (!disp->Options.UseFallback)
return EGL_FALSE;
 
if (disp->Options.TestOnly)
return EGL_TRUE;
 
GLX_dpy = CALLOC_STRUCT(GLX_egl_display);
if (!GLX_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
 
GLX_dpy->dpy = (Display *) disp->PlatformDisplay;
if (!GLX_dpy->dpy) {
GLX_dpy->dpy = XOpenDisplay(NULL);
if (!GLX_dpy->dpy) {
_eglLog(_EGL_WARNING, "GLX: XOpenDisplay failed");
free(GLX_dpy);
return EGL_FALSE;
}
}
 
if (!GLX_drv->glXQueryVersion(GLX_dpy->dpy,
&GLX_dpy->glx_maj, &GLX_dpy->glx_min)) {
_eglLog(_EGL_WARNING, "GLX: glXQueryVersion failed");
if (!disp->PlatformDisplay)
XCloseDisplay(GLX_dpy->dpy);
free(GLX_dpy);
return EGL_FALSE;
}
 
disp->DriverData = (void *) GLX_dpy;
disp->ClientAPIs = EGL_OPENGL_BIT;
 
check_extensions(GLX_drv, GLX_dpy, DefaultScreen(GLX_dpy->dpy));
check_quirks(GLX_drv, GLX_dpy, DefaultScreen(GLX_dpy->dpy));
 
create_configs(drv, disp, DefaultScreen(GLX_dpy->dpy));
if (!_eglGetArraySize(disp->Configs)) {
_eglLog(_EGL_WARNING, "GLX: failed to create any config");
if (!disp->PlatformDisplay)
XCloseDisplay(GLX_dpy->dpy);
free(GLX_dpy);
return EGL_FALSE;
}
 
/* we're supporting EGL 1.4 */
disp->VersionMajor = 1;
disp->VersionMinor = 4;
 
return EGL_TRUE;
}
 
 
/**
* Called via eglTerminate(), drv->API.Terminate().
*/
static EGLBoolean
GLX_eglTerminate(_EGLDriver *drv, _EGLDisplay *disp)
{
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
 
_eglReleaseDisplayResources(drv, disp);
_eglCleanupDisplay(disp);
 
free(GLX_dpy->visuals);
free(GLX_dpy->fbconfigs);
 
if (!disp->PlatformDisplay)
XCloseDisplay(GLX_dpy->dpy);
free(GLX_dpy);
 
disp->DriverData = NULL;
 
return EGL_TRUE;
}
 
 
/**
* Called via eglCreateContext(), drv->API.CreateContext().
*/
static _EGLContext *
GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
_EGLContext *share_list, const EGLint *attrib_list)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_context *GLX_ctx = CALLOC_STRUCT(GLX_egl_context);
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_context *GLX_ctx_shared = GLX_egl_context(share_list);
 
if (!GLX_ctx) {
_eglError(EGL_BAD_ALLOC, "eglCreateContext");
return NULL;
}
 
if (!_eglInitContext(&GLX_ctx->Base, disp, conf, attrib_list)) {
free(GLX_ctx);
return NULL;
}
 
if (GLX_dpy->have_fbconfig) {
GLX_ctx->context = GLX_drv->glXCreateNewContext(GLX_dpy->dpy,
GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
GLX_RGBA_TYPE,
GLX_ctx_shared ? GLX_ctx_shared->context : NULL,
GL_TRUE);
}
else {
GLX_ctx->context = GLX_drv->glXCreateContext(GLX_dpy->dpy,
&GLX_dpy->visuals[GLX_egl_config_index(conf)],
GLX_ctx_shared ? GLX_ctx_shared->context : NULL,
GL_TRUE);
}
if (!GLX_ctx->context) {
free(GLX_ctx);
return NULL;
}
 
return &GLX_ctx->Base;
}
 
/**
* Called via eglDestroyContext(), drv->API.DestroyContext().
*/
static EGLBoolean
GLX_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_context *GLX_ctx = GLX_egl_context(ctx);
 
if (_eglPutContext(ctx)) {
assert(GLX_ctx);
GLX_drv->glXDestroyContext(GLX_dpy->dpy, GLX_ctx->context);
 
free(GLX_ctx);
}
 
return EGL_TRUE;
}
 
/**
* Destroy a surface. The display is allowed to be uninitialized.
*/
static void
destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
{
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf);
 
if (GLX_surf->destroy)
GLX_surf->destroy(GLX_dpy->dpy, GLX_surf->glx_drawable);
 
free(GLX_surf);
}
 
 
/**
* Called via eglMakeCurrent(), drv->API.MakeCurrent().
*/
static EGLBoolean
GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
_EGLSurface *rsurf, _EGLContext *ctx)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_dsurf = GLX_egl_surface(dsurf);
struct GLX_egl_surface *GLX_rsurf = GLX_egl_surface(rsurf);
struct GLX_egl_context *GLX_ctx = GLX_egl_context(ctx);
_EGLContext *old_ctx;
_EGLSurface *old_dsurf, *old_rsurf;
GLXDrawable ddraw, rdraw;
GLXContext cctx;
EGLBoolean ret = EGL_FALSE;
 
/* make new bindings */
if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf))
return EGL_FALSE;
 
ddraw = (GLX_dsurf) ? GLX_dsurf->glx_drawable : None;
rdraw = (GLX_rsurf) ? GLX_rsurf->glx_drawable : None;
cctx = (GLX_ctx) ? GLX_ctx->context : NULL;
 
if (GLX_dpy->have_make_current_read)
ret = GLX_drv->glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx);
else if (ddraw == rdraw)
ret = GLX_drv->glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
 
if (ret) {
if (_eglPutSurface(old_dsurf))
destroy_surface(disp, old_dsurf);
if (_eglPutSurface(old_rsurf))
destroy_surface(disp, old_rsurf);
/* no destroy? */
_eglPutContext(old_ctx);
}
else {
/* undo the previous _eglBindContext */
_eglBindContext(old_ctx, old_dsurf, old_rsurf, &ctx, &dsurf, &rsurf);
assert(&GLX_ctx->Base == ctx &&
&GLX_dsurf->Base == dsurf &&
&GLX_rsurf->Base == rsurf);
 
_eglPutSurface(dsurf);
_eglPutSurface(rsurf);
_eglPutContext(ctx);
 
_eglPutSurface(old_dsurf);
_eglPutSurface(old_rsurf);
_eglPutContext(old_ctx);
}
 
return ret;
}
 
/** Get size of given window */
static Status
get_drawable_size(Display *dpy, Drawable d, unsigned *width, unsigned *height)
{
Window root;
Status stat;
int xpos, ypos;
unsigned int w, h, bw, depth;
stat = XGetGeometry(dpy, d, &root, &xpos, &ypos, &w, &h, &bw, &depth);
*width = w;
*height = h;
return stat;
}
 
/**
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
static _EGLSurface *
GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, EGLNativeWindowType window,
const EGLint *attrib_list)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf;
unsigned width, height;
 
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf) {
_eglError(EGL_BAD_ALLOC, "eglCreateWindowSurface");
return NULL;
}
 
if (!_eglInitSurface(&GLX_surf->Base, disp, EGL_WINDOW_BIT,
conf, attrib_list)) {
free(GLX_surf);
return NULL;
}
 
GLX_surf->drawable = window;
 
if (GLX_dpy->have_1_3 && !GLX_dpy->glx_window_quirk) {
GLX_surf->glx_drawable = GLX_drv->glXCreateWindow(GLX_dpy->dpy,
GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
GLX_surf->drawable, NULL);
}
else {
GLX_surf->glx_drawable = GLX_surf->drawable;
}
 
if (!GLX_surf->glx_drawable) {
free(GLX_surf);
return NULL;
}
 
if (GLX_dpy->have_1_3 && !GLX_dpy->glx_window_quirk)
GLX_surf->destroy = GLX_drv->glXDestroyWindow;
 
get_drawable_size(GLX_dpy->dpy, window, &width, &height);
GLX_surf->Base.Width = width;
GLX_surf->Base.Height = height;
 
return &GLX_surf->Base;
}
 
static _EGLSurface *
GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, EGLNativePixmapType pixmap,
const EGLint *attrib_list)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf;
unsigned width, height;
 
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf) {
_eglError(EGL_BAD_ALLOC, "eglCreatePixmapSurface");
return NULL;
}
 
if (!_eglInitSurface(&GLX_surf->Base, disp, EGL_PIXMAP_BIT,
conf, attrib_list)) {
free(GLX_surf);
return NULL;
}
 
GLX_surf->drawable = pixmap;
 
if (GLX_dpy->have_1_3) {
GLX_surf->glx_drawable = GLX_drv->glXCreatePixmap(GLX_dpy->dpy,
GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
GLX_surf->drawable, NULL);
}
else if (GLX_dpy->have_fbconfig) {
GLXFBConfig fbconfig = GLX_dpy->fbconfigs[GLX_egl_config_index(conf)];
XVisualInfo *vinfo;
 
vinfo = GLX_drv->glXGetVisualFromFBConfig(GLX_dpy->dpy, fbconfig);
if (vinfo) {
GLX_surf->glx_drawable = GLX_drv->glXCreateGLXPixmap(GLX_dpy->dpy,
vinfo, GLX_surf->drawable);
free(vinfo);
}
}
else {
GLX_surf->glx_drawable = GLX_drv->glXCreateGLXPixmap(GLX_dpy->dpy,
&GLX_dpy->visuals[GLX_egl_config_index(conf)],
GLX_surf->drawable);
}
 
if (!GLX_surf->glx_drawable) {
free(GLX_surf);
return NULL;
}
 
GLX_surf->destroy = (GLX_dpy->have_1_3) ?
GLX_drv->glXDestroyPixmap : GLX_drv->glXDestroyGLXPixmap;
 
get_drawable_size(GLX_dpy->dpy, pixmap, &width, &height);
GLX_surf->Base.Width = width;
GLX_surf->Base.Height = height;
 
return &GLX_surf->Base;
}
 
static _EGLSurface *
GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, const EGLint *attrib_list)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf;
int attribs[5];
int i;
 
GLX_surf = CALLOC_STRUCT(GLX_egl_surface);
if (!GLX_surf) {
_eglError(EGL_BAD_ALLOC, "eglCreatePbufferSurface");
return NULL;
}
 
if (!_eglInitSurface(&GLX_surf->Base, disp, EGL_PBUFFER_BIT,
conf, attrib_list)) {
free(GLX_surf);
return NULL;
}
 
i = 0;
attribs[i] = None;
 
GLX_surf->drawable = None;
 
if (GLX_dpy->have_1_3) {
/* put geometry in attribs */
if (GLX_surf->Base.Width) {
attribs[i++] = GLX_PBUFFER_WIDTH;
attribs[i++] = GLX_surf->Base.Width;
}
if (GLX_surf->Base.Height) {
attribs[i++] = GLX_PBUFFER_HEIGHT;
attribs[i++] = GLX_surf->Base.Height;
}
attribs[i] = None;
 
GLX_surf->glx_drawable = GLX_drv->glXCreatePbuffer(GLX_dpy->dpy,
GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], attribs);
}
else if (GLX_dpy->have_pbuffer) {
GLX_surf->glx_drawable = GLX_drv->glXCreateGLXPbufferSGIX(GLX_dpy->dpy,
GLX_dpy->fbconfigs[GLX_egl_config_index(conf)],
GLX_surf->Base.Width,
GLX_surf->Base.Height,
attribs);
}
 
if (!GLX_surf->glx_drawable) {
free(GLX_surf);
return NULL;
}
 
GLX_surf->destroy = (GLX_dpy->have_1_3) ?
GLX_drv->glXDestroyPbuffer : GLX_drv->glXDestroyGLXPbufferSGIX;
 
return &GLX_surf->Base;
}
 
 
static EGLBoolean
GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
{
(void) drv;
 
if (_eglPutSurface(surf))
destroy_surface(disp, surf);
 
return EGL_TRUE;
}
 
 
static EGLBoolean
GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf = GLX_egl_surface(draw);
 
GLX_drv->glXSwapBuffers(GLX_dpy->dpy, GLX_surf->glx_drawable);
 
return EGL_TRUE;
}
 
/*
* Called from eglGetProcAddress() via drv->API.GetProcAddress().
*/
static _EGLProc
GLX_eglGetProcAddress(_EGLDriver *drv, const char *procname)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
 
return (_EGLProc) GLX_drv->glXGetProcAddress((const GLubyte *) procname);
}
 
static EGLBoolean
GLX_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
 
(void) dpy;
(void) ctx;
 
GLX_drv->glXWaitGL();
return EGL_TRUE;
}
 
static EGLBoolean
GLX_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
 
(void) dpy;
 
if (engine != EGL_CORE_NATIVE_ENGINE)
return _eglError(EGL_BAD_PARAMETER, "eglWaitNative");
GLX_drv->glXWaitX();
return EGL_TRUE;
}
 
static void
GLX_Unload(_EGLDriver *drv)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
 
if (GLX_drv->handle)
dlclose(GLX_drv->handle);
free(GLX_drv);
}
 
 
static EGLBoolean
GLX_Load(_EGLDriver *drv)
{
struct GLX_egl_driver *GLX_drv = GLX_egl_driver(drv);
void *handle = NULL;
 
GLX_drv->glXGetProcAddress = dlsym(RTLD_DEFAULT, "glXGetProcAddress");
if (!GLX_drv->glXGetProcAddress)
GLX_drv->glXGetProcAddress = dlsym(RTLD_DEFAULT, "glXGetProcAddressARB");
if (!GLX_drv->glXGetProcAddress) {
handle = dlopen("libGL.so", RTLD_LAZY | RTLD_LOCAL);
if (!handle)
goto fail;
 
GLX_drv->glXGetProcAddress = dlsym(handle, "glXGetProcAddress");
if (!GLX_drv->glXGetProcAddress)
GLX_drv->glXGetProcAddress = dlsym(handle, "glXGetProcAddressARB");
if (!GLX_drv->glXGetProcAddress)
goto fail;
}
 
#define GET_PROC(proc_type, proc_name, check) \
do { \
GLX_drv->proc_name = (proc_type) \
GLX_drv->glXGetProcAddress((const GLubyte *) #proc_name); \
if (check && !GLX_drv->proc_name) goto fail; \
} while (0)
 
/* GLX 1.0 */
GET_PROC(GLXCREATECONTEXTPROC, glXCreateContext, EGL_TRUE);
GET_PROC(GLXDESTROYCONTEXTPROC, glXDestroyContext, EGL_TRUE);
GET_PROC(GLXMAKECURRENTPROC, glXMakeCurrent, EGL_TRUE);
GET_PROC(GLXSWAPBUFFERSPROC, glXSwapBuffers, EGL_TRUE);
GET_PROC(GLXCREATEGLXPIXMAPPROC, glXCreateGLXPixmap, EGL_TRUE);
GET_PROC(GLXDESTROYGLXPIXMAPPROC, glXDestroyGLXPixmap, EGL_TRUE);
GET_PROC(GLXQUERYVERSIONPROC, glXQueryVersion, EGL_TRUE);
GET_PROC(GLXGETCONFIGPROC, glXGetConfig, EGL_TRUE);
GET_PROC(GLXWAITGLPROC, glXWaitGL, EGL_TRUE);
GET_PROC(GLXWAITXPROC, glXWaitX, EGL_TRUE);
 
/* GLX 1.1 */
GET_PROC(GLXQUERYEXTENSIONSSTRINGPROC, glXQueryExtensionsString, EGL_TRUE);
GET_PROC(GLXQUERYSERVERSTRINGPROC, glXQueryServerString, EGL_TRUE);
GET_PROC(GLXGETCLIENTSTRINGPROC, glXGetClientString, EGL_TRUE);
 
/* GLX 1.3 */
GET_PROC(PFNGLXGETFBCONFIGSPROC, glXGetFBConfigs, EGL_FALSE);
GET_PROC(PFNGLXGETFBCONFIGATTRIBPROC, glXGetFBConfigAttrib, EGL_FALSE);
GET_PROC(PFNGLXGETVISUALFROMFBCONFIGPROC, glXGetVisualFromFBConfig, EGL_FALSE);
GET_PROC(PFNGLXCREATEWINDOWPROC, glXCreateWindow, EGL_FALSE);
GET_PROC(PFNGLXDESTROYWINDOWPROC, glXDestroyWindow, EGL_FALSE);
GET_PROC(PFNGLXCREATEPIXMAPPROC, glXCreatePixmap, EGL_FALSE);
GET_PROC(PFNGLXDESTROYPIXMAPPROC, glXDestroyPixmap, EGL_FALSE);
GET_PROC(PFNGLXCREATEPBUFFERPROC, glXCreatePbuffer, EGL_FALSE);
GET_PROC(PFNGLXDESTROYPBUFFERPROC, glXDestroyPbuffer, EGL_FALSE);
GET_PROC(PFNGLXCREATENEWCONTEXTPROC, glXCreateNewContext, EGL_FALSE);
GET_PROC(PFNGLXMAKECONTEXTCURRENTPROC, glXMakeContextCurrent, EGL_FALSE);
 
/* GLX_SGIX_pbuffer */
GET_PROC(PFNGLXCREATEGLXPBUFFERSGIXPROC,
glXCreateGLXPbufferSGIX, EGL_FALSE);
GET_PROC(PFNGLXDESTROYGLXPBUFFERSGIXPROC,
glXDestroyGLXPbufferSGIX, EGL_FALSE);
#undef GET_PROC
 
GLX_drv->handle = handle;
 
return EGL_TRUE;
 
fail:
if (handle)
dlclose(handle);
return EGL_FALSE;
}
 
 
/**
* This is the main entrypoint into the driver, called by libEGL.
* Create a new _EGLDriver object and init its dispatch table.
*/
_EGLDriver *
_eglBuiltInDriverGLX(const char *args)
{
struct GLX_egl_driver *GLX_drv = CALLOC_STRUCT(GLX_egl_driver);
 
(void) args;
 
if (!GLX_drv)
return NULL;
 
if (!GLX_Load(&GLX_drv->Base)) {
_eglLog(_EGL_WARNING, "GLX: failed to load GLX");
free(GLX_drv);
return NULL;
}
 
_eglInitDriverFallbacks(&GLX_drv->Base);
GLX_drv->Base.API.Initialize = GLX_eglInitialize;
GLX_drv->Base.API.Terminate = GLX_eglTerminate;
GLX_drv->Base.API.CreateContext = GLX_eglCreateContext;
GLX_drv->Base.API.DestroyContext = GLX_eglDestroyContext;
GLX_drv->Base.API.MakeCurrent = GLX_eglMakeCurrent;
GLX_drv->Base.API.CreateWindowSurface = GLX_eglCreateWindowSurface;
GLX_drv->Base.API.CreatePixmapSurface = GLX_eglCreatePixmapSurface;
GLX_drv->Base.API.CreatePbufferSurface = GLX_eglCreatePbufferSurface;
GLX_drv->Base.API.DestroySurface = GLX_eglDestroySurface;
GLX_drv->Base.API.SwapBuffers = GLX_eglSwapBuffers;
GLX_drv->Base.API.GetProcAddress = GLX_eglGetProcAddress;
GLX_drv->Base.API.WaitClient = GLX_eglWaitClient;
GLX_drv->Base.API.WaitNative = GLX_eglWaitNative;
 
GLX_drv->Base.Name = "GLX";
GLX_drv->Base.Unload = GLX_Unload;
 
return &GLX_drv->Base;
}