/contrib/sdk/sources/Mesa/src/egl/Makefile.am |
---|
0,0 → 1,24 |
# 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. |
SUBDIRS= |
SUBDIRS += drivers main |
/contrib/sdk/sources/Mesa/src/egl/Makefile.in |
---|
0,0 → 1,796 |
# 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 |
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am |
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 = |
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 = |
SOURCES = |
DIST_SOURCES = |
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ |
ctags-recursive dvi-recursive html-recursive info-recursive \ |
install-data-recursive install-dvi-recursive \ |
install-exec-recursive install-html-recursive \ |
install-info-recursive install-pdf-recursive \ |
install-ps-recursive install-recursive installcheck-recursive \ |
installdirs-recursive pdf-recursive ps-recursive \ |
tags-recursive uninstall-recursive |
am__can_run_installinfo = \ |
case $$AM_UPDATE_INFO_DIR in \ |
n|no|NO) false;; \ |
*) (install-info --version) >/dev/null 2>&1;; \ |
esac |
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ |
distclean-recursive maintainer-clean-recursive |
am__recursive_targets = \ |
$(RECURSIVE_TARGETS) \ |
$(RECURSIVE_CLEAN_TARGETS) \ |
$(am__extra_recursive_targets) |
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ |
distdir |
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 |
DIST_SUBDIRS = $(SUBDIRS) |
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
am__relativize = \ |
dir0=`pwd`; \ |
sed_first='s,^\([^/]*\)/.*$$,\1,'; \ |
sed_rest='s,^[^/]*/*,,'; \ |
sed_last='s,^.*/\([^/]*\)$$,\1,'; \ |
sed_butlast='s,/*[^/]*$$,,'; \ |
while test -n "$$dir1"; do \ |
first=`echo "$$dir1" | sed -e "$$sed_first"`; \ |
if test "$$first" != "."; then \ |
if test "$$first" = ".."; then \ |
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ |
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ |
else \ |
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ |
if test "$$first2" = "$$first"; then \ |
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ |
else \ |
dir2="../$$dir2"; \ |
fi; \ |
dir0="$$dir0"/"$$first"; \ |
fi; \ |
fi; \ |
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ |
done; \ |
reldir="$$dir2" |
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@ |
SUBDIRS = drivers main |
all: all-recursive |
.SUFFIXES: |
$(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/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/egl/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): |
mostlyclean-libtool: |
-rm -f *.lo |
clean-libtool: |
-rm -rf .libs _libs |
# This directory's subdirectories are mostly independent; you can cd |
# into them and run 'make' without going through this Makefile. |
# To change the values of 'make' variables: instead of editing Makefiles, |
# (1) if the variable is set in 'config.status', edit 'config.status' |
# (which will cause the Makefiles to be regenerated when you run 'make'); |
# (2) otherwise, pass the desired values on the 'make' command line. |
$(am__recursive_targets): |
@fail=; \ |
if $(am__make_keepgoing); then \ |
failcom='fail=yes'; \ |
else \ |
failcom='exit 1'; \ |
fi; \ |
dot_seen=no; \ |
target=`echo $@ | sed s/-recursive//`; \ |
case "$@" in \ |
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ |
*) list='$(SUBDIRS)' ;; \ |
esac; \ |
for subdir in $$list; do \ |
echo "Making $$target in $$subdir"; \ |
if test "$$subdir" = "."; then \ |
dot_seen=yes; \ |
local_target="$$target-am"; \ |
else \ |
local_target="$$target"; \ |
fi; \ |
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ |
|| eval $$failcom; \ |
done; \ |
if test "$$dot_seen" = "no"; then \ |
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ |
fi; test -z "$$fail" |
ID: $(am__tagged_files) |
$(am__define_uniq_tagged_files); mkid -fID $$unique |
tags: tags-recursive |
TAGS: tags |
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) |
set x; \ |
here=`pwd`; \ |
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ |
include_option=--etags-include; \ |
empty_fix=.; \ |
else \ |
include_option=--include; \ |
empty_fix=; \ |
fi; \ |
list='$(SUBDIRS)'; for subdir in $$list; do \ |
if test "$$subdir" = .; then :; else \ |
test ! -f $$subdir/TAGS || \ |
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ |
fi; \ |
done; \ |
$(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-recursive |
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-recursive |
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 |
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ |
if test "$$subdir" = .; then :; else \ |
$(am__make_dryrun) \ |
|| test -d "$(distdir)/$$subdir" \ |
|| $(MKDIR_P) "$(distdir)/$$subdir" \ |
|| exit 1; \ |
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ |
$(am__relativize); \ |
new_distdir=$$reldir; \ |
dir1=$$subdir; dir2="$(top_distdir)"; \ |
$(am__relativize); \ |
new_top_distdir=$$reldir; \ |
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ |
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ |
($(am__cd) $$subdir && \ |
$(MAKE) $(AM_MAKEFLAGS) \ |
top_distdir="$$new_top_distdir" \ |
distdir="$$new_distdir" \ |
am__remove_distdir=: \ |
am__skip_length_check=: \ |
am__skip_mode_fix=: \ |
distdir) \ |
|| exit 1; \ |
fi; \ |
done |
check-am: all-am |
check: check-recursive |
all-am: Makefile |
installdirs: installdirs-recursive |
installdirs-am: |
install: install-recursive |
install-exec: install-exec-recursive |
install-data: install-data-recursive |
uninstall: uninstall-recursive |
install-am: all-am |
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am |
installcheck: installcheck-recursive |
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-recursive |
clean-am: clean-generic clean-libtool mostlyclean-am |
distclean: distclean-recursive |
-rm -f Makefile |
distclean-am: clean-am distclean-generic distclean-tags |
dvi: dvi-recursive |
dvi-am: |
html: html-recursive |
html-am: |
info: info-recursive |
info-am: |
install-data-am: |
install-dvi: install-dvi-recursive |
install-dvi-am: |
install-exec-am: |
install-html: install-html-recursive |
install-html-am: |
install-info: install-info-recursive |
install-info-am: |
install-man: |
install-pdf: install-pdf-recursive |
install-pdf-am: |
install-ps: install-ps-recursive |
install-ps-am: |
installcheck-am: |
maintainer-clean: maintainer-clean-recursive |
-rm -f Makefile |
maintainer-clean-am: distclean-am maintainer-clean-generic |
mostlyclean: mostlyclean-recursive |
mostlyclean-am: mostlyclean-generic mostlyclean-libtool |
pdf: pdf-recursive |
pdf-am: |
ps: ps-recursive |
ps-am: |
uninstall-am: |
.MAKE: $(am__recursive_targets) install-am install-strip |
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ |
check-am clean clean-generic clean-libtool cscopelist-am ctags \ |
ctags-am distclean 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 \ |
installdirs-am maintainer-clean maintainer-clean-generic \ |
mostlyclean 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/docs/EGL_MESA_screen_surface |
---|
0,0 → 1,564 |
Name |
MESA_screen_surface |
Name Strings |
EGL_MESA_screen_surface |
Contact |
Brian Paul |
To discuss, join the dri-egl@lists.freedesktop.org list. |
Status |
Obsolete. |
Version |
11 (27 January 2006) |
Number |
TBD |
Dependencies |
EGL 1.0 or later. |
Overview |
EGL 1.1 supports three types of drawing surfaces: |
* Window surfaces |
* Pixmap surfaces |
* Pbuffer surfaces |
This extension defines a fourth type of drawing surface: |
* Screen surface |
A screen surface is a surface for which the (front) color buffer can |
be directly displayed (i.e. scanned out) on a monitor (such as a flat |
panel or CRT). In particular the color buffer memory will be allocated |
at a location in VRAM (and in a suitable format) which can be displayed |
by the graphics hardware. |
Note that the width and height of the screen surface need not exactly |
match the monitor's current resolution. For example, while the monitor |
may be configured to to show 1024x768 pixels, the associated screen |
surface may be larger, such as 1200x1000. The "screen origin" attribute |
will specify which region of the screen surface which is visible on the |
monitor. The screen surface can be scrolled by changing this origin. |
This extension also defines functions for controlling the monitor's |
display mode (width, height, refresh rate, etc), and specifing which |
screen surface is to be displayed on a monitor. |
The new EGLModeMESA type and related functions are very similar to the |
EGLConfig type and related functions. The user may get a list of |
supported modes for a screen and specify the mode to be used when |
displaying a screen surface. |
Issues |
1. Should EGL_INTERLACE be a supported mode attribute? |
Arguments against: |
No, this should be provided by another extension which would |
also provide the mechanisms needed to play back interlaced video |
material correctly on hardware that supports it. |
This extension should prefer non-interlaced modes. [M. Danzer] |
Arguments for: |
An interlaced display can be of use without considering video |
material. Being able to query whether a screen is operating in |
interlaced mode can be used by applications to control their |
drawing. For example: avoid drawing 1-pixel-wide horizontal lines |
if screen is interlaced. [B. Paul] |
Resolution: Defer for future extension? |
2. Should EGL_REFRESH_RATE be a supported mode attribute? |
Arguments for: |
Yes, it's been shown that applications and/or users need to select |
modes by this. [M. Danzer] |
Many examples have been given in which it's desirable to let the |
user choose from a variety of refresh rates without having to |
restart/reconfigure. [B. Paul] |
Arguments against: |
TBD. |
Resolution: Yes. |
3. Exactly how should the list of modes returned by eglChooseConfigMESA |
be sorted? |
Current method is described in the text below. Subject to change. |
Alternately, leave the sorting order undefined so that each |
implementation can return the modes in order of "most desirable" |
to "least desirable" which may depend on the display technology |
(CRT vs LCD, etc) or other factors. |
4. How should screen blanking be supported? Note that a screen can be |
disabled or turned off by calling eglShowSurface(dpy, scrn, |
EGL_NO_SURFACE, EGL_NO_MODE_MESA). But what about power-save mode? |
I would defer this to other extensions that depend on this one. |
I can imagine people wanting different semantics not just in |
relation to the power management API being exposed (DPMS or whatever) |
but also relating to what events can trigger EGL_CONTEXT_LOST. Also |
I'm not sure whether power management commands are properly operations |
on the Display or on a screen surface. [A. Jackson] |
5. Should the EGL_PHYSICAL_SIZE_EGL query be kept? The size information |
isn't always reliable (consider video projectors) but can still be |
used to determine the pixel aspect ratio. |
Resolution: Omit. The EGL 1.2 specification includes queries for |
the display resolution and pixel aspect ratio. |
6. Should detailed mode timing information be exposed by this API? |
Probably not. Instead, offer that information in a layered extension. |
7. How should the notion of a screen's "native" mode be expressed? |
For example, LCD panels have a native resolution and refresh rate |
that looks best but other sub-optimal resolutions may be supported. |
The mode attribute EGL_OPTIMAL_MESA will be set for modes which |
best match the screen. [M. Danzer] |
8. Should eglQueryModeStringMESA() be included? This function returns |
a human-readable string which corresponds to an EGLMode. |
Arguments for: |
A mode name such as "HDTV-720P" might mean more to users than |
"1280x720@60Hz" if the later were generated via code. |
Arguments against: |
There's no standard syntax for the strings. May cause more |
trouble than it's worth. |
Postpone for future extension. [A. Jackson] |
Latest discussion leaning toward omitting this function. |
9. Should we use "Get" or "Query" for functions which return state? |
The EGL 1.x specification doesn't seem to be totally consistent |
in this regard, but "Query" is used more often. |
Use "Get" for mode-related queries (as for EGLConfigs) but "Query" |
for everything else. |
10. What should be the default size for screen surfaces? |
For Pbuffer surfaces the default width and height are zero. |
We'll do the same for screen surfaces. Since there's no function |
to resize surfaces it's useless to have a 0x0 screen, but this isn't |
a situation that'll normally be encountered. |
11. Should there be a function for resizing a screen surface? |
Suppose one wants to change the screen's size in the EGL application. |
Also suppose there's a hardware restriction such that only one screen |
surface can exist at a time (either for lack of memory or because of |
memory layout restrictions). |
The basic idea is that the currently displayed screen surface must |
be deallocated before a new one can be created. Perhaps a resize |
function would work better? |
12. How should sub-pixel LCD color information be made available? |
What about the display's gamma value? |
Perhaps expose as additional read-only mode attributes. |
Perhaps postpone for a layered extension. |
13. What happens if the user attempts to delete a screen surface that |
is currently being shown? |
Spec currently says that's illegal and that an error (TBD) will be |
generated. |
14. What if the physical screen size can't be determined? Should |
a query of EGL_PHYSICAL_SIZE_MESA return [0,0]? |
Obsolete: EGL_PHYSICAL_SIZE_MESA not used. |
15. Suppose the device's number of RAMDACs is different from the |
number of output ports. For example, a graphics card with |
two RAMDACs but three ports (VGA, DVI, TV). |
Address this in a follow-on extension. [Matthias Hopf] |
16. How should we deal with on-the-fly device changes? For example, |
the monitor being unplugged and replaced by another with different |
characteristics? |
A HAL event could be received via DBUS in the application [J. Smirl, |
A. Jackson]. |
Should there be an EGL mechanism for detecting this? Maybe an |
EGL_SCREEN_LOST error (similar to EGL_CONTEXT_LOST) can be recorded |
when there's a screen change. At least then the application can |
poll to detect this situation. |
Maybe leave that to a future extension. |
See also the EGL_SCREEN_COUNT_MESA query. |
17. What if pixel-accurate panning is not supported (see |
eglScreenPositionMESA)? [M. Danzer] |
Is this a common problem? Can we ignore it for now? |
18. Should eglShowSurfaceMESA be renamed to eglShowScreenSurfaceMESA? |
Probably. |
New Procedures and Functions |
EGLBoolean eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, |
const EGLint *attrib_list, |
EGLModeMESA *modes, EGLint modes_size, |
EGLint *num_modes) |
EGLBoolean eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLModeMESA *modes, EGLint modes_size, |
EGLint *num_modes) |
EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, |
EGLint attrib, EGLint *value) |
EGLBoolean eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, |
EGLint screens_size, EGLint *num_screens) |
EGLSurface eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, |
const EGLint *attrib_list) |
EGLBoolean eglShowSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLSurface surface, EGLModeMESA mode) |
EGLBoolean eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLint x, EGLint y) |
EGLBoolean eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLint attrib, EGLint *value); |
EGLBoolean eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLSurface *surface) |
EGLBoolean eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLModeMESA *mode) |
const char *eglQueryModeStringMESA(EGLDisplay dpy, EGLMode mode); |
New Types |
EGLModeMESA |
EGLScreenMESA |
New Tokens |
New error codes: |
EGL_BAD_SCREEN_MESA |
EGL_BAD_MODE_MESA |
Screen-related tokens: |
EGL_SCREEN_COUNT_MESA |
EGL_SCREEN_POSITION_MESA |
EGL_SCREEN_BIT_MESA |
EGL_SCREEN_POSITION_GRANULARITY_MESA |
Mode-related tokens: |
EGL_MODE_ID_MESA |
EGL_REFRESH_RATE_MESA |
EGL_INTERLACED_MESA |
EGL_OPTIMAL_MESA |
EGL_NO_MODE_MESA |
Additions to Chapter X of the EGL 1.1 Specification |
[XXX this all has to be rewritten to fit into the EGL specification |
and match the conventions of an EGL extension. For now, just list |
all the functions with brief descriptions.] |
EGLBoolean eglChooseModeMESA(EGLDisplay dpy, const EGLScreenMESA screen, |
EGLint *attrib_list, EGLModeMESA *modes, |
EGLint modes_size, EGLint *num_modes) |
Like eglChooseConfig, returns a list of EGLModes which match the given |
attribute list. This does not set the screen's current display mode. |
The attribute list is a list of token/value pairs terminated with |
EGL_NONE. Supported attributes include: |
Name Description |
--------------------- --------------------------------------------- |
EGL_WIDTH Mode width (resolution) |
EGL_HEIGHT Mode height (resolution) |
EGL_REFRESH_RATE_MESA The mode's refresh rate, multiplied by 1000 |
EGL_INTERLACED_MESA 1 indicates an interlaced mode, 0 otherwise |
EGL_OPTIMAL_MESA Set if the most is especially optimal for the |
screen (ex. for particular LCD resolutions) |
Any other token will generate the error EGL_BAD_ATTRIBUTE. |
The list of modes returned by eglChooseModeMESA will be sorted |
according to the following criteria. See the discussion of table 3.3 |
in the EGL specification for more information. |
Selection Sort Sort |
Attribute Default Criteria Order Priority |
-------------------- -------------- ----------- ------ -------- |
EGL_OPTIMAL_MESA EGL_DONT_CARE Exact 1,0 1 |
EGL_INTERLACED_MESA EGL_DONT_CARE Exact 0,1 2 |
EGL_REFRESH_RATE EGL_DONT_CARE AtLeast Larger 3 |
EGL_WIDTH EGL_DONT_CARE AtLeast Larger 4 |
EGL_HEIGHT EGL_DONT_CARE AtLeast Larger 5 |
EGL_MODE_ID_MESA EGL_DONT_CARE Exact Smaller 6 |
EGLBoolean eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLModeMESA *modes, EGLint modes_size, |
EGLint *num_modes) |
Like eglGetConfigs, returns a list of all modes supported by the |
given screen. The returned modes will be sorted in the same manner |
as for eglChooseModeMESA(). |
EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, |
EGLint attrib, EGLint *value) |
Used to query mode attributes. The following attributes are supported: |
Name Return value description |
--------------------- ---------------------------------------------- |
EGL_OPTIMAL_MESA 1 indicates an optimal mode, 0 otherwise |
EGL_INTERLACED_MESA 1 indicates an interlaced mode, 0 otherwise |
EGL_REFRESH_RATE_MESA The mode's refresh rate, multiplied by 1000 |
EGL_WIDTH Mode width (resolution) |
EGL_HEIGHT Mode height (resolution) |
EGL_MODE_ID_MESA A unique small integer identifier for the mode |
Any other token will generate the error EGL_BAD_ATTRIBUTE. |
EGLBoolean eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, |
EGLint screens_size, EGLint *num_screens) |
This function returns an array of all available screen handles. |
<screens_size> is the maximum number of screens to return in the |
<screens> array. <num_screens> will return the number of screen handles |
placed in the array, even if <screens> is NULL. |
The number of screens and the availability of each may change over |
time (hot-plugging). Screen handles will not be reused. When a |
screen handle becomes invalid, function calls which reference an |
invalid handle will generate EGL_BAD_SCREEN_MESA. |
The first screen handle returned will be considered to be the primary |
one. |
EGLSurface eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, |
const EGLint *attrib_list) |
Create a surface that can be displayed on a screen. <attrib_list> is |
an array of token/value pairs terminated with EGL_NONE. Valid tokens |
include: |
Name Description |
---------------- -------------------------------- |
EGL_WIDTH desired surface width in pixels |
EGL_HEIGHT desired surface height in pixels |
Any other token will generate the error EGL_BAD_ATTRIBUTE. |
The default width and height are zero. |
EGLBoolean eglShowSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLSurface surface, EGLModeMESA mode) |
This function causes a screen to show the given surface (or more |
precisely, the surface's front color buffer) with the given mode. |
If the surface is in any way incompatible with the mode, the error |
EGL_BAD_MATCH will be generated, EGL_FALSE will be returned, and the |
previous screen state will remain in effect. This might occur when |
the bandwidth of the video-out subsystem is exceeded, or if the mode |
specifies a width or height that's greater than the width or height |
of the surface. |
To disable a screen, the values EGL_NO_SURFACE and EGL_NO_MODE_MESA |
be passed as the <surface> and <mode> parameters. |
The values of EGL_SCREEN_POSITION_MESA are clamped to the new valid |
range computed from the screen size and surface size. If the new |
surface is EGL_NO_SURFACE, EGL_SCREEN_POSITION_MESA is set to [0, 0]. |
Attempting to delete a screen surface which is currently being |
displayed will result in the error EGL_BAD_ACCESS being generated. |
EGLBoolean eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLint x, EGLint y) |
Specifies the origin of the screen's view into the surface, if the |
surface is larger than the screen. Valid values for x and y are |
[0, surfaceWidth - screenWidth] and [0, surfaceHeight - screenHeight], |
respectively. |
The x and y values are also constrained to be integer multiples of the |
EGL_SCREEN_POSITION_GRANULARITY_MESA values. |
EGLBoolean eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLint attrib, EGLint *value); |
Used to query screen attributes. <attrib> may be one of the following: |
Name Return value description |
------------------------ --------------------------------------------- |
EGL_SCREEN_POSITION_MESA x, y position of the screen's origin with |
respect to the surface. If no surface is |
attached to the screen, [0, 0] is returned. |
EGL_SCREEN_POSITION_GRANULARITY_MESA |
Returns the granularity, in pixels, for |
which the screen position is constrained. |
Any other token will generate the error EGL_BAD_ATTRIBUTE. |
EGLBoolean eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLSurface *surface) |
Returns the surface currently displayed on the given screen. <surface> |
may be EGL_NO_SURFACE if the screen isn't currently showing any surface. |
EGLBoolean eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLModeMESA *mode) |
Returns the given screen's current display mode. The mode may be |
EGL_NO_MODE_MESA if the screen is currently disabled. |
const char *eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode); |
Returns a human-readable string for the given mode. The string is a |
zero-terminated C string which the user should not attempt to free. |
There is no standard syntax for mode strings. Applications should |
not directly rely on mode strings. |
Version History |
1. 15 March 2005 - BrianP |
Initial version |
2. 16 March 2005 - BrianP |
Removed EGL_DEPTH_MESA |
Added EGL_PHYSICAL_WIDTH_MESA, EGL_PHYSICAL_HEIGHT_MESA queries |
Added EGL_OPTIMAL_MESA for width/height/refresh rate selection |
Added possible eglQueryModeStringMESA() function |
More details of the new functions explained. |
3. 18 March 2005 - BrianP |
Added screen_number to eglChooseModeMESA(). |
Fix off by one mistake in value range for ORIGIN attributes |
Added Issues section |
4. 21 March 2005 - BrianP |
Removed eglScreenAttribsMESA(). |
Added eglScreenPositionMESA() to set screen origin. |
Replaced EGL_SCREEN_X/Y_OFFSET_MESA with EGL_SCREEN_POSITION_MESA. |
Replaced EGL_PHYSICAL_WIDTH/HEIGHT_MESA with EGL_PHYSICAL_SIZE_MESA. |
Use EGL_OPTIMAL_MESA as a new mode attribute. (Michel Danzer) |
Added a few more issues. |
5. 6 April 2005 - BrianP |
More language for eglGetModeStringMESA(). |
Added issues 10, 11, 12, 13, 14. |
Updated issue 3 discussion about mode sorting. |
6. 22 April 2005 - BrianP |
Fixed "LDC" typo. |
Added issues 15, 16. |
Changed dependency on EGL 1.1 to EGL 1.0 |
s/EGL_NUM_SCREENS_MESA/EGL_SCREEN_COUNT_MESA/ |
Added eglQueryDisplayMESA() to New Functions section. |
Clarified language for the EGL_SCREEN_COUNT_MESA query. |
7. 29 April 2005 - BrianP |
Added EGLScreenMESA type and eglGetScreensMESA() function. [J. Smirl]. |
Replaced EGLint screen_number parameters with EGLScreenMESA screen. |
Added issue 17 (pixel-accurate panning) |
8. 2 May 2005 - BrianP |
Removed eglQueryDisplayMESA. |
Fixed a few more EGLint -> EGLScreenMESA changes. |
9. 20 May 2005 - BrianP |
Fixed a few typos. |
Updated some open issues text. |
10. 10 August 2005 - BrianP |
Added EGL_SCREEN_POSITION_GRANULARITY_MESA. |
11. 27 January 2006 - BrianP |
EGL_PHYSICAL_SIZE_MESA removed since EGL 1.2 has a similar feature. |
/contrib/sdk/sources/Mesa/src/egl/drivers/Makefile.am |
---|
0,0 → 1,30 |
# 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. |
SUBDIRS = |
if HAVE_EGL_DRIVER_GLX |
SUBDIRS += glx |
endif |
if HAVE_EGL_DRIVER_DRI2 |
SUBDIRS += dri2 |
endif |
/contrib/sdk/sources/Mesa/src/egl/drivers/Makefile.in |
---|
0,0 → 1,798 |
# 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@ |
@HAVE_EGL_DRIVER_GLX_TRUE@am__append_1 = glx |
@HAVE_EGL_DRIVER_DRI2_TRUE@am__append_2 = dri2 |
subdir = src/egl/drivers |
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am |
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 = |
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 = |
SOURCES = |
DIST_SOURCES = |
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ |
ctags-recursive dvi-recursive html-recursive info-recursive \ |
install-data-recursive install-dvi-recursive \ |
install-exec-recursive install-html-recursive \ |
install-info-recursive install-pdf-recursive \ |
install-ps-recursive install-recursive installcheck-recursive \ |
installdirs-recursive pdf-recursive ps-recursive \ |
tags-recursive uninstall-recursive |
am__can_run_installinfo = \ |
case $$AM_UPDATE_INFO_DIR in \ |
n|no|NO) false;; \ |
*) (install-info --version) >/dev/null 2>&1;; \ |
esac |
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ |
distclean-recursive maintainer-clean-recursive |
am__recursive_targets = \ |
$(RECURSIVE_TARGETS) \ |
$(RECURSIVE_CLEAN_TARGETS) \ |
$(am__extra_recursive_targets) |
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ |
distdir |
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 |
DIST_SUBDIRS = glx dri2 |
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
am__relativize = \ |
dir0=`pwd`; \ |
sed_first='s,^\([^/]*\)/.*$$,\1,'; \ |
sed_rest='s,^[^/]*/*,,'; \ |
sed_last='s,^.*/\([^/]*\)$$,\1,'; \ |
sed_butlast='s,/*[^/]*$$,,'; \ |
while test -n "$$dir1"; do \ |
first=`echo "$$dir1" | sed -e "$$sed_first"`; \ |
if test "$$first" != "."; then \ |
if test "$$first" = ".."; then \ |
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ |
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ |
else \ |
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ |
if test "$$first2" = "$$first"; then \ |
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ |
else \ |
dir2="../$$dir2"; \ |
fi; \ |
dir0="$$dir0"/"$$first"; \ |
fi; \ |
fi; \ |
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ |
done; \ |
reldir="$$dir2" |
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@ |
SUBDIRS = $(am__append_1) $(am__append_2) |
all: all-recursive |
.SUFFIXES: |
$(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/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/egl/drivers/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): |
mostlyclean-libtool: |
-rm -f *.lo |
clean-libtool: |
-rm -rf .libs _libs |
# This directory's subdirectories are mostly independent; you can cd |
# into them and run 'make' without going through this Makefile. |
# To change the values of 'make' variables: instead of editing Makefiles, |
# (1) if the variable is set in 'config.status', edit 'config.status' |
# (which will cause the Makefiles to be regenerated when you run 'make'); |
# (2) otherwise, pass the desired values on the 'make' command line. |
$(am__recursive_targets): |
@fail=; \ |
if $(am__make_keepgoing); then \ |
failcom='fail=yes'; \ |
else \ |
failcom='exit 1'; \ |
fi; \ |
dot_seen=no; \ |
target=`echo $@ | sed s/-recursive//`; \ |
case "$@" in \ |
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ |
*) list='$(SUBDIRS)' ;; \ |
esac; \ |
for subdir in $$list; do \ |
echo "Making $$target in $$subdir"; \ |
if test "$$subdir" = "."; then \ |
dot_seen=yes; \ |
local_target="$$target-am"; \ |
else \ |
local_target="$$target"; \ |
fi; \ |
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ |
|| eval $$failcom; \ |
done; \ |
if test "$$dot_seen" = "no"; then \ |
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ |
fi; test -z "$$fail" |
ID: $(am__tagged_files) |
$(am__define_uniq_tagged_files); mkid -fID $$unique |
tags: tags-recursive |
TAGS: tags |
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) |
set x; \ |
here=`pwd`; \ |
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ |
include_option=--etags-include; \ |
empty_fix=.; \ |
else \ |
include_option=--include; \ |
empty_fix=; \ |
fi; \ |
list='$(SUBDIRS)'; for subdir in $$list; do \ |
if test "$$subdir" = .; then :; else \ |
test ! -f $$subdir/TAGS || \ |
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ |
fi; \ |
done; \ |
$(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-recursive |
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-recursive |
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 |
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ |
if test "$$subdir" = .; then :; else \ |
$(am__make_dryrun) \ |
|| test -d "$(distdir)/$$subdir" \ |
|| $(MKDIR_P) "$(distdir)/$$subdir" \ |
|| exit 1; \ |
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ |
$(am__relativize); \ |
new_distdir=$$reldir; \ |
dir1=$$subdir; dir2="$(top_distdir)"; \ |
$(am__relativize); \ |
new_top_distdir=$$reldir; \ |
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ |
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ |
($(am__cd) $$subdir && \ |
$(MAKE) $(AM_MAKEFLAGS) \ |
top_distdir="$$new_top_distdir" \ |
distdir="$$new_distdir" \ |
am__remove_distdir=: \ |
am__skip_length_check=: \ |
am__skip_mode_fix=: \ |
distdir) \ |
|| exit 1; \ |
fi; \ |
done |
check-am: all-am |
check: check-recursive |
all-am: Makefile |
installdirs: installdirs-recursive |
installdirs-am: |
install: install-recursive |
install-exec: install-exec-recursive |
install-data: install-data-recursive |
uninstall: uninstall-recursive |
install-am: all-am |
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am |
installcheck: installcheck-recursive |
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-recursive |
clean-am: clean-generic clean-libtool mostlyclean-am |
distclean: distclean-recursive |
-rm -f Makefile |
distclean-am: clean-am distclean-generic distclean-tags |
dvi: dvi-recursive |
dvi-am: |
html: html-recursive |
html-am: |
info: info-recursive |
info-am: |
install-data-am: |
install-dvi: install-dvi-recursive |
install-dvi-am: |
install-exec-am: |
install-html: install-html-recursive |
install-html-am: |
install-info: install-info-recursive |
install-info-am: |
install-man: |
install-pdf: install-pdf-recursive |
install-pdf-am: |
install-ps: install-ps-recursive |
install-ps-am: |
installcheck-am: |
maintainer-clean: maintainer-clean-recursive |
-rm -f Makefile |
maintainer-clean-am: distclean-am maintainer-clean-generic |
mostlyclean: mostlyclean-recursive |
mostlyclean-am: mostlyclean-generic mostlyclean-libtool |
pdf: pdf-recursive |
pdf-am: |
ps: ps-recursive |
ps-am: |
uninstall-am: |
.MAKE: $(am__recursive_targets) install-am install-strip |
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ |
check-am clean clean-generic clean-libtool cscopelist-am ctags \ |
ctags-am distclean 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 \ |
installdirs-am maintainer-clean maintainer-clean-generic \ |
mostlyclean 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/dri2/Android.mk |
---|
0,0 → 1,49 |
# Mesa 3-D graphics library |
# |
# Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com> |
# Copyright (C) 2010-2011 LunarG Inc. |
# |
# 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. |
# Android.mk for egl_dri2 |
LOCAL_PATH := $(call my-dir) |
include $(CLEAR_VARS) |
LOCAL_SRC_FILES := \ |
egl_dri2.c \ |
platform_android.c |
LOCAL_CFLAGS := \ |
-DDEFAULT_DRIVER_DIR=\"/system/lib/dri\" \ |
-DHAVE_SHARED_GLAPI \ |
-DHAVE_ANDROID_PLATFORM |
LOCAL_C_INCLUDES := \ |
$(MESA_TOP)/src/mapi \ |
$(MESA_TOP)/src/egl/main \ |
$(DRM_GRALLOC_TOP) \ |
$(DRM_TOP) \ |
$(DRM_TOP)/include/drm |
LOCAL_MODULE := libmesa_egl_dri2 |
include $(MESA_COMMON_MK) |
include $(BUILD_STATIC_LIBRARY) |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/Makefile.am |
---|
0,0 → 1,65 |
# 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 \ |
-I$(top_srcdir)/src/gbm/main \ |
-I$(top_srcdir)/src/gbm/backends/dri \ |
-I$(top_srcdir)/src/egl/wayland/wayland-egl \ |
-I$(top_srcdir)/src/egl/wayland/wayland-drm \ |
-I$(top_builddir)/src/egl/wayland/wayland-drm \ |
$(DEFINES) \ |
$(VISIBILITY_CFLAGS) \ |
$(LIBDRM_CFLAGS) \ |
$(LIBUDEV_CFLAGS) \ |
$(LIBKMS_CFLAGS) \ |
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" |
noinst_LTLIBRARIES = libegl_dri2.la |
libegl_dri2_la_SOURCES = \ |
egl_dri2.c \ |
common.c |
libegl_dri2_la_LIBADD = \ |
$(EGL_LIB_DEPS) |
if HAVE_SHARED_GLAPI |
AM_CFLAGS += -DHAVE_SHARED_GLAPI |
endif |
if HAVE_EGL_PLATFORM_X11 |
libegl_dri2_la_SOURCES += platform_x11.c |
AM_CFLAGS += -DHAVE_X11_PLATFORM |
AM_CFLAGS += $(XCB_DRI2_CFLAGS) |
endif |
if HAVE_EGL_PLATFORM_WAYLAND |
libegl_dri2_la_SOURCES += platform_wayland.c |
AM_CFLAGS += -DHAVE_WAYLAND_PLATFORM |
AM_CFLAGS += $(WAYLAND_CFLAGS) |
endif |
if HAVE_EGL_PLATFORM_DRM |
libegl_dri2_la_SOURCES += platform_drm.c |
AM_CFLAGS += -DHAVE_DRM_PLATFORM |
endif |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/Makefile.in |
---|
0,0 → 1,800 |
# 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@ |
@HAVE_SHARED_GLAPI_TRUE@am__append_1 = -DHAVE_SHARED_GLAPI |
@HAVE_EGL_PLATFORM_X11_TRUE@am__append_2 = platform_x11.c |
@HAVE_EGL_PLATFORM_X11_TRUE@am__append_3 = -DHAVE_X11_PLATFORM \ |
@HAVE_EGL_PLATFORM_X11_TRUE@ $(XCB_DRI2_CFLAGS) |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__append_4 = platform_wayland.c |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__append_5 = \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ -DHAVE_WAYLAND_PLATFORM \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ $(WAYLAND_CFLAGS) |
@HAVE_EGL_PLATFORM_DRM_TRUE@am__append_6 = platform_drm.c |
@HAVE_EGL_PLATFORM_DRM_TRUE@am__append_7 = -DHAVE_DRM_PLATFORM |
subdir = src/egl/drivers/dri2 |
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_dri2_la_DEPENDENCIES = $(am__DEPENDENCIES_1) |
am__libegl_dri2_la_SOURCES_DIST = egl_dri2.c common.c platform_x11.c \ |
platform_wayland.c platform_drm.c |
@HAVE_EGL_PLATFORM_X11_TRUE@am__objects_1 = platform_x11.lo |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__objects_2 = platform_wayland.lo |
@HAVE_EGL_PLATFORM_DRM_TRUE@am__objects_3 = platform_drm.lo |
am_libegl_dri2_la_OBJECTS = egl_dri2.lo common.lo $(am__objects_1) \ |
$(am__objects_2) $(am__objects_3) |
libegl_dri2_la_OBJECTS = $(am_libegl_dri2_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_dri2_la_SOURCES) |
DIST_SOURCES = $(am__libegl_dri2_la_SOURCES_DIST) |
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 \ |
-I$(top_srcdir)/src/gbm/main \ |
-I$(top_srcdir)/src/gbm/backends/dri \ |
-I$(top_srcdir)/src/egl/wayland/wayland-egl \ |
-I$(top_srcdir)/src/egl/wayland/wayland-drm \ |
-I$(top_builddir)/src/egl/wayland/wayland-drm $(DEFINES) \ |
$(VISIBILITY_CFLAGS) $(LIBDRM_CFLAGS) $(LIBUDEV_CFLAGS) \ |
$(LIBKMS_CFLAGS) \ |
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \ |
$(am__append_1) $(am__append_3) $(am__append_5) \ |
$(am__append_7) |
noinst_LTLIBRARIES = libegl_dri2.la |
libegl_dri2_la_SOURCES = egl_dri2.c common.c $(am__append_2) \ |
$(am__append_4) $(am__append_6) |
libegl_dri2_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/dri2/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/egl/drivers/dri2/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_dri2.la: $(libegl_dri2_la_OBJECTS) $(libegl_dri2_la_DEPENDENCIES) $(EXTRA_libegl_dri2_la_DEPENDENCIES) |
$(AM_V_CCLD)$(LINK) $(libegl_dri2_la_OBJECTS) $(libegl_dri2_la_LIBADD) $(LIBS) |
mostlyclean-compile: |
-rm -f *.$(OBJEXT) |
distclean-compile: |
-rm -f *.tab.c |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egl_dri2.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/platform_drm.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/platform_wayland.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/platform_x11.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/dri2/common.c |
---|
0,0 → 1,144 |
/* |
* 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 (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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#include <stdio.h> |
#include <string.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <unistd.h> |
#include "egl_dri2.h" |
#ifdef HAVE_LIBUDEV |
#define DRIVER_MAP_DRI2_ONLY |
#include "pci_ids/pci_id_driver_map.h" |
#include <libudev.h> |
static struct udev_device * |
dri2_udev_device_new_from_fd(struct udev *udev, int fd) |
{ |
struct udev_device *device; |
struct stat buf; |
if (fstat(fd, &buf) < 0) { |
_eglLog(_EGL_WARNING, "EGL-DRI2: failed to stat fd %d", fd); |
return NULL; |
} |
device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev); |
if (device == NULL) { |
_eglLog(_EGL_WARNING, |
"EGL-DRI2: could not create udev device for fd %d", fd); |
return NULL; |
} |
return device; |
} |
char * |
dri2_get_device_name_for_fd(int fd) |
{ |
struct udev *udev; |
struct udev_device *device; |
const char *const_device_name; |
char *device_name = NULL; |
udev = udev_new(); |
device = dri2_udev_device_new_from_fd(udev, fd); |
if (device == NULL) |
return NULL; |
const_device_name = udev_device_get_devnode(device); |
if (!const_device_name) |
goto out; |
device_name = strdup(const_device_name); |
out: |
udev_device_unref(device); |
udev_unref(udev); |
return device_name; |
} |
char * |
dri2_get_driver_for_fd(int fd) |
{ |
struct udev *udev; |
struct udev_device *device, *parent; |
const char *pci_id; |
char *driver = NULL; |
int vendor_id, chip_id, i, j; |
udev = udev_new(); |
device = dri2_udev_device_new_from_fd(udev, fd); |
if (device == NULL) |
return NULL; |
parent = udev_device_get_parent(device); |
if (parent == NULL) { |
_eglLog(_EGL_WARNING, "DRI2: could not get parent device"); |
goto out; |
} |
pci_id = udev_device_get_property_value(parent, "PCI_ID"); |
if (pci_id == NULL || |
sscanf(pci_id, "%x:%x", &vendor_id, &chip_id) != 2) { |
_eglLog(_EGL_WARNING, "EGL-DRI2: malformed or no PCI ID"); |
goto out; |
} |
for (i = 0; driver_map[i].driver; i++) { |
if (vendor_id != driver_map[i].vendor_id) |
continue; |
if (driver_map[i].num_chips_ids == -1) { |
driver = strdup(driver_map[i].driver); |
_eglLog(_EGL_DEBUG, "pci id for %d: %04x:%04x, driver %s", |
fd, vendor_id, chip_id, driver); |
goto out; |
} |
for (j = 0; j < driver_map[i].num_chips_ids; j++) |
if (driver_map[i].chip_ids[j] == chip_id) { |
driver = strdup(driver_map[i].driver); |
_eglLog(_EGL_DEBUG, "pci id for %d: %04x:%04x, driver %s", |
fd, vendor_id, chip_id, driver); |
goto out; |
} |
} |
out: |
udev_device_unref(device); |
udev_unref(udev); |
return driver; |
} |
#endif /* HAVE_LIBUDEV */ |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/egl_dri2.c |
---|
0,0 → 1,1775 |
/* |
* Copyright © 2010 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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
*/ |
#include <stdlib.h> |
#include <string.h> |
#include <stdio.h> |
#include <limits.h> |
#include <fcntl.h> |
#include <errno.h> |
#include <unistd.h> |
#include <xf86drm.h> |
#include <GL/gl.h> |
#include <GL/internal/dri_interface.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#define EGL_EGLEXT_PROTOTYPES |
#include <EGL/egl.h> |
#include <EGL/eglext.h> |
#include "eglmode.h" |
#include "eglscreen.h" |
#include "egl_dri2.h" |
typedef unsigned int lib_handle; |
lib_handle load_library(const char *name); |
void *get_proc_address(lib_handle lib, char *proc_name); |
const __DRIuseInvalidateExtension use_invalidate = { |
{ __DRI_USE_INVALIDATE, 1 } |
}; |
EGLint dri2_to_egl_attribute_map[] = { |
0, |
EGL_BUFFER_SIZE, /* __DRI_ATTRIB_BUFFER_SIZE */ |
EGL_LEVEL, /* __DRI_ATTRIB_LEVEL */ |
EGL_RED_SIZE, /* __DRI_ATTRIB_RED_SIZE */ |
EGL_GREEN_SIZE, /* __DRI_ATTRIB_GREEN_SIZE */ |
EGL_BLUE_SIZE, /* __DRI_ATTRIB_BLUE_SIZE */ |
EGL_LUMINANCE_SIZE, /* __DRI_ATTRIB_LUMINANCE_SIZE */ |
EGL_ALPHA_SIZE, /* __DRI_ATTRIB_ALPHA_SIZE */ |
0, /* __DRI_ATTRIB_ALPHA_MASK_SIZE */ |
EGL_DEPTH_SIZE, /* __DRI_ATTRIB_DEPTH_SIZE */ |
EGL_STENCIL_SIZE, /* __DRI_ATTRIB_STENCIL_SIZE */ |
0, /* __DRI_ATTRIB_ACCUM_RED_SIZE */ |
0, /* __DRI_ATTRIB_ACCUM_GREEN_SIZE */ |
0, /* __DRI_ATTRIB_ACCUM_BLUE_SIZE */ |
0, /* __DRI_ATTRIB_ACCUM_ALPHA_SIZE */ |
EGL_SAMPLE_BUFFERS, /* __DRI_ATTRIB_SAMPLE_BUFFERS */ |
EGL_SAMPLES, /* __DRI_ATTRIB_SAMPLES */ |
0, /* __DRI_ATTRIB_RENDER_TYPE, */ |
0, /* __DRI_ATTRIB_CONFIG_CAVEAT */ |
0, /* __DRI_ATTRIB_CONFORMANT */ |
0, /* __DRI_ATTRIB_DOUBLE_BUFFER */ |
0, /* __DRI_ATTRIB_STEREO */ |
0, /* __DRI_ATTRIB_AUX_BUFFERS */ |
0, /* __DRI_ATTRIB_TRANSPARENT_TYPE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_RED_VALUE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE */ |
0, /* __DRI_ATTRIB_FLOAT_MODE (deprecated) */ |
0, /* __DRI_ATTRIB_RED_MASK */ |
0, /* __DRI_ATTRIB_GREEN_MASK */ |
0, /* __DRI_ATTRIB_BLUE_MASK */ |
0, /* __DRI_ATTRIB_ALPHA_MASK */ |
EGL_MAX_PBUFFER_WIDTH, /* __DRI_ATTRIB_MAX_PBUFFER_WIDTH */ |
EGL_MAX_PBUFFER_HEIGHT, /* __DRI_ATTRIB_MAX_PBUFFER_HEIGHT */ |
EGL_MAX_PBUFFER_PIXELS, /* __DRI_ATTRIB_MAX_PBUFFER_PIXELS */ |
0, /* __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH */ |
0, /* __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT */ |
0, /* __DRI_ATTRIB_VISUAL_SELECT_GROUP */ |
0, /* __DRI_ATTRIB_SWAP_METHOD */ |
EGL_MAX_SWAP_INTERVAL, /* __DRI_ATTRIB_MAX_SWAP_INTERVAL */ |
EGL_MIN_SWAP_INTERVAL, /* __DRI_ATTRIB_MIN_SWAP_INTERVAL */ |
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGB */ |
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA */ |
0, /* __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE */ |
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */ |
EGL_Y_INVERTED_NOK, /* __DRI_ATTRIB_YINVERTED */ |
0, /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */ |
}; |
static EGLBoolean |
dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria) |
{ |
if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0) |
return EGL_FALSE; |
if (!_eglMatchConfig(conf, criteria)) |
return EGL_FALSE; |
return EGL_TRUE; |
} |
struct dri2_egl_config * |
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, |
int depth, EGLint surface_type, const EGLint *attr_list, |
const unsigned int *rgba_masks) |
{ |
struct dri2_egl_config *conf; |
struct dri2_egl_display *dri2_dpy; |
_EGLConfig base; |
unsigned int attrib, value, double_buffer; |
EGLint key, bind_to_texture_rgb, bind_to_texture_rgba; |
unsigned int dri_masks[4] = { 0, 0, 0, 0 }; |
_EGLConfig *matching_config; |
EGLint num_configs = 0; |
EGLint config_id; |
int i; |
dri2_dpy = disp->DriverData; |
_eglInitConfig(&base, disp, id); |
i = 0; |
double_buffer = 0; |
bind_to_texture_rgb = 0; |
bind_to_texture_rgba = 0; |
while (dri2_dpy->core->indexConfigAttrib(dri_config, i++, &attrib, &value)) { |
switch (attrib) { |
case __DRI_ATTRIB_RENDER_TYPE: |
if (value & __DRI_ATTRIB_RGBA_BIT) |
value = EGL_RGB_BUFFER; |
else if (value & __DRI_ATTRIB_LUMINANCE_BIT) |
value = EGL_LUMINANCE_BUFFER; |
else |
return NULL; |
_eglSetConfigKey(&base, EGL_COLOR_BUFFER_TYPE, value); |
break; |
case __DRI_ATTRIB_CONFIG_CAVEAT: |
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG) |
value = EGL_NON_CONFORMANT_CONFIG; |
else if (value & __DRI_ATTRIB_SLOW_BIT) |
value = EGL_SLOW_CONFIG; |
else |
value = EGL_NONE; |
_eglSetConfigKey(&base, EGL_CONFIG_CAVEAT, value); |
break; |
case __DRI_ATTRIB_BIND_TO_TEXTURE_RGB: |
bind_to_texture_rgb = value; |
break; |
case __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA: |
bind_to_texture_rgba = value; |
break; |
case __DRI_ATTRIB_DOUBLE_BUFFER: |
double_buffer = value; |
break; |
case __DRI_ATTRIB_RED_MASK: |
dri_masks[0] = value; |
break; |
case __DRI_ATTRIB_GREEN_MASK: |
dri_masks[1] = value; |
break; |
case __DRI_ATTRIB_BLUE_MASK: |
dri_masks[2] = value; |
break; |
case __DRI_ATTRIB_ALPHA_MASK: |
dri_masks[3] = value; |
break; |
default: |
key = dri2_to_egl_attribute_map[attrib]; |
if (key != 0) |
_eglSetConfigKey(&base, key, value); |
break; |
} |
} |
if (attr_list) |
for (i = 0; attr_list[i] != EGL_NONE; i += 2) |
_eglSetConfigKey(&base, attr_list[i], attr_list[i+1]); |
/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig. Otherwise |
* it will only match a 32-bit RGBA visual. On a composited window manager |
* on X11, this will make all of the EGLConfigs with destination alpha get |
* blended by the compositor. This is probably not what the application |
* wants... especially on drivers that only have 32-bit RGBA EGLConfigs! |
*/ |
if (depth > 0 && depth != base.BufferSize |
&& !(depth == 24 && base.BufferSize == 32)) |
return NULL; |
if (rgba_masks && memcmp(rgba_masks, dri_masks, sizeof(dri_masks))) |
return NULL; |
base.NativeRenderable = EGL_TRUE; |
base.SurfaceType = surface_type; |
if (surface_type & (EGL_PBUFFER_BIT | |
(disp->Extensions.NOK_texture_from_pixmap ? EGL_PIXMAP_BIT : 0))) { |
base.BindToTextureRGB = bind_to_texture_rgb; |
if (base.AlphaSize > 0) |
base.BindToTextureRGBA = bind_to_texture_rgba; |
} |
base.RenderableType = disp->ClientAPIs; |
base.Conformant = disp->ClientAPIs; |
base.MinSwapInterval = dri2_dpy->min_swap_interval; |
base.MaxSwapInterval = dri2_dpy->max_swap_interval; |
if (!_eglValidateConfig(&base, EGL_FALSE)) { |
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id); |
return NULL; |
} |
config_id = base.ConfigID; |
base.ConfigID = EGL_DONT_CARE; |
base.SurfaceType = EGL_DONT_CARE; |
num_configs = _eglFilterArray(disp->Configs, (void **) &matching_config, 1, |
(_EGLArrayForEach) dri2_match_config, &base); |
if (num_configs == 1) { |
conf = (struct dri2_egl_config *) matching_config; |
if (double_buffer && !conf->dri_double_config) |
conf->dri_double_config = dri_config; |
else if (!double_buffer && !conf->dri_single_config) |
conf->dri_single_config = dri_config; |
else |
/* a similar config type is already added (unlikely) => discard */ |
return NULL; |
} |
else if (num_configs == 0) { |
conf = malloc(sizeof *conf); |
if (conf == NULL) |
return NULL; |
memcpy(&conf->base, &base, sizeof base); |
if (double_buffer) { |
conf->dri_double_config = dri_config; |
conf->dri_single_config = NULL; |
} else { |
conf->dri_single_config = dri_config; |
conf->dri_double_config = NULL; |
} |
conf->base.SurfaceType = 0; |
conf->base.ConfigID = config_id; |
_eglLinkConfig(&conf->base); |
} |
else { |
assert(0); |
return NULL; |
} |
if (double_buffer) { |
surface_type &= ~EGL_PIXMAP_BIT; |
} |
conf->base.SurfaceType |= surface_type; |
return conf; |
} |
__DRIimage * |
dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data) |
{ |
_EGLDisplay *disp = data; |
struct dri2_egl_image *dri2_img; |
_EGLImage *img; |
(void) screen; |
img = _eglLookupImage(image, disp); |
if (img == NULL) { |
_eglError(EGL_BAD_PARAMETER, "dri2_lookup_egl_image"); |
return NULL; |
} |
dri2_img = dri2_egl_image(image); |
return dri2_img->dri_image; |
} |
const __DRIimageLookupExtension image_lookup_extension = { |
{ __DRI_IMAGE_LOOKUP, 1 }, |
dri2_lookup_egl_image |
}; |
static const char dri_driver_path[] = "";//DEFAULT_DRIVER_DIR; |
struct dri2_extension_match { |
const char *name; |
int version; |
int offset; |
}; |
static struct dri2_extension_match dri2_driver_extensions[] = { |
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) }, |
{ __DRI_DRI2, 2, offsetof(struct dri2_egl_display, dri2) }, |
{ NULL, 0, 0 } |
}; |
static struct dri2_extension_match dri2_core_extensions[] = { |
{ __DRI2_FLUSH, 1, offsetof(struct dri2_egl_display, flush) }, |
{ __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) }, |
{ __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) }, |
{ NULL, 0, 0 } |
}; |
static struct dri2_extension_match swrast_driver_extensions[] = { |
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) }, |
{ __DRI_SWRAST, 2, offsetof(struct dri2_egl_display, swrast) }, |
{ NULL, 0, 0 } |
}; |
static struct dri2_extension_match swrast_core_extensions[] = { |
{ __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) }, |
{ NULL, 0, 0 } |
}; |
static EGLBoolean |
dri2_bind_extensions(struct dri2_egl_display *dri2_dpy, |
struct dri2_extension_match *matches, |
const __DRIextension **extensions) |
{ |
int i, j, ret = EGL_TRUE; |
void *field; |
for (i = 0; extensions[i]; i++) { |
_eglLog(_EGL_DEBUG, "DRI2: found extension `%s'", extensions[i]->name); |
for (j = 0; matches[j].name; j++) { |
if (strcmp(extensions[i]->name, matches[j].name) == 0 && |
extensions[i]->version >= matches[j].version) { |
field = ((char *) dri2_dpy + matches[j].offset); |
*(const __DRIextension **) field = extensions[i]; |
_eglLog(_EGL_INFO, "DRI2: found extension %s version %d", |
extensions[i]->name, extensions[i]->version); |
} |
} |
} |
for (j = 0; matches[j].name; j++) { |
field = ((char *) dri2_dpy + matches[j].offset); |
if (*(const __DRIextension **) field == NULL) { |
_eglLog(_EGL_FATAL, "DRI2: did not find extension %s version %d", |
matches[j].name, matches[j].version); |
ret = EGL_FALSE; |
} |
} |
return ret; |
} |
#if 0 |
static const __DRIextension ** |
dri2_open_driver(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = disp->DriverData; |
const __DRIextension **extensions; |
char path[PATH_MAX], *search_paths, *p, *next, *end; |
search_paths = NULL; |
if (geteuid() == getuid()) { |
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH */ |
search_paths = getenv("LIBGL_DRIVERS_PATH"); |
} |
// if (search_paths == NULL) |
// search_paths = DEFAULT_DRIVER_DIR; |
dri2_dpy->driver = NULL; |
end = search_paths + strlen(search_paths); |
for (p = search_paths; p < end && dri2_dpy->driver == NULL; p = next + 1) { |
int len; |
next = strchr(p, ':'); |
if (next == NULL) |
next = end; |
len = next - p; |
#if GLX_USE_TLS |
snprintf(path, sizeof path, |
"%.*s/tls/%s_dri.so", len, p, dri2_dpy->driver_name); |
dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
#endif |
if (dri2_dpy->driver == NULL) { |
snprintf(path, sizeof path, |
"%.*s/%s_dri.so", len, p, dri2_dpy->driver_name); |
dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
if (dri2_dpy->driver == NULL) |
_eglLog(_EGL_DEBUG, "failed to open %s: %s\n", path, dlerror()); |
} |
} |
if (dri2_dpy->driver == NULL) { |
_eglLog(_EGL_WARNING, |
"DRI2: failed to open %s (search paths %s)", |
dri2_dpy->driver_name, search_paths); |
return NULL; |
} |
_eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path); |
extensions = dlsym(dri2_dpy->driver, __DRI_DRIVER_EXTENSIONS); |
if (extensions == NULL) { |
_eglLog(_EGL_WARNING, |
"DRI2: driver exports no extensions (%s)", dlerror()); |
dlclose(dri2_dpy->driver); |
} |
return extensions; |
} |
EGLBoolean |
dri2_load_driver(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = disp->DriverData; |
const __DRIextension **extensions; |
extensions = dri2_open_driver(disp); |
if (!extensions) |
return EGL_FALSE; |
if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions)) { |
dlclose(dri2_dpy->driver); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
EGLBoolean |
dri2_load_driver_swrast(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = disp->DriverData; |
const __DRIextension **extensions; |
dri2_dpy->driver_name = "swrast"; |
extensions = dri2_open_driver(disp); |
if (!extensions) |
return EGL_FALSE; |
if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, extensions)) { |
dlclose(dri2_dpy->driver); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
#endif |
void |
dri2_setup_screen(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
unsigned int api_mask; |
if (dri2_dpy->dri2) { |
api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen); |
} else { |
assert(dri2_dpy->swrast); |
api_mask = 1 << __DRI_API_OPENGL | |
1 << __DRI_API_GLES | |
1 << __DRI_API_GLES2 | |
1 << __DRI_API_GLES3; |
} |
disp->ClientAPIs = 0; |
if (api_mask & (1 <<__DRI_API_OPENGL)) |
disp->ClientAPIs |= EGL_OPENGL_BIT; |
if (api_mask & (1 <<__DRI_API_GLES)) |
disp->ClientAPIs |= EGL_OPENGL_ES_BIT; |
if (api_mask & (1 << __DRI_API_GLES2)) |
disp->ClientAPIs |= EGL_OPENGL_ES2_BIT; |
if (api_mask & (1 << __DRI_API_GLES3)) |
disp->ClientAPIs |= EGL_OPENGL_ES3_BIT_KHR; |
assert(dri2_dpy->dri2 || dri2_dpy->swrast); |
disp->Extensions.KHR_surfaceless_context = EGL_TRUE; |
disp->Extensions.MESA_screen_surface = EGL_TRUE; |
if (dri2_dpy->dri2 && dri2_dpy->dri2->base.version >= 3) { |
disp->Extensions.KHR_create_context = EGL_TRUE; |
if (dri2_dpy->robustness) |
disp->Extensions.EXT_create_context_robustness = EGL_TRUE; |
} |
if (dri2_dpy->image) { |
disp->Extensions.MESA_drm_image = EGL_TRUE; |
disp->Extensions.KHR_image_base = EGL_TRUE; |
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE; |
if (dri2_dpy->image->base.version >= 5 && |
dri2_dpy->image->createImageFromTexture) { |
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE; |
disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE; |
} |
} |
{ |
_EGLMode *mode; |
_EGLScreen *screen = malloc(sizeof(*screen)); |
_eglInitScreen(screen, disp, 3); |
mode = &screen->Modes[0]; |
mode->Width = 800; |
mode->Height = 600; |
mode->RefreshRate = 60; |
mode->Optimal = EGL_FALSE; |
mode->Interlaced = EGL_FALSE; |
mode->Name = "800 x 600 60Hz"; |
mode = &screen->Modes[1]; |
mode->Width = 1024; |
mode->Height = 768; |
mode->RefreshRate = 60; |
mode->Optimal = EGL_FALSE; |
mode->Interlaced = EGL_FALSE; |
mode->Name = "1024 x 768 60Hz"; |
mode = &screen->Modes[2]; |
mode->Width = 1280; |
mode->Height = 1024; |
mode->RefreshRate = 60; |
mode->Optimal = EGL_FALSE; |
mode->Interlaced = EGL_FALSE; |
mode->Name = "1280 x 1024 60Hz"; |
_eglLinkScreen(screen); |
} |
} |
EGLBoolean |
dri2_create_screen(_EGLDisplay *disp) |
{ |
const __DRIextension **extensions; |
struct dri2_egl_display *dri2_dpy; |
dri2_dpy = disp->DriverData; |
if (dri2_dpy->dri2) { |
dri2_dpy->dri_screen = |
dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions, |
&dri2_dpy->driver_configs, disp); |
} else { |
assert(dri2_dpy->swrast); |
dri2_dpy->dri_screen = |
dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions, |
&dri2_dpy->driver_configs, disp); |
} |
if (dri2_dpy->dri_screen == NULL) { |
_eglLog(_EGL_WARNING, "DRI2: failed to create dri screen"); |
return EGL_FALSE; |
} |
dri2_dpy->own_dri_screen = 1; |
extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen); |
if (dri2_dpy->dri2) { |
unsigned i; |
if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions)) |
goto cleanup_dri_screen; |
for (i = 0; extensions[i]; i++) { |
if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) { |
dri2_dpy->robustness = (__DRIrobustnessExtension *) extensions[i]; |
} |
if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) { |
dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i]; |
} |
} |
} else { |
assert(dri2_dpy->swrast); |
if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions)) |
goto cleanup_dri_screen; |
} |
dri2_setup_screen(disp); |
return EGL_TRUE; |
cleanup_dri_screen: |
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen); |
return EGL_FALSE; |
} |
/** |
* Called via eglInitialize(), GLX_drv->API.Initialize(). |
*/ |
static EGLBoolean |
dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
/* not until swrast_dri is supported */ |
if (disp->Options.UseFallback) |
return EGL_FALSE; |
return dri2_initialize_drm(drv, disp); |
#if 0 |
switch (disp->Platform) { |
#ifdef HAVE_X11_PLATFORM |
case _EGL_PLATFORM_X11: |
if (disp->Options.TestOnly) |
return EGL_TRUE; |
return dri2_initialize_x11(drv, disp); |
#endif |
#ifdef HAVE_LIBUDEV |
#ifdef HAVE_DRM_PLATFORM |
case _EGL_PLATFORM_DRM: |
if (disp->Options.TestOnly) |
return EGL_TRUE; |
return dri2_initialize_drm(drv, disp); |
#endif |
#ifdef HAVE_WAYLAND_PLATFORM |
case _EGL_PLATFORM_WAYLAND: |
if (disp->Options.TestOnly) |
return EGL_TRUE; |
return dri2_initialize_wayland(drv, disp); |
#endif |
#endif |
#ifdef HAVE_ANDROID_PLATFORM |
case _EGL_PLATFORM_ANDROID: |
if (disp->Options.TestOnly) |
return EGL_TRUE; |
return dri2_initialize_android(drv, disp); |
#endif |
default: |
return EGL_FALSE; |
} |
#endif |
} |
/** |
* Called via eglTerminate(), drv->API.Terminate(). |
*/ |
static EGLBoolean |
dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
_eglReleaseDisplayResources(drv, disp); |
_eglCleanupDisplay(disp); |
if (dri2_dpy->own_dri_screen) |
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen); |
// if (dri2_dpy->fd) |
// close(dri2_dpy->fd); |
// if (dri2_dpy->driver) |
// dlclose(dri2_dpy->driver); |
free(dri2_dpy->device_name); |
if (disp->PlatformDisplay == NULL) { |
switch (disp->Platform) { |
#ifdef HAVE_X11_PLATFORM |
case _EGL_PLATFORM_X11: |
xcb_disconnect(dri2_dpy->conn); |
break; |
#endif |
#ifdef HAVE_DRM_PLATFORM |
case _EGL_PLATFORM_DRM: |
if (dri2_dpy->own_device) { |
gbm_device_destroy(&dri2_dpy->gbm_dri->base.base); |
} |
break; |
#endif |
default: |
break; |
} |
} |
free(dri2_dpy); |
disp->DriverData = NULL; |
return EGL_TRUE; |
} |
/** |
* Set the error code after a call to |
* dri2_egl_display::dri2::createContextAttribs. |
*/ |
static void |
dri2_create_context_attribs_error(int dri_error) |
{ |
EGLint egl_error; |
switch (dri_error) { |
case __DRI_CTX_ERROR_SUCCESS: |
return; |
case __DRI_CTX_ERROR_NO_MEMORY: |
egl_error = EGL_BAD_ALLOC; |
break; |
/* From the EGL_KHR_create_context spec, section "Errors": |
* |
* * If <config> does not support a client API context compatible |
* with the requested API major and minor version, [...] context flags, |
* and context reset notification behavior (for client API types where |
* these attributes are supported), then an EGL_BAD_MATCH error is |
* generated. |
* |
* * If an OpenGL ES context is requested and the values for |
* attributes EGL_CONTEXT_MAJOR_VERSION_KHR and |
* EGL_CONTEXT_MINOR_VERSION_KHR specify an OpenGL ES version that |
* is not defined, than an EGL_BAD_MATCH error is generated. |
* |
* * If an OpenGL context is requested, the requested version is |
* greater than 3.2, and the value for attribute |
* EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR has no bits set; has any |
* bits set other than EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR and |
* EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; has more than |
* one of these bits set; or if the implementation does not support |
* the requested profile, then an EGL_BAD_MATCH error is generated. |
*/ |
case __DRI_CTX_ERROR_BAD_API: |
case __DRI_CTX_ERROR_BAD_VERSION: |
case __DRI_CTX_ERROR_BAD_FLAG: |
egl_error = EGL_BAD_MATCH; |
break; |
/* From the EGL_KHR_create_context spec, section "Errors": |
* |
* * If an attribute name or attribute value in <attrib_list> is not |
* recognized (including unrecognized bits in bitmask attributes), |
* then an EGL_BAD_ATTRIBUTE error is generated." |
*/ |
case __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE: |
case __DRI_CTX_ERROR_UNKNOWN_FLAG: |
egl_error = EGL_BAD_ATTRIBUTE; |
break; |
default: |
assert(0); |
egl_error = EGL_BAD_MATCH; |
break; |
} |
_eglError(egl_error, "dri2_create_context"); |
} |
/** |
* Called via eglCreateContext(), drv->API.CreateContext(). |
*/ |
static _EGLContext * |
dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, |
_EGLContext *share_list, const EGLint *attrib_list) |
{ |
struct dri2_egl_context *dri2_ctx; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_context *dri2_ctx_shared = dri2_egl_context(share_list); |
__DRIcontext *shared = |
dri2_ctx_shared ? dri2_ctx_shared->dri_context : NULL; |
struct dri2_egl_config *dri2_config = dri2_egl_config(conf); |
const __DRIconfig *dri_config; |
int api; |
(void) drv; |
dri2_ctx = malloc(sizeof *dri2_ctx); |
if (!dri2_ctx) { |
_eglError(EGL_BAD_ALLOC, "eglCreateContext"); |
return NULL; |
} |
if (!_eglInitContext(&dri2_ctx->base, disp, conf, attrib_list)) |
goto cleanup; |
switch (dri2_ctx->base.ClientAPI) { |
case EGL_OPENGL_ES_API: |
switch (dri2_ctx->base.ClientMajorVersion) { |
case 1: |
api = __DRI_API_GLES; |
break; |
case 2: |
api = __DRI_API_GLES2; |
break; |
case 3: |
api = __DRI_API_GLES3; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, "eglCreateContext"); |
return NULL; |
} |
break; |
case EGL_OPENGL_API: |
if ((dri2_ctx->base.ClientMajorVersion >= 4 |
|| (dri2_ctx->base.ClientMajorVersion == 3 |
&& dri2_ctx->base.ClientMinorVersion >= 2)) |
&& dri2_ctx->base.Profile == EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR) |
api = __DRI_API_OPENGL_CORE; |
else |
api = __DRI_API_OPENGL; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, "eglCreateContext"); |
free(dri2_ctx); |
return NULL; |
} |
if (conf != NULL) { |
/* The config chosen here isn't necessarily |
* used for surfaces later. |
* A pixmap surface will use the single config. |
* This opportunity depends on disabling the |
* doubleBufferMode check in |
* src/mesa/main/context.c:check_compatible() |
*/ |
if (dri2_config->dri_double_config) |
dri_config = dri2_config->dri_double_config; |
else |
dri_config = dri2_config->dri_single_config; |
/* EGL_WINDOW_BIT is set only when there is a dri_double_config. This |
* makes sure the back buffer will always be used. |
*/ |
if (conf->SurfaceType & EGL_WINDOW_BIT) |
dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER; |
} |
else |
dri_config = NULL; |
if (dri2_dpy->dri2) { |
if (dri2_dpy->dri2->base.version >= 3) { |
unsigned error; |
unsigned num_attribs = 0; |
uint32_t ctx_attribs[8]; |
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION; |
ctx_attribs[num_attribs++] = dri2_ctx->base.ClientMajorVersion; |
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION; |
ctx_attribs[num_attribs++] = dri2_ctx->base.ClientMinorVersion; |
if (dri2_ctx->base.Flags != 0) { |
/* If the implementation doesn't support the __DRI2_ROBUSTNESS |
* extension, don't even try to send it the robust-access flag. |
* It may explode. Instead, generate the required EGL error here. |
*/ |
if ((dri2_ctx->base.Flags & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) != 0 |
&& !dri2_dpy->robustness) { |
_eglError(EGL_BAD_MATCH, "eglCreateContext"); |
goto cleanup; |
} |
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_FLAGS; |
ctx_attribs[num_attribs++] = dri2_ctx->base.Flags; |
} |
if (dri2_ctx->base.ResetNotificationStrategy != EGL_NO_RESET_NOTIFICATION_KHR) { |
/* If the implementation doesn't support the __DRI2_ROBUSTNESS |
* extension, don't even try to send it a reset strategy. It may |
* explode. Instead, generate the required EGL error here. |
*/ |
if (!dri2_dpy->robustness) { |
_eglError(EGL_BAD_CONFIG, "eglCreateContext"); |
goto cleanup; |
} |
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY; |
ctx_attribs[num_attribs++] = __DRI_CTX_RESET_LOSE_CONTEXT; |
} |
assert(num_attribs <= ARRAY_SIZE(ctx_attribs)); |
dri2_ctx->dri_context = |
dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen, |
api, |
dri_config, |
shared, |
num_attribs / 2, |
ctx_attribs, |
& error, |
dri2_ctx); |
dri2_create_context_attribs_error(error); |
} else { |
dri2_ctx->dri_context = |
dri2_dpy->dri2->createNewContextForAPI(dri2_dpy->dri_screen, |
api, |
dri_config, |
shared, |
dri2_ctx); |
} |
} else { |
assert(dri2_dpy->swrast); |
dri2_ctx->dri_context = |
dri2_dpy->swrast->createNewContextForAPI(dri2_dpy->dri_screen, |
api, |
dri_config, |
shared, |
dri2_ctx); |
} |
if (!dri2_ctx->dri_context) |
goto cleanup; |
return &dri2_ctx->base; |
cleanup: |
free(dri2_ctx); |
return NULL; |
} |
/** |
* Called via eglDestroyContext(), drv->API.DestroyContext(). |
*/ |
static EGLBoolean |
dri2_destroy_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) |
{ |
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
if (_eglPutContext(ctx)) { |
dri2_dpy->core->destroyContext(dri2_ctx->dri_context); |
free(dri2_ctx); |
} |
return EGL_TRUE; |
} |
/** |
* Called via eglMakeCurrent(), drv->API.MakeCurrent(). |
*/ |
static EGLBoolean |
dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, |
_EGLSurface *rsurf, _EGLContext *ctx) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_dsurf = dri2_egl_surface(dsurf); |
struct dri2_egl_surface *dri2_rsurf = dri2_egl_surface(rsurf); |
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); |
_EGLContext *old_ctx; |
_EGLSurface *old_dsurf, *old_rsurf; |
__DRIdrawable *ddraw, *rdraw; |
__DRIcontext *cctx; |
/* make new bindings */ |
if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf)) |
return EGL_FALSE; |
/* flush before context switch */ |
if (old_ctx && dri2_drv->glFlush) |
dri2_drv->glFlush(); |
ddraw = (dri2_dsurf) ? dri2_dsurf->dri_drawable : NULL; |
rdraw = (dri2_rsurf) ? dri2_rsurf->dri_drawable : NULL; |
cctx = (dri2_ctx) ? dri2_ctx->dri_context : NULL; |
if (old_ctx) { |
__DRIcontext *old_cctx = dri2_egl_context(old_ctx)->dri_context; |
dri2_dpy->core->unbindContext(old_cctx); |
} |
if ((cctx == NULL && ddraw == NULL && rdraw == NULL) || |
dri2_dpy->core->bindContext(cctx, ddraw, rdraw)) { |
if (old_dsurf) |
drv->API.DestroySurface(drv, disp, old_dsurf); |
if (old_rsurf) |
drv->API.DestroySurface(drv, disp, old_rsurf); |
if (old_ctx) |
drv->API.DestroyContext(drv, disp, old_ctx); |
return EGL_TRUE; |
} else { |
/* undo the previous _eglBindContext */ |
_eglBindContext(old_ctx, old_dsurf, old_rsurf, &ctx, &dsurf, &rsurf); |
assert(&dri2_ctx->base == ctx && |
&dri2_dsurf->base == dsurf && |
&dri2_rsurf->base == rsurf); |
_eglPutSurface(dsurf); |
_eglPutSurface(rsurf); |
_eglPutContext(ctx); |
_eglPutSurface(old_dsurf); |
_eglPutSurface(old_rsurf); |
_eglPutContext(old_ctx); |
return EGL_FALSE; |
} |
} |
/* |
* Called from eglGetProcAddress() via drv->API.GetProcAddress(). |
*/ |
static _EGLProc |
dri2_get_proc_address(_EGLDriver *drv, const char *procname) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
return dri2_drv->get_proc_address(procname); |
} |
static EGLBoolean |
dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(ctx->DrawSurface); |
(void) drv; |
/* FIXME: If EGL allows frontbuffer rendering for window surfaces, |
* we need to copy fake to real here.*/ |
if (dri2_dpy->flush != NULL) |
dri2_dpy->flush->flush(dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_wait_native(_EGLDriver *drv, _EGLDisplay *disp, EGLint engine) |
{ |
(void) drv; |
(void) disp; |
if (engine != EGL_CORE_NATIVE_ENGINE) |
return _eglError(EGL_BAD_PARAMETER, "eglWaitNative"); |
/* glXWaitX(); */ |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_bind_tex_image(_EGLDriver *drv, |
_EGLDisplay *disp, _EGLSurface *surf, EGLint buffer) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
struct dri2_egl_context *dri2_ctx; |
_EGLContext *ctx; |
GLint format, target; |
ctx = _eglGetCurrentContext(); |
dri2_ctx = dri2_egl_context(ctx); |
if (!_eglBindTexImage(drv, disp, surf, buffer)) |
return EGL_FALSE; |
switch (dri2_surf->base.TextureFormat) { |
case EGL_TEXTURE_RGB: |
format = __DRI_TEXTURE_FORMAT_RGB; |
break; |
case EGL_TEXTURE_RGBA: |
format = __DRI_TEXTURE_FORMAT_RGBA; |
break; |
default: |
assert(0); |
} |
switch (dri2_surf->base.TextureTarget) { |
case EGL_TEXTURE_2D: |
target = GL_TEXTURE_2D; |
break; |
default: |
assert(0); |
} |
(*dri2_dpy->tex_buffer->setTexBuffer2)(dri2_ctx->dri_context, |
target, format, |
dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_release_tex_image(_EGLDriver *drv, |
_EGLDisplay *disp, _EGLSurface *surf, EGLint buffer) |
{ |
#if __DRI_TEX_BUFFER_VERSION >= 3 |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
struct dri2_egl_context *dri2_ctx; |
_EGLContext *ctx; |
GLint target; |
ctx = _eglGetCurrentContext(); |
dri2_ctx = dri2_egl_context(ctx); |
if (!_eglReleaseTexImage(drv, disp, surf, buffer)) |
return EGL_FALSE; |
switch (dri2_surf->base.TextureTarget) { |
case EGL_TEXTURE_2D: |
target = GL_TEXTURE_2D; |
break; |
default: |
assert(0); |
} |
if (dri2_dpy->tex_buffer->releaseTexBuffer!=NULL) |
(*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context, |
target, |
dri2_surf->dri_drawable); |
#endif |
return EGL_TRUE; |
} |
static _EGLImage * |
dri2_create_image(_EGLDisplay *disp, __DRIimage *dri_image) |
{ |
struct dri2_egl_image *dri2_img; |
if (dri_image == NULL) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image"); |
return NULL; |
} |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image"); |
return NULL; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
free(dri2_img); |
return NULL; |
} |
dri2_img->dri_image = dri_image; |
return &dri2_img->base; |
} |
static _EGLImage * |
dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer buffer, |
const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); |
GLuint renderbuffer = (GLuint) (uintptr_t) buffer; |
__DRIimage *dri_image; |
if (renderbuffer == 0) { |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
dri_image = |
dri2_dpy->image->createImageFromRenderbuffer(dri2_ctx->dri_context, |
renderbuffer, NULL); |
return dri2_create_image(disp, dri_image); |
} |
static _EGLImage * |
dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
EGLint format, name, pitch, err; |
_EGLImageAttribs attrs; |
__DRIimage *dri_image; |
name = (EGLint) (uintptr_t) buffer; |
err = _eglParseImageAttribList(&attrs, disp, attr_list); |
if (err != EGL_SUCCESS) |
return NULL; |
if (attrs.Width <= 0 || attrs.Height <= 0 || |
attrs.DRMBufferStrideMESA <= 0) { |
_eglError(EGL_BAD_PARAMETER, |
"bad width, height or stride"); |
return NULL; |
} |
switch (attrs.DRMBufferFormatMESA) { |
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: |
format = __DRI_IMAGE_FORMAT_ARGB8888; |
pitch = attrs.DRMBufferStrideMESA; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, |
"dri2_create_image_khr: unsupported pixmap depth"); |
return NULL; |
} |
dri_image = |
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, |
attrs.Width, |
attrs.Height, |
format, |
name, |
pitch, |
NULL); |
return dri2_create_image(disp, dri_image); |
} |
#ifdef HAVE_WAYLAND_PLATFORM |
/* This structure describes how a wl_buffer maps to one or more |
* __DRIimages. A wl_drm_buffer stores the wl_drm format code and the |
* offsets and strides of the planes in the buffer. This table maps a |
* wl_drm format code to a description of the planes in the buffer |
* that lets us create a __DRIimage for each of the planes. */ |
static const struct wl_drm_components_descriptor { |
uint32_t dri_components; |
EGLint components; |
int nplanes; |
} wl_drm_components[] = { |
{ __DRI_IMAGE_COMPONENTS_RGB, EGL_TEXTURE_RGB, 1 }, |
{ __DRI_IMAGE_COMPONENTS_RGBA, EGL_TEXTURE_RGBA, 1 }, |
{ __DRI_IMAGE_COMPONENTS_Y_U_V, EGL_TEXTURE_Y_U_V_WL, 3 }, |
{ __DRI_IMAGE_COMPONENTS_Y_UV, EGL_TEXTURE_Y_UV_WL, 2 }, |
{ __DRI_IMAGE_COMPONENTS_Y_XUXV, EGL_TEXTURE_Y_XUXV_WL, 2 }, |
}; |
static _EGLImage * |
dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer _buffer, |
const EGLint *attr_list) |
{ |
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
const struct wl_drm_components_descriptor *f; |
__DRIimage *dri_image; |
_EGLImageAttribs attrs; |
EGLint err; |
int32_t plane; |
if (!wayland_buffer_is_drm(&buffer->buffer)) |
return NULL; |
err = _eglParseImageAttribList(&attrs, disp, attr_list); |
plane = attrs.PlaneWL; |
if (err != EGL_SUCCESS) { |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer"); |
return NULL; |
} |
f = buffer->driver_format; |
if (plane < 0 || plane >= f->nplanes) { |
_eglError(EGL_BAD_PARAMETER, |
"dri2_create_image_wayland_wl_buffer (plane out of bounds)"); |
return NULL; |
} |
dri_image = dri2_dpy->image->fromPlanar(buffer->driver_buffer, plane, NULL); |
if (dri_image == NULL) { |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer"); |
return NULL; |
} |
return dri2_create_image(disp, dri_image); |
} |
#endif |
/** |
* Set the error code after a call to |
* dri2_egl_image::dri_image::createImageFromTexture. |
*/ |
static void |
dri2_create_image_khr_texture_error(int dri_error) |
{ |
EGLint egl_error; |
switch (dri_error) { |
case __DRI_IMAGE_ERROR_SUCCESS: |
return; |
case __DRI_IMAGE_ERROR_BAD_ALLOC: |
egl_error = EGL_BAD_ALLOC; |
break; |
case __DRI_IMAGE_ERROR_BAD_MATCH: |
egl_error = EGL_BAD_MATCH; |
break; |
case __DRI_IMAGE_ERROR_BAD_PARAMETER: |
egl_error = EGL_BAD_PARAMETER; |
break; |
default: |
assert(0); |
egl_error = EGL_BAD_MATCH; |
break; |
} |
_eglError(egl_error, "dri2_create_image_khr_texture"); |
} |
static _EGLImage * |
dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx, |
EGLenum target, |
EGLClientBuffer buffer, |
const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); |
struct dri2_egl_image *dri2_img; |
GLuint texture = (GLuint) (uintptr_t) buffer; |
_EGLImageAttribs attrs; |
GLuint depth; |
GLenum gl_target; |
unsigned error; |
if (texture == 0) { |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
if (_eglParseImageAttribList(&attrs, disp, attr_list) != EGL_SUCCESS) |
return EGL_NO_IMAGE_KHR; |
switch (target) { |
case EGL_GL_TEXTURE_2D_KHR: |
depth = 0; |
gl_target = GL_TEXTURE_2D; |
break; |
case EGL_GL_TEXTURE_3D_KHR: |
depth = attrs.GLTextureZOffset; |
gl_target = GL_TEXTURE_3D; |
break; |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: |
depth = target - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR; |
gl_target = GL_TEXTURE_CUBE_MAP; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); |
free(dri2_img); |
return EGL_NO_IMAGE_KHR; |
} |
dri2_img->dri_image = |
dri2_dpy->image->createImageFromTexture(dri2_ctx->dri_context, |
gl_target, |
texture, |
depth, |
attrs.GLTextureLevel, |
&error, |
dri2_img); |
dri2_create_image_khr_texture_error(error); |
if (!dri2_img->dri_image) { |
free(dri2_img); |
return EGL_NO_IMAGE_KHR; |
} |
return &dri2_img->base; |
} |
_EGLImage * |
dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLContext *ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
(void) drv; |
switch (target) { |
case EGL_GL_TEXTURE_2D_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: |
return dri2_create_image_khr_texture(disp, ctx, target, buffer, attr_list); |
case EGL_GL_RENDERBUFFER_KHR: |
return dri2_create_image_khr_renderbuffer(disp, ctx, buffer, attr_list); |
case EGL_DRM_BUFFER_MESA: |
return dri2_create_image_mesa_drm_buffer(disp, ctx, buffer, attr_list); |
#ifdef HAVE_WAYLAND_PLATFORM |
case EGL_WAYLAND_BUFFER_WL: |
return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list); |
#endif |
default: |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
} |
static EGLBoolean |
dri2_destroy_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *image) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_image *dri2_img = dri2_egl_image(image); |
(void) drv; |
dri2_dpy->image->destroyImage(dri2_img->dri_image); |
free(dri2_img); |
return EGL_TRUE; |
} |
static _EGLImage * |
dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, |
const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_image *dri2_img; |
_EGLImageAttribs attrs; |
unsigned int dri_use, valid_mask; |
int format; |
EGLint err = EGL_SUCCESS; |
(void) drv; |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
if (!attr_list) { |
err = EGL_BAD_PARAMETER; |
goto cleanup_img; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
err = EGL_BAD_PARAMETER; |
goto cleanup_img; |
} |
err = _eglParseImageAttribList(&attrs, disp, attr_list); |
if (err != EGL_SUCCESS) |
goto cleanup_img; |
if (attrs.Width <= 0 || attrs.Height <= 0) { |
_eglLog(_EGL_WARNING, "bad width or height (%dx%d)", |
attrs.Width, attrs.Height); |
goto cleanup_img; |
} |
switch (attrs.DRMBufferFormatMESA) { |
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: |
format = __DRI_IMAGE_FORMAT_ARGB8888; |
break; |
default: |
_eglLog(_EGL_WARNING, "bad image format value 0x%04x", |
attrs.DRMBufferFormatMESA); |
goto cleanup_img; |
} |
valid_mask = |
EGL_DRM_BUFFER_USE_SCANOUT_MESA | |
EGL_DRM_BUFFER_USE_SHARE_MESA | |
EGL_DRM_BUFFER_USE_CURSOR_MESA; |
if (attrs.DRMBufferUseMESA & ~valid_mask) { |
_eglLog(_EGL_WARNING, "bad image use bit 0x%04x", |
attrs.DRMBufferUseMESA & ~valid_mask); |
goto cleanup_img; |
} |
dri_use = 0; |
if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_SHARE_MESA) |
dri_use |= __DRI_IMAGE_USE_SHARE; |
if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_SCANOUT_MESA) |
dri_use |= __DRI_IMAGE_USE_SCANOUT; |
if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_CURSOR_MESA) |
dri_use |= __DRI_IMAGE_USE_CURSOR; |
dri2_img->dri_image = |
dri2_dpy->image->createImage(dri2_dpy->dri_screen, |
attrs.Width, attrs.Height, |
format, dri_use, dri2_img); |
if (dri2_img->dri_image == NULL) { |
err = EGL_BAD_ALLOC; |
goto cleanup_img; |
} |
return &dri2_img->base; |
cleanup_img: |
free(dri2_img); |
_eglError(err, "dri2_create_drm_image_mesa"); |
return EGL_NO_IMAGE_KHR; |
} |
static EGLBoolean |
dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, |
EGLint *name, EGLint *handle, EGLint *stride) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_image *dri2_img = dri2_egl_image(img); |
(void) drv; |
if (name && !dri2_dpy->image->queryImage(dri2_img->dri_image, |
__DRI_IMAGE_ATTRIB_NAME, name)) { |
_eglError(EGL_BAD_ALLOC, "dri2_export_drm_image_mesa"); |
return EGL_FALSE; |
} |
if (handle) |
dri2_dpy->image->queryImage(dri2_img->dri_image, |
__DRI_IMAGE_ATTRIB_HANDLE, handle); |
if (stride) |
dri2_dpy->image->queryImage(dri2_img->dri_image, |
__DRI_IMAGE_ATTRIB_STRIDE, stride); |
return EGL_TRUE; |
} |
#ifdef HAVE_WAYLAND_PLATFORM |
static void |
dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd, |
struct wl_drm_buffer *buffer) |
{ |
_EGLDisplay *disp = user_data; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
__DRIimage *img; |
int i, dri_components = 0; |
if (fd == -1) |
img = dri2_dpy->image->createImageFromNames(dri2_dpy->dri_screen, |
buffer->buffer.width, |
buffer->buffer.height, |
buffer->format, |
(int*)&name, 1, |
buffer->stride, |
buffer->offset, |
NULL); |
else |
img = dri2_dpy->image->createImageFromFds(dri2_dpy->dri_screen, |
buffer->buffer.width, |
buffer->buffer.height, |
buffer->format, |
&fd, 1, |
buffer->stride, |
buffer->offset, |
NULL); |
if (img == NULL) |
return; |
dri2_dpy->image->queryImage(img, __DRI_IMAGE_ATTRIB_COMPONENTS, &dri_components); |
buffer->driver_format = NULL; |
for (i = 0; i < ARRAY_SIZE(wl_drm_components); i++) |
if (wl_drm_components[i].dri_components == dri_components) |
buffer->driver_format = &wl_drm_components[i]; |
if (buffer->driver_format == NULL) |
dri2_dpy->image->destroyImage(img); |
else |
buffer->driver_buffer = img; |
} |
static void |
dri2_wl_release_buffer(void *user_data, struct wl_drm_buffer *buffer) |
{ |
_EGLDisplay *disp = user_data; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
dri2_dpy->image->destroyImage(buffer->driver_buffer); |
} |
static struct wayland_drm_callbacks wl_drm_callbacks = { |
.authenticate = NULL, |
.reference_buffer = dri2_wl_reference_buffer, |
.release_buffer = dri2_wl_release_buffer |
}; |
static EGLBoolean |
dri2_bind_wayland_display_wl(_EGLDriver *drv, _EGLDisplay *disp, |
struct wl_display *wl_dpy) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
int ret, flags = 0; |
uint64_t cap; |
(void) drv; |
if (dri2_dpy->wl_server_drm) |
return EGL_FALSE; |
wl_drm_callbacks.authenticate = |
(int(*)(void *, uint32_t)) dri2_dpy->authenticate; |
ret = drmGetCap(dri2_dpy->fd, DRM_CAP_PRIME, &cap); |
if (ret == 0 && cap == (DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT) && |
dri2_dpy->image->base.version >= 7 && |
dri2_dpy->image->createImageFromFds != NULL) |
flags |= WAYLAND_DRM_PRIME; |
dri2_dpy->wl_server_drm = |
wayland_drm_init(wl_dpy, dri2_dpy->device_name, |
&wl_drm_callbacks, disp, flags); |
if (!dri2_dpy->wl_server_drm) |
return EGL_FALSE; |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_unbind_wayland_display_wl(_EGLDriver *drv, _EGLDisplay *disp, |
struct wl_display *wl_dpy) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
(void) drv; |
if (!dri2_dpy->wl_server_drm) |
return EGL_FALSE; |
wayland_drm_uninit(dri2_dpy->wl_server_drm); |
dri2_dpy->wl_server_drm = NULL; |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *disp, |
struct wl_buffer *_buffer, |
EGLint attribute, EGLint *value) |
{ |
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer; |
const struct wl_drm_components_descriptor *format; |
if (!wayland_buffer_is_drm(&buffer->buffer)) |
return EGL_FALSE; |
format = buffer->driver_format; |
switch (attribute) { |
case EGL_TEXTURE_FORMAT: |
*value = format->components; |
return EGL_TRUE; |
case EGL_WIDTH: |
*value = buffer->buffer.width; |
return EGL_TRUE; |
case EGL_HEIGHT: |
*value = buffer->buffer.height; |
return EGL_TRUE; |
} |
return EGL_FALSE; |
} |
#endif |
static void |
dri2_unload(_EGLDriver *drv) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
// if (dri2_drv->handle) |
// dlclose(dri2_drv->handle); |
free(dri2_drv); |
} |
static EGLBoolean |
dri2_load(_EGLDriver *drv) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
const char *libname = "libGL.dll"; |
lib_handle handle; |
handle = load_library(libname); |
if (handle) { |
dri2_drv->get_proc_address = (_EGLProc (*)(const char *)) |
get_proc_address(handle, "_glapi_get_proc_address"); |
if (!dri2_drv->get_proc_address) { |
/* no need to keep a reference */ |
handle = 0; |
} |
} |
/* if glapi is not available, loading DRI drivers will fail */ |
if (!dri2_drv->get_proc_address) { |
_eglLog(_EGL_WARNING, "DRI2: failed to find _glapi_get_proc_address"); |
return EGL_FALSE; |
} |
dri2_drv->glFlush = (void (*)(void)) |
dri2_drv->get_proc_address("glFlush"); |
dri2_drv->handle = (void*)handle; |
return EGL_TRUE; |
} |
/** |
* This is the main entrypoint into the driver, called by libEGL. |
* Create a new _EGLDriver object and init its dispatch table. |
*/ |
_EGLDriver * |
_eglBuiltInDriverDRI2(const char *args) |
{ |
struct dri2_egl_driver *dri2_drv; |
(void) args; |
dri2_drv = calloc(1, sizeof *dri2_drv); |
if (!dri2_drv) |
return NULL; |
if (!dri2_load(&dri2_drv->base)) { |
free(dri2_drv); |
return NULL; |
} |
_eglInitDriverFallbacks(&dri2_drv->base); |
dri2_drv->base.API.Initialize = dri2_initialize; |
dri2_drv->base.API.Terminate = dri2_terminate; |
dri2_drv->base.API.CreateContext = dri2_create_context; |
dri2_drv->base.API.DestroyContext = dri2_destroy_context; |
dri2_drv->base.API.MakeCurrent = dri2_make_current; |
dri2_drv->base.API.GetProcAddress = dri2_get_proc_address; |
dri2_drv->base.API.WaitClient = dri2_wait_client; |
dri2_drv->base.API.WaitNative = dri2_wait_native; |
dri2_drv->base.API.BindTexImage = dri2_bind_tex_image; |
dri2_drv->base.API.ReleaseTexImage = dri2_release_tex_image; |
dri2_drv->base.API.CreateImageKHR = dri2_create_image_khr; |
dri2_drv->base.API.DestroyImageKHR = dri2_destroy_image_khr; |
dri2_drv->base.API.CreateDRMImageMESA = dri2_create_drm_image_mesa; |
dri2_drv->base.API.ExportDRMImageMESA = dri2_export_drm_image_mesa; |
#ifdef HAVE_WAYLAND_PLATFORM |
dri2_drv->base.API.BindWaylandDisplayWL = dri2_bind_wayland_display_wl; |
dri2_drv->base.API.UnbindWaylandDisplayWL = dri2_unbind_wayland_display_wl; |
dri2_drv->base.API.QueryWaylandBufferWL = dri2_query_wayland_buffer_wl; |
#endif |
dri2_drv->base.Name = "DRI2"; |
dri2_drv->base.Unload = dri2_unload; |
return &dri2_drv->base; |
} |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/egl_dri2.c.bak |
---|
0,0 → 1,1780 |
/* |
* Copyright © 2010 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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
*/ |
#include <stdlib.h> |
#include <string.h> |
#include <stdio.h> |
#include <limits.h> |
#include <fcntl.h> |
#include <errno.h> |
#include <unistd.h> |
#include <xf86drm.h> |
#include <GL/gl.h> |
#include <GL/internal/dri_interface.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#define EGL_EGLEXT_PROTOTYPES |
#include <EGL/egl.h> |
#include <EGL/eglext.h> |
#include "eglmode.h" |
#include "eglscreen.h" |
#include "egl_dri2.h" |
typedef unsigned int lib_handle; |
lib_handle load_library(const char *name); |
void *get_proc_address(lib_handle lib, char *proc_name); |
const __DRIuseInvalidateExtension use_invalidate = { |
{ __DRI_USE_INVALIDATE, 1 } |
}; |
EGLint dri2_to_egl_attribute_map[] = { |
0, |
EGL_BUFFER_SIZE, /* __DRI_ATTRIB_BUFFER_SIZE */ |
EGL_LEVEL, /* __DRI_ATTRIB_LEVEL */ |
EGL_RED_SIZE, /* __DRI_ATTRIB_RED_SIZE */ |
EGL_GREEN_SIZE, /* __DRI_ATTRIB_GREEN_SIZE */ |
EGL_BLUE_SIZE, /* __DRI_ATTRIB_BLUE_SIZE */ |
EGL_LUMINANCE_SIZE, /* __DRI_ATTRIB_LUMINANCE_SIZE */ |
EGL_ALPHA_SIZE, /* __DRI_ATTRIB_ALPHA_SIZE */ |
0, /* __DRI_ATTRIB_ALPHA_MASK_SIZE */ |
EGL_DEPTH_SIZE, /* __DRI_ATTRIB_DEPTH_SIZE */ |
EGL_STENCIL_SIZE, /* __DRI_ATTRIB_STENCIL_SIZE */ |
0, /* __DRI_ATTRIB_ACCUM_RED_SIZE */ |
0, /* __DRI_ATTRIB_ACCUM_GREEN_SIZE */ |
0, /* __DRI_ATTRIB_ACCUM_BLUE_SIZE */ |
0, /* __DRI_ATTRIB_ACCUM_ALPHA_SIZE */ |
EGL_SAMPLE_BUFFERS, /* __DRI_ATTRIB_SAMPLE_BUFFERS */ |
EGL_SAMPLES, /* __DRI_ATTRIB_SAMPLES */ |
0, /* __DRI_ATTRIB_RENDER_TYPE, */ |
0, /* __DRI_ATTRIB_CONFIG_CAVEAT */ |
0, /* __DRI_ATTRIB_CONFORMANT */ |
0, /* __DRI_ATTRIB_DOUBLE_BUFFER */ |
0, /* __DRI_ATTRIB_STEREO */ |
0, /* __DRI_ATTRIB_AUX_BUFFERS */ |
0, /* __DRI_ATTRIB_TRANSPARENT_TYPE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_RED_VALUE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE */ |
0, /* __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE */ |
0, /* __DRI_ATTRIB_FLOAT_MODE (deprecated) */ |
0, /* __DRI_ATTRIB_RED_MASK */ |
0, /* __DRI_ATTRIB_GREEN_MASK */ |
0, /* __DRI_ATTRIB_BLUE_MASK */ |
0, /* __DRI_ATTRIB_ALPHA_MASK */ |
EGL_MAX_PBUFFER_WIDTH, /* __DRI_ATTRIB_MAX_PBUFFER_WIDTH */ |
EGL_MAX_PBUFFER_HEIGHT, /* __DRI_ATTRIB_MAX_PBUFFER_HEIGHT */ |
EGL_MAX_PBUFFER_PIXELS, /* __DRI_ATTRIB_MAX_PBUFFER_PIXELS */ |
0, /* __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH */ |
0, /* __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT */ |
0, /* __DRI_ATTRIB_VISUAL_SELECT_GROUP */ |
0, /* __DRI_ATTRIB_SWAP_METHOD */ |
EGL_MAX_SWAP_INTERVAL, /* __DRI_ATTRIB_MAX_SWAP_INTERVAL */ |
EGL_MIN_SWAP_INTERVAL, /* __DRI_ATTRIB_MIN_SWAP_INTERVAL */ |
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGB */ |
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA */ |
0, /* __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE */ |
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */ |
EGL_Y_INVERTED_NOK, /* __DRI_ATTRIB_YINVERTED */ |
0, /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */ |
}; |
static EGLBoolean |
dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria) |
{ |
if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0) |
return EGL_FALSE; |
if (!_eglMatchConfig(conf, criteria)) |
return EGL_FALSE; |
return EGL_TRUE; |
} |
struct dri2_egl_config * |
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, |
int depth, EGLint surface_type, const EGLint *attr_list, |
const unsigned int *rgba_masks) |
{ |
struct dri2_egl_config *conf; |
struct dri2_egl_display *dri2_dpy; |
_EGLConfig base; |
unsigned int attrib, value, double_buffer; |
EGLint key, bind_to_texture_rgb, bind_to_texture_rgba; |
unsigned int dri_masks[4] = { 0, 0, 0, 0 }; |
_EGLConfig *matching_config; |
EGLint num_configs = 0; |
EGLint config_id; |
int i; |
dri2_dpy = disp->DriverData; |
_eglInitConfig(&base, disp, id); |
i = 0; |
double_buffer = 0; |
bind_to_texture_rgb = 0; |
bind_to_texture_rgba = 0; |
while (dri2_dpy->core->indexConfigAttrib(dri_config, i++, &attrib, &value)) { |
switch (attrib) { |
case __DRI_ATTRIB_RENDER_TYPE: |
if (value & __DRI_ATTRIB_RGBA_BIT) |
value = EGL_RGB_BUFFER; |
else if (value & __DRI_ATTRIB_LUMINANCE_BIT) |
value = EGL_LUMINANCE_BUFFER; |
else |
return NULL; |
_eglSetConfigKey(&base, EGL_COLOR_BUFFER_TYPE, value); |
break; |
case __DRI_ATTRIB_CONFIG_CAVEAT: |
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG) |
value = EGL_NON_CONFORMANT_CONFIG; |
else if (value & __DRI_ATTRIB_SLOW_BIT) |
value = EGL_SLOW_CONFIG; |
else |
value = EGL_NONE; |
_eglSetConfigKey(&base, EGL_CONFIG_CAVEAT, value); |
break; |
case __DRI_ATTRIB_BIND_TO_TEXTURE_RGB: |
bind_to_texture_rgb = value; |
break; |
case __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA: |
bind_to_texture_rgba = value; |
break; |
case __DRI_ATTRIB_DOUBLE_BUFFER: |
double_buffer = value; |
break; |
case __DRI_ATTRIB_RED_MASK: |
dri_masks[0] = value; |
break; |
case __DRI_ATTRIB_GREEN_MASK: |
dri_masks[1] = value; |
break; |
case __DRI_ATTRIB_BLUE_MASK: |
dri_masks[2] = value; |
break; |
case __DRI_ATTRIB_ALPHA_MASK: |
dri_masks[3] = value; |
break; |
default: |
key = dri2_to_egl_attribute_map[attrib]; |
if (key != 0) |
_eglSetConfigKey(&base, key, value); |
break; |
} |
} |
if (attr_list) |
for (i = 0; attr_list[i] != EGL_NONE; i += 2) |
_eglSetConfigKey(&base, attr_list[i], attr_list[i+1]); |
/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig. Otherwise |
* it will only match a 32-bit RGBA visual. On a composited window manager |
* on X11, this will make all of the EGLConfigs with destination alpha get |
* blended by the compositor. This is probably not what the application |
* wants... especially on drivers that only have 32-bit RGBA EGLConfigs! |
*/ |
if (depth > 0 && depth != base.BufferSize |
&& !(depth == 24 && base.BufferSize == 32)) |
return NULL; |
if (rgba_masks && memcmp(rgba_masks, dri_masks, sizeof(dri_masks))) |
return NULL; |
base.NativeRenderable = EGL_TRUE; |
base.SurfaceType = surface_type; |
if (surface_type & (EGL_PBUFFER_BIT | |
(disp->Extensions.NOK_texture_from_pixmap ? EGL_PIXMAP_BIT : 0))) { |
base.BindToTextureRGB = bind_to_texture_rgb; |
if (base.AlphaSize > 0) |
base.BindToTextureRGBA = bind_to_texture_rgba; |
} |
base.RenderableType = disp->ClientAPIs; |
base.Conformant = disp->ClientAPIs; |
base.MinSwapInterval = dri2_dpy->min_swap_interval; |
base.MaxSwapInterval = dri2_dpy->max_swap_interval; |
if (!_eglValidateConfig(&base, EGL_FALSE)) { |
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id); |
return NULL; |
} |
config_id = base.ConfigID; |
base.ConfigID = EGL_DONT_CARE; |
base.SurfaceType = EGL_DONT_CARE; |
num_configs = _eglFilterArray(disp->Configs, (void **) &matching_config, 1, |
(_EGLArrayForEach) dri2_match_config, &base); |
if (num_configs == 1) { |
conf = (struct dri2_egl_config *) matching_config; |
if (double_buffer && !conf->dri_double_config) |
conf->dri_double_config = dri_config; |
else if (!double_buffer && !conf->dri_single_config) |
conf->dri_single_config = dri_config; |
else |
/* a similar config type is already added (unlikely) => discard */ |
return NULL; |
} |
else if (num_configs == 0) { |
conf = malloc(sizeof *conf); |
if (conf == NULL) |
return NULL; |
memcpy(&conf->base, &base, sizeof base); |
if (double_buffer) { |
conf->dri_double_config = dri_config; |
conf->dri_single_config = NULL; |
} else { |
conf->dri_single_config = dri_config; |
conf->dri_double_config = NULL; |
} |
conf->base.SurfaceType = 0; |
conf->base.ConfigID = config_id; |
_eglLinkConfig(&conf->base); |
} |
else { |
assert(0); |
return NULL; |
} |
if (double_buffer) { |
surface_type &= ~EGL_PIXMAP_BIT; |
} |
conf->base.SurfaceType |= surface_type; |
return conf; |
} |
__DRIimage * |
dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data) |
{ |
_EGLDisplay *disp = data; |
struct dri2_egl_image *dri2_img; |
_EGLImage *img; |
(void) screen; |
img = _eglLookupImage(image, disp); |
if (img == NULL) { |
_eglError(EGL_BAD_PARAMETER, "dri2_lookup_egl_image"); |
return NULL; |
} |
dri2_img = dri2_egl_image(image); |
return dri2_img->dri_image; |
} |
const __DRIimageLookupExtension image_lookup_extension = { |
{ __DRI_IMAGE_LOOKUP, 1 }, |
dri2_lookup_egl_image |
}; |
static const char dri_driver_path[] = "";//DEFAULT_DRIVER_DIR; |
struct dri2_extension_match { |
const char *name; |
int version; |
int offset; |
}; |
static struct dri2_extension_match dri2_driver_extensions[] = { |
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) }, |
{ __DRI_DRI2, 2, offsetof(struct dri2_egl_display, dri2) }, |
{ NULL, 0, 0 } |
}; |
static struct dri2_extension_match dri2_core_extensions[] = { |
{ __DRI2_FLUSH, 1, offsetof(struct dri2_egl_display, flush) }, |
{ __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) }, |
{ __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) }, |
{ NULL, 0, 0 } |
}; |
static struct dri2_extension_match swrast_driver_extensions[] = { |
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) }, |
{ __DRI_SWRAST, 2, offsetof(struct dri2_egl_display, swrast) }, |
{ NULL, 0, 0 } |
}; |
static struct dri2_extension_match swrast_core_extensions[] = { |
{ __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) }, |
{ NULL, 0, 0 } |
}; |
static EGLBoolean |
dri2_bind_extensions(struct dri2_egl_display *dri2_dpy, |
struct dri2_extension_match *matches, |
const __DRIextension **extensions) |
{ |
int i, j, ret = EGL_TRUE; |
void *field; |
for (i = 0; extensions[i]; i++) { |
_eglLog(_EGL_DEBUG, "DRI2: found extension `%s'", extensions[i]->name); |
for (j = 0; matches[j].name; j++) { |
if (strcmp(extensions[i]->name, matches[j].name) == 0 && |
extensions[i]->version >= matches[j].version) { |
field = ((char *) dri2_dpy + matches[j].offset); |
*(const __DRIextension **) field = extensions[i]; |
_eglLog(_EGL_INFO, "DRI2: found extension %s version %d", |
extensions[i]->name, extensions[i]->version); |
} |
} |
} |
for (j = 0; matches[j].name; j++) { |
field = ((char *) dri2_dpy + matches[j].offset); |
if (*(const __DRIextension **) field == NULL) { |
_eglLog(_EGL_FATAL, "DRI2: did not find extension %s version %d", |
matches[j].name, matches[j].version); |
ret = EGL_FALSE; |
} |
} |
return ret; |
} |
#if 0 |
static const __DRIextension ** |
dri2_open_driver(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = disp->DriverData; |
const __DRIextension **extensions; |
char path[PATH_MAX], *search_paths, *p, *next, *end; |
search_paths = NULL; |
if (geteuid() == getuid()) { |
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH */ |
search_paths = getenv("LIBGL_DRIVERS_PATH"); |
} |
// if (search_paths == NULL) |
// search_paths = DEFAULT_DRIVER_DIR; |
dri2_dpy->driver = NULL; |
end = search_paths + strlen(search_paths); |
for (p = search_paths; p < end && dri2_dpy->driver == NULL; p = next + 1) { |
int len; |
next = strchr(p, ':'); |
if (next == NULL) |
next = end; |
len = next - p; |
#if GLX_USE_TLS |
snprintf(path, sizeof path, |
"%.*s/tls/%s_dri.so", len, p, dri2_dpy->driver_name); |
dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
#endif |
if (dri2_dpy->driver == NULL) { |
snprintf(path, sizeof path, |
"%.*s/%s_dri.so", len, p, dri2_dpy->driver_name); |
dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
if (dri2_dpy->driver == NULL) |
_eglLog(_EGL_DEBUG, "failed to open %s: %s\n", path, dlerror()); |
} |
} |
if (dri2_dpy->driver == NULL) { |
_eglLog(_EGL_WARNING, |
"DRI2: failed to open %s (search paths %s)", |
dri2_dpy->driver_name, search_paths); |
return NULL; |
} |
_eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path); |
extensions = dlsym(dri2_dpy->driver, __DRI_DRIVER_EXTENSIONS); |
if (extensions == NULL) { |
_eglLog(_EGL_WARNING, |
"DRI2: driver exports no extensions (%s)", dlerror()); |
dlclose(dri2_dpy->driver); |
} |
return extensions; |
} |
EGLBoolean |
dri2_load_driver(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = disp->DriverData; |
const __DRIextension **extensions; |
extensions = dri2_open_driver(disp); |
if (!extensions) |
return EGL_FALSE; |
if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions)) { |
dlclose(dri2_dpy->driver); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
EGLBoolean |
dri2_load_driver_swrast(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = disp->DriverData; |
const __DRIextension **extensions; |
dri2_dpy->driver_name = "swrast"; |
extensions = dri2_open_driver(disp); |
if (!extensions) |
return EGL_FALSE; |
if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, extensions)) { |
dlclose(dri2_dpy->driver); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
#endif |
void |
dri2_setup_screen(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
unsigned int api_mask; |
if (dri2_dpy->dri2) { |
api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen); |
} else { |
assert(dri2_dpy->swrast); |
api_mask = 1 << __DRI_API_OPENGL | |
1 << __DRI_API_GLES | |
1 << __DRI_API_GLES2 | |
1 << __DRI_API_GLES3; |
} |
disp->ClientAPIs = 0; |
if (api_mask & (1 <<__DRI_API_OPENGL)) |
disp->ClientAPIs |= EGL_OPENGL_BIT; |
if (api_mask & (1 <<__DRI_API_GLES)) |
disp->ClientAPIs |= EGL_OPENGL_ES_BIT; |
if (api_mask & (1 << __DRI_API_GLES2)) |
disp->ClientAPIs |= EGL_OPENGL_ES2_BIT; |
if (api_mask & (1 << __DRI_API_GLES3)) |
disp->ClientAPIs |= EGL_OPENGL_ES3_BIT_KHR; |
assert(dri2_dpy->dri2 || dri2_dpy->swrast); |
disp->Extensions.KHR_surfaceless_context = EGL_TRUE; |
disp->Extensions.MESA_screen_surface = EGL_TRUE; |
if (dri2_dpy->dri2 && dri2_dpy->dri2->base.version >= 3) { |
disp->Extensions.KHR_create_context = EGL_TRUE; |
if (dri2_dpy->robustness) |
disp->Extensions.EXT_create_context_robustness = EGL_TRUE; |
} |
if (dri2_dpy->image) { |
disp->Extensions.MESA_drm_image = EGL_TRUE; |
disp->Extensions.KHR_image_base = EGL_TRUE; |
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE; |
if (dri2_dpy->image->base.version >= 5 && |
dri2_dpy->image->createImageFromTexture) { |
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE; |
disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE; |
} |
} |
{ |
_EGLMode *mode; |
_EGLScreen *screen = malloc(sizeof(*screen)); |
_eglInitScreen(screen, disp, 3); |
mode = &screen->Modes[0]; |
mode->Width = 800; |
mode->Height = 600; |
mode->RefreshRate = 60; |
mode->Optimal = EGL_FALSE; |
mode->Interlaced = EGL_FALSE; |
mode->Name = "800 x 600 60Hz"; |
mode = &screen->Modes[1]; |
mode->Width = 1024; |
mode->Height = 768; |
mode->RefreshRate = 60; |
mode->Optimal = EGL_FALSE; |
mode->Interlaced = EGL_FALSE; |
mode->Name = "1024 x 768 60Hz"; |
mode = &screen->Modes[2]; |
mode->Width = 1280; |
mode->Height = 1024; |
mode->RefreshRate = 60; |
mode->Optimal = EGL_FALSE; |
mode->Interlaced = EGL_FALSE; |
mode->Name = "1280 x 1024 60Hz"; |
_eglLinkScreen(screen); |
} |
} |
EGLBoolean |
dri2_create_screen(_EGLDisplay *disp) |
{ |
const __DRIextension **extensions; |
struct dri2_egl_display *dri2_dpy; |
dri2_dpy = disp->DriverData; |
if (dri2_dpy->dri2) { |
dri2_dpy->dri_screen = |
dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions, |
&dri2_dpy->driver_configs, disp); |
} else { |
assert(dri2_dpy->swrast); |
dri2_dpy->dri_screen = |
dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions, |
&dri2_dpy->driver_configs, disp); |
} |
if (dri2_dpy->dri_screen == NULL) { |
_eglLog(_EGL_WARNING, "DRI2: failed to create dri screen"); |
return EGL_FALSE; |
} |
dri2_dpy->own_dri_screen = 1; |
extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen); |
if (dri2_dpy->dri2) { |
unsigned i; |
if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions)) |
goto cleanup_dri_screen; |
for (i = 0; extensions[i]; i++) { |
if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) { |
dri2_dpy->robustness = (__DRIrobustnessExtension *) extensions[i]; |
} |
if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) { |
dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i]; |
} |
} |
} else { |
assert(dri2_dpy->swrast); |
if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions)) |
goto cleanup_dri_screen; |
} |
dri2_setup_screen(disp); |
return EGL_TRUE; |
cleanup_dri_screen: |
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen); |
return EGL_FALSE; |
} |
/** |
* Called via eglInitialize(), GLX_drv->API.Initialize(). |
*/ |
static EGLBoolean |
dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
/* not until swrast_dri is supported */ |
if (disp->Options.UseFallback) |
return EGL_FALSE; |
return dri2_initialize_drm(drv, disp); |
#if 0 |
switch (disp->Platform) { |
#ifdef HAVE_X11_PLATFORM |
case _EGL_PLATFORM_X11: |
if (disp->Options.TestOnly) |
return EGL_TRUE; |
return dri2_initialize_x11(drv, disp); |
#endif |
#ifdef HAVE_LIBUDEV |
#ifdef HAVE_DRM_PLATFORM |
case _EGL_PLATFORM_DRM: |
if (disp->Options.TestOnly) |
return EGL_TRUE; |
return dri2_initialize_drm(drv, disp); |
#endif |
#ifdef HAVE_WAYLAND_PLATFORM |
case _EGL_PLATFORM_WAYLAND: |
if (disp->Options.TestOnly) |
return EGL_TRUE; |
return dri2_initialize_wayland(drv, disp); |
#endif |
#endif |
#ifdef HAVE_ANDROID_PLATFORM |
case _EGL_PLATFORM_ANDROID: |
if (disp->Options.TestOnly) |
return EGL_TRUE; |
return dri2_initialize_android(drv, disp); |
#endif |
default: |
return EGL_FALSE; |
} |
#endif |
} |
/** |
* Called via eglTerminate(), drv->API.Terminate(). |
*/ |
static EGLBoolean |
dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
_eglReleaseDisplayResources(drv, disp); |
_eglCleanupDisplay(disp); |
if (dri2_dpy->own_dri_screen) |
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen); |
// if (dri2_dpy->fd) |
// close(dri2_dpy->fd); |
// if (dri2_dpy->driver) |
// dlclose(dri2_dpy->driver); |
free(dri2_dpy->device_name); |
if (disp->PlatformDisplay == NULL) { |
switch (disp->Platform) { |
#ifdef HAVE_X11_PLATFORM |
case _EGL_PLATFORM_X11: |
xcb_disconnect(dri2_dpy->conn); |
break; |
#endif |
#ifdef HAVE_DRM_PLATFORM |
case _EGL_PLATFORM_DRM: |
if (dri2_dpy->own_device) { |
gbm_device_destroy(&dri2_dpy->gbm_dri->base.base); |
} |
break; |
#endif |
default: |
break; |
} |
} |
free(dri2_dpy); |
disp->DriverData = NULL; |
return EGL_TRUE; |
} |
/** |
* Set the error code after a call to |
* dri2_egl_display::dri2::createContextAttribs. |
*/ |
static void |
dri2_create_context_attribs_error(int dri_error) |
{ |
EGLint egl_error; |
switch (dri_error) { |
case __DRI_CTX_ERROR_SUCCESS: |
return; |
case __DRI_CTX_ERROR_NO_MEMORY: |
egl_error = EGL_BAD_ALLOC; |
break; |
/* From the EGL_KHR_create_context spec, section "Errors": |
* |
* * If <config> does not support a client API context compatible |
* with the requested API major and minor version, [...] context flags, |
* and context reset notification behavior (for client API types where |
* these attributes are supported), then an EGL_BAD_MATCH error is |
* generated. |
* |
* * If an OpenGL ES context is requested and the values for |
* attributes EGL_CONTEXT_MAJOR_VERSION_KHR and |
* EGL_CONTEXT_MINOR_VERSION_KHR specify an OpenGL ES version that |
* is not defined, than an EGL_BAD_MATCH error is generated. |
* |
* * If an OpenGL context is requested, the requested version is |
* greater than 3.2, and the value for attribute |
* EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR has no bits set; has any |
* bits set other than EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR and |
* EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; has more than |
* one of these bits set; or if the implementation does not support |
* the requested profile, then an EGL_BAD_MATCH error is generated. |
*/ |
case __DRI_CTX_ERROR_BAD_API: |
case __DRI_CTX_ERROR_BAD_VERSION: |
case __DRI_CTX_ERROR_BAD_FLAG: |
egl_error = EGL_BAD_MATCH; |
break; |
/* From the EGL_KHR_create_context spec, section "Errors": |
* |
* * If an attribute name or attribute value in <attrib_list> is not |
* recognized (including unrecognized bits in bitmask attributes), |
* then an EGL_BAD_ATTRIBUTE error is generated." |
*/ |
case __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE: |
case __DRI_CTX_ERROR_UNKNOWN_FLAG: |
egl_error = EGL_BAD_ATTRIBUTE; |
break; |
default: |
assert(0); |
egl_error = EGL_BAD_MATCH; |
break; |
} |
_eglError(egl_error, "dri2_create_context"); |
} |
/** |
* Called via eglCreateContext(), drv->API.CreateContext(). |
*/ |
static _EGLContext * |
dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, |
_EGLContext *share_list, const EGLint *attrib_list) |
{ |
struct dri2_egl_context *dri2_ctx; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_context *dri2_ctx_shared = dri2_egl_context(share_list); |
__DRIcontext *shared = |
dri2_ctx_shared ? dri2_ctx_shared->dri_context : NULL; |
struct dri2_egl_config *dri2_config = dri2_egl_config(conf); |
const __DRIconfig *dri_config; |
int api; |
(void) drv; |
dri2_ctx = malloc(sizeof *dri2_ctx); |
if (!dri2_ctx) { |
_eglError(EGL_BAD_ALLOC, "eglCreateContext"); |
return NULL; |
} |
if (!_eglInitContext(&dri2_ctx->base, disp, conf, attrib_list)) |
goto cleanup; |
switch (dri2_ctx->base.ClientAPI) { |
case EGL_OPENGL_ES_API: |
switch (dri2_ctx->base.ClientMajorVersion) { |
case 1: |
api = __DRI_API_GLES; |
break; |
case 2: |
api = __DRI_API_GLES2; |
break; |
case 3: |
api = __DRI_API_GLES3; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, "eglCreateContext"); |
return NULL; |
} |
break; |
case EGL_OPENGL_API: |
if ((dri2_ctx->base.ClientMajorVersion >= 4 |
|| (dri2_ctx->base.ClientMajorVersion == 3 |
&& dri2_ctx->base.ClientMinorVersion >= 2)) |
&& dri2_ctx->base.Profile == EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR) |
api = __DRI_API_OPENGL_CORE; |
else |
api = __DRI_API_OPENGL; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, "eglCreateContext"); |
free(dri2_ctx); |
return NULL; |
} |
if (conf != NULL) { |
/* The config chosen here isn't necessarily |
* used for surfaces later. |
* A pixmap surface will use the single config. |
* This opportunity depends on disabling the |
* doubleBufferMode check in |
* src/mesa/main/context.c:check_compatible() |
*/ |
if (dri2_config->dri_double_config) |
dri_config = dri2_config->dri_double_config; |
else |
dri_config = dri2_config->dri_single_config; |
/* EGL_WINDOW_BIT is set only when there is a dri_double_config. This |
* makes sure the back buffer will always be used. |
*/ |
if (conf->SurfaceType & EGL_WINDOW_BIT) |
dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER; |
} |
else |
dri_config = NULL; |
if (dri2_dpy->dri2) { |
if (dri2_dpy->dri2->base.version >= 3) { |
unsigned error; |
unsigned num_attribs = 0; |
uint32_t ctx_attribs[8]; |
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION; |
ctx_attribs[num_attribs++] = dri2_ctx->base.ClientMajorVersion; |
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION; |
ctx_attribs[num_attribs++] = dri2_ctx->base.ClientMinorVersion; |
if (dri2_ctx->base.Flags != 0) { |
/* If the implementation doesn't support the __DRI2_ROBUSTNESS |
* extension, don't even try to send it the robust-access flag. |
* It may explode. Instead, generate the required EGL error here. |
*/ |
if ((dri2_ctx->base.Flags & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) != 0 |
&& !dri2_dpy->robustness) { |
_eglError(EGL_BAD_MATCH, "eglCreateContext"); |
goto cleanup; |
} |
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_FLAGS; |
ctx_attribs[num_attribs++] = dri2_ctx->base.Flags; |
} |
if (dri2_ctx->base.ResetNotificationStrategy != EGL_NO_RESET_NOTIFICATION_KHR) { |
/* If the implementation doesn't support the __DRI2_ROBUSTNESS |
* extension, don't even try to send it a reset strategy. It may |
* explode. Instead, generate the required EGL error here. |
*/ |
if (!dri2_dpy->robustness) { |
_eglError(EGL_BAD_CONFIG, "eglCreateContext"); |
goto cleanup; |
} |
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY; |
ctx_attribs[num_attribs++] = __DRI_CTX_RESET_LOSE_CONTEXT; |
} |
assert(num_attribs <= ARRAY_SIZE(ctx_attribs)); |
dri2_ctx->dri_context = |
dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen, |
api, |
dri_config, |
shared, |
num_attribs / 2, |
ctx_attribs, |
& error, |
dri2_ctx); |
dri2_create_context_attribs_error(error); |
} else { |
dri2_ctx->dri_context = |
dri2_dpy->dri2->createNewContextForAPI(dri2_dpy->dri_screen, |
api, |
dri_config, |
shared, |
dri2_ctx); |
} |
} else { |
assert(dri2_dpy->swrast); |
dri2_ctx->dri_context = |
dri2_dpy->swrast->createNewContextForAPI(dri2_dpy->dri_screen, |
api, |
dri_config, |
shared, |
dri2_ctx); |
} |
if (!dri2_ctx->dri_context) |
goto cleanup; |
return &dri2_ctx->base; |
cleanup: |
free(dri2_ctx); |
return NULL; |
} |
/** |
* Called via eglDestroyContext(), drv->API.DestroyContext(). |
*/ |
static EGLBoolean |
dri2_destroy_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) |
{ |
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
if (_eglPutContext(ctx)) { |
dri2_dpy->core->destroyContext(dri2_ctx->dri_context); |
free(dri2_ctx); |
} |
return EGL_TRUE; |
} |
/** |
* Called via eglMakeCurrent(), drv->API.MakeCurrent(). |
*/ |
static EGLBoolean |
dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, |
_EGLSurface *rsurf, _EGLContext *ctx) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_dsurf = dri2_egl_surface(dsurf); |
struct dri2_egl_surface *dri2_rsurf = dri2_egl_surface(rsurf); |
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); |
_EGLContext *old_ctx; |
_EGLSurface *old_dsurf, *old_rsurf; |
__DRIdrawable *ddraw, *rdraw; |
__DRIcontext *cctx; |
/* make new bindings */ |
if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf)) |
return EGL_FALSE; |
/* flush before context switch */ |
if (old_ctx && dri2_drv->glFlush) |
dri2_drv->glFlush(); |
ddraw = (dri2_dsurf) ? dri2_dsurf->dri_drawable : NULL; |
rdraw = (dri2_rsurf) ? dri2_rsurf->dri_drawable : NULL; |
cctx = (dri2_ctx) ? dri2_ctx->dri_context : NULL; |
printf("%s cctx %p ddraw %p, rdraw %p\n", |
__FUNCTION__, cctx, ddraw, rdraw); |
__asm__ __volatile__ ("int3"); |
if (old_ctx) { |
__DRIcontext *old_cctx = dri2_egl_context(old_ctx)->dri_context; |
dri2_dpy->core->unbindContext(old_cctx); |
} |
if ((cctx == NULL && ddraw == NULL && rdraw == NULL) || |
dri2_dpy->core->bindContext(cctx, ddraw, rdraw)) { |
if (old_dsurf) |
drv->API.DestroySurface(drv, disp, old_dsurf); |
if (old_rsurf) |
drv->API.DestroySurface(drv, disp, old_rsurf); |
if (old_ctx) |
drv->API.DestroyContext(drv, disp, old_ctx); |
return EGL_TRUE; |
} else { |
/* undo the previous _eglBindContext */ |
_eglBindContext(old_ctx, old_dsurf, old_rsurf, &ctx, &dsurf, &rsurf); |
assert(&dri2_ctx->base == ctx && |
&dri2_dsurf->base == dsurf && |
&dri2_rsurf->base == rsurf); |
_eglPutSurface(dsurf); |
_eglPutSurface(rsurf); |
_eglPutContext(ctx); |
_eglPutSurface(old_dsurf); |
_eglPutSurface(old_rsurf); |
_eglPutContext(old_ctx); |
return EGL_FALSE; |
} |
} |
/* |
* Called from eglGetProcAddress() via drv->API.GetProcAddress(). |
*/ |
static _EGLProc |
dri2_get_proc_address(_EGLDriver *drv, const char *procname) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
return dri2_drv->get_proc_address(procname); |
} |
static EGLBoolean |
dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(ctx->DrawSurface); |
(void) drv; |
/* FIXME: If EGL allows frontbuffer rendering for window surfaces, |
* we need to copy fake to real here.*/ |
if (dri2_dpy->flush != NULL) |
dri2_dpy->flush->flush(dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_wait_native(_EGLDriver *drv, _EGLDisplay *disp, EGLint engine) |
{ |
(void) drv; |
(void) disp; |
if (engine != EGL_CORE_NATIVE_ENGINE) |
return _eglError(EGL_BAD_PARAMETER, "eglWaitNative"); |
/* glXWaitX(); */ |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_bind_tex_image(_EGLDriver *drv, |
_EGLDisplay *disp, _EGLSurface *surf, EGLint buffer) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
struct dri2_egl_context *dri2_ctx; |
_EGLContext *ctx; |
GLint format, target; |
ctx = _eglGetCurrentContext(); |
dri2_ctx = dri2_egl_context(ctx); |
if (!_eglBindTexImage(drv, disp, surf, buffer)) |
return EGL_FALSE; |
switch (dri2_surf->base.TextureFormat) { |
case EGL_TEXTURE_RGB: |
format = __DRI_TEXTURE_FORMAT_RGB; |
break; |
case EGL_TEXTURE_RGBA: |
format = __DRI_TEXTURE_FORMAT_RGBA; |
break; |
default: |
assert(0); |
} |
switch (dri2_surf->base.TextureTarget) { |
case EGL_TEXTURE_2D: |
target = GL_TEXTURE_2D; |
break; |
default: |
assert(0); |
} |
(*dri2_dpy->tex_buffer->setTexBuffer2)(dri2_ctx->dri_context, |
target, format, |
dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_release_tex_image(_EGLDriver *drv, |
_EGLDisplay *disp, _EGLSurface *surf, EGLint buffer) |
{ |
#if __DRI_TEX_BUFFER_VERSION >= 3 |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
struct dri2_egl_context *dri2_ctx; |
_EGLContext *ctx; |
GLint target; |
ctx = _eglGetCurrentContext(); |
dri2_ctx = dri2_egl_context(ctx); |
if (!_eglReleaseTexImage(drv, disp, surf, buffer)) |
return EGL_FALSE; |
switch (dri2_surf->base.TextureTarget) { |
case EGL_TEXTURE_2D: |
target = GL_TEXTURE_2D; |
break; |
default: |
assert(0); |
} |
if (dri2_dpy->tex_buffer->releaseTexBuffer!=NULL) |
(*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context, |
target, |
dri2_surf->dri_drawable); |
#endif |
return EGL_TRUE; |
} |
static _EGLImage * |
dri2_create_image(_EGLDisplay *disp, __DRIimage *dri_image) |
{ |
struct dri2_egl_image *dri2_img; |
if (dri_image == NULL) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image"); |
return NULL; |
} |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image"); |
return NULL; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
free(dri2_img); |
return NULL; |
} |
dri2_img->dri_image = dri_image; |
return &dri2_img->base; |
} |
static _EGLImage * |
dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer buffer, |
const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); |
GLuint renderbuffer = (GLuint) (uintptr_t) buffer; |
__DRIimage *dri_image; |
if (renderbuffer == 0) { |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
dri_image = |
dri2_dpy->image->createImageFromRenderbuffer(dri2_ctx->dri_context, |
renderbuffer, NULL); |
return dri2_create_image(disp, dri_image); |
} |
static _EGLImage * |
dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
EGLint format, name, pitch, err; |
_EGLImageAttribs attrs; |
__DRIimage *dri_image; |
name = (EGLint) (uintptr_t) buffer; |
err = _eglParseImageAttribList(&attrs, disp, attr_list); |
if (err != EGL_SUCCESS) |
return NULL; |
if (attrs.Width <= 0 || attrs.Height <= 0 || |
attrs.DRMBufferStrideMESA <= 0) { |
_eglError(EGL_BAD_PARAMETER, |
"bad width, height or stride"); |
return NULL; |
} |
switch (attrs.DRMBufferFormatMESA) { |
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: |
format = __DRI_IMAGE_FORMAT_ARGB8888; |
pitch = attrs.DRMBufferStrideMESA; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, |
"dri2_create_image_khr: unsupported pixmap depth"); |
return NULL; |
} |
dri_image = |
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, |
attrs.Width, |
attrs.Height, |
format, |
name, |
pitch, |
NULL); |
return dri2_create_image(disp, dri_image); |
} |
#ifdef HAVE_WAYLAND_PLATFORM |
/* This structure describes how a wl_buffer maps to one or more |
* __DRIimages. A wl_drm_buffer stores the wl_drm format code and the |
* offsets and strides of the planes in the buffer. This table maps a |
* wl_drm format code to a description of the planes in the buffer |
* that lets us create a __DRIimage for each of the planes. */ |
static const struct wl_drm_components_descriptor { |
uint32_t dri_components; |
EGLint components; |
int nplanes; |
} wl_drm_components[] = { |
{ __DRI_IMAGE_COMPONENTS_RGB, EGL_TEXTURE_RGB, 1 }, |
{ __DRI_IMAGE_COMPONENTS_RGBA, EGL_TEXTURE_RGBA, 1 }, |
{ __DRI_IMAGE_COMPONENTS_Y_U_V, EGL_TEXTURE_Y_U_V_WL, 3 }, |
{ __DRI_IMAGE_COMPONENTS_Y_UV, EGL_TEXTURE_Y_UV_WL, 2 }, |
{ __DRI_IMAGE_COMPONENTS_Y_XUXV, EGL_TEXTURE_Y_XUXV_WL, 2 }, |
}; |
static _EGLImage * |
dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer _buffer, |
const EGLint *attr_list) |
{ |
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
const struct wl_drm_components_descriptor *f; |
__DRIimage *dri_image; |
_EGLImageAttribs attrs; |
EGLint err; |
int32_t plane; |
if (!wayland_buffer_is_drm(&buffer->buffer)) |
return NULL; |
err = _eglParseImageAttribList(&attrs, disp, attr_list); |
plane = attrs.PlaneWL; |
if (err != EGL_SUCCESS) { |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer"); |
return NULL; |
} |
f = buffer->driver_format; |
if (plane < 0 || plane >= f->nplanes) { |
_eglError(EGL_BAD_PARAMETER, |
"dri2_create_image_wayland_wl_buffer (plane out of bounds)"); |
return NULL; |
} |
dri_image = dri2_dpy->image->fromPlanar(buffer->driver_buffer, plane, NULL); |
if (dri_image == NULL) { |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer"); |
return NULL; |
} |
return dri2_create_image(disp, dri_image); |
} |
#endif |
/** |
* Set the error code after a call to |
* dri2_egl_image::dri_image::createImageFromTexture. |
*/ |
static void |
dri2_create_image_khr_texture_error(int dri_error) |
{ |
EGLint egl_error; |
switch (dri_error) { |
case __DRI_IMAGE_ERROR_SUCCESS: |
return; |
case __DRI_IMAGE_ERROR_BAD_ALLOC: |
egl_error = EGL_BAD_ALLOC; |
break; |
case __DRI_IMAGE_ERROR_BAD_MATCH: |
egl_error = EGL_BAD_MATCH; |
break; |
case __DRI_IMAGE_ERROR_BAD_PARAMETER: |
egl_error = EGL_BAD_PARAMETER; |
break; |
default: |
assert(0); |
egl_error = EGL_BAD_MATCH; |
break; |
} |
_eglError(egl_error, "dri2_create_image_khr_texture"); |
} |
static _EGLImage * |
dri2_create_image_khr_texture(_EGLDisplay *disp, _EGLContext *ctx, |
EGLenum target, |
EGLClientBuffer buffer, |
const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx); |
struct dri2_egl_image *dri2_img; |
GLuint texture = (GLuint) (uintptr_t) buffer; |
_EGLImageAttribs attrs; |
GLuint depth; |
GLenum gl_target; |
unsigned error; |
if (texture == 0) { |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
if (_eglParseImageAttribList(&attrs, disp, attr_list) != EGL_SUCCESS) |
return EGL_NO_IMAGE_KHR; |
switch (target) { |
case EGL_GL_TEXTURE_2D_KHR: |
depth = 0; |
gl_target = GL_TEXTURE_2D; |
break; |
case EGL_GL_TEXTURE_3D_KHR: |
depth = attrs.GLTextureZOffset; |
gl_target = GL_TEXTURE_3D; |
break; |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: |
depth = target - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR; |
gl_target = GL_TEXTURE_CUBE_MAP; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); |
free(dri2_img); |
return EGL_NO_IMAGE_KHR; |
} |
dri2_img->dri_image = |
dri2_dpy->image->createImageFromTexture(dri2_ctx->dri_context, |
gl_target, |
texture, |
depth, |
attrs.GLTextureLevel, |
&error, |
dri2_img); |
dri2_create_image_khr_texture_error(error); |
if (!dri2_img->dri_image) { |
free(dri2_img); |
return EGL_NO_IMAGE_KHR; |
} |
return &dri2_img->base; |
} |
_EGLImage * |
dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLContext *ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
(void) drv; |
switch (target) { |
case EGL_GL_TEXTURE_2D_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: |
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: |
return dri2_create_image_khr_texture(disp, ctx, target, buffer, attr_list); |
case EGL_GL_RENDERBUFFER_KHR: |
return dri2_create_image_khr_renderbuffer(disp, ctx, buffer, attr_list); |
case EGL_DRM_BUFFER_MESA: |
return dri2_create_image_mesa_drm_buffer(disp, ctx, buffer, attr_list); |
#ifdef HAVE_WAYLAND_PLATFORM |
case EGL_WAYLAND_BUFFER_WL: |
return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list); |
#endif |
default: |
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
} |
static EGLBoolean |
dri2_destroy_image_khr(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *image) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_image *dri2_img = dri2_egl_image(image); |
(void) drv; |
dri2_dpy->image->destroyImage(dri2_img->dri_image); |
free(dri2_img); |
return EGL_TRUE; |
} |
static _EGLImage * |
dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, |
const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_image *dri2_img; |
_EGLImageAttribs attrs; |
unsigned int dri_use, valid_mask; |
int format; |
EGLint err = EGL_SUCCESS; |
(void) drv; |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
if (!attr_list) { |
err = EGL_BAD_PARAMETER; |
goto cleanup_img; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
err = EGL_BAD_PARAMETER; |
goto cleanup_img; |
} |
err = _eglParseImageAttribList(&attrs, disp, attr_list); |
if (err != EGL_SUCCESS) |
goto cleanup_img; |
if (attrs.Width <= 0 || attrs.Height <= 0) { |
_eglLog(_EGL_WARNING, "bad width or height (%dx%d)", |
attrs.Width, attrs.Height); |
goto cleanup_img; |
} |
switch (attrs.DRMBufferFormatMESA) { |
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: |
format = __DRI_IMAGE_FORMAT_ARGB8888; |
break; |
default: |
_eglLog(_EGL_WARNING, "bad image format value 0x%04x", |
attrs.DRMBufferFormatMESA); |
goto cleanup_img; |
} |
valid_mask = |
EGL_DRM_BUFFER_USE_SCANOUT_MESA | |
EGL_DRM_BUFFER_USE_SHARE_MESA | |
EGL_DRM_BUFFER_USE_CURSOR_MESA; |
if (attrs.DRMBufferUseMESA & ~valid_mask) { |
_eglLog(_EGL_WARNING, "bad image use bit 0x%04x", |
attrs.DRMBufferUseMESA & ~valid_mask); |
goto cleanup_img; |
} |
dri_use = 0; |
if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_SHARE_MESA) |
dri_use |= __DRI_IMAGE_USE_SHARE; |
if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_SCANOUT_MESA) |
dri_use |= __DRI_IMAGE_USE_SCANOUT; |
if (attrs.DRMBufferUseMESA & EGL_DRM_BUFFER_USE_CURSOR_MESA) |
dri_use |= __DRI_IMAGE_USE_CURSOR; |
dri2_img->dri_image = |
dri2_dpy->image->createImage(dri2_dpy->dri_screen, |
attrs.Width, attrs.Height, |
format, dri_use, dri2_img); |
if (dri2_img->dri_image == NULL) { |
err = EGL_BAD_ALLOC; |
goto cleanup_img; |
} |
return &dri2_img->base; |
cleanup_img: |
free(dri2_img); |
_eglError(err, "dri2_create_drm_image_mesa"); |
return EGL_NO_IMAGE_KHR; |
} |
static EGLBoolean |
dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, |
EGLint *name, EGLint *handle, EGLint *stride) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_image *dri2_img = dri2_egl_image(img); |
(void) drv; |
if (name && !dri2_dpy->image->queryImage(dri2_img->dri_image, |
__DRI_IMAGE_ATTRIB_NAME, name)) { |
_eglError(EGL_BAD_ALLOC, "dri2_export_drm_image_mesa"); |
return EGL_FALSE; |
} |
if (handle) |
dri2_dpy->image->queryImage(dri2_img->dri_image, |
__DRI_IMAGE_ATTRIB_HANDLE, handle); |
if (stride) |
dri2_dpy->image->queryImage(dri2_img->dri_image, |
__DRI_IMAGE_ATTRIB_STRIDE, stride); |
return EGL_TRUE; |
} |
#ifdef HAVE_WAYLAND_PLATFORM |
static void |
dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd, |
struct wl_drm_buffer *buffer) |
{ |
_EGLDisplay *disp = user_data; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
__DRIimage *img; |
int i, dri_components = 0; |
if (fd == -1) |
img = dri2_dpy->image->createImageFromNames(dri2_dpy->dri_screen, |
buffer->buffer.width, |
buffer->buffer.height, |
buffer->format, |
(int*)&name, 1, |
buffer->stride, |
buffer->offset, |
NULL); |
else |
img = dri2_dpy->image->createImageFromFds(dri2_dpy->dri_screen, |
buffer->buffer.width, |
buffer->buffer.height, |
buffer->format, |
&fd, 1, |
buffer->stride, |
buffer->offset, |
NULL); |
if (img == NULL) |
return; |
dri2_dpy->image->queryImage(img, __DRI_IMAGE_ATTRIB_COMPONENTS, &dri_components); |
buffer->driver_format = NULL; |
for (i = 0; i < ARRAY_SIZE(wl_drm_components); i++) |
if (wl_drm_components[i].dri_components == dri_components) |
buffer->driver_format = &wl_drm_components[i]; |
if (buffer->driver_format == NULL) |
dri2_dpy->image->destroyImage(img); |
else |
buffer->driver_buffer = img; |
} |
static void |
dri2_wl_release_buffer(void *user_data, struct wl_drm_buffer *buffer) |
{ |
_EGLDisplay *disp = user_data; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
dri2_dpy->image->destroyImage(buffer->driver_buffer); |
} |
static struct wayland_drm_callbacks wl_drm_callbacks = { |
.authenticate = NULL, |
.reference_buffer = dri2_wl_reference_buffer, |
.release_buffer = dri2_wl_release_buffer |
}; |
static EGLBoolean |
dri2_bind_wayland_display_wl(_EGLDriver *drv, _EGLDisplay *disp, |
struct wl_display *wl_dpy) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
int ret, flags = 0; |
uint64_t cap; |
(void) drv; |
if (dri2_dpy->wl_server_drm) |
return EGL_FALSE; |
wl_drm_callbacks.authenticate = |
(int(*)(void *, uint32_t)) dri2_dpy->authenticate; |
ret = drmGetCap(dri2_dpy->fd, DRM_CAP_PRIME, &cap); |
if (ret == 0 && cap == (DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT) && |
dri2_dpy->image->base.version >= 7 && |
dri2_dpy->image->createImageFromFds != NULL) |
flags |= WAYLAND_DRM_PRIME; |
dri2_dpy->wl_server_drm = |
wayland_drm_init(wl_dpy, dri2_dpy->device_name, |
&wl_drm_callbacks, disp, flags); |
if (!dri2_dpy->wl_server_drm) |
return EGL_FALSE; |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_unbind_wayland_display_wl(_EGLDriver *drv, _EGLDisplay *disp, |
struct wl_display *wl_dpy) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
(void) drv; |
if (!dri2_dpy->wl_server_drm) |
return EGL_FALSE; |
wayland_drm_uninit(dri2_dpy->wl_server_drm); |
dri2_dpy->wl_server_drm = NULL; |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *disp, |
struct wl_buffer *_buffer, |
EGLint attribute, EGLint *value) |
{ |
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer; |
const struct wl_drm_components_descriptor *format; |
if (!wayland_buffer_is_drm(&buffer->buffer)) |
return EGL_FALSE; |
format = buffer->driver_format; |
switch (attribute) { |
case EGL_TEXTURE_FORMAT: |
*value = format->components; |
return EGL_TRUE; |
case EGL_WIDTH: |
*value = buffer->buffer.width; |
return EGL_TRUE; |
case EGL_HEIGHT: |
*value = buffer->buffer.height; |
return EGL_TRUE; |
} |
return EGL_FALSE; |
} |
#endif |
static void |
dri2_unload(_EGLDriver *drv) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
// if (dri2_drv->handle) |
// dlclose(dri2_drv->handle); |
free(dri2_drv); |
} |
static EGLBoolean |
dri2_load(_EGLDriver *drv) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
const char *libname = "libGL.dll"; |
lib_handle handle; |
handle = load_library(libname); |
if (handle) { |
dri2_drv->get_proc_address = (_EGLProc (*)(const char *)) |
get_proc_address(handle, "_glapi_get_proc_address"); |
if (!dri2_drv->get_proc_address) { |
/* no need to keep a reference */ |
handle = 0; |
} |
} |
/* if glapi is not available, loading DRI drivers will fail */ |
if (!dri2_drv->get_proc_address) { |
_eglLog(_EGL_WARNING, "DRI2: failed to find _glapi_get_proc_address"); |
return EGL_FALSE; |
} |
dri2_drv->glFlush = (void (*)(void)) |
dri2_drv->get_proc_address("glFlush"); |
dri2_drv->handle = (void*)handle; |
return EGL_TRUE; |
} |
/** |
* This is the main entrypoint into the driver, called by libEGL. |
* Create a new _EGLDriver object and init its dispatch table. |
*/ |
_EGLDriver * |
_eglBuiltInDriverDRI2(const char *args) |
{ |
struct dri2_egl_driver *dri2_drv; |
(void) args; |
dri2_drv = calloc(1, sizeof *dri2_drv); |
if (!dri2_drv) |
return NULL; |
if (!dri2_load(&dri2_drv->base)) { |
free(dri2_drv); |
return NULL; |
} |
_eglInitDriverFallbacks(&dri2_drv->base); |
dri2_drv->base.API.Initialize = dri2_initialize; |
dri2_drv->base.API.Terminate = dri2_terminate; |
dri2_drv->base.API.CreateContext = dri2_create_context; |
dri2_drv->base.API.DestroyContext = dri2_destroy_context; |
dri2_drv->base.API.MakeCurrent = dri2_make_current; |
dri2_drv->base.API.GetProcAddress = dri2_get_proc_address; |
dri2_drv->base.API.WaitClient = dri2_wait_client; |
dri2_drv->base.API.WaitNative = dri2_wait_native; |
dri2_drv->base.API.BindTexImage = dri2_bind_tex_image; |
dri2_drv->base.API.ReleaseTexImage = dri2_release_tex_image; |
dri2_drv->base.API.CreateImageKHR = dri2_create_image_khr; |
dri2_drv->base.API.DestroyImageKHR = dri2_destroy_image_khr; |
dri2_drv->base.API.CreateDRMImageMESA = dri2_create_drm_image_mesa; |
dri2_drv->base.API.ExportDRMImageMESA = dri2_export_drm_image_mesa; |
#ifdef HAVE_WAYLAND_PLATFORM |
dri2_drv->base.API.BindWaylandDisplayWL = dri2_bind_wayland_display_wl; |
dri2_drv->base.API.UnbindWaylandDisplayWL = dri2_unbind_wayland_display_wl; |
dri2_drv->base.API.QueryWaylandBufferWL = dri2_query_wayland_buffer_wl; |
#endif |
dri2_drv->base.Name = "DRI2"; |
dri2_drv->base.Unload = dri2_unload; |
return &dri2_drv->base; |
} |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/egl_dri2.h |
---|
0,0 → 1,275 |
/* |
* 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 (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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
*/ |
#ifndef EGL_DRI2_INCLUDED |
#define EGL_DRI2_INCLUDED |
#ifdef HAVE_X11_PLATFORM |
#include <xcb/xcb.h> |
#include <xcb/dri2.h> |
#include <xcb/xfixes.h> |
#include <X11/Xlib-xcb.h> |
#endif |
#ifdef HAVE_WAYLAND_PLATFORM |
#include <wayland-client.h> |
#include "wayland-drm.h" |
#include "wayland-egl-priv.h" |
#endif |
#include <GL/gl.h> |
#include <GL/internal/dri_interface.h> |
#ifdef HAVE_DRM_PLATFORM |
#include <gbm_driint.h> |
#endif |
#ifdef HAVE_ANDROID_PLATFORM |
#define LOG_TAG "EGL-DRI2" |
#if ANDROID_VERSION >= 0x0400 |
# include <system/window.h> |
#else |
# define android_native_buffer_t ANativeWindowBuffer |
# include <ui/egl/android_natives.h> |
# include <ui/android_native_buffer.h> |
#endif |
#include <hardware/gralloc.h> |
#include <gralloc_drm_handle.h> |
#include <cutils/log.h> |
#endif /* HAVE_ANDROID_PLATFORM */ |
#include "eglconfig.h" |
#include "eglcontext.h" |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "eglcurrent.h" |
#include "egllog.h" |
#include "eglsurface.h" |
#include "eglimage.h" |
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
struct dri2_egl_driver |
{ |
_EGLDriver base; |
void *handle; |
_EGLProc (*get_proc_address)(const char *procname); |
void (*glFlush)(void); |
}; |
struct dri2_egl_display |
{ |
int dri2_major; |
int dri2_minor; |
__DRIscreen *dri_screen; |
int own_dri_screen; |
const __DRIconfig **driver_configs; |
void *driver; |
__DRIcoreExtension *core; |
__DRIdri2Extension *dri2; |
__DRIswrastExtension *swrast; |
__DRI2flushExtension *flush; |
__DRItexBufferExtension *tex_buffer; |
__DRIimageExtension *image; |
__DRIrobustnessExtension *robustness; |
__DRI2configQueryExtension *config; |
int fd; |
int own_device; |
int swap_available; |
int invalidate_available; |
int min_swap_interval; |
int max_swap_interval; |
int default_swap_interval; |
#ifdef HAVE_DRM_PLATFORM |
struct gbm_dri_device *gbm_dri; |
#endif |
char *device_name; |
char *driver_name; |
__DRIdri2LoaderExtension dri2_loader_extension; |
__DRIswrastLoaderExtension swrast_loader_extension; |
const __DRIextension *extensions[4]; |
#ifdef HAVE_X11_PLATFORM |
xcb_connection_t *conn; |
#endif |
#ifdef HAVE_WAYLAND_PLATFORM |
struct wl_display *wl_dpy; |
struct wl_registry *wl_registry; |
struct wl_drm *wl_server_drm; |
struct wl_drm *wl_drm; |
struct wl_event_queue *wl_queue; |
int authenticated; |
int formats; |
uint32_t capabilities; |
#endif |
int (*authenticate) (_EGLDisplay *disp, uint32_t id); |
}; |
struct dri2_egl_context |
{ |
_EGLContext base; |
__DRIcontext *dri_context; |
}; |
#ifdef HAVE_WAYLAND_PLATFORM |
enum wayland_buffer_type { |
WL_BUFFER_FRONT, |
WL_BUFFER_BACK, |
WL_BUFFER_THIRD, |
WL_BUFFER_COUNT |
}; |
#endif |
struct dri2_egl_surface |
{ |
_EGLSurface base; |
__DRIdrawable *dri_drawable; |
__DRIbuffer buffers[5]; |
int buffer_count; |
int have_fake_front; |
int swap_interval; |
#ifdef HAVE_X11_PLATFORM |
xcb_drawable_t drawable; |
xcb_xfixes_region_t region; |
int depth; |
int bytes_per_pixel; |
xcb_gcontext_t gc; |
xcb_gcontext_t swapgc; |
#endif |
#ifdef HAVE_WAYLAND_PLATFORM |
struct wl_egl_window *wl_win; |
int dx; |
int dy; |
struct wl_callback *frame_callback; |
int format; |
#endif |
#ifdef HAVE_DRM_PLATFORM |
struct gbm_dri_surface *gbm_surf; |
#endif |
#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) |
__DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT]; |
struct { |
#ifdef HAVE_WAYLAND_PLATFORM |
struct wl_buffer *wl_buffer; |
__DRIimage *dri_image; |
int pitch, name; |
#endif |
#ifdef HAVE_DRM_PLATFORM |
struct gbm_bo *bo; |
#endif |
int locked; |
int age; |
} color_buffers[3], *back, *current; |
#endif |
#ifdef HAVE_ANDROID_PLATFORM |
struct ANativeWindow *window; |
struct ANativeWindowBuffer *buffer; |
/* EGL-owned buffers */ |
__DRIbuffer *local_buffers[__DRI_BUFFER_COUNT]; |
#endif |
}; |
struct dri2_egl_config |
{ |
_EGLConfig base; |
const __DRIconfig *dri_single_config; |
const __DRIconfig *dri_double_config; |
}; |
struct dri2_egl_image |
{ |
_EGLImage base; |
__DRIimage *dri_image; |
}; |
/* standard typecasts */ |
_EGL_DRIVER_STANDARD_TYPECASTS(dri2_egl) |
_EGL_DRIVER_TYPECAST(dri2_egl_image, _EGLImage, obj) |
extern const __DRIimageLookupExtension image_lookup_extension; |
extern const __DRIuseInvalidateExtension use_invalidate; |
EGLBoolean |
dri2_load_driver(_EGLDisplay *disp); |
/* Helper for platforms not using dri2_create_screen */ |
void |
dri2_setup_screen(_EGLDisplay *disp); |
EGLBoolean |
dri2_load_driver_swrast(_EGLDisplay *disp); |
EGLBoolean |
dri2_create_screen(_EGLDisplay *disp); |
__DRIimage * |
dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data); |
struct dri2_egl_config * |
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, |
int depth, EGLint surface_type, const EGLint *attr_list, |
const unsigned int *rgba_masks); |
_EGLImage * |
dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLContext *ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list); |
EGLBoolean |
dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp); |
EGLBoolean |
dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp); |
EGLBoolean |
dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp); |
EGLBoolean |
dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp); |
char * |
dri2_get_driver_for_fd(int fd); |
char * |
dri2_get_device_name_for_fd(int fd); |
#endif /* EGL_DRI2_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_android.c |
---|
0,0 → 1,832 |
/* |
* Mesa 3-D graphics library |
* |
* Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com> |
* Copyright (C) 2010-2011 LunarG Inc. |
* |
* Based on platform_x11, which has |
* |
* 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 <errno.h> |
#include <dlfcn.h> |
#if ANDROID_VERSION >= 0x402 |
#include <sync/sync.h> |
#endif |
/* for droid_get_pci_id */ |
#include <xf86drm.h> |
#include <i915_drm.h> |
#include <radeon_drm.h> |
#include "egl_dri2.h" |
#include "gralloc_drm.h" |
static int |
get_format_bpp(int native) |
{ |
int bpp; |
switch (native) { |
case HAL_PIXEL_FORMAT_RGBA_8888: |
case HAL_PIXEL_FORMAT_RGBX_8888: |
case HAL_PIXEL_FORMAT_BGRA_8888: |
bpp = 4; |
break; |
case HAL_PIXEL_FORMAT_RGB_888: |
bpp = 3; |
break; |
case HAL_PIXEL_FORMAT_RGB_565: |
case HAL_PIXEL_FORMAT_RGBA_5551: |
case HAL_PIXEL_FORMAT_RGBA_4444: |
bpp = 2; |
break; |
default: |
bpp = 0; |
break; |
} |
return bpp; |
} |
static int |
get_native_buffer_name(struct ANativeWindowBuffer *buf) |
{ |
return gralloc_drm_get_gem_handle(buf->handle); |
} |
static EGLBoolean |
droid_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf) |
{ |
#if ANDROID_VERSION >= 0x0402 |
int fence_fd; |
if (dri2_surf->window->dequeueBuffer(dri2_surf->window, &dri2_surf->buffer, |
&fence_fd)) |
return EGL_FALSE; |
/* If access to the buffer is controlled by a sync fence, then block on the |
* fence. |
* |
* It may be more performant to postpone blocking until there is an |
* immediate need to write to the buffer. But doing so would require adding |
* hooks to the DRI2 loader. |
* |
* From the ANativeWindow::dequeueBuffer documentation: |
* |
* The libsync fence file descriptor returned in the int pointed to by |
* the fenceFd argument will refer to the fence that must signal |
* before the dequeued buffer may be written to. A value of -1 |
* indicates that the caller may access the buffer immediately without |
* waiting on a fence. If a valid file descriptor is returned (i.e. |
* any value except -1) then the caller is responsible for closing the |
* file descriptor. |
*/ |
if (fence_fd >= 0) { |
/* From the SYNC_IOC_WAIT documentation in <linux/sync.h>: |
* |
* Waits indefinitely if timeout < 0. |
*/ |
int timeout = -1; |
sync_wait(fence_fd, timeout); |
close(fence_fd); |
} |
dri2_surf->buffer->common.incRef(&dri2_surf->buffer->common); |
#else |
if (dri2_surf->window->dequeueBuffer(dri2_surf->window, &dri2_surf->buffer)) |
return EGL_FALSE; |
dri2_surf->buffer->common.incRef(&dri2_surf->buffer->common); |
dri2_surf->window->lockBuffer(dri2_surf->window, dri2_surf->buffer); |
#endif |
return EGL_TRUE; |
} |
static EGLBoolean |
droid_window_enqueue_buffer(struct dri2_egl_surface *dri2_surf) |
{ |
#if ANDROID_VERSION >= 0x0402 |
/* Queue the buffer without a sync fence. This informs the ANativeWindow |
* that it may access the buffer immediately. |
* |
* From ANativeWindow::dequeueBuffer: |
* |
* The fenceFd argument specifies a libsync fence file descriptor for |
* a fence that must signal before the buffer can be accessed. If |
* the buffer can be accessed immediately then a value of -1 should |
* be used. The caller must not use the file descriptor after it |
* is passed to queueBuffer, and the ANativeWindow implementation |
* is responsible for closing it. |
*/ |
int fence_fd = -1; |
dri2_surf->window->queueBuffer(dri2_surf->window, dri2_surf->buffer, |
fence_fd); |
#else |
dri2_surf->window->queueBuffer(dri2_surf->window, dri2_surf->buffer); |
#endif |
dri2_surf->buffer->common.decRef(&dri2_surf->buffer->common); |
dri2_surf->buffer = NULL; |
return EGL_TRUE; |
} |
static void |
droid_window_cancel_buffer(struct dri2_egl_surface *dri2_surf) |
{ |
/* no cancel buffer? */ |
droid_window_enqueue_buffer(dri2_surf); |
} |
static __DRIbuffer * |
droid_alloc_local_buffer(struct dri2_egl_surface *dri2_surf, |
unsigned int att, unsigned int format) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
if (att >= ARRAY_SIZE(dri2_surf->local_buffers)) |
return NULL; |
if (!dri2_surf->local_buffers[att]) { |
dri2_surf->local_buffers[att] = |
dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen, att, format, |
dri2_surf->base.Width, dri2_surf->base.Height); |
} |
return dri2_surf->local_buffers[att]; |
} |
static void |
droid_free_local_buffers(struct dri2_egl_surface *dri2_surf) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
int i; |
for (i = 0; i < ARRAY_SIZE(dri2_surf->local_buffers); i++) { |
if (dri2_surf->local_buffers[i]) { |
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen, |
dri2_surf->local_buffers[i]); |
dri2_surf->local_buffers[i] = NULL; |
} |
} |
} |
static _EGLSurface * |
droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf); |
struct dri2_egl_surface *dri2_surf; |
dri2_surf = calloc(1, sizeof *dri2_surf); |
if (!dri2_surf) { |
_eglError(EGL_BAD_ALLOC, "droid_create_surface"); |
return NULL; |
} |
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list)) |
goto cleanup_surface; |
if (type == EGL_WINDOW_BIT) { |
int format; |
if (!window || window->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) { |
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface"); |
goto cleanup_surface; |
} |
if (window->query(window, NATIVE_WINDOW_FORMAT, &format)) { |
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface"); |
goto cleanup_surface; |
} |
if (format != dri2_conf->base.NativeVisualID) { |
_eglLog(_EGL_WARNING, "Native format mismatch: 0x%x != 0x%x", |
format, dri2_conf->base.NativeVisualID); |
} |
window->query(window, NATIVE_WINDOW_WIDTH, &dri2_surf->base.Width); |
window->query(window, NATIVE_WINDOW_HEIGHT, &dri2_surf->base.Height); |
} |
dri2_surf->dri_drawable = |
(*dri2_dpy->dri2->createNewDrawable)(dri2_dpy->dri_screen, |
dri2_conf->dri_double_config, |
dri2_surf); |
if (dri2_surf->dri_drawable == NULL) { |
_eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable"); |
goto cleanup_surface; |
} |
if (window) { |
window->common.incRef(&window->common); |
dri2_surf->window = window; |
} |
return &dri2_surf->base; |
cleanup_surface: |
free(dri2_surf); |
return NULL; |
} |
static _EGLSurface * |
droid_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
return droid_create_surface(drv, disp, EGL_WINDOW_BIT, conf, |
window, attrib_list); |
} |
static _EGLSurface * |
droid_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, EGLNativePixmapType pixmap, |
const EGLint *attrib_list) |
{ |
return NULL; |
} |
static _EGLSurface * |
droid_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, const EGLint *attrib_list) |
{ |
return droid_create_surface(drv, disp, EGL_PBUFFER_BIT, conf, |
NULL, attrib_list); |
} |
static EGLBoolean |
droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
if (!_eglPutSurface(surf)) |
return EGL_TRUE; |
droid_free_local_buffers(dri2_surf); |
if (dri2_surf->base.Type == EGL_WINDOW_BIT) { |
if (dri2_surf->buffer) |
droid_window_cancel_buffer(dri2_surf); |
dri2_surf->window->common.decRef(&dri2_surf->window->common); |
} |
(*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); |
free(dri2_surf); |
return EGL_TRUE; |
} |
static EGLBoolean |
droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) |
{ |
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv); |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); |
_EGLContext *ctx; |
if (dri2_surf->base.Type != EGL_WINDOW_BIT) |
return EGL_TRUE; |
if (dri2_drv->glFlush) { |
ctx = _eglGetCurrentContext(); |
if (ctx && ctx->DrawSurface == &dri2_surf->base) |
dri2_drv->glFlush(); |
} |
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); |
if (dri2_surf->buffer) |
droid_window_enqueue_buffer(dri2_surf); |
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
static _EGLImage * |
dri2_create_image_android_native_buffer(_EGLDisplay *disp, _EGLContext *ctx, |
struct ANativeWindowBuffer *buf) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_image *dri2_img; |
int name; |
EGLint format; |
if (ctx != NULL) { |
/* From the EGL_ANDROID_image_native_buffer spec: |
* |
* * If <target> is EGL_NATIVE_BUFFER_ANDROID and <ctx> is not |
* EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated. |
*/ |
_eglError(EGL_BAD_CONTEXT, "eglCreateEGLImageKHR: for " |
"EGL_NATIVE_BUFFER_ANDROID, the context must be " |
"EGL_NO_CONTEXT"); |
return NULL; |
} |
if (!buf || buf->common.magic != ANDROID_NATIVE_BUFFER_MAGIC || |
buf->common.version != sizeof(*buf)) { |
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); |
return NULL; |
} |
name = get_native_buffer_name(buf); |
if (!name) { |
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR"); |
return NULL; |
} |
/* see the table in droid_add_configs_for_visuals */ |
switch (buf->format) { |
case HAL_PIXEL_FORMAT_BGRA_8888: |
format = __DRI_IMAGE_FORMAT_ARGB8888; |
break; |
case HAL_PIXEL_FORMAT_RGB_565: |
format = __DRI_IMAGE_FORMAT_RGB565; |
break; |
case HAL_PIXEL_FORMAT_RGBA_8888: |
format = __DRI_IMAGE_FORMAT_ABGR8888; |
break; |
case HAL_PIXEL_FORMAT_RGBX_8888: |
format = __DRI_IMAGE_FORMAT_XBGR8888; |
break; |
case HAL_PIXEL_FORMAT_RGB_888: |
case HAL_PIXEL_FORMAT_RGBA_5551: |
case HAL_PIXEL_FORMAT_RGBA_4444: |
/* unsupported */ |
default: |
_eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", buf->format); |
return NULL; |
break; |
} |
dri2_img = calloc(1, sizeof(*dri2_img)); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "droid_create_image_mesa_drm"); |
return NULL; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
free(dri2_img); |
return NULL; |
} |
dri2_img->dri_image = |
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, |
buf->width, |
buf->height, |
format, |
name, |
buf->stride, |
dri2_img); |
if (!dri2_img->dri_image) { |
free(dri2_img); |
_eglError(EGL_BAD_ALLOC, "droid_create_image_mesa_drm"); |
return NULL; |
} |
return &dri2_img->base; |
} |
static _EGLImage * |
droid_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLContext *ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
switch (target) { |
case EGL_NATIVE_BUFFER_ANDROID: |
return dri2_create_image_android_native_buffer(disp, ctx, |
(struct ANativeWindowBuffer *) buffer); |
default: |
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list); |
} |
} |
static void |
droid_init_driver_functions(_EGLDriver *drv) |
{ |
drv->API.CreateWindowSurface = droid_create_window_surface; |
drv->API.CreatePixmapSurface = droid_create_pixmap_surface; |
drv->API.CreatePbufferSurface = droid_create_pbuffer_surface; |
drv->API.DestroySurface = droid_destroy_surface; |
drv->API.SwapBuffers = droid_swap_buffers; |
drv->API.CreateImageKHR = droid_create_image_khr; |
} |
static void |
droid_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) |
{ |
} |
static int |
droid_get_buffers_parse_attachments(struct dri2_egl_surface *dri2_surf, |
unsigned int *attachments, int count) |
{ |
int num_buffers = 0, i; |
/* fill dri2_surf->buffers */ |
for (i = 0; i < count * 2; i += 2) { |
__DRIbuffer *buf, *local; |
assert(num_buffers < ARRAY_SIZE(dri2_surf->buffers)); |
buf = &dri2_surf->buffers[num_buffers]; |
switch (attachments[i]) { |
case __DRI_BUFFER_BACK_LEFT: |
if (dri2_surf->base.Type == EGL_WINDOW_BIT) { |
buf->attachment = attachments[i]; |
buf->name = get_native_buffer_name(dri2_surf->buffer); |
buf->cpp = get_format_bpp(dri2_surf->buffer->format); |
buf->pitch = dri2_surf->buffer->stride * buf->cpp; |
buf->flags = 0; |
if (buf->name) |
num_buffers++; |
break; |
} |
/* fall through for pbuffers */ |
case __DRI_BUFFER_DEPTH: |
case __DRI_BUFFER_STENCIL: |
case __DRI_BUFFER_ACCUM: |
case __DRI_BUFFER_DEPTH_STENCIL: |
case __DRI_BUFFER_HIZ: |
local = droid_alloc_local_buffer(dri2_surf, |
attachments[i], attachments[i + 1]); |
if (local) { |
*buf = *local; |
num_buffers++; |
} |
break; |
case __DRI_BUFFER_FRONT_LEFT: |
case __DRI_BUFFER_FRONT_RIGHT: |
case __DRI_BUFFER_FAKE_FRONT_LEFT: |
case __DRI_BUFFER_FAKE_FRONT_RIGHT: |
case __DRI_BUFFER_BACK_RIGHT: |
default: |
/* no front or right buffers */ |
break; |
} |
} |
return num_buffers; |
} |
static __DRIbuffer * |
droid_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; |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
int i; |
if (dri2_surf->base.Type == EGL_WINDOW_BIT) { |
/* try to dequeue the next back buffer */ |
if (!dri2_surf->buffer && !droid_window_dequeue_buffer(dri2_surf)) |
return NULL; |
/* free outdated buffers and update the surface size */ |
if (dri2_surf->base.Width != dri2_surf->buffer->width || |
dri2_surf->base.Height != dri2_surf->buffer->height) { |
droid_free_local_buffers(dri2_surf); |
dri2_surf->base.Width = dri2_surf->buffer->width; |
dri2_surf->base.Height = dri2_surf->buffer->height; |
} |
} |
dri2_surf->buffer_count = |
droid_get_buffers_parse_attachments(dri2_surf, attachments, count); |
if (width) |
*width = dri2_surf->base.Width; |
if (height) |
*height = dri2_surf->base.Height; |
*out_count = dri2_surf->buffer_count;; |
return dri2_surf->buffers; |
} |
static EGLBoolean |
droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); |
const struct { |
int format; |
int size; |
unsigned int rgba_masks[4]; |
} visuals[] = { |
{ HAL_PIXEL_FORMAT_RGBA_8888, 32, { 0xff, 0xff00, 0xff0000, 0xff000000 } }, |
{ HAL_PIXEL_FORMAT_RGBX_8888, 32, { 0xff, 0xff00, 0xff0000, 0x0 } }, |
{ HAL_PIXEL_FORMAT_RGB_888, 24, { 0xff, 0xff00, 0xff0000, 0x0 } }, |
{ HAL_PIXEL_FORMAT_RGB_565, 16, { 0xf800, 0x7e0, 0x1f, 0x0 } }, |
{ HAL_PIXEL_FORMAT_BGRA_8888, 32, { 0xff0000, 0xff00, 0xff, 0xff000000 } }, |
{ 0, 0, { 0, 0, 0, 0 } } |
}; |
int count, i, j; |
count = 0; |
for (i = 0; visuals[i].format; i++) { |
int format_count = 0; |
for (j = 0; dri2_dpy->driver_configs[j]; j++) { |
const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT; |
struct dri2_egl_config *dri2_conf; |
unsigned int double_buffered = 0; |
dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[j], |
__DRI_ATTRIB_DOUBLE_BUFFER, &double_buffered); |
/* support only double buffered configs */ |
if (!double_buffered) |
continue; |
dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j], |
count + 1, visuals[i].size, surface_type, NULL, |
visuals[i].rgba_masks); |
if (dri2_conf) { |
dri2_conf->base.NativeVisualID = visuals[i].format; |
dri2_conf->base.NativeVisualType = visuals[i].format; |
count++; |
format_count++; |
} |
} |
if (!format_count) { |
_eglLog(_EGL_DEBUG, "No DRI config supports native format 0x%x", |
visuals[i].format); |
} |
} |
/* post-process configs */ |
for (i = 0; i < dpy->Configs->Size; i++) { |
struct dri2_egl_config *dri2_conf = dri2_egl_config(dpy->Configs->Elements[i]); |
/* there is no front buffer so no OpenGL */ |
dri2_conf->base.RenderableType &= ~EGL_OPENGL_BIT; |
dri2_conf->base.Conformant &= ~EGL_OPENGL_BIT; |
} |
return (count != 0); |
} |
static EGLBoolean |
droid_get_pci_id(int fd, int *vendor_id, int *chip_id) |
{ |
drmVersionPtr version; |
*chip_id = -1; |
version = drmGetVersion(fd); |
if (!version) { |
_eglLog(_EGL_WARNING, "invalid drm fd"); |
return EGL_FALSE; |
} |
if (!version->name) { |
_eglLog(_EGL_WARNING, "unable to determine the driver name"); |
drmFreeVersion(version); |
return EGL_FALSE; |
} |
if (strcmp(version->name, "i915") == 0) { |
struct drm_i915_getparam gp; |
int ret; |
*vendor_id = 0x8086; |
memset(&gp, 0, sizeof(gp)); |
gp.param = I915_PARAM_CHIPSET_ID; |
gp.value = chip_id; |
ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp)); |
if (ret) { |
_eglLog(_EGL_WARNING, "failed to get param for i915"); |
*chip_id = -1; |
} |
} |
else if (strcmp(version->name, "radeon") == 0) { |
struct drm_radeon_info info; |
int ret; |
*vendor_id = 0x1002; |
memset(&info, 0, sizeof(info)); |
info.request = RADEON_INFO_DEVICE_ID; |
info.value = (unsigned long) chip_id; |
ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); |
if (ret) { |
_eglLog(_EGL_WARNING, "failed to get info for radeon"); |
*chip_id = -1; |
} |
} |
else if (strcmp(version->name, "nouveau") == 0) { |
*vendor_id = 0x10de; |
/* not used */ |
*chip_id = 0; |
} |
else if (strcmp(version->name, "vmwgfx") == 0) { |
*vendor_id = 0x15ad; |
/* assume SVGA II */ |
*chip_id = 0x0405; |
} |
drmFreeVersion(version); |
return (*chip_id >= 0); |
} |
#define DRIVER_MAP_DRI2_ONLY |
#include "pci_ids/pci_id_driver_map.h" |
static const char * |
droid_get_driver_name(int fd) |
{ |
int vendor_id = -1, chip_id = -1; |
int idx, i; |
char *name; |
if (!droid_get_pci_id(fd, &vendor_id, &chip_id)) |
return NULL; |
for (idx = 0; driver_map[idx].driver; idx++) { |
if (vendor_id != driver_map[idx].vendor_id) |
continue; |
if (driver_map[idx].num_chips_ids == -1) |
break; |
for (i = 0; i < driver_map[idx].num_chips_ids; i++) { |
if (driver_map[idx].chip_ids[i] == chip_id) |
break; |
} |
if (i < driver_map[idx].num_chips_ids) |
break; |
} |
_eglLog(_EGL_INFO, "pci id for fd %d: %04x:%04x, driver %s", |
fd, vendor_id, chip_id, driver_map[idx].driver); |
return driver_map[idx].driver; |
} |
static int |
droid_open_device(void) |
{ |
const hw_module_t *mod; |
int fd = -1, err; |
err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &mod); |
if (!err) { |
const gralloc_module_t *gr = (gralloc_module_t *) mod; |
err = -EINVAL; |
if (gr->perform) |
err = gr->perform(gr, GRALLOC_MODULE_PERFORM_GET_DRM_FD, &fd); |
} |
if (err || fd < 0) { |
_eglLog(_EGL_WARNING, "fail to get drm fd"); |
fd = -1; |
} |
return (fd >= 0) ? dup(fd) : -1; |
} |
/* support versions < JellyBean */ |
#ifndef ALOGW |
#define ALOGW LOGW |
#endif |
#ifndef ALOGD |
#define ALOGD LOGD |
#endif |
#ifndef ALOGI |
#define ALOGI LOGI |
#endif |
static void |
droid_log(EGLint level, const char *msg) |
{ |
switch (level) { |
case _EGL_DEBUG: |
ALOGD("%s", msg); |
break; |
case _EGL_INFO: |
ALOGI("%s", msg); |
break; |
case _EGL_WARNING: |
ALOGW("%s", msg); |
break; |
case _EGL_FATAL: |
LOG_FATAL("%s", msg); |
break; |
default: |
break; |
} |
} |
EGLBoolean |
dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy) |
{ |
struct dri2_egl_display *dri2_dpy; |
const char *err; |
_eglSetLogProc(droid_log); |
dri2_dpy = calloc(1, sizeof(*dri2_dpy)); |
if (!dri2_dpy) |
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); |
dpy->DriverData = (void *) dri2_dpy; |
dri2_dpy->fd = droid_open_device(); |
if (dri2_dpy->fd < 0) { |
err = "DRI2: failed to open device"; |
goto cleanup_display; |
} |
dri2_dpy->driver_name = (char *) droid_get_driver_name(dri2_dpy->fd); |
if (dri2_dpy->driver_name == NULL) { |
err = "DRI2: failed to get driver name"; |
goto cleanup_device; |
} |
if (!dri2_load_driver(dpy)) { |
err = "DRI2: failed to load driver"; |
goto cleanup_device; |
} |
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 = droid_flush_front_buffer; |
dri2_dpy->dri2_loader_extension.getBuffersWithFormat = |
droid_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(dpy)) { |
err = "DRI2: failed to create screen"; |
goto cleanup_driver; |
} |
if (!droid_add_configs_for_visuals(drv, dpy)) { |
err = "DRI2: failed to add configs"; |
goto cleanup_screen; |
} |
dpy->Extensions.ANDROID_image_native_buffer = EGL_TRUE; |
dpy->Extensions.KHR_image_base = EGL_TRUE; |
/* we're supporting EGL 1.4 */ |
dpy->VersionMajor = 1; |
dpy->VersionMinor = 4; |
droid_init_driver_functions(drv); |
return EGL_TRUE; |
cleanup_screen: |
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen); |
cleanup_driver: |
dlclose(dri2_dpy->driver); |
cleanup_device: |
close(dri2_dpy->fd); |
cleanup_display: |
free(dri2_dpy); |
return _eglError(EGL_NOT_INITIALIZED, err); |
} |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_drm.c |
---|
0,0 → 1,560 |
/* |
* 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 (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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
*/ |
#include <stdlib.h> |
#include <stdio.h> |
#include <string.h> |
#include <xf86drm.h> |
//#include <dlfcn.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <fcntl.h> |
#include <unistd.h> |
#include <kos32sys.h> |
#include <pixlib2.h> |
#define EGL_EGLEXT_PROTOTYPES |
#include <EGL/egl.h> |
#include <EGL/eglext.h> |
#include "egl_dri2.h" |
int sna_bitmap_from_handle(bitmap_t *bitmap, uint32_t handle); |
void sna_set_bo_handle(bitmap_t *bitmap, int handle); |
int sna_blit_tex(bitmap_t *bitmap, int scale, int dst_x, int dst_y, |
int w, int h, int src_x, int src_y); |
static struct gbm_bo * |
lock_front_buffer(struct gbm_surface *_surf) |
{ |
struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf; |
struct dri2_egl_surface *dri2_surf = surf->dri_private; |
struct gbm_bo *bo; |
if (dri2_surf->current == NULL) { |
_eglError(EGL_BAD_SURFACE, "no front buffer"); |
return NULL; |
} |
bo = dri2_surf->current->bo; |
dri2_surf->current->locked = 1; |
dri2_surf->current = NULL; |
return bo; |
} |
static void |
release_buffer(struct gbm_surface *_surf, struct gbm_bo *bo) |
{ |
struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf; |
struct dri2_egl_surface *dri2_surf = surf->dri_private; |
int i; |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
if (dri2_surf->color_buffers[i].bo == bo) { |
dri2_surf->color_buffers[i].locked = 0; |
} |
} |
} |
static int |
has_free_buffers(struct gbm_surface *_surf) |
{ |
struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf; |
struct dri2_egl_surface *dri2_surf = surf->dri_private; |
int i; |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) |
if (!dri2_surf->color_buffers[i].locked) |
return 1; |
return 0; |
} |
static _EGLSurface * |
dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf); |
struct dri2_egl_surface *dri2_surf; |
struct gbm_dri_surface *surf; |
(void) drv; |
dri2_surf = calloc(1, sizeof *dri2_surf); |
if (!dri2_surf) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_surface"); |
return NULL; |
} |
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list)) |
goto cleanup_surf; |
switch (type) { |
case EGL_WINDOW_BIT: |
if (!window) |
return NULL; |
surf = gbm_dri_surface((struct gbm_surface *) window); |
dri2_surf->gbm_surf = surf; |
dri2_surf->base.Width = surf->base.width; |
dri2_surf->base.Height = surf->base.height; |
surf->dri_private = dri2_surf; |
break; |
default: |
goto cleanup_surf; |
} |
dri2_surf->dri_drawable = |
(*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen, |
dri2_conf->dri_double_config, |
dri2_surf->gbm_surf); |
if (dri2_surf->dri_drawable == NULL) { |
_eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable"); |
goto cleanup_surf; |
} |
return &dri2_surf->base; |
cleanup_surf: |
free(dri2_surf); |
return NULL; |
} |
static _EGLSurface * |
dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
return dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf, |
window, attrib_list); |
} |
static EGLBoolean |
dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
int i; |
if (!_eglPutSurface(surf)) |
return EGL_TRUE; |
(*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
if (dri2_surf->color_buffers[i].bo) |
gbm_bo_destroy(dri2_surf->color_buffers[i].bo); |
} |
for (i = 0; i < __DRI_BUFFER_COUNT; i++) { |
if (dri2_surf->dri_buffers[i]) |
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen, |
dri2_surf->dri_buffers[i]); |
} |
free(surf); |
return EGL_TRUE; |
} |
static int |
get_back_bo(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
struct gbm_dri_bo *bo; |
struct gbm_dri_surface *surf = dri2_surf->gbm_surf; |
int i, name, pitch; |
if (dri2_surf->back == NULL) |
{ |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) |
{ |
if(dri2_surf->color_buffers[i].locked) |
{ |
dri2_surf->color_buffers[i].locked = 0; |
continue; |
} |
dri2_surf->back = &dri2_surf->color_buffers[i]; |
} |
} |
if (dri2_surf->back == NULL) |
return -1; |
if (dri2_surf->back->bo == NULL) |
dri2_surf->back->bo = gbm_bo_create(&dri2_dpy->gbm_dri->base.base, |
surf->base.width, surf->base.height, |
surf->base.format, surf->base.flags); |
if (dri2_surf->back->bo == NULL) |
return -1; |
bo = (struct gbm_dri_bo *) dri2_surf->back->bo; |
dri2_dpy->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_NAME, &name); |
dri2_dpy->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE, &pitch); |
buffer->attachment = __DRI_BUFFER_BACK_LEFT; |
buffer->name = name; |
buffer->pitch = pitch; |
buffer->cpp = 4; |
buffer->flags = 0; |
dri2_surf->back->locked = 1; |
return 0; |
} |
static int |
get_aux_bo(struct dri2_egl_surface *dri2_surf, |
unsigned int attachment, unsigned int format, __DRIbuffer *buffer) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
__DRIbuffer *b = dri2_surf->dri_buffers[attachment]; |
if (b == NULL) { |
b = dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen, |
attachment, format, |
dri2_surf->base.Width, |
dri2_surf->base.Height); |
dri2_surf->dri_buffers[attachment] = b; |
} |
if (b == NULL) |
return -1; |
memcpy(buffer, b, sizeof *buffer); |
return 0; |
} |
static __DRIbuffer * |
dri2_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; |
int i, j; |
// printf("dri2_get_buffers_with_format count %d\n", count); |
dri2_surf->buffer_count = 0; |
for (i = 0, j = 0; i < 2 * count; i += 2, j++) { |
assert(attachments[i] < __DRI_BUFFER_COUNT); |
assert(dri2_surf->buffer_count < 5); |
// printf("attachments %d\n",attachments[i]); |
switch (attachments[i]) { |
case __DRI_BUFFER_BACK_LEFT: |
if (get_back_bo(dri2_surf, &dri2_surf->buffers[j]) < 0) { |
_eglError(EGL_BAD_ALLOC, "failed to allocate color buffer"); |
return NULL; |
} |
break; |
default: |
if (get_aux_bo(dri2_surf, attachments[i], attachments[i + 1], |
&dri2_surf->buffers[j]) < 0) { |
_eglError(EGL_BAD_ALLOC, "failed to allocate aux buffer"); |
return NULL; |
} |
break; |
} |
} |
*out_count = j; |
if (j == 0) |
return NULL; |
*width = dri2_surf->base.Width; |
*height = dri2_surf->base.Height; |
return dri2_surf->buffers; |
} |
static __DRIbuffer * |
dri2_get_buffers(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *loaderPrivate) |
{ |
unsigned int *attachments_with_format; |
__DRIbuffer *buffer; |
const unsigned int format = 32; |
int i; |
attachments_with_format = calloc(count * 2, sizeof(unsigned int)); |
if (!attachments_with_format) { |
*out_count = 0; |
return NULL; |
} |
for (i = 0; i < count; ++i) { |
attachments_with_format[2*i] = attachments[i]; |
attachments_with_format[2*i + 1] = format; |
} |
buffer = |
dri2_get_buffers_with_format(driDrawable, |
width, height, |
attachments_with_format, count, |
out_count, loaderPrivate); |
free(attachments_with_format); |
return buffer; |
} |
static void |
dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) |
{ |
(void) driDrawable; |
(void) loaderPrivate; |
} |
static EGLBoolean |
dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); |
__DRIbuffer buffer; |
static bitmap_t bm; |
int i; |
if (dri2_surf->base.Type == EGL_WINDOW_BIT) { |
if (dri2_surf->current) |
_eglError(EGL_BAD_SURFACE, "dri2_swap_buffers"); |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) |
if (dri2_surf->color_buffers[i].age > 0) |
dri2_surf->color_buffers[i].age++; |
#if 1 |
if ( (dri2_surf->back != NULL) && |
(dri2_surf->back->bo != NULL)) |
{ |
struct gbm_dri_bo *bo; |
bo = (struct gbm_dri_bo *)dri2_surf->back->bo; |
if(bm.width == 0) |
{ |
// printf("%s bo: %p handle: %d width: %d height: %d pitch %d format %x\n", |
// __FUNCTION__, bo, bo->base.base.handle.s32, bo->base.base.width, |
// bo->base.base.height, (int)bo->base.base.stride, |
// bo->base.base.format); |
bm.width = bo->base.base.width; |
bm.height = bo->base.base.height; |
bm.pitch = (int)bo->base.base.stride; |
bm.max_width = bo->base.base.width; |
bm.max_height = bo->base.base.height; |
bm.flags = HW_TEX_BLIT; |
if( sna_bitmap_from_handle(&bm, bo->base.base.handle.s32)) |
{ |
printf("sna_bitmap_from_handle failed\n"); |
} |
} |
if( bm.handle != 0) |
{ |
// printf("%s bo: %p handle: %d width: %d height: %d pitch %d format %x\n", |
// __FUNCTION__, bo, bo->base.base.handle.s32, bo->base.base.width, |
// bo->base.base.height, (int)bo->base.base.stride, |
// bo->base.base.format); |
sna_set_bo_handle(&bm, bo->base.base.handle.s32); |
sna_blit_tex(&bm, 0, 5, 20, bm.width, bm.height, 0, 0); |
} |
} |
#endif |
dri2_surf->current = dri2_surf->back; |
dri2_surf->current->age = 1; |
dri2_surf->back = NULL; |
} |
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); |
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
static EGLint |
dri2_query_buffer_age(_EGLDriver *drv, |
_EGLDisplay *disp, _EGLSurface *surface) |
{ |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface); |
__DRIbuffer buffer; |
if (get_back_bo(dri2_surf, &buffer) < 0) { |
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age"); |
return 0; |
} |
return dri2_surf->back->age; |
} |
static _EGLImage * |
dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct gbm_dri_bo *dri_bo = gbm_dri_bo((struct gbm_bo *) buffer); |
struct dri2_egl_image *dri2_img; |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap"); |
return NULL; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
free(dri2_img); |
return NULL; |
} |
dri2_img->dri_image = dri2_dpy->image->dupImage(dri_bo->image, dri2_img); |
if (dri2_img->dri_image == NULL) { |
free(dri2_img); |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap"); |
return NULL; |
} |
return &dri2_img->base; |
} |
static _EGLImage * |
dri2_drm_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLContext *ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
(void) drv; |
switch (target) { |
case EGL_NATIVE_PIXMAP_KHR: |
return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list); |
default: |
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list); |
} |
} |
#if 0 |
static int |
dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
return drmAuthMagic(dri2_dpy->fd, id); |
} |
#endif |
EGLBoolean |
dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy; |
struct gbm_device *gbm; |
int fd = -1; |
int i; |
dri2_dpy = calloc(1, sizeof *dri2_dpy); |
if (!dri2_dpy) |
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); |
disp->DriverData = (void *) dri2_dpy; |
gbm = disp->PlatformDisplay; |
if (gbm == NULL) { |
fd = get_service("DISPLAY"); |
dri2_dpy->own_device = 1; |
gbm = gbm_create_device(fd); |
if (gbm == NULL) |
return EGL_FALSE; |
} |
if (strcmp(gbm_device_get_backend_name(gbm), "drm") != 0) { |
free(dri2_dpy); |
return EGL_FALSE; |
} |
dri2_dpy->gbm_dri = gbm_dri_device(gbm); |
if (dri2_dpy->gbm_dri->base.type != GBM_DRM_DRIVER_TYPE_DRI) { |
free(dri2_dpy); |
return EGL_FALSE; |
} |
dri2_dpy->fd = fd; |
dri2_dpy->device_name = strdup("drm device"); //dri2_get_device_name_for_fd(dri2_dpy->fd); |
dri2_dpy->driver_name = dri2_dpy->gbm_dri->base.driver_name; |
dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen; |
dri2_dpy->core = dri2_dpy->gbm_dri->core; |
dri2_dpy->dri2 = dri2_dpy->gbm_dri->dri2; |
dri2_dpy->image = dri2_dpy->gbm_dri->image; |
dri2_dpy->flush = dri2_dpy->gbm_dri->flush; |
dri2_dpy->driver_configs = dri2_dpy->gbm_dri->driver_configs; |
dri2_dpy->gbm_dri->lookup_image = dri2_lookup_egl_image; |
dri2_dpy->gbm_dri->lookup_user_data = disp; |
dri2_dpy->gbm_dri->get_buffers = dri2_get_buffers; |
dri2_dpy->gbm_dri->flush_front_buffer = dri2_flush_front_buffer; |
dri2_dpy->gbm_dri->get_buffers_with_format = dri2_get_buffers_with_format; |
dri2_dpy->gbm_dri->base.base.surface_lock_front_buffer = lock_front_buffer; |
dri2_dpy->gbm_dri->base.base.surface_release_buffer = release_buffer; |
dri2_dpy->gbm_dri->base.base.surface_has_free_buffers = has_free_buffers; |
dri2_setup_screen(disp); |
for (i = 0; dri2_dpy->driver_configs[i]; i++) |
dri2_add_config(disp, dri2_dpy->driver_configs[i], |
i + 1, 0, EGL_WINDOW_BIT, NULL, NULL); |
drv->API.CreateWindowSurface = dri2_create_window_surface; |
drv->API.DestroySurface = dri2_destroy_surface; |
drv->API.SwapBuffers = dri2_swap_buffers; |
drv->API.CreateImageKHR = dri2_drm_create_image_khr; |
drv->API.QueryBufferAge = dri2_query_buffer_age; |
disp->Extensions.EXT_buffer_age = EGL_TRUE; |
#ifdef HAVE_WAYLAND_PLATFORM |
disp->Extensions.WL_bind_wayland_display = EGL_TRUE; |
#endif |
// dri2_dpy->authenticate = dri2_drm_authenticate; |
/* we're supporting EGL 1.4 */ |
disp->VersionMajor = 1; |
disp->VersionMinor = 4; |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_drm.c.bak |
---|
0,0 → 1,543 |
/* |
* 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 (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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
*/ |
#include <stdlib.h> |
#include <stdio.h> |
#include <string.h> |
#include <xf86drm.h> |
//#include <dlfcn.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <fcntl.h> |
#include <unistd.h> |
#include <kos32sys.h> |
#include <pixlib2.h> |
#define EGL_EGLEXT_PROTOTYPES |
#include <EGL/egl.h> |
#include <EGL/eglext.h> |
#include "egl_dri2.h" |
int sna_bitmap_from_handle(bitmap_t *bitmap, uint32_t handle); |
void sna_set_bo_handle(bitmap_t *bitmap, int handle); |
int sna_blit_tex(bitmap_t *bitmap, int scale, int dst_x, int dst_y, |
int w, int h, int src_x, int src_y); |
static struct gbm_bo * |
lock_front_buffer(struct gbm_surface *_surf) |
{ |
struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf; |
struct dri2_egl_surface *dri2_surf = surf->dri_private; |
struct gbm_bo *bo; |
if (dri2_surf->current == NULL) { |
_eglError(EGL_BAD_SURFACE, "no front buffer"); |
return NULL; |
} |
bo = dri2_surf->current->bo; |
dri2_surf->current->locked = 1; |
dri2_surf->current = NULL; |
return bo; |
} |
static void |
release_buffer(struct gbm_surface *_surf, struct gbm_bo *bo) |
{ |
struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf; |
struct dri2_egl_surface *dri2_surf = surf->dri_private; |
int i; |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
if (dri2_surf->color_buffers[i].bo == bo) { |
dri2_surf->color_buffers[i].locked = 0; |
} |
} |
} |
static int |
has_free_buffers(struct gbm_surface *_surf) |
{ |
struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf; |
struct dri2_egl_surface *dri2_surf = surf->dri_private; |
int i; |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) |
if (!dri2_surf->color_buffers[i].locked) |
return 1; |
return 0; |
} |
static _EGLSurface * |
dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf); |
struct dri2_egl_surface *dri2_surf; |
struct gbm_dri_surface *surf; |
(void) drv; |
dri2_surf = calloc(1, sizeof *dri2_surf); |
if (!dri2_surf) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_surface"); |
return NULL; |
} |
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list)) |
goto cleanup_surf; |
switch (type) { |
case EGL_WINDOW_BIT: |
if (!window) |
return NULL; |
surf = gbm_dri_surface((struct gbm_surface *) window); |
dri2_surf->gbm_surf = surf; |
dri2_surf->base.Width = surf->base.width; |
dri2_surf->base.Height = surf->base.height; |
surf->dri_private = dri2_surf; |
break; |
default: |
goto cleanup_surf; |
} |
dri2_surf->dri_drawable = |
(*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen, |
dri2_conf->dri_double_config, |
dri2_surf->gbm_surf); |
if (dri2_surf->dri_drawable == NULL) { |
_eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable"); |
goto cleanup_surf; |
} |
return &dri2_surf->base; |
cleanup_surf: |
free(dri2_surf); |
return NULL; |
} |
static _EGLSurface * |
dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
return dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf, |
window, attrib_list); |
} |
static EGLBoolean |
dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
int i; |
if (!_eglPutSurface(surf)) |
return EGL_TRUE; |
(*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
if (dri2_surf->color_buffers[i].bo) |
gbm_bo_destroy(dri2_surf->color_buffers[i].bo); |
} |
for (i = 0; i < __DRI_BUFFER_COUNT; i++) { |
if (dri2_surf->dri_buffers[i]) |
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen, |
dri2_surf->dri_buffers[i]); |
} |
free(surf); |
return EGL_TRUE; |
} |
static int |
get_back_bo(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
struct gbm_dri_bo *bo; |
struct gbm_dri_surface *surf = dri2_surf->gbm_surf; |
int i, name, pitch; |
if (dri2_surf->back == NULL) { |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
if (!dri2_surf->color_buffers[i].locked) { |
dri2_surf->back = &dri2_surf->color_buffers[i]; |
break; |
} |
} |
} |
if (dri2_surf->back == NULL) |
return -1; |
if (dri2_surf->back->bo == NULL) |
dri2_surf->back->bo = gbm_bo_create(&dri2_dpy->gbm_dri->base.base, |
surf->base.width, surf->base.height, |
surf->base.format, surf->base.flags); |
if (dri2_surf->back->bo == NULL) |
return -1; |
bo = (struct gbm_dri_bo *) dri2_surf->back->bo; |
dri2_dpy->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_NAME, &name); |
dri2_dpy->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE, &pitch); |
buffer->attachment = __DRI_BUFFER_BACK_LEFT; |
buffer->name = name; |
buffer->pitch = pitch; |
buffer->cpp = 4; |
buffer->flags = 0; |
return 0; |
} |
static int |
get_aux_bo(struct dri2_egl_surface *dri2_surf, |
unsigned int attachment, unsigned int format, __DRIbuffer *buffer) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
__DRIbuffer *b = dri2_surf->dri_buffers[attachment]; |
if (b == NULL) { |
b = dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen, |
attachment, format, |
dri2_surf->base.Width, |
dri2_surf->base.Height); |
dri2_surf->dri_buffers[attachment] = b; |
} |
if (b == NULL) |
return -1; |
memcpy(buffer, b, sizeof *buffer); |
return 0; |
} |
static __DRIbuffer * |
dri2_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; |
int i, j; |
dri2_surf->buffer_count = 0; |
for (i = 0, j = 0; i < 2 * count; i += 2, j++) { |
assert(attachments[i] < __DRI_BUFFER_COUNT); |
assert(dri2_surf->buffer_count < 5); |
switch (attachments[i]) { |
case __DRI_BUFFER_BACK_LEFT: |
if (get_back_bo(dri2_surf, &dri2_surf->buffers[j]) < 0) { |
_eglError(EGL_BAD_ALLOC, "failed to allocate color buffer"); |
return NULL; |
} |
break; |
default: |
if (get_aux_bo(dri2_surf, attachments[i], attachments[i + 1], |
&dri2_surf->buffers[j]) < 0) { |
_eglError(EGL_BAD_ALLOC, "failed to allocate aux buffer"); |
return NULL; |
} |
break; |
} |
} |
*out_count = j; |
if (j == 0) |
return NULL; |
*width = dri2_surf->base.Width; |
*height = dri2_surf->base.Height; |
return dri2_surf->buffers; |
} |
static __DRIbuffer * |
dri2_get_buffers(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *loaderPrivate) |
{ |
unsigned int *attachments_with_format; |
__DRIbuffer *buffer; |
const unsigned int format = 32; |
int i; |
attachments_with_format = calloc(count * 2, sizeof(unsigned int)); |
if (!attachments_with_format) { |
*out_count = 0; |
return NULL; |
} |
for (i = 0; i < count; ++i) { |
attachments_with_format[2*i] = attachments[i]; |
attachments_with_format[2*i + 1] = format; |
} |
buffer = |
dri2_get_buffers_with_format(driDrawable, |
width, height, |
attachments_with_format, count, |
out_count, loaderPrivate); |
free(attachments_with_format); |
return buffer; |
} |
static void |
dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) |
{ |
(void) driDrawable; |
(void) loaderPrivate; |
} |
static EGLBoolean |
dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); |
__DRIbuffer buffer; |
static bitmap_t bm; |
int i; |
if (dri2_surf->base.Type == EGL_WINDOW_BIT) { |
if (dri2_surf->current) |
_eglError(EGL_BAD_SURFACE, "dri2_swap_buffers"); |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) |
if (dri2_surf->color_buffers[i].age > 0) |
dri2_surf->color_buffers[i].age++; |
if ( (dri2_surf->back != NULL) && |
(dri2_surf->back->bo != NULL)) |
{ |
struct gbm_dri_bo *bo; |
bo = (struct gbm_dri_bo *)dri2_surf->back->bo; |
if(bm.width == 0) |
{ |
printf("%s bo: %p handle: %d width: %d height: %d pitch %d format %x\n", |
__FUNCTION__, bo, bo->base.base.handle.s32, bo->base.base.width, |
bo->base.base.height, (int)bo->base.base.stride, |
bo->base.base.format); |
bm.width = bo->base.base.width; |
bm.height = bo->base.base.height; |
bm.pitch = (int)bo->base.base.stride; |
bm.max_width = bo->base.base.width; |
bm.max_height = bo->base.base.height; |
bm.flags = HW_TEX_BLIT; |
if( sna_bitmap_from_handle(&bm, bo->base.base.handle.s32)) |
{ |
printf("sna_bitmap_from_handle failed\n"); |
} |
} |
if( bm.handle != 0) |
{ |
sna_set_bo_handle(&bm, bo->base.base.handle.s32); |
sna_blit_tex(&bm, 0, 5, 22, bm.width, bm.height, 0, 0); |
} |
} |
dri2_surf->current = dri2_surf->back; |
dri2_surf->current->age = 1; |
dri2_surf->back = NULL; |
} |
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); |
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
static EGLint |
dri2_query_buffer_age(_EGLDriver *drv, |
_EGLDisplay *disp, _EGLSurface *surface) |
{ |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface); |
__DRIbuffer buffer; |
if (get_back_bo(dri2_surf, &buffer) < 0) { |
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age"); |
return 0; |
} |
return dri2_surf->back->age; |
} |
static _EGLImage * |
dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct gbm_dri_bo *dri_bo = gbm_dri_bo((struct gbm_bo *) buffer); |
struct dri2_egl_image *dri2_img; |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap"); |
return NULL; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
free(dri2_img); |
return NULL; |
} |
dri2_img->dri_image = dri2_dpy->image->dupImage(dri_bo->image, dri2_img); |
if (dri2_img->dri_image == NULL) { |
free(dri2_img); |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap"); |
return NULL; |
} |
return &dri2_img->base; |
} |
static _EGLImage * |
dri2_drm_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLContext *ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
(void) drv; |
switch (target) { |
case EGL_NATIVE_PIXMAP_KHR: |
return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list); |
default: |
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list); |
} |
} |
#if 0 |
static int |
dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
return drmAuthMagic(dri2_dpy->fd, id); |
} |
#endif |
EGLBoolean |
dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy; |
struct gbm_device *gbm; |
int fd = -1; |
int i; |
dri2_dpy = calloc(1, sizeof *dri2_dpy); |
if (!dri2_dpy) |
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); |
disp->DriverData = (void *) dri2_dpy; |
gbm = disp->PlatformDisplay; |
if (gbm == NULL) { |
fd = get_service("DISPLAY"); |
dri2_dpy->own_device = 1; |
gbm = gbm_create_device(fd); |
if (gbm == NULL) |
return EGL_FALSE; |
} |
if (strcmp(gbm_device_get_backend_name(gbm), "drm") != 0) { |
free(dri2_dpy); |
return EGL_FALSE; |
} |
dri2_dpy->gbm_dri = gbm_dri_device(gbm); |
if (dri2_dpy->gbm_dri->base.type != GBM_DRM_DRIVER_TYPE_DRI) { |
free(dri2_dpy); |
return EGL_FALSE; |
} |
dri2_dpy->fd = fd; |
dri2_dpy->device_name = strdup("drm device"); //dri2_get_device_name_for_fd(dri2_dpy->fd); |
dri2_dpy->driver_name = dri2_dpy->gbm_dri->base.driver_name; |
dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen; |
dri2_dpy->core = dri2_dpy->gbm_dri->core; |
dri2_dpy->dri2 = dri2_dpy->gbm_dri->dri2; |
dri2_dpy->image = dri2_dpy->gbm_dri->image; |
dri2_dpy->flush = dri2_dpy->gbm_dri->flush; |
dri2_dpy->driver_configs = dri2_dpy->gbm_dri->driver_configs; |
dri2_dpy->gbm_dri->lookup_image = dri2_lookup_egl_image; |
dri2_dpy->gbm_dri->lookup_user_data = disp; |
dri2_dpy->gbm_dri->get_buffers = dri2_get_buffers; |
dri2_dpy->gbm_dri->flush_front_buffer = dri2_flush_front_buffer; |
dri2_dpy->gbm_dri->get_buffers_with_format = dri2_get_buffers_with_format; |
dri2_dpy->gbm_dri->base.base.surface_lock_front_buffer = lock_front_buffer; |
dri2_dpy->gbm_dri->base.base.surface_release_buffer = release_buffer; |
dri2_dpy->gbm_dri->base.base.surface_has_free_buffers = has_free_buffers; |
dri2_setup_screen(disp); |
for (i = 0; dri2_dpy->driver_configs[i]; i++) |
dri2_add_config(disp, dri2_dpy->driver_configs[i], |
i + 1, 0, EGL_WINDOW_BIT, NULL, NULL); |
drv->API.CreateWindowSurface = dri2_create_window_surface; |
drv->API.CreatePbufferSurface = dri2_create_pbuffer_surface; |
drv->API.DestroySurface = dri2_destroy_surface; |
drv->API.SwapBuffers = dri2_swap_buffers; |
drv->API.CreateImageKHR = dri2_drm_create_image_khr; |
drv->API.QueryBufferAge = dri2_query_buffer_age; |
disp->Extensions.EXT_buffer_age = EGL_TRUE; |
#ifdef HAVE_WAYLAND_PLATFORM |
disp->Extensions.WL_bind_wayland_display = EGL_TRUE; |
#endif |
// dri2_dpy->authenticate = dri2_drm_authenticate; |
/* we're supporting EGL 1.4 */ |
disp->VersionMajor = 1; |
disp->VersionMinor = 4; |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_wayland.c |
---|
0,0 → 1,847 |
/* |
* Copyright © 2011-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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#include <stdlib.h> |
#include <string.h> |
#include <limits.h> |
#include <dlfcn.h> |
#include <errno.h> |
#include <unistd.h> |
#include <fcntl.h> |
#include <xf86drm.h> |
#include "egl_dri2.h" |
#include <wayland-client.h> |
#include "wayland-drm-client-protocol.h" |
enum wl_drm_format_flags { |
HAS_ARGB8888 = 1, |
HAS_XRGB8888 = 2 |
}; |
static void |
sync_callback(void *data, struct wl_callback *callback, uint32_t serial) |
{ |
int *done = data; |
*done = 1; |
wl_callback_destroy(callback); |
} |
static const struct wl_callback_listener sync_listener = { |
sync_callback |
}; |
static int |
roundtrip(struct dri2_egl_display *dri2_dpy) |
{ |
struct wl_callback *callback; |
int done = 0, ret = 0; |
callback = wl_display_sync(dri2_dpy->wl_dpy); |
wl_callback_add_listener(callback, &sync_listener, &done); |
wl_proxy_set_queue((struct wl_proxy *) callback, dri2_dpy->wl_queue); |
while (ret != -1 && !done) |
ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue); |
if (!done) |
wl_callback_destroy(callback); |
return ret; |
} |
static void |
wl_buffer_release(void *data, struct wl_buffer *buffer) |
{ |
struct dri2_egl_surface *dri2_surf = data; |
int i; |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); ++i) |
if (dri2_surf->color_buffers[i].wl_buffer == buffer) |
break; |
if (i == ARRAY_SIZE(dri2_surf->color_buffers)) { |
wl_buffer_destroy(buffer); |
return; |
} |
dri2_surf->color_buffers[i].locked = 0; |
} |
static struct wl_buffer_listener wl_buffer_listener = { |
wl_buffer_release |
}; |
static void |
resize_callback(struct wl_egl_window *wl_win, void *data) |
{ |
struct dri2_egl_surface *dri2_surf = data; |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable); |
} |
/** |
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). |
*/ |
static _EGLSurface * |
dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf); |
struct dri2_egl_surface *dri2_surf; |
(void) drv; |
dri2_surf = malloc(sizeof *dri2_surf); |
if (!dri2_surf) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_surface"); |
return NULL; |
} |
memset(dri2_surf, 0, sizeof *dri2_surf); |
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list)) |
goto cleanup_surf; |
if (conf->AlphaSize == 0) |
dri2_surf->format = WL_DRM_FORMAT_XRGB8888; |
else |
dri2_surf->format = WL_DRM_FORMAT_ARGB8888; |
switch (type) { |
case EGL_WINDOW_BIT: |
dri2_surf->wl_win = (struct wl_egl_window *) window; |
dri2_surf->wl_win->private = dri2_surf; |
dri2_surf->wl_win->resize_callback = resize_callback; |
dri2_surf->base.Width = -1; |
dri2_surf->base.Height = -1; |
break; |
default: |
goto cleanup_surf; |
} |
dri2_surf->dri_drawable = |
(*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen, |
type == EGL_WINDOW_BIT ? |
dri2_conf->dri_double_config : |
dri2_conf->dri_single_config, |
dri2_surf); |
if (dri2_surf->dri_drawable == NULL) { |
_eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable"); |
goto cleanup_dri_drawable; |
} |
return &dri2_surf->base; |
cleanup_dri_drawable: |
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable); |
cleanup_surf: |
free(dri2_surf); |
return NULL; |
} |
/** |
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). |
*/ |
static _EGLSurface * |
dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
return dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf, |
window, attrib_list); |
} |
/** |
* Called via eglDestroySurface(), drv->API.DestroySurface(). |
*/ |
static EGLBoolean |
dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
int i; |
(void) drv; |
if (!_eglPutSurface(surf)) |
return EGL_TRUE; |
(*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
if (dri2_surf->color_buffers[i].wl_buffer) |
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer); |
if (dri2_surf->color_buffers[i].dri_image) |
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image); |
} |
for (i = 0; i < __DRI_BUFFER_COUNT; i++) |
if (dri2_surf->dri_buffers[i] && |
dri2_surf->dri_buffers[i]->attachment != __DRI_BUFFER_BACK_LEFT) |
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen, |
dri2_surf->dri_buffers[i]); |
if (dri2_surf->frame_callback) |
wl_callback_destroy(dri2_surf->frame_callback); |
if (dri2_surf->base.Type == EGL_WINDOW_BIT) { |
dri2_surf->wl_win->private = NULL; |
dri2_surf->wl_win->resize_callback = NULL; |
} |
free(surf); |
return EGL_TRUE; |
} |
static void |
dri2_release_buffers(struct dri2_egl_surface *dri2_surf) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
int i; |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
if (dri2_surf->color_buffers[i].wl_buffer && |
!dri2_surf->color_buffers[i].locked) |
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer); |
if (dri2_surf->color_buffers[i].dri_image) |
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image); |
dri2_surf->color_buffers[i].wl_buffer = NULL; |
dri2_surf->color_buffers[i].dri_image = NULL; |
dri2_surf->color_buffers[i].locked = 0; |
} |
for (i = 0; i < __DRI_BUFFER_COUNT; i++) |
if (dri2_surf->dri_buffers[i] && |
dri2_surf->dri_buffers[i]->attachment != __DRI_BUFFER_BACK_LEFT) |
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen, |
dri2_surf->dri_buffers[i]); |
} |
static int |
get_back_bo(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
__DRIimage *image; |
int i, name, pitch; |
/* There might be a buffer release already queued that wasn't processed */ |
wl_display_dispatch_queue_pending(dri2_dpy->wl_dpy, dri2_dpy->wl_queue); |
if (dri2_surf->back == NULL) { |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
/* Get an unlocked buffer, preferrably one with a dri_buffer already |
* allocated. */ |
if (dri2_surf->color_buffers[i].locked) |
continue; |
if (dri2_surf->back == NULL) |
dri2_surf->back = &dri2_surf->color_buffers[i]; |
else if (dri2_surf->back->dri_image == NULL) |
dri2_surf->back = &dri2_surf->color_buffers[i]; |
} |
} |
if (dri2_surf->back == NULL) |
return -1; |
if (dri2_surf->back->dri_image == NULL) { |
dri2_surf->back->dri_image = |
dri2_dpy->image->createImage(dri2_dpy->dri_screen, |
dri2_surf->base.Width, |
dri2_surf->base.Height, |
__DRI_IMAGE_FORMAT_ARGB8888, |
__DRI_IMAGE_USE_SHARE, |
NULL); |
dri2_surf->back->age = 0; |
} |
if (dri2_surf->back->dri_image == NULL) |
return -1; |
image = dri2_surf->back->dri_image; |
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NAME, &name); |
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &pitch); |
dri2_surf->back->name = name; |
dri2_surf->back->pitch = pitch; |
buffer->attachment = __DRI_BUFFER_BACK_LEFT; |
buffer->name = name; |
buffer->pitch = pitch; |
buffer->cpp = 4; |
buffer->flags = 0; |
dri2_surf->back->locked = 1; |
return 0; |
} |
static int |
get_aux_bo(struct dri2_egl_surface *dri2_surf, |
unsigned int attachment, unsigned int format, __DRIbuffer *buffer) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
__DRIbuffer *b = dri2_surf->dri_buffers[attachment]; |
if (b == NULL) { |
b = dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen, |
attachment, format, |
dri2_surf->base.Width, |
dri2_surf->base.Height); |
dri2_surf->dri_buffers[attachment] = b; |
} |
if (b == NULL) |
return -1; |
memcpy(buffer, b, sizeof *buffer); |
return 0; |
} |
static __DRIbuffer * |
dri2_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; |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
int i, j; |
if (dri2_surf->base.Type == EGL_WINDOW_BIT && |
(dri2_surf->base.Width != dri2_surf->wl_win->width || |
dri2_surf->base.Height != dri2_surf->wl_win->height)) { |
dri2_release_buffers(dri2_surf); |
dri2_surf->base.Width = dri2_surf->wl_win->width; |
dri2_surf->base.Height = dri2_surf->wl_win->height; |
dri2_surf->dx = dri2_surf->wl_win->dx; |
dri2_surf->dy = dri2_surf->wl_win->dy; |
} |
for (i = 0, j = 0; i < 2 * count; i += 2, j++) { |
switch (attachments[i]) { |
case __DRI_BUFFER_BACK_LEFT: |
if (get_back_bo(dri2_surf, &dri2_surf->buffers[j]) < 0) { |
_eglError(EGL_BAD_ALLOC, "failed to allocate color buffer"); |
return NULL; |
} |
break; |
default: |
if (get_aux_bo(dri2_surf, attachments[i], attachments[i + 1], |
&dri2_surf->buffers[j]) < 0) { |
_eglError(EGL_BAD_ALLOC, "failed to allocate aux buffer"); |
return NULL; |
} |
break; |
} |
} |
/* If we have an extra unlocked buffer at this point, we had to do triple |
* buffering for a while, but now can go back to just double buffering. |
* That means we can free any unlocked buffer now. */ |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { |
if (!dri2_surf->color_buffers[i].locked && |
dri2_surf->color_buffers[i].wl_buffer) { |
wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer); |
dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image); |
dri2_surf->color_buffers[i].wl_buffer = NULL; |
dri2_surf->color_buffers[i].dri_image = NULL; |
} |
} |
*out_count = j; |
if (j == 0) |
return NULL; |
*width = dri2_surf->base.Width; |
*height = dri2_surf->base.Height; |
return dri2_surf->buffers; |
} |
static __DRIbuffer * |
dri2_get_buffers(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *loaderPrivate) |
{ |
unsigned int *attachments_with_format; |
__DRIbuffer *buffer; |
const unsigned int format = 32; |
int i; |
attachments_with_format = calloc(count * 2, sizeof(unsigned int)); |
if (!attachments_with_format) { |
*out_count = 0; |
return NULL; |
} |
for (i = 0; i < count; ++i) { |
attachments_with_format[2*i] = attachments[i]; |
attachments_with_format[2*i + 1] = format; |
} |
buffer = |
dri2_get_buffers_with_format(driDrawable, |
width, height, |
attachments_with_format, count, |
out_count, loaderPrivate); |
free(attachments_with_format); |
return buffer; |
} |
static void |
dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) |
{ |
(void) driDrawable; |
(void) loaderPrivate; |
} |
static void |
wayland_frame_callback(void *data, struct wl_callback *callback, uint32_t time) |
{ |
struct dri2_egl_surface *dri2_surf = data; |
dri2_surf->frame_callback = NULL; |
wl_callback_destroy(callback); |
} |
static const struct wl_callback_listener frame_listener = { |
wayland_frame_callback |
}; |
static void |
create_wl_buffer(struct dri2_egl_surface *dri2_surf) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
int fd; |
if (dri2_surf->current->wl_buffer != NULL) |
return; |
if (dri2_dpy->capabilities & WL_DRM_CAPABILITY_PRIME) { |
dri2_dpy->image->queryImage(dri2_surf->current->dri_image, |
__DRI_IMAGE_ATTRIB_FD, &fd); |
dri2_surf->current->wl_buffer = |
wl_drm_create_prime_buffer(dri2_dpy->wl_drm, |
fd, |
dri2_surf->base.Width, |
dri2_surf->base.Height, |
dri2_surf->format, |
0, dri2_surf->current->pitch, |
0, 0, |
0, 0); |
close(fd); |
} else { |
dri2_surf->current->wl_buffer = |
wl_drm_create_buffer(dri2_dpy->wl_drm, |
dri2_surf->current->name, |
dri2_surf->base.Width, |
dri2_surf->base.Height, |
dri2_surf->current->pitch, |
dri2_surf->format); |
} |
wl_proxy_set_queue((struct wl_proxy *) dri2_surf->current->wl_buffer, |
dri2_dpy->wl_queue); |
wl_buffer_add_listener(dri2_surf->current->wl_buffer, |
&wl_buffer_listener, dri2_surf); |
} |
/** |
* Called via eglSwapBuffers(), drv->API.SwapBuffers(). |
*/ |
static EGLBoolean |
dri2_swap_buffers_with_damage(_EGLDriver *drv, |
_EGLDisplay *disp, |
_EGLSurface *draw, |
const EGLint *rects, |
EGLint n_rects) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); |
__DRIbuffer buffer; |
int i, ret = 0; |
while (dri2_surf->frame_callback && ret != -1) |
ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue); |
if (ret < 0) |
return EGL_FALSE; |
dri2_surf->frame_callback = wl_surface_frame(dri2_surf->wl_win->surface); |
wl_callback_add_listener(dri2_surf->frame_callback, |
&frame_listener, dri2_surf); |
wl_proxy_set_queue((struct wl_proxy *) dri2_surf->frame_callback, |
dri2_dpy->wl_queue); |
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) |
if (dri2_surf->color_buffers[i].age > 0) |
dri2_surf->color_buffers[i].age++; |
/* Make sure we have a back buffer in case we're swapping without ever |
* rendering. */ |
if (get_back_bo(dri2_surf, &buffer) < 0) { |
_eglError(EGL_BAD_ALLOC, "dri2_swap_buffers"); |
return EGL_FALSE; |
} |
dri2_surf->back->age = 1; |
dri2_surf->current = dri2_surf->back; |
dri2_surf->back = NULL; |
create_wl_buffer(dri2_surf); |
wl_surface_attach(dri2_surf->wl_win->surface, |
dri2_surf->current->wl_buffer, |
dri2_surf->dx, dri2_surf->dy); |
dri2_surf->wl_win->attached_width = dri2_surf->base.Width; |
dri2_surf->wl_win->attached_height = dri2_surf->base.Height; |
/* reset resize growing parameters */ |
dri2_surf->dx = 0; |
dri2_surf->dy = 0; |
if (n_rects == 0) { |
wl_surface_damage(dri2_surf->wl_win->surface, 0, 0, |
dri2_surf->base.Width, dri2_surf->base.Height); |
} else { |
for (i = 0; i < n_rects; i++) { |
const int *rect = &rects[i * 4]; |
wl_surface_damage(dri2_surf->wl_win->surface, |
rect[0], |
dri2_surf->base.Height - rect[1] - rect[3], |
rect[2], rect[3]); |
} |
} |
wl_surface_commit(dri2_surf->wl_win->surface); |
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); |
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
static EGLint |
dri2_query_buffer_age(_EGLDriver *drv, |
_EGLDisplay *disp, _EGLSurface *surface) |
{ |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface); |
__DRIbuffer buffer; |
if (get_back_bo(dri2_surf, &buffer) < 0) { |
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age"); |
return 0; |
} |
return dri2_surf->back->age; |
} |
static EGLBoolean |
dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) |
{ |
return dri2_swap_buffers_with_damage (drv, disp, draw, NULL, 0); |
} |
static int |
dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
int ret = 0; |
dri2_dpy->authenticated = 0; |
wl_drm_authenticate(dri2_dpy->wl_drm, id); |
if (roundtrip(dri2_dpy) < 0) |
ret = -1; |
if (!dri2_dpy->authenticated) |
ret = -1; |
/* reset authenticated */ |
dri2_dpy->authenticated = 1; |
return ret; |
} |
/** |
* Called via eglTerminate(), drv->API.Terminate(). |
*/ |
static EGLBoolean |
dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
_eglReleaseDisplayResources(drv, disp); |
_eglCleanupDisplay(disp); |
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen); |
close(dri2_dpy->fd); |
dlclose(dri2_dpy->driver); |
free(dri2_dpy->driver_name); |
free(dri2_dpy->device_name); |
wl_drm_destroy(dri2_dpy->wl_drm); |
if (dri2_dpy->own_device) |
wl_display_disconnect(dri2_dpy->wl_dpy); |
free(dri2_dpy); |
disp->DriverData = NULL; |
return EGL_TRUE; |
} |
static void |
drm_handle_device(void *data, struct wl_drm *drm, const char *device) |
{ |
struct dri2_egl_display *dri2_dpy = data; |
drm_magic_t magic; |
dri2_dpy->device_name = strdup(device); |
if (!dri2_dpy->device_name) |
return; |
#ifdef O_CLOEXEC |
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC); |
if (dri2_dpy->fd == -1 && errno == EINVAL) |
#endif |
{ |
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR); |
if (dri2_dpy->fd != -1) |
fcntl(dri2_dpy->fd, F_SETFD, fcntl(dri2_dpy->fd, F_GETFD) | |
FD_CLOEXEC); |
} |
if (dri2_dpy->fd == -1) { |
_eglLog(_EGL_WARNING, "wayland-egl: could not open %s (%s)", |
dri2_dpy->device_name, strerror(errno)); |
return; |
} |
drmGetMagic(dri2_dpy->fd, &magic); |
wl_drm_authenticate(dri2_dpy->wl_drm, magic); |
} |
static void |
drm_handle_format(void *data, struct wl_drm *drm, uint32_t format) |
{ |
struct dri2_egl_display *dri2_dpy = data; |
switch (format) { |
case WL_DRM_FORMAT_ARGB8888: |
dri2_dpy->formats |= HAS_ARGB8888; |
break; |
case WL_DRM_FORMAT_XRGB8888: |
dri2_dpy->formats |= HAS_XRGB8888; |
break; |
} |
} |
static void |
drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value) |
{ |
struct dri2_egl_display *dri2_dpy = data; |
dri2_dpy->capabilities = value; |
} |
static void |
drm_handle_authenticated(void *data, struct wl_drm *drm) |
{ |
struct dri2_egl_display *dri2_dpy = data; |
dri2_dpy->authenticated = 1; |
} |
static const struct wl_drm_listener drm_listener = { |
drm_handle_device, |
drm_handle_format, |
drm_handle_authenticated, |
drm_handle_capabilities |
}; |
static void |
registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, |
const char *interface, uint32_t version) |
{ |
struct dri2_egl_display *dri2_dpy = data; |
if (version > 1) |
version = 2; |
if (strcmp(interface, "wl_drm") == 0) { |
dri2_dpy->wl_drm = |
wl_registry_bind(registry, name, &wl_drm_interface, version); |
wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy); |
} |
} |
static void |
registry_handle_global_remove(void *data, struct wl_registry *registry, |
uint32_t name) |
{ |
} |
static const struct wl_registry_listener registry_listener = { |
registry_handle_global, |
registry_handle_global_remove |
}; |
EGLBoolean |
dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy; |
const __DRIconfig *config; |
uint32_t types; |
int i; |
static const unsigned int argb_masks[4] = |
{ 0xff0000, 0xff00, 0xff, 0xff000000 }; |
static const unsigned int rgb_masks[4] = { 0xff0000, 0xff00, 0xff, 0 }; |
drv->API.CreateWindowSurface = dri2_create_window_surface; |
drv->API.DestroySurface = dri2_destroy_surface; |
drv->API.SwapBuffers = dri2_swap_buffers; |
drv->API.SwapBuffersWithDamageEXT = dri2_swap_buffers_with_damage; |
drv->API.Terminate = dri2_terminate; |
drv->API.QueryBufferAge = dri2_query_buffer_age; |
dri2_dpy = calloc(1, sizeof *dri2_dpy); |
if (!dri2_dpy) |
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); |
disp->DriverData = (void *) dri2_dpy; |
if (disp->PlatformDisplay == NULL) { |
dri2_dpy->wl_dpy = wl_display_connect(NULL); |
if (dri2_dpy->wl_dpy == NULL) |
goto cleanup_dpy; |
dri2_dpy->own_device = 1; |
} else { |
dri2_dpy->wl_dpy = disp->PlatformDisplay; |
} |
dri2_dpy->wl_queue = wl_display_create_queue(dri2_dpy->wl_dpy); |
if (dri2_dpy->own_device) |
wl_display_dispatch_pending(dri2_dpy->wl_dpy); |
dri2_dpy->wl_registry = wl_display_get_registry(dri2_dpy->wl_dpy); |
wl_proxy_set_queue((struct wl_proxy *) dri2_dpy->wl_registry, |
dri2_dpy->wl_queue); |
wl_registry_add_listener(dri2_dpy->wl_registry, |
®istry_listener, dri2_dpy); |
if (roundtrip(dri2_dpy) < 0 || dri2_dpy->wl_drm == NULL) |
goto cleanup_dpy; |
if (roundtrip(dri2_dpy) < 0 || dri2_dpy->fd == -1) |
goto cleanup_drm; |
if (roundtrip(dri2_dpy) < 0 || !dri2_dpy->authenticated) |
goto cleanup_fd; |
dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd); |
if (dri2_dpy->driver_name == NULL) { |
_eglError(EGL_BAD_ALLOC, "DRI2: failed to get driver name"); |
goto cleanup_fd; |
} |
if (!dri2_load_driver(disp)) |
goto cleanup_driver_name; |
dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER; |
dri2_dpy->dri2_loader_extension.base.version = 3; |
dri2_dpy->dri2_loader_extension.getBuffers = dri2_get_buffers; |
dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_flush_front_buffer; |
dri2_dpy->dri2_loader_extension.getBuffersWithFormat = |
dri2_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)) |
goto cleanup_driver; |
/* The server shouldn't advertise WL_DRM_CAPABILITY_PRIME if the driver |
* doesn't have createImageFromFds, since we're using the same driver on |
* both sides. We don't want crash if that happens anyway, so fall back to |
* gem names if we don't have prime support. */ |
if (dri2_dpy->image->base.version < 7 || |
dri2_dpy->image->createImageFromFds == NULL) |
dri2_dpy->capabilities &= WL_DRM_CAPABILITY_PRIME; |
types = EGL_WINDOW_BIT; |
for (i = 0; dri2_dpy->driver_configs[i]; i++) { |
config = dri2_dpy->driver_configs[i]; |
if (dri2_dpy->formats & HAS_XRGB8888) |
dri2_add_config(disp, config, i + 1, 0, types, NULL, rgb_masks); |
if (dri2_dpy->formats & HAS_ARGB8888) |
dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks); |
} |
disp->Extensions.WL_bind_wayland_display = EGL_TRUE; |
disp->Extensions.EXT_buffer_age = EGL_TRUE; |
dri2_dpy->authenticate = dri2_wayland_authenticate; |
disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE; |
/* we're supporting EGL 1.4 */ |
disp->VersionMajor = 1; |
disp->VersionMinor = 4; |
return EGL_TRUE; |
cleanup_driver: |
dlclose(dri2_dpy->driver); |
cleanup_driver_name: |
free(dri2_dpy->driver_name); |
cleanup_fd: |
close(dri2_dpy->fd); |
cleanup_drm: |
free(dri2_dpy->device_name); |
wl_drm_destroy(dri2_dpy->wl_drm); |
cleanup_dpy: |
free(dri2_dpy); |
return EGL_FALSE; |
} |
/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_x11.c |
---|
0,0 → 1,1236 |
/* |
* 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 (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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
*/ |
#include <stdlib.h> |
#include <string.h> |
#include <stdio.h> |
#include <limits.h> |
#include <dlfcn.h> |
#include <fcntl.h> |
#include <errno.h> |
#include <unistd.h> |
#include <xf86drm.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include "egl_dri2.h" |
/* From xmlpool/options.h, user exposed so should be stable */ |
#define DRI_CONF_VBLANK_NEVER 0 |
#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1 |
#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2 |
#define DRI_CONF_VBLANK_ALWAYS_SYNC 3 |
static void |
swrastCreateDrawable(struct dri2_egl_display * dri2_dpy, |
struct dri2_egl_surface * dri2_surf, |
int depth) |
{ |
uint32_t mask; |
const uint32_t function = GXcopy; |
uint32_t valgc[2]; |
/* create GC's */ |
dri2_surf->gc = xcb_generate_id(dri2_dpy->conn); |
mask = XCB_GC_FUNCTION; |
xcb_create_gc(dri2_dpy->conn, dri2_surf->gc, dri2_surf->drawable, mask, &function); |
dri2_surf->swapgc = xcb_generate_id(dri2_dpy->conn); |
mask = XCB_GC_FUNCTION | XCB_GC_GRAPHICS_EXPOSURES; |
valgc[0] = function; |
valgc[1] = False; |
xcb_create_gc(dri2_dpy->conn, dri2_surf->swapgc, dri2_surf->drawable, mask, valgc); |
dri2_surf->depth = depth; |
switch (depth) { |
case 32: |
case 24: |
dri2_surf->bytes_per_pixel = 4; |
break; |
case 16: |
dri2_surf->bytes_per_pixel = 2; |
break; |
case 8: |
dri2_surf->bytes_per_pixel = 1; |
break; |
case 0: |
dri2_surf->bytes_per_pixel = 0; |
break; |
default: |
_eglLog(_EGL_WARNING, "unsupported depth %d", depth); |
} |
} |
static void |
swrastDestroyDrawable(struct dri2_egl_display * dri2_dpy, |
struct dri2_egl_surface * dri2_surf) |
{ |
xcb_free_gc(dri2_dpy->conn, dri2_surf->gc); |
xcb_free_gc(dri2_dpy->conn, dri2_surf->swapgc); |
} |
static void |
swrastGetDrawableInfo(__DRIdrawable * draw, |
int *x, int *y, int *w, int *h, |
void *loaderPrivate) |
{ |
struct dri2_egl_surface *dri2_surf = loaderPrivate; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display); |
xcb_get_geometry_cookie_t cookie; |
xcb_get_geometry_reply_t *reply; |
xcb_generic_error_t *error; |
*w = *h = 0; |
cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable); |
reply = xcb_get_geometry_reply (dri2_dpy->conn, cookie, &error); |
if (reply == NULL) |
return; |
if (error != NULL) { |
_eglLog(_EGL_WARNING, "error in xcb_get_geometry"); |
free(error); |
} else { |
*w = reply->width; |
*h = reply->height; |
} |
free(reply); |
} |
static void |
swrastPutImage(__DRIdrawable * draw, int op, |
int x, int y, int w, int h, |
char *data, void *loaderPrivate) |
{ |
struct dri2_egl_surface *dri2_surf = loaderPrivate; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display); |
xcb_gcontext_t gc; |
switch (op) { |
case __DRI_SWRAST_IMAGE_OP_DRAW: |
gc = dri2_surf->gc; |
break; |
case __DRI_SWRAST_IMAGE_OP_SWAP: |
gc = dri2_surf->swapgc; |
break; |
default: |
return; |
} |
xcb_put_image(dri2_dpy->conn, XCB_IMAGE_FORMAT_Z_PIXMAP, dri2_surf->drawable, |
gc, w, h, x, y, 0, dri2_surf->depth, |
w*h*dri2_surf->bytes_per_pixel, (const uint8_t *)data); |
} |
static void |
swrastGetImage(__DRIdrawable * read, |
int x, int y, int w, int h, |
char *data, void *loaderPrivate) |
{ |
struct dri2_egl_surface *dri2_surf = loaderPrivate; |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display); |
xcb_get_image_cookie_t cookie; |
xcb_get_image_reply_t *reply; |
xcb_generic_error_t *error; |
cookie = xcb_get_image (dri2_dpy->conn, XCB_IMAGE_FORMAT_Z_PIXMAP, |
dri2_surf->drawable, x, y, w, h, ~0); |
reply = xcb_get_image_reply (dri2_dpy->conn, cookie, &error); |
if (reply == NULL) |
return; |
if (error != NULL) { |
_eglLog(_EGL_WARNING, "error in xcb_get_image"); |
free(error); |
} else { |
uint32_t bytes = xcb_get_image_data_length(reply); |
uint8_t *idata = xcb_get_image_data(reply); |
memcpy(data, idata, bytes); |
} |
free(reply); |
} |
/** |
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). |
*/ |
static _EGLSurface * |
dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, |
_EGLConfig *conf, EGLNativeWindowType native_window, |
const EGLint *attrib_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf); |
struct dri2_egl_surface *dri2_surf; |
xcb_get_geometry_cookie_t cookie; |
xcb_get_geometry_reply_t *reply; |
xcb_screen_iterator_t s; |
xcb_generic_error_t *error; |
xcb_drawable_t window = (uintptr_t )native_window; |
(void) drv; |
dri2_surf = malloc(sizeof *dri2_surf); |
if (!dri2_surf) { |
_eglError(EGL_BAD_ALLOC, "dri2_create_surface"); |
return NULL; |
} |
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list)) |
goto cleanup_surf; |
dri2_surf->region = XCB_NONE; |
if (type == EGL_PBUFFER_BIT) { |
dri2_surf->drawable = xcb_generate_id(dri2_dpy->conn); |
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn)); |
xcb_create_pixmap(dri2_dpy->conn, conf->BufferSize, |
dri2_surf->drawable, s.data->root, |
dri2_surf->base.Width, dri2_surf->base.Height); |
} else { |
dri2_surf->drawable = window; |
} |
if (dri2_dpy->dri2) { |
dri2_surf->dri_drawable = |
(*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen, |
type == EGL_WINDOW_BIT ? |
dri2_conf->dri_double_config : |
dri2_conf->dri_single_config, |
dri2_surf); |
} else { |
assert(dri2_dpy->swrast); |
dri2_surf->dri_drawable = |
(*dri2_dpy->swrast->createNewDrawable) (dri2_dpy->dri_screen, |
dri2_conf->dri_double_config, |
dri2_surf); |
} |
if (dri2_surf->dri_drawable == NULL) { |
_eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable"); |
goto cleanup_pixmap; |
} |
if (dri2_dpy->dri2) { |
xcb_dri2_create_drawable (dri2_dpy->conn, dri2_surf->drawable); |
} else { |
swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_BUFFER_SIZE)); |
} |
if (type != EGL_PBUFFER_BIT) { |
cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable); |
reply = xcb_get_geometry_reply (dri2_dpy->conn, cookie, &error); |
if (reply == NULL || error != NULL) { |
_eglError(EGL_BAD_ALLOC, "xcb_get_geometry"); |
free(error); |
goto cleanup_dri_drawable; |
} |
dri2_surf->base.Width = reply->width; |
dri2_surf->base.Height = reply->height; |
free(reply); |
} |
/* we always copy the back buffer to front */ |
dri2_surf->base.PostSubBufferSupportedNV = EGL_TRUE; |
return &dri2_surf->base; |
cleanup_dri_drawable: |
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable); |
cleanup_pixmap: |
if (type == EGL_PBUFFER_BIT) |
xcb_free_pixmap(dri2_dpy->conn, dri2_surf->drawable); |
cleanup_surf: |
free(dri2_surf); |
return NULL; |
} |
/** |
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). |
*/ |
static _EGLSurface * |
dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, EGLNativeWindowType window, |
const EGLint *attrib_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
_EGLSurface *surf; |
surf = dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf, |
window, attrib_list); |
if (surf != NULL) { |
/* When we first create the DRI2 drawable, its swap interval on the |
* server side is 1. |
*/ |
surf->SwapInterval = 1; |
/* Override that with a driconf-set value. */ |
drv->API.SwapInterval(drv, disp, surf, dri2_dpy->default_swap_interval); |
} |
return surf; |
} |
static _EGLSurface * |
dri2_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, EGLNativePixmapType pixmap, |
const EGLint *attrib_list) |
{ |
return dri2_create_surface(drv, disp, EGL_PIXMAP_BIT, conf, |
pixmap, attrib_list); |
} |
static _EGLSurface * |
dri2_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLConfig *conf, const EGLint *attrib_list) |
{ |
return dri2_create_surface(drv, disp, EGL_PBUFFER_BIT, conf, |
XCB_WINDOW_NONE, attrib_list); |
} |
static EGLBoolean |
dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
(void) drv; |
if (!_eglPutSurface(surf)) |
return EGL_TRUE; |
(*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); |
if (dri2_dpy->dri2) { |
xcb_dri2_destroy_drawable (dri2_dpy->conn, dri2_surf->drawable); |
} else { |
assert(dri2_dpy->swrast); |
swrastDestroyDrawable(dri2_dpy, dri2_surf); |
} |
if (surf->Type == EGL_PBUFFER_BIT) |
xcb_free_pixmap (dri2_dpy->conn, dri2_surf->drawable); |
free(surf); |
return EGL_TRUE; |
} |
/** |
* Process list of buffer received from the server |
* |
* Processes the list of buffers received in a reply from the server to either |
* \c DRI2GetBuffers or \c DRI2GetBuffersWithFormat. |
*/ |
static void |
dri2_process_buffers(struct dri2_egl_surface *dri2_surf, |
xcb_dri2_dri2_buffer_t *buffers, unsigned count) |
{ |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
xcb_rectangle_t rectangle; |
unsigned i; |
dri2_surf->buffer_count = count; |
dri2_surf->have_fake_front = 0; |
/* This assumes the DRI2 buffer attachment tokens matches the |
* __DRIbuffer tokens. */ |
for (i = 0; i < count; i++) { |
dri2_surf->buffers[i].attachment = buffers[i].attachment; |
dri2_surf->buffers[i].name = buffers[i].name; |
dri2_surf->buffers[i].pitch = buffers[i].pitch; |
dri2_surf->buffers[i].cpp = buffers[i].cpp; |
dri2_surf->buffers[i].flags = buffers[i].flags; |
/* We only use the DRI drivers single buffer configs. This |
* means that if we try to render to a window, DRI2 will give us |
* the fake front buffer, which we'll use as a back buffer. |
* Note that EGL doesn't require that several clients rendering |
* to the same window must see the same aux buffers. */ |
if (dri2_surf->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT) |
dri2_surf->have_fake_front = 1; |
} |
if (dri2_surf->region != XCB_NONE) |
xcb_xfixes_destroy_region(dri2_dpy->conn, dri2_surf->region); |
rectangle.x = 0; |
rectangle.y = 0; |
rectangle.width = dri2_surf->base.Width; |
rectangle.height = dri2_surf->base.Height; |
dri2_surf->region = xcb_generate_id(dri2_dpy->conn); |
xcb_xfixes_create_region(dri2_dpy->conn, dri2_surf->region, 1, &rectangle); |
} |
static __DRIbuffer * |
dri2_get_buffers(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *loaderPrivate) |
{ |
struct dri2_egl_surface *dri2_surf = loaderPrivate; |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
xcb_dri2_dri2_buffer_t *buffers; |
xcb_dri2_get_buffers_reply_t *reply; |
xcb_dri2_get_buffers_cookie_t cookie; |
(void) driDrawable; |
cookie = xcb_dri2_get_buffers_unchecked (dri2_dpy->conn, |
dri2_surf->drawable, |
count, count, attachments); |
reply = xcb_dri2_get_buffers_reply (dri2_dpy->conn, cookie, NULL); |
buffers = xcb_dri2_get_buffers_buffers (reply); |
if (buffers == NULL) |
return NULL; |
*out_count = reply->count; |
dri2_surf->base.Width = *width = reply->width; |
dri2_surf->base.Height = *height = reply->height; |
dri2_process_buffers(dri2_surf, buffers, *out_count); |
free(reply); |
return dri2_surf->buffers; |
} |
static __DRIbuffer * |
dri2_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; |
struct dri2_egl_display *dri2_dpy = |
dri2_egl_display(dri2_surf->base.Resource.Display); |
xcb_dri2_dri2_buffer_t *buffers; |
xcb_dri2_get_buffers_with_format_reply_t *reply; |
xcb_dri2_get_buffers_with_format_cookie_t cookie; |
xcb_dri2_attach_format_t *format_attachments; |
(void) driDrawable; |
format_attachments = (xcb_dri2_attach_format_t *) attachments; |
cookie = xcb_dri2_get_buffers_with_format_unchecked (dri2_dpy->conn, |
dri2_surf->drawable, |
count, count, |
format_attachments); |
reply = xcb_dri2_get_buffers_with_format_reply (dri2_dpy->conn, |
cookie, NULL); |
if (reply == NULL) |
return NULL; |
buffers = xcb_dri2_get_buffers_with_format_buffers (reply); |
dri2_surf->base.Width = *width = reply->width; |
dri2_surf->base.Height = *height = reply->height; |
*out_count = reply->count; |
dri2_process_buffers(dri2_surf, buffers, *out_count); |
free(reply); |
return dri2_surf->buffers; |
} |
static void |
dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) |
{ |
(void) driDrawable; |
/* FIXME: Does EGL support front buffer rendering at all? */ |
#if 0 |
struct dri2_egl_surface *dri2_surf = loaderPrivate; |
dri2WaitGL(dri2_surf); |
#else |
(void) loaderPrivate; |
#endif |
} |
static char * |
dri2_strndup(const char *s, int length) |
{ |
char *d; |
d = malloc(length + 1); |
if (d == NULL) |
return NULL; |
memcpy(d, s, length); |
d[length] = '\0'; |
return d; |
} |
static EGLBoolean |
dri2_connect(struct dri2_egl_display *dri2_dpy) |
{ |
xcb_xfixes_query_version_reply_t *xfixes_query; |
xcb_xfixes_query_version_cookie_t xfixes_query_cookie; |
xcb_dri2_query_version_reply_t *dri2_query; |
xcb_dri2_query_version_cookie_t dri2_query_cookie; |
xcb_dri2_connect_reply_t *connect; |
xcb_dri2_connect_cookie_t connect_cookie; |
xcb_generic_error_t *error; |
xcb_screen_iterator_t s; |
char *driver_name, *device_name; |
const xcb_query_extension_reply_t *extension; |
xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_xfixes_id); |
xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_dri2_id); |
extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_xfixes_id); |
if (!(extension && extension->present)) |
return EGL_FALSE; |
extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_dri2_id); |
if (!(extension && extension->present)) |
return EGL_FALSE; |
xfixes_query_cookie = xcb_xfixes_query_version(dri2_dpy->conn, |
XCB_XFIXES_MAJOR_VERSION, |
XCB_XFIXES_MINOR_VERSION); |
dri2_query_cookie = xcb_dri2_query_version (dri2_dpy->conn, |
XCB_DRI2_MAJOR_VERSION, |
XCB_DRI2_MINOR_VERSION); |
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn)); |
connect_cookie = xcb_dri2_connect_unchecked (dri2_dpy->conn, |
s.data->root, |
XCB_DRI2_DRIVER_TYPE_DRI); |
xfixes_query = |
xcb_xfixes_query_version_reply (dri2_dpy->conn, |
xfixes_query_cookie, &error); |
if (xfixes_query == NULL || |
error != NULL || xfixes_query->major_version < 2) { |
_eglLog(_EGL_WARNING, "DRI2: failed to query xfixes version"); |
free(error); |
return EGL_FALSE; |
} |
free(xfixes_query); |
dri2_query = |
xcb_dri2_query_version_reply (dri2_dpy->conn, dri2_query_cookie, &error); |
if (dri2_query == NULL || error != NULL) { |
_eglLog(_EGL_WARNING, "DRI2: failed to query version"); |
free(error); |
return EGL_FALSE; |
} |
dri2_dpy->dri2_major = dri2_query->major_version; |
dri2_dpy->dri2_minor = dri2_query->minor_version; |
free(dri2_query); |
connect = xcb_dri2_connect_reply (dri2_dpy->conn, connect_cookie, NULL); |
if (connect == NULL || |
connect->driver_name_length + connect->device_name_length == 0) { |
_eglLog(_EGL_WARNING, "DRI2: failed to authenticate"); |
return EGL_FALSE; |
} |
driver_name = xcb_dri2_connect_driver_name (connect); |
dri2_dpy->driver_name = |
dri2_strndup(driver_name, |
xcb_dri2_connect_driver_name_length (connect)); |
device_name = xcb_dri2_connect_device_name (connect); |
dri2_dpy->device_name = |
dri2_strndup(device_name, |
xcb_dri2_connect_device_name_length (connect)); |
if (dri2_dpy->device_name == NULL || dri2_dpy->driver_name == NULL) { |
free(dri2_dpy->device_name); |
free(dri2_dpy->driver_name); |
free(connect); |
return EGL_FALSE; |
} |
free(connect); |
return EGL_TRUE; |
} |
static int |
dri2_x11_authenticate(_EGLDisplay *disp, uint32_t id) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
xcb_dri2_authenticate_reply_t *authenticate; |
xcb_dri2_authenticate_cookie_t authenticate_cookie; |
xcb_screen_iterator_t s; |
int ret = 0; |
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn)); |
authenticate_cookie = |
xcb_dri2_authenticate_unchecked(dri2_dpy->conn, s.data->root, id); |
authenticate = |
xcb_dri2_authenticate_reply(dri2_dpy->conn, authenticate_cookie, NULL); |
if (authenticate == NULL || !authenticate->authenticated) |
ret = -1; |
free(authenticate); |
return ret; |
} |
static EGLBoolean |
dri2_authenticate(_EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
drm_magic_t magic; |
if (drmGetMagic(dri2_dpy->fd, &magic)) { |
_eglLog(_EGL_WARNING, "DRI2: failed to get drm magic"); |
return EGL_FALSE; |
} |
if (dri2_x11_authenticate(disp, magic) < 0) { |
_eglLog(_EGL_WARNING, "DRI2: failed to authenticate"); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy, |
_EGLDisplay *disp) |
{ |
xcb_screen_iterator_t s; |
xcb_depth_iterator_t d; |
xcb_visualtype_t *visuals; |
int i, j, id; |
EGLint surface_type; |
EGLint config_attrs[] = { |
EGL_NATIVE_VISUAL_ID, 0, |
EGL_NATIVE_VISUAL_TYPE, 0, |
EGL_NONE |
}; |
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn)); |
d = xcb_screen_allowed_depths_iterator(s.data); |
id = 1; |
surface_type = |
EGL_WINDOW_BIT | |
EGL_PIXMAP_BIT | |
EGL_PBUFFER_BIT | |
EGL_SWAP_BEHAVIOR_PRESERVED_BIT; |
while (d.rem > 0) { |
EGLBoolean class_added[6] = { 0, }; |
visuals = xcb_depth_visuals(d.data); |
for (i = 0; i < xcb_depth_visuals_length(d.data); i++) { |
if (class_added[visuals[i]._class]) |
continue; |
class_added[visuals[i]._class] = EGL_TRUE; |
for (j = 0; dri2_dpy->driver_configs[j]; j++) { |
config_attrs[1] = visuals[i].visual_id; |
config_attrs[3] = visuals[i]._class; |
dri2_add_config(disp, dri2_dpy->driver_configs[j], id++, |
d.data->depth, surface_type, config_attrs, NULL); |
} |
} |
xcb_depth_next(&d); |
} |
if (!_eglGetArraySize(disp->Configs)) { |
_eglLog(_EGL_WARNING, "DRI2: failed to create any config"); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_copy_region(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLSurface *draw, xcb_xfixes_region_t region) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); |
enum xcb_dri2_attachment_t render_attachment; |
xcb_dri2_copy_region_cookie_t cookie; |
/* No-op for a pixmap or pbuffer surface */ |
if (draw->Type == EGL_PIXMAP_BIT || draw->Type == EGL_PBUFFER_BIT) |
return EGL_TRUE; |
if (dri2_dpy->flush) |
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); |
if (dri2_surf->have_fake_front) |
render_attachment = XCB_DRI2_ATTACHMENT_BUFFER_FAKE_FRONT_LEFT; |
else |
render_attachment = XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT; |
cookie = xcb_dri2_copy_region_unchecked(dri2_dpy->conn, |
dri2_surf->drawable, |
region, |
XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT, |
render_attachment); |
free(xcb_dri2_copy_region_reply(dri2_dpy->conn, cookie, NULL)); |
return EGL_TRUE; |
} |
static int64_t |
dri2_swap_buffers_msc(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, |
int64_t msc, int64_t divisor, int64_t remainder) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); |
uint32_t msc_hi = msc >> 32; |
uint32_t msc_lo = msc & 0xffffffff; |
uint32_t divisor_hi = divisor >> 32; |
uint32_t divisor_lo = divisor & 0xffffffff; |
uint32_t remainder_hi = remainder >> 32; |
uint32_t remainder_lo = remainder & 0xffffffff; |
xcb_dri2_swap_buffers_cookie_t cookie; |
xcb_dri2_swap_buffers_reply_t *reply; |
int64_t swap_count = -1; |
/* No-op for a pixmap or pbuffer surface */ |
if (draw->Type == EGL_PIXMAP_BIT || draw->Type == EGL_PBUFFER_BIT) |
return 0; |
if (draw->SwapBehavior == EGL_BUFFER_PRESERVED || !dri2_dpy->swap_available) |
return dri2_copy_region(drv, disp, draw, dri2_surf->region) ? 0 : -1; |
if (dri2_dpy->flush) |
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); |
cookie = xcb_dri2_swap_buffers_unchecked(dri2_dpy->conn, dri2_surf->drawable, |
msc_hi, msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo); |
reply = xcb_dri2_swap_buffers_reply(dri2_dpy->conn, cookie, NULL); |
if (reply) { |
swap_count = (((int64_t)reply->swap_hi) << 32) | reply->swap_lo; |
free(reply); |
} |
/* Since we aren't watching for the server's invalidate events like we're |
* supposed to (due to XCB providing no mechanism for filtering the events |
* the way xlib does), and SwapBuffers is a common cause of invalidate |
* events, just shove one down to the driver, even though we haven't told |
* the driver that we're the kind of loader that provides reliable |
* invalidate events. This causes the driver to request buffers again at |
* its next draw, so that we get the correct buffers if a pageflip |
* happened. The driver should still be using the viewport hack to catch |
* window resizes. |
*/ |
if (dri2_dpy->flush && |
dri2_dpy->flush->base.version >= 3 && dri2_dpy->flush->invalidate) |
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable); |
return swap_count; |
} |
static EGLBoolean |
dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); |
if (dri2_dpy->dri2) { |
return dri2_swap_buffers_msc(drv, disp, draw, 0, 0, 0) != -1; |
} else { |
assert(dri2_dpy->swrast); |
dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable); |
return EGL_TRUE; |
} |
} |
static EGLBoolean |
dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, |
EGLint numRects, const EGLint *rects) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw); |
EGLBoolean ret; |
xcb_xfixes_region_t region; |
xcb_rectangle_t rectangles[16]; |
int i; |
if (numRects > (int)ARRAY_SIZE(rectangles)) |
return dri2_copy_region(drv, disp, draw, dri2_surf->region); |
for (i = 0; i < numRects; i++) { |
rectangles[i].x = rects[i * 4]; |
rectangles[i].y = dri2_surf->base.Height - rects[i * 4 + 1] - rects[i * 4 + 3]; |
rectangles[i].width = rects[i * 4 + 2]; |
rectangles[i].height = rects[i * 4 + 3]; |
} |
region = xcb_generate_id(dri2_dpy->conn); |
xcb_xfixes_create_region(dri2_dpy->conn, region, numRects, rectangles); |
ret = dri2_copy_region(drv, disp, draw, region); |
xcb_xfixes_destroy_region(dri2_dpy->conn, region); |
return ret; |
} |
static EGLBoolean |
dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, |
EGLint x, EGLint y, EGLint width, EGLint height) |
{ |
const EGLint rect[4] = { x, y, width, height }; |
if (x < 0 || y < 0 || width < 0 || height < 0) |
_eglError(EGL_BAD_PARAMETER, "eglPostSubBufferNV"); |
return dri2_swap_buffers_region(drv, disp, draw, 1, rect); |
} |
static EGLBoolean |
dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint interval) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
if (interval > surf->Config->MaxSwapInterval) |
interval = surf->Config->MaxSwapInterval; |
else if (interval < surf->Config->MinSwapInterval) |
interval = surf->Config->MinSwapInterval; |
if (interval != surf->SwapInterval && dri2_dpy->swap_available) |
xcb_dri2_swap_interval(dri2_dpy->conn, dri2_surf->drawable, interval); |
surf->SwapInterval = interval; |
return EGL_TRUE; |
} |
static EGLBoolean |
dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, |
EGLNativePixmapType native_target) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); |
xcb_gcontext_t gc; |
xcb_pixmap_t target = (uintptr_t )native_target; |
(void) drv; |
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable); |
gc = xcb_generate_id(dri2_dpy->conn); |
xcb_create_gc(dri2_dpy->conn, gc, target, 0, NULL); |
xcb_copy_area(dri2_dpy->conn, |
dri2_surf->drawable, |
target, |
gc, |
0, 0, |
0, 0, |
dri2_surf->base.Width, |
dri2_surf->base.Height); |
xcb_free_gc(dri2_dpy->conn, gc); |
return EGL_TRUE; |
} |
static _EGLImage * |
dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); |
struct dri2_egl_image *dri2_img; |
unsigned int attachments[1]; |
xcb_drawable_t drawable; |
xcb_dri2_get_buffers_cookie_t buffers_cookie; |
xcb_dri2_get_buffers_reply_t *buffers_reply; |
xcb_dri2_dri2_buffer_t *buffers; |
xcb_get_geometry_cookie_t geometry_cookie; |
xcb_get_geometry_reply_t *geometry_reply; |
xcb_generic_error_t *error; |
int stride, format; |
(void) ctx; |
drawable = (xcb_drawable_t) (uintptr_t) buffer; |
xcb_dri2_create_drawable (dri2_dpy->conn, drawable); |
attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT; |
buffers_cookie = |
xcb_dri2_get_buffers_unchecked (dri2_dpy->conn, |
drawable, 1, 1, attachments); |
geometry_cookie = xcb_get_geometry (dri2_dpy->conn, drawable); |
buffers_reply = xcb_dri2_get_buffers_reply (dri2_dpy->conn, |
buffers_cookie, NULL); |
buffers = xcb_dri2_get_buffers_buffers (buffers_reply); |
if (buffers == NULL) { |
return NULL; |
} |
geometry_reply = xcb_get_geometry_reply (dri2_dpy->conn, |
geometry_cookie, &error); |
if (geometry_reply == NULL || error != NULL) { |
_eglError(EGL_BAD_ALLOC, "xcb_get_geometry"); |
free(error); |
free(buffers_reply); |
return NULL; |
} |
switch (geometry_reply->depth) { |
case 16: |
format = __DRI_IMAGE_FORMAT_RGB565; |
break; |
case 24: |
format = __DRI_IMAGE_FORMAT_XRGB8888; |
break; |
case 32: |
format = __DRI_IMAGE_FORMAT_ARGB8888; |
break; |
default: |
_eglError(EGL_BAD_PARAMETER, |
"dri2_create_image_khr: unsupported pixmap depth"); |
free(buffers_reply); |
free(geometry_reply); |
return NULL; |
} |
dri2_img = malloc(sizeof *dri2_img); |
if (!dri2_img) { |
free(buffers_reply); |
free(geometry_reply); |
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); |
return EGL_NO_IMAGE_KHR; |
} |
if (!_eglInitImage(&dri2_img->base, disp)) { |
free(buffers_reply); |
free(geometry_reply); |
free(dri2_img); |
return EGL_NO_IMAGE_KHR; |
} |
stride = buffers[0].pitch / buffers[0].cpp; |
dri2_img->dri_image = |
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, |
buffers_reply->width, |
buffers_reply->height, |
format, |
buffers[0].name, |
stride, |
dri2_img); |
free(buffers_reply); |
free(geometry_reply); |
return &dri2_img->base; |
} |
static _EGLImage * |
dri2_x11_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, |
_EGLContext *ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
(void) drv; |
switch (target) { |
case EGL_NATIVE_PIXMAP_KHR: |
return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list); |
default: |
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list); |
} |
} |
static EGLBoolean |
dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy; |
drv->API.CreateWindowSurface = dri2_create_window_surface; |
drv->API.CreatePixmapSurface = dri2_create_pixmap_surface; |
drv->API.CreatePbufferSurface = dri2_create_pbuffer_surface; |
drv->API.DestroySurface = dri2_destroy_surface; |
drv->API.SwapBuffers = dri2_swap_buffers; |
drv->API.CopyBuffers = dri2_copy_buffers; |
drv->API.SwapBuffersRegionNOK = NULL; |
drv->API.CreateImageKHR = NULL; |
drv->API.DestroyImageKHR = NULL; |
drv->API.CreateDRMImageMESA = NULL; |
drv->API.ExportDRMImageMESA = NULL; |
dri2_dpy = calloc(1, sizeof *dri2_dpy); |
if (!dri2_dpy) |
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); |
disp->DriverData = (void *) dri2_dpy; |
if (disp->PlatformDisplay == NULL) { |
dri2_dpy->conn = xcb_connect(0, 0); |
} else { |
dri2_dpy->conn = XGetXCBConnection((Display *) disp->PlatformDisplay); |
} |
if (xcb_connection_has_error(dri2_dpy->conn)) { |
_eglLog(_EGL_WARNING, "DRI2: xcb_connect failed"); |
goto cleanup_dpy; |
} |
if (!dri2_load_driver_swrast(disp)) |
goto cleanup_conn; |
dri2_dpy->swrast_loader_extension.base.name = __DRI_SWRAST_LOADER; |
dri2_dpy->swrast_loader_extension.base.version = __DRI_SWRAST_LOADER_VERSION; |
dri2_dpy->swrast_loader_extension.getDrawableInfo = swrastGetDrawableInfo; |
dri2_dpy->swrast_loader_extension.putImage = swrastPutImage; |
dri2_dpy->swrast_loader_extension.getImage = swrastGetImage; |
dri2_dpy->extensions[0] = &dri2_dpy->swrast_loader_extension.base; |
dri2_dpy->extensions[1] = NULL; |
dri2_dpy->extensions[2] = NULL; |
if (!dri2_create_screen(disp)) |
goto cleanup_driver; |
if (dri2_dpy->conn) { |
if (!dri2_add_configs_for_visuals(dri2_dpy, disp)) |
goto cleanup_configs; |
} |
/* we're supporting EGL 1.4 */ |
disp->VersionMajor = 1; |
disp->VersionMinor = 4; |
return EGL_TRUE; |
cleanup_configs: |
_eglCleanupDisplay(disp); |
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen); |
cleanup_driver: |
dlclose(dri2_dpy->driver); |
cleanup_conn: |
if (disp->PlatformDisplay == NULL) |
xcb_disconnect(dri2_dpy->conn); |
cleanup_dpy: |
free(dri2_dpy); |
return EGL_FALSE; |
} |
static void |
dri2_setup_swap_interval(struct dri2_egl_display *dri2_dpy) |
{ |
GLint vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1; |
int arbitrary_max_interval = 1000; |
/* default behavior for no SwapBuffers support: no vblank syncing |
* either. |
*/ |
dri2_dpy->min_swap_interval = 0; |
dri2_dpy->max_swap_interval = 0; |
if (!dri2_dpy->swap_available) |
return; |
/* If we do have swapbuffers, then we can support pretty much any swap |
* interval, but we allow driconf to override applications. |
*/ |
if (dri2_dpy->config) |
dri2_dpy->config->configQueryi(dri2_dpy->dri_screen, |
"vblank_mode", &vblank_mode); |
switch (vblank_mode) { |
case DRI_CONF_VBLANK_NEVER: |
dri2_dpy->min_swap_interval = 0; |
dri2_dpy->max_swap_interval = 0; |
dri2_dpy->default_swap_interval = 0; |
break; |
case DRI_CONF_VBLANK_ALWAYS_SYNC: |
dri2_dpy->min_swap_interval = 1; |
dri2_dpy->max_swap_interval = arbitrary_max_interval; |
dri2_dpy->default_swap_interval = 1; |
break; |
case DRI_CONF_VBLANK_DEF_INTERVAL_0: |
dri2_dpy->min_swap_interval = 0; |
dri2_dpy->max_swap_interval = arbitrary_max_interval; |
dri2_dpy->default_swap_interval = 0; |
break; |
default: |
case DRI_CONF_VBLANK_DEF_INTERVAL_1: |
dri2_dpy->min_swap_interval = 0; |
dri2_dpy->max_swap_interval = arbitrary_max_interval; |
dri2_dpy->default_swap_interval = 1; |
break; |
} |
} |
static EGLBoolean |
dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
struct dri2_egl_display *dri2_dpy; |
drv->API.CreateWindowSurface = dri2_create_window_surface; |
drv->API.CreatePixmapSurface = dri2_create_pixmap_surface; |
drv->API.CreatePbufferSurface = dri2_create_pbuffer_surface; |
drv->API.DestroySurface = dri2_destroy_surface; |
drv->API.SwapBuffers = dri2_swap_buffers; |
drv->API.CopyBuffers = dri2_copy_buffers; |
drv->API.CreateImageKHR = dri2_x11_create_image_khr; |
drv->API.SwapBuffersRegionNOK = dri2_swap_buffers_region; |
drv->API.PostSubBufferNV = dri2_post_sub_buffer; |
drv->API.SwapInterval = dri2_swap_interval; |
dri2_dpy = calloc(1, sizeof *dri2_dpy); |
if (!dri2_dpy) |
return _eglError(EGL_BAD_ALLOC, "eglInitialize"); |
disp->DriverData = (void *) dri2_dpy; |
if (disp->PlatformDisplay == NULL) { |
dri2_dpy->conn = xcb_connect(0, 0); |
} else { |
dri2_dpy->conn = XGetXCBConnection((Display *) disp->PlatformDisplay); |
} |
if (xcb_connection_has_error(dri2_dpy->conn)) { |
_eglLog(_EGL_WARNING, "DRI2: xcb_connect failed"); |
goto cleanup_dpy; |
} |
if (dri2_dpy->conn) { |
if (!dri2_connect(dri2_dpy)) |
goto cleanup_conn; |
} |
if (!dri2_load_driver(disp)) |
goto cleanup_conn; |
#ifdef O_CLOEXEC |
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC); |
if (dri2_dpy->fd == -1 && errno == EINVAL) |
#endif |
{ |
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR); |
if (dri2_dpy->fd != -1) |
fcntl(dri2_dpy->fd, F_SETFD, fcntl(dri2_dpy->fd, F_GETFD) | |
FD_CLOEXEC); |
} |
if (dri2_dpy->fd == -1) { |
_eglLog(_EGL_WARNING, |
"DRI2: could not open %s (%s)", dri2_dpy->device_name, |
strerror(errno)); |
goto cleanup_driver; |
} |
if (dri2_dpy->conn) { |
if (!dri2_authenticate(disp)) |
goto cleanup_fd; |
} |
if (dri2_dpy->dri2_minor >= 1) { |
dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER; |
dri2_dpy->dri2_loader_extension.base.version = 3; |
dri2_dpy->dri2_loader_extension.getBuffers = dri2_get_buffers; |
dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_flush_front_buffer; |
dri2_dpy->dri2_loader_extension.getBuffersWithFormat = |
dri2_get_buffers_with_format; |
} else { |
dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER; |
dri2_dpy->dri2_loader_extension.base.version = 2; |
dri2_dpy->dri2_loader_extension.getBuffers = dri2_get_buffers; |
dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_flush_front_buffer; |
dri2_dpy->dri2_loader_extension.getBuffersWithFormat = NULL; |
} |
dri2_dpy->extensions[0] = &dri2_dpy->dri2_loader_extension.base; |
dri2_dpy->extensions[1] = &image_lookup_extension.base; |
dri2_dpy->extensions[2] = NULL; |
dri2_dpy->swap_available = (dri2_dpy->dri2_minor >= 2); |
dri2_dpy->invalidate_available = (dri2_dpy->dri2_minor >= 3); |
if (!dri2_create_screen(disp)) |
goto cleanup_fd; |
dri2_setup_swap_interval(dri2_dpy); |
if (dri2_dpy->conn) { |
if (!dri2_add_configs_for_visuals(dri2_dpy, disp)) |
goto cleanup_configs; |
} |
disp->Extensions.KHR_image_pixmap = EGL_TRUE; |
disp->Extensions.NOK_swap_region = EGL_TRUE; |
disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE; |
disp->Extensions.NV_post_sub_buffer = EGL_TRUE; |
#ifdef HAVE_WAYLAND_PLATFORM |
disp->Extensions.WL_bind_wayland_display = EGL_TRUE; |
#endif |
dri2_dpy->authenticate = dri2_x11_authenticate; |
/* we're supporting EGL 1.4 */ |
disp->VersionMajor = 1; |
disp->VersionMinor = 4; |
return EGL_TRUE; |
cleanup_configs: |
_eglCleanupDisplay(disp); |
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen); |
cleanup_fd: |
close(dri2_dpy->fd); |
cleanup_driver: |
dlclose(dri2_dpy->driver); |
cleanup_conn: |
if (disp->PlatformDisplay == NULL) |
xcb_disconnect(dri2_dpy->conn); |
cleanup_dpy: |
free(dri2_dpy); |
return EGL_FALSE; |
} |
EGLBoolean |
dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp) |
{ |
EGLBoolean initialized = EGL_TRUE; |
int x11_dri2_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL); |
if (x11_dri2_accel) { |
if (!dri2_initialize_x11_dri2(drv, disp)) { |
initialized = dri2_initialize_x11_swrast(drv, disp); |
} |
} else { |
initialized = dri2_initialize_x11_swrast(drv, disp); |
} |
return initialized; |
} |
/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; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/Android.mk |
---|
0,0 → 1,165 |
# Mesa 3-D graphics library |
# |
# Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com> |
# Copyright (C) 2010-2011 LunarG Inc. |
# |
# 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. |
# Android.mk for libGLES_mesa |
LOCAL_PATH := $(call my-dir) |
# from Makefile |
SOURCES = \ |
eglapi.c \ |
eglarray.c \ |
eglconfig.c \ |
eglcontext.c \ |
eglcurrent.c \ |
egldisplay.c \ |
egldriver.c \ |
eglfallbacks.c \ |
eglglobals.c \ |
eglimage.c \ |
egllog.c \ |
eglmisc.c \ |
eglmode.c \ |
eglscreen.c \ |
eglstring.c \ |
eglsurface.c \ |
eglsync.c |
# --------------------------------------- |
# Build libGLES_mesa |
# --------------------------------------- |
include $(CLEAR_VARS) |
LOCAL_SRC_FILES := $(SOURCES) |
LOCAL_CFLAGS := \ |
-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID \ |
-D_EGL_DRIVER_SEARCH_DIR=\"/system/lib/egl\" \ |
-D_EGL_OS_UNIX=1 |
LOCAL_STATIC_LIBRARIES := |
LOCAL_SHARED_LIBRARIES := \ |
libglapi \ |
libdl \ |
libhardware \ |
liblog \ |
libcutils \ |
libgralloc_drm \ |
ifeq ($(shell echo "$(MESA_ANDROID_VERSION) >= 4.2" | bc),1) |
LOCAL_SHARED_LIBRARIES += libsync |
endif |
# add libdrm if there are hardware drivers |
ifneq ($(MESA_GPU_DRIVERS),swrast) |
LOCAL_SHARED_LIBRARIES += libdrm |
endif |
ifeq ($(strip $(MESA_BUILD_CLASSIC)),true) |
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2 |
LOCAL_STATIC_LIBRARIES += libmesa_egl_dri2 |
# require i915_dri and/or i965_dri |
LOCAL_REQUIRED_MODULES += \ |
$(addsuffix _dri, $(filter i915 i965, $(MESA_GPU_DRIVERS))) |
endif # MESA_BUILD_CLASSIC |
ifeq ($(strip $(MESA_BUILD_GALLIUM)),true) |
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GALLIUM |
gallium_DRIVERS := |
# swrast |
gallium_DRIVERS += libmesa_pipe_softpipe libmesa_winsys_sw_android |
# i915g |
ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),) |
gallium_DRIVERS += libmesa_winsys_i915 libmesa_pipe_i915 |
LOCAL_SHARED_LIBRARIES += libdrm_intel |
endif |
# ilo |
ifneq ($(filter ilo, $(MESA_GPU_DRIVERS)),) |
gallium_DRIVERS += libmesa_winsys_intel libmesa_pipe_ilo |
LOCAL_SHARED_LIBRARIES += libdrm_intel |
endif |
# nouveau |
ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),) |
gallium_DRIVERS += \ |
libmesa_winsys_nouveau \ |
libmesa_pipe_nvfx \ |
libmesa_pipe_nv50 \ |
libmesa_pipe_nvc0 \ |
libmesa_pipe_nouveau |
LOCAL_SHARED_LIBRARIES += libdrm_nouveau |
endif |
# r300g/r600g/radeonsi |
ifneq ($(filter r300g r600g radeonsi, $(MESA_GPU_DRIVERS)),) |
gallium_DRIVERS += libmesa_winsys_radeon |
ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),) |
gallium_DRIVERS += libmesa_pipe_r300 |
endif |
ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),) |
gallium_DRIVERS += libmesa_pipe_r600 |
endif |
ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),) |
gallium_DRIVERS += libmesa_pipe_radeonsi |
endif |
endif |
# vmwgfx |
ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),) |
gallium_DRIVERS += libmesa_winsys_svga libmesa_pipe_svga |
endif |
# |
# Notes about the order here: |
# |
# * libmesa_st_egl depends on libmesa_winsys_sw_android in $(gallium_DRIVERS) |
# * libmesa_pipe_r300 in $(gallium_DRIVERS) depends on libmesa_st_mesa and |
# libmesa_glsl |
# * libmesa_st_mesa depends on libmesa_glsl |
# * libmesa_glsl depends on libmesa_glsl_utils |
# |
LOCAL_STATIC_LIBRARIES := \ |
libmesa_egl_gallium \ |
libmesa_st_egl \ |
$(gallium_DRIVERS) \ |
libmesa_st_mesa \ |
libmesa_glsl \ |
libmesa_glsl_utils \ |
libmesa_gallium \ |
$(LOCAL_STATIC_LIBRARIES) |
endif # MESA_BUILD_GALLIUM |
LOCAL_MODULE := libGLES_mesa |
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl |
include $(MESA_COMMON_MK) |
include $(BUILD_SHARED_LIBRARY) |
/contrib/sdk/sources/Mesa/src/egl/main/Makefile.am |
---|
0,0 → 1,139 |
# 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. |
GLAPI_LIB = ../mapi/glapi/libglapi.la |
if HAVE_XF86VIDMODE |
EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE |
endif |
AM_CFLAGS = \ |
-I$(top_srcdir)/include \ |
-I$(top_srcdir)/src/gbm/main \ |
$(DEFINES) \ |
$(VISIBILITY_CFLAGS) \ |
$(EGL_CFLAGS) \ |
-D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \ |
-D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\" \ |
-D_EGL_OS_UNIX=1 |
lib_LTLIBRARIES = libEGL.la |
libEGL_la_SOURCES = \ |
eglapi.c \ |
eglarray.c \ |
eglconfig.c \ |
eglcontext.c \ |
eglcurrent.c \ |
egldisplay.c \ |
egldriver.c \ |
eglfallbacks.c \ |
eglglobals.c \ |
eglimage.c \ |
egllog.c \ |
eglmisc.c \ |
eglmode.c \ |
eglscreen.c \ |
eglstring.c \ |
eglsurface.c \ |
eglsync.c \ |
eglcompiler.h \ |
eglconfig.h \ |
eglcontext.h \ |
eglcurrent.h \ |
egldefines.h \ |
egldisplay.h \ |
egldriver.h \ |
eglglobals.h \ |
eglimage.h \ |
egllog.h \ |
eglmisc.h \ |
eglmode.h \ |
eglmutex.h \ |
eglscreen.h \ |
eglstring.h \ |
eglsurface.h \ |
eglsync.h |
libEGL_la_LIBADD = \ |
$(EGL_LIB_DEPS) |
libEGL_la_LDFLAGS = -Wl,-Bsymbolic -version-number 1:0 -no-undefined |
if HAVE_EGL_PLATFORM_X11 |
AM_CFLAGS += -DHAVE_X11_PLATFORM |
AM_CFLAGS += $(XCB_DRI2_CFLAGS) |
libEGL_la_LIBADD += $(XCB_DRI2_LIBS) |
endif |
if HAVE_EGL_PLATFORM_WAYLAND |
AM_CFLAGS += -DHAVE_WAYLAND_PLATFORM |
AM_CFLAGS += $(WAYLAND_CFLAGS) |
libEGL_la_LIBADD += $(WAYLAND_LIBS) |
libEGL_la_LIBADD += $(LIBDRM_LIBS) |
libEGL_la_LIBADD += ../wayland/wayland-drm/libwayland-drm.la |
endif |
if HAVE_EGL_PLATFORM_DRM |
AM_CFLAGS += -DHAVE_DRM_PLATFORM |
libEGL_la_LIBADD += ../../gbm/libgbm.la |
endif |
if HAVE_EGL_PLATFORM_FBDEV |
AM_CFLAGS += -DHAVE_FBDEV_PLATFORM |
endif |
if HAVE_EGL_PLATFORM_NULL |
AM_CFLAGS += -DHAVE_NULL_PLATFORM |
endif |
if HAVE_EGL_DRIVER_GLX |
AM_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX |
libEGL_la_LIBADD += ../drivers/glx/libegl_glx.la |
libEGL_la_LIBADD += $(X11_LIBS) $(DLOPEN_LIBS) |
endif |
if HAVE_EGL_DRIVER_DRI2 |
AM_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2 |
AM_CFLAGS += -DHAVE_XCB_DRI2 |
libEGL_la_LIBADD += ../drivers/dri2/libegl_dri2.la |
libEGL_la_LIBADD += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIBS) |
endif |
# Provide compatibility with scripts for the old Mesa build system for |
# a while by putting a link to the driver into /lib of the build tree. |
all-local: libEGL.la |
$(MKDIR_P) $(top_builddir)/$(LIB_DIR); |
ln -f .libs/libEGL.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libEGL.so.1 |
ln -sf libEGL.so.1 $(top_builddir)/$(LIB_DIR)/libEGL.so |
pkgconfigdir = $(libdir)/pkgconfig |
pkgconfig_DATA = egl.pc |
khrdir = $(includedir)/KHR |
khr_HEADERS = $(top_srcdir)/include/KHR/khrplatform.h |
egldir = $(includedir)/EGL |
egl_HEADERS = \ |
$(top_srcdir)/include/EGL/eglext.h \ |
$(top_srcdir)/include/EGL/egl.h \ |
$(top_srcdir)/include/EGL/eglmesaext.h \ |
$(top_srcdir)/include/EGL/eglplatform.h |
/contrib/sdk/sources/Mesa/src/egl/main/Makefile.in |
---|
0,0 → 1,1023 |
# 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@ |
@HAVE_EGL_PLATFORM_X11_TRUE@am__append_1 = -DHAVE_X11_PLATFORM \ |
@HAVE_EGL_PLATFORM_X11_TRUE@ $(XCB_DRI2_CFLAGS) |
@HAVE_EGL_PLATFORM_X11_TRUE@am__append_2 = $(XCB_DRI2_LIBS) |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__append_3 = \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ -DHAVE_WAYLAND_PLATFORM \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ $(WAYLAND_CFLAGS) |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__append_4 = $(WAYLAND_LIBS) \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ $(LIBDRM_LIBS) \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ ../wayland/wayland-drm/libwayland-drm.la |
@HAVE_EGL_PLATFORM_DRM_TRUE@am__append_5 = -DHAVE_DRM_PLATFORM |
@HAVE_EGL_PLATFORM_DRM_TRUE@am__append_6 = ../../gbm/libgbm.la |
@HAVE_EGL_PLATFORM_FBDEV_TRUE@am__append_7 = -DHAVE_FBDEV_PLATFORM |
@HAVE_EGL_PLATFORM_NULL_TRUE@am__append_8 = -DHAVE_NULL_PLATFORM |
@HAVE_EGL_DRIVER_GLX_TRUE@am__append_9 = -D_EGL_BUILT_IN_DRIVER_GLX |
@HAVE_EGL_DRIVER_GLX_TRUE@am__append_10 = \ |
@HAVE_EGL_DRIVER_GLX_TRUE@ ../drivers/glx/libegl_glx.la \ |
@HAVE_EGL_DRIVER_GLX_TRUE@ $(X11_LIBS) $(DLOPEN_LIBS) |
@HAVE_EGL_DRIVER_DRI2_TRUE@am__append_11 = \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ -D_EGL_BUILT_IN_DRIVER_DRI2 \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ -DHAVE_XCB_DRI2 |
@HAVE_EGL_DRIVER_DRI2_TRUE@am__append_12 = \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ ../drivers/dri2/libegl_dri2.la \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ $(LIBUDEV_LIBS) $(DLOPEN_LIBS) \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ $(LIBDRM_LIBS) |
subdir = src/egl/main |
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ |
$(srcdir)/egl.pc.in $(top_srcdir)/bin/depcomp $(egl_HEADERS) \ |
$(khr_HEADERS) |
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 = egl.pc |
CONFIG_CLEAN_VPATH_FILES = |
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; |
am__vpath_adj = case $$p in \ |
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ |
*) f=$$p;; \ |
esac; |
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; |
am__install_max = 40 |
am__nobase_strip_setup = \ |
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` |
am__nobase_strip = \ |
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" |
am__nobase_list = $(am__nobase_strip_setup); \ |
for p in $$list; do echo "$$p $$p"; done | \ |
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ |
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ |
if (++n[$$2] == $(am__install_max)) \ |
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ |
END { for (dir in files) print dir, files[dir] }' |
am__base_list = \ |
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ |
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' |
am__uninstall_files_from_dir = { \ |
test -z "$$files" \ |
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ |
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \ |
$(am__cd) "$$dir" && rm -f $$files; }; \ |
} |
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ |
"$(DESTDIR)$(egldir)" "$(DESTDIR)$(khrdir)" |
LTLIBRARIES = $(lib_LTLIBRARIES) |
am__DEPENDENCIES_1 = |
@HAVE_EGL_PLATFORM_X11_TRUE@am__DEPENDENCIES_2 = \ |
@HAVE_EGL_PLATFORM_X11_TRUE@ $(am__DEPENDENCIES_1) |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__DEPENDENCIES_3 = \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ $(am__DEPENDENCIES_1) \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ $(am__DEPENDENCIES_1) \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ ../wayland/wayland-drm/libwayland-drm.la |
@HAVE_EGL_DRIVER_GLX_TRUE@am__DEPENDENCIES_4 = \ |
@HAVE_EGL_DRIVER_GLX_TRUE@ ../drivers/glx/libegl_glx.la \ |
@HAVE_EGL_DRIVER_GLX_TRUE@ $(am__DEPENDENCIES_1) |
@HAVE_EGL_DRIVER_DRI2_TRUE@am__DEPENDENCIES_5 = \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ ../drivers/dri2/libegl_dri2.la \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ $(am__DEPENDENCIES_1) \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ $(am__DEPENDENCIES_1) \ |
@HAVE_EGL_DRIVER_DRI2_TRUE@ $(am__DEPENDENCIES_1) |
libEGL_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ |
$(am__DEPENDENCIES_3) $(am__append_6) $(am__DEPENDENCIES_4) \ |
$(am__DEPENDENCIES_5) |
am_libEGL_la_OBJECTS = eglapi.lo eglarray.lo eglconfig.lo \ |
eglcontext.lo eglcurrent.lo egldisplay.lo egldriver.lo \ |
eglfallbacks.lo eglglobals.lo eglimage.lo egllog.lo eglmisc.lo \ |
eglmode.lo eglscreen.lo eglstring.lo eglsurface.lo eglsync.lo |
libEGL_la_OBJECTS = $(am_libEGL_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 = |
libEGL_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ |
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ |
$(libEGL_la_LDFLAGS) $(LDFLAGS) -o $@ |
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_la_SOURCES) |
DIST_SOURCES = $(libEGL_la_SOURCES) |
am__can_run_installinfo = \ |
case $$AM_UPDATE_INFO_DIR in \ |
n|no|NO) false;; \ |
*) (install-info --version) >/dev/null 2>&1;; \ |
esac |
DATA = $(pkgconfig_DATA) |
HEADERS = $(egl_HEADERS) $(khr_HEADERS) |
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@ |
GLAPI_LIB = ../mapi/glapi/libglapi.la |
@HAVE_XF86VIDMODE_TRUE@EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE |
AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/gbm/main \ |
$(DEFINES) $(VISIBILITY_CFLAGS) $(EGL_CFLAGS) \ |
-D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \ |
-D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\" \ |
-D_EGL_OS_UNIX=1 $(am__append_1) $(am__append_3) \ |
$(am__append_5) $(am__append_7) $(am__append_8) \ |
$(am__append_9) $(am__append_11) |
lib_LTLIBRARIES = libEGL.la |
libEGL_la_SOURCES = \ |
eglapi.c \ |
eglarray.c \ |
eglconfig.c \ |
eglcontext.c \ |
eglcurrent.c \ |
egldisplay.c \ |
egldriver.c \ |
eglfallbacks.c \ |
eglglobals.c \ |
eglimage.c \ |
egllog.c \ |
eglmisc.c \ |
eglmode.c \ |
eglscreen.c \ |
eglstring.c \ |
eglsurface.c \ |
eglsync.c \ |
eglcompiler.h \ |
eglconfig.h \ |
eglcontext.h \ |
eglcurrent.h \ |
egldefines.h \ |
egldisplay.h \ |
egldriver.h \ |
eglglobals.h \ |
eglimage.h \ |
egllog.h \ |
eglmisc.h \ |
eglmode.h \ |
eglmutex.h \ |
eglscreen.h \ |
eglstring.h \ |
eglsurface.h \ |
eglsync.h |
libEGL_la_LIBADD = $(EGL_LIB_DEPS) $(am__append_2) $(am__append_4) \ |
$(am__append_6) $(am__append_10) $(am__append_12) |
libEGL_la_LDFLAGS = -Wl,-Bsymbolic -version-number 1:0 -no-undefined |
pkgconfigdir = $(libdir)/pkgconfig |
pkgconfig_DATA = egl.pc |
khrdir = $(includedir)/KHR |
khr_HEADERS = $(top_srcdir)/include/KHR/khrplatform.h |
egldir = $(includedir)/EGL |
egl_HEADERS = \ |
$(top_srcdir)/include/EGL/eglext.h \ |
$(top_srcdir)/include/EGL/egl.h \ |
$(top_srcdir)/include/EGL/eglmesaext.h \ |
$(top_srcdir)/include/EGL/eglplatform.h |
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/main/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/egl/main/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): |
egl.pc: $(top_builddir)/config.status $(srcdir)/egl.pc.in |
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ |
install-libLTLIBRARIES: $(lib_LTLIBRARIES) |
@$(NORMAL_INSTALL) |
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ |
list2=; for p in $$list; do \ |
if test -f $$p; then \ |
list2="$$list2 $$p"; \ |
else :; fi; \ |
done; \ |
test -z "$$list2" || { \ |
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ |
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ |
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ |
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ |
} |
uninstall-libLTLIBRARIES: |
@$(NORMAL_UNINSTALL) |
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ |
for p in $$list; do \ |
$(am__strip_dir) \ |
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ |
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ |
done |
clean-libLTLIBRARIES: |
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) |
@list='$(lib_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.la: $(libEGL_la_OBJECTS) $(libEGL_la_DEPENDENCIES) $(EXTRA_libEGL_la_DEPENDENCIES) |
$(AM_V_CCLD)$(libEGL_la_LINK) -rpath $(libdir) $(libEGL_la_OBJECTS) $(libEGL_la_LIBADD) $(LIBS) |
mostlyclean-compile: |
-rm -f *.$(OBJEXT) |
distclean-compile: |
-rm -f *.tab.c |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglapi.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglarray.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglconfig.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglcontext.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglcurrent.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egldisplay.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egldriver.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglfallbacks.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglglobals.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglimage.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egllog.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglmisc.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglmode.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglscreen.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglstring.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglsurface.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eglsync.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 |
install-pkgconfigDATA: $(pkgconfig_DATA) |
@$(NORMAL_INSTALL) |
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ |
if test -n "$$list"; then \ |
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ |
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ |
fi; \ |
for p in $$list; do \ |
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ |
echo "$$d$$p"; \ |
done | $(am__base_list) | \ |
while read files; do \ |
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ |
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ |
done |
uninstall-pkgconfigDATA: |
@$(NORMAL_UNINSTALL) |
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ |
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ |
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) |
install-eglHEADERS: $(egl_HEADERS) |
@$(NORMAL_INSTALL) |
@list='$(egl_HEADERS)'; test -n "$(egldir)" || list=; \ |
if test -n "$$list"; then \ |
echo " $(MKDIR_P) '$(DESTDIR)$(egldir)'"; \ |
$(MKDIR_P) "$(DESTDIR)$(egldir)" || exit 1; \ |
fi; \ |
for p in $$list; do \ |
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ |
echo "$$d$$p"; \ |
done | $(am__base_list) | \ |
while read files; do \ |
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(egldir)'"; \ |
$(INSTALL_HEADER) $$files "$(DESTDIR)$(egldir)" || exit $$?; \ |
done |
uninstall-eglHEADERS: |
@$(NORMAL_UNINSTALL) |
@list='$(egl_HEADERS)'; test -n "$(egldir)" || list=; \ |
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ |
dir='$(DESTDIR)$(egldir)'; $(am__uninstall_files_from_dir) |
install-khrHEADERS: $(khr_HEADERS) |
@$(NORMAL_INSTALL) |
@list='$(khr_HEADERS)'; test -n "$(khrdir)" || list=; \ |
if test -n "$$list"; then \ |
echo " $(MKDIR_P) '$(DESTDIR)$(khrdir)'"; \ |
$(MKDIR_P) "$(DESTDIR)$(khrdir)" || exit 1; \ |
fi; \ |
for p in $$list; do \ |
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ |
echo "$$d$$p"; \ |
done | $(am__base_list) | \ |
while read files; do \ |
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(khrdir)'"; \ |
$(INSTALL_HEADER) $$files "$(DESTDIR)$(khrdir)" || exit $$?; \ |
done |
uninstall-khrHEADERS: |
@$(NORMAL_UNINSTALL) |
@list='$(khr_HEADERS)'; test -n "$(khrdir)" || list=; \ |
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ |
dir='$(DESTDIR)$(khrdir)'; $(am__uninstall_files_from_dir) |
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) $(DATA) $(HEADERS) all-local |
installdirs: |
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(egldir)" "$(DESTDIR)$(khrdir)"; do \ |
test -z "$$dir" || $(MKDIR_P) "$$dir"; \ |
done |
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-libLTLIBRARIES clean-libtool \ |
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-eglHEADERS install-khrHEADERS \ |
install-pkgconfigDATA |
install-dvi: install-dvi-am |
install-dvi-am: |
install-exec-am: install-libLTLIBRARIES |
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: uninstall-eglHEADERS uninstall-khrHEADERS \ |
uninstall-libLTLIBRARIES uninstall-pkgconfigDATA |
.MAKE: install-am install-strip |
.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \ |
clean-generic clean-libLTLIBRARIES clean-libtool 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-eglHEADERS \ |
install-exec install-exec-am install-html install-html-am \ |
install-info install-info-am install-khrHEADERS \ |
install-libLTLIBRARIES install-man install-pdf install-pdf-am \ |
install-pkgconfigDATA 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 uninstall-eglHEADERS \ |
uninstall-khrHEADERS uninstall-libLTLIBRARIES \ |
uninstall-pkgconfigDATA |
# Provide compatibility with scripts for the old Mesa build system for |
# a while by putting a link to the driver into /lib of the build tree. |
all-local: libEGL.la |
$(MKDIR_P) $(top_builddir)/$(LIB_DIR); |
ln -f .libs/libEGL.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libEGL.so.1 |
ln -sf libEGL.so.1 $(top_builddir)/$(LIB_DIR)/libEGL.so |
# 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/main/README.txt |
---|
0,0 → 1,71 |
Notes about the EGL library: |
The EGL code here basically consists of two things: |
1. An EGL API dispatcher. This directly routes all the eglFooBar() API |
calls into driver-specific functions. |
2. Fallbacks for EGL API functions. A driver _could_ implement all the |
EGL API calls from scratch. But in many cases, the fallbacks provided |
in libEGL (such as eglChooseConfig()) will do the job. |
Bootstrapping: |
When the apps calls eglOpenDisplay() a device driver is selected and loaded |
(look for dlsym() or LoadLibrary() in egldriver.c). |
The driver's _eglMain() function is then called. This driver function |
allocates, initializes and returns a new _EGLDriver object (usually a |
subclass of that type). |
As part of initialization, the dispatch table in _EGLDriver->API must be |
populated with all the EGL entrypoints. Typically, _eglInitDriverFallbacks() |
can be used to plug in default/fallback functions. Some functions like |
driver->API.Initialize and driver->API.Terminate _must_ be implemented |
with driver-specific code (no default/fallback function is possible). |
A bit later, the app will call eglInitialize(). This will get routed |
to the driver->API.Initialize() function. Any additional driver |
initialization that wasn't done in _eglMain() should be done at this |
point. Typically, this will involve setting up visual configs, etc. |
Special Functions: |
Certain EGL functions _must_ be implemented by the driver. This includes: |
eglCreateContext |
eglCreateWindowSurface |
eglCreatePixmapSurface |
eglCreatePBufferSurface |
eglMakeCurrent |
eglSwapBuffers |
Most of the EGLConfig-related functions can be implemented with the |
defaults/fallbacks. Same thing for the eglGet/Query functions. |
Teardown: |
When eglTerminate() is called, the driver->API.Terminate() function is |
called. The driver should clean up after itself. eglTerminate() will |
then close/unload the driver (shared library). |
Subclassing: |
The internal libEGL data structures such as _EGLDisplay, _EGLContext, |
_EGLSurface, etc should be considered base classes from which drivers |
will derive subclasses. |
/contrib/sdk/sources/Mesa/src/egl/main/SConscript |
---|
0,0 → 1,56 |
####################################################################### |
# SConscript for EGL |
Import('*') |
env = env.Clone() |
env.Append(CPPDEFINES = [ |
'_EGL_BUILT_IN_DRIVER_GALLIUM', |
'_EGL_DRIVER_SEARCH_DIR=\\"\\"', |
]) |
if env['platform'] == 'windows': |
env.Append(CPPDEFINES = [ |
'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS', |
'_EGL_OS_WINDOWS', |
'_EGL_GET_CORE_ADDRESSES', |
'KHRONOS_DLL_EXPORTS', |
]) |
else: |
env.Append(CPPDEFINES = [ |
'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11', |
'_EGL_OS_UNIX', |
]) |
env.Append(CPPPATH = [ |
'#/include', |
]) |
egl_sources = [ |
'eglapi.c', |
'eglarray.c', |
'eglconfig.c', |
'eglcontext.c', |
'eglcurrent.c', |
'egldisplay.c', |
'egldriver.c', |
'eglfallbacks.c', |
'eglglobals.c', |
'eglimage.c', |
'egllog.c', |
'eglmisc.c', |
'eglmode.c', |
'eglscreen.c', |
'eglstring.c', |
'eglsurface.c', |
'eglsync.c', |
] |
egl = env.ConvenienceLibrary( |
target = 'egl', |
source = egl_sources, |
) |
Export('egl') |
/contrib/sdk/sources/Mesa/src/egl/main/egl.def |
---|
0,0 → 1,35 |
EXPORTS |
eglBindAPI |
eglBindTexImage |
eglChooseConfig |
eglCopyBuffers |
eglCreateContext |
eglCreatePbufferFromClientBuffer |
eglCreatePbufferSurface |
eglCreatePixmapSurface |
eglCreateWindowSurface |
eglDestroyContext |
eglDestroySurface |
eglGetConfigAttrib |
eglGetConfigs |
eglGetCurrentContext |
eglGetCurrentDisplay |
eglGetCurrentSurface |
eglGetDisplay |
eglGetError |
eglGetProcAddress |
eglInitialize |
eglMakeCurrent |
eglQueryAPI |
eglQueryContext |
eglQueryString |
eglQuerySurface |
eglReleaseTexImage |
eglReleaseThread |
eglSurfaceAttrib |
eglSwapBuffers |
eglSwapInterval |
eglTerminate |
eglWaitClient |
eglWaitGL |
eglWaitNative |
/contrib/sdk/sources/Mesa/src/egl/main/egl.pc.in |
---|
0,0 → 1,12 |
prefix=@prefix@ |
exec_prefix=${prefix} |
libdir=@libdir@ |
includedir=@includedir@ |
Name: egl |
Description: Mesa EGL library |
Requires.private: @GL_PC_REQ_PRIV@ |
Version: @PACKAGE_VERSION@ |
Libs: -L${libdir} -lEGL |
Libs.private: @GL_PC_LIB_PRIV@ |
Cflags: -I${includedir} @GL_PC_CFLAGS@ |
/contrib/sdk/sources/Mesa/src/egl/main/eglapi.c |
---|
0,0 → 1,1616 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* Public EGL API entrypoints |
* |
* Generally, we use the EGLDisplay parameter as a key to lookup the |
* appropriate device driver handle, then jump though the driver's |
* dispatch table to handle the function. |
* |
* That allows us the option of supporting multiple, simultaneous, |
* heterogeneous hardware devices in the future. |
* |
* The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are |
* opaque handles. Internal objects are linked to a display to |
* create the handles. |
* |
* For each public API entry point, the opaque handles are looked up |
* before being dispatched to the drivers. When it fails to look up |
* a handle, one of |
* |
* EGL_BAD_DISPLAY |
* EGL_BAD_CONFIG |
* EGL_BAD_CONTEXT |
* EGL_BAD_SURFACE |
* EGL_BAD_SCREEN_MESA |
* EGL_BAD_MODE_MESA |
* |
* is generated and the driver function is not called. An |
* uninitialized EGLDisplay has no driver associated with it. When |
* such display is detected, |
* |
* EGL_NOT_INITIALIZED |
* |
* is generated. |
* |
* Some of the entry points use current display, context, or surface |
* implicitly. For such entry points, the implicit objects are also |
* checked before calling the driver function. Other than the |
* errors listed above, |
* |
* EGL_BAD_CURRENT_SURFACE |
* |
* may also be generated. |
* |
* Notes on naming conventions: |
* |
* eglFooBar - public EGL function |
* EGL_FOO_BAR - public EGL token |
* EGLDatatype - public EGL datatype |
* |
* _eglFooBar - private EGL function |
* _EGLDatatype - private EGL datatype, typedef'd struct |
* _egl_struct - private EGL struct, non-typedef'd |
* |
*/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include "eglcontext.h" |
#include "egldisplay.h" |
#include "egltypedefs.h" |
#include "eglcurrent.h" |
#include "egldriver.h" |
#include "eglsurface.h" |
#include "eglconfig.h" |
#include "eglscreen.h" |
#include "eglmode.h" |
#include "eglimage.h" |
#include "eglsync.h" |
/** |
* Macros to help return an API entrypoint. |
* |
* These macros will unlock the display and record the error code. |
*/ |
#define RETURN_EGL_ERROR(disp, err, ret) \ |
do { \ |
if (disp) \ |
_eglUnlockDisplay(disp); \ |
/* EGL error codes are non-zero */ \ |
if (err) \ |
_eglError(err, __FUNCTION__); \ |
return ret; \ |
} while (0) |
#define RETURN_EGL_SUCCESS(disp, ret) \ |
RETURN_EGL_ERROR(disp, EGL_SUCCESS, ret) |
/* record EGL_SUCCESS only when ret evaluates to true */ |
#define RETURN_EGL_EVAL(disp, ret) \ |
RETURN_EGL_ERROR(disp, (ret) ? EGL_SUCCESS : 0, ret) |
/* |
* A bunch of macros and checks to simplify error checking. |
*/ |
#define _EGL_CHECK_DISPLAY(disp, ret, drv) \ |
do { \ |
drv = _eglCheckDisplay(disp, __FUNCTION__); \ |
if (!drv) \ |
RETURN_EGL_ERROR(disp, 0, ret); \ |
} while (0) |
#define _EGL_CHECK_OBJECT(disp, type, obj, ret, drv) \ |
do { \ |
drv = _eglCheck ## type(disp, obj, __FUNCTION__); \ |
if (!drv) \ |
RETURN_EGL_ERROR(disp, 0, ret); \ |
} while (0) |
#define _EGL_CHECK_SURFACE(disp, surf, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Surface, surf, ret, drv) |
#define _EGL_CHECK_CONTEXT(disp, context, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Context, context, ret, drv) |
#define _EGL_CHECK_CONFIG(disp, conf, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Config, conf, ret, drv) |
#define _EGL_CHECK_SCREEN(disp, scrn, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Screen, scrn, ret, drv) |
#define _EGL_CHECK_MODE(disp, m, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Mode, m, ret, drv) |
#define _EGL_CHECK_SYNC(disp, s, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Sync, s, ret, drv) |
static INLINE _EGLDriver * |
_eglCheckDisplay(_EGLDisplay *disp, const char *msg) |
{ |
if (!disp) { |
_eglError(EGL_BAD_DISPLAY, msg); |
return NULL; |
} |
if (!disp->Initialized) { |
_eglError(EGL_NOT_INITIALIZED, msg); |
return NULL; |
} |
return disp->Driver; |
} |
static INLINE _EGLDriver * |
_eglCheckSurface(_EGLDisplay *disp, _EGLSurface *surf, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!surf) { |
_eglError(EGL_BAD_SURFACE, msg); |
return NULL; |
} |
return drv; |
} |
static INLINE _EGLDriver * |
_eglCheckContext(_EGLDisplay *disp, _EGLContext *context, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!context) { |
_eglError(EGL_BAD_CONTEXT, msg); |
return NULL; |
} |
return drv; |
} |
static INLINE _EGLDriver * |
_eglCheckConfig(_EGLDisplay *disp, _EGLConfig *conf, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!conf) { |
_eglError(EGL_BAD_CONFIG, msg); |
return NULL; |
} |
return drv; |
} |
static INLINE _EGLDriver * |
_eglCheckSync(_EGLDisplay *disp, _EGLSync *s, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!s) { |
_eglError(EGL_BAD_PARAMETER, msg); |
return NULL; |
} |
return drv; |
} |
#ifdef EGL_MESA_screen_surface |
static INLINE _EGLDriver * |
_eglCheckScreen(_EGLDisplay *disp, _EGLScreen *scrn, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!scrn) { |
_eglError(EGL_BAD_SCREEN_MESA, msg); |
return NULL; |
} |
return drv; |
} |
static INLINE _EGLDriver * |
_eglCheckMode(_EGLDisplay *disp, _EGLMode *m, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!m) { |
_eglError(EGL_BAD_MODE_MESA, msg); |
return NULL; |
} |
return drv; |
} |
#endif /* EGL_MESA_screen_surface */ |
/** |
* Lookup and lock a display. |
*/ |
static INLINE _EGLDisplay * |
_eglLockDisplay(EGLDisplay display) |
{ |
_EGLDisplay *dpy = _eglLookupDisplay(display); |
if (dpy) |
_eglLockMutex(&dpy->Mutex); |
return dpy; |
} |
/** |
* Unlock a display. |
*/ |
static INLINE void |
_eglUnlockDisplay(_EGLDisplay *dpy) |
{ |
_eglUnlockMutex(&dpy->Mutex); |
} |
/** |
* This is typically the first EGL function that an application calls. |
* It associates a private _EGLDisplay object to the native display. |
*/ |
EGLDisplay EGLAPIENTRY |
eglGetDisplay(EGLNativeDisplayType nativeDisplay) |
{ |
_EGLPlatformType plat = _eglGetNativePlatform(nativeDisplay); |
_EGLDisplay *dpy = _eglFindDisplay(plat, (void *) nativeDisplay); |
return _eglGetDisplayHandle(dpy); |
} |
/** |
* This is typically the second EGL function that an application calls. |
* Here we load/initialize the actual hardware driver. |
*/ |
EGLBoolean EGLAPIENTRY |
eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
if (!disp) |
RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); |
if (!disp->Initialized) { |
if (!_eglMatchDriver(disp, EGL_FALSE)) |
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); |
/* limit to APIs supported by core */ |
disp->ClientAPIs &= _EGL_API_ALL_BITS; |
} |
/* Update applications version of major and minor if not NULL */ |
if ((major != NULL) && (minor != NULL)) { |
*major = disp->VersionMajor; |
*minor = disp->VersionMinor; |
} |
RETURN_EGL_SUCCESS(disp, EGL_TRUE); |
} |
EGLBoolean EGLAPIENTRY |
eglTerminate(EGLDisplay dpy) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
if (!disp) |
RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); |
if (disp->Initialized) { |
_EGLDriver *drv = disp->Driver; |
drv->API.Terminate(drv, disp); |
/* do not reset disp->Driver */ |
disp->Initialized = EGL_FALSE; |
} |
RETURN_EGL_SUCCESS(disp, EGL_TRUE); |
} |
const char * EGLAPIENTRY |
eglQueryString(EGLDisplay dpy, EGLint name) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
const char *ret; |
_EGL_CHECK_DISPLAY(disp, NULL, drv); |
ret = drv->API.QueryString(drv, disp, name); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, |
EGLint config_size, EGLint *num_config) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, |
EGLint config_size, EGLint *num_config) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, |
config_size, num_config); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv); |
ret = drv->API.GetConfigAttrib(drv, disp, conf, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLContext EGLAPIENTRY |
eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, |
const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLContext *share = _eglLookupContext(share_list, disp); |
_EGLDriver *drv; |
_EGLContext *context; |
EGLContext ret; |
_EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv); |
if (!config) { |
/* config may be NULL if surfaceless */ |
if (!disp->Extensions.KHR_surfaceless_context) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT); |
} |
if (!share && share_list != EGL_NO_CONTEXT) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT); |
context = drv->API.CreateContext(drv, disp, conf, share, attrib_list); |
ret = (context) ? _eglLinkContext(context) : EGL_NO_CONTEXT; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglDestroyContext(EGLDisplay dpy, EGLContext ctx) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *context = _eglLookupContext(ctx, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv); |
_eglUnlinkContext(context); |
ret = drv->API.DestroyContext(drv, disp, context); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, |
EGLContext ctx) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *context = _eglLookupContext(ctx, disp); |
_EGLSurface *draw_surf = _eglLookupSurface(draw, disp); |
_EGLSurface *read_surf = _eglLookupSurface(read, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
if (!disp) |
RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE); |
drv = disp->Driver; |
/* display is allowed to be uninitialized under certain condition */ |
if (!disp->Initialized) { |
if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE || |
ctx != EGL_NO_CONTEXT) |
RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE); |
} |
if (!drv) |
RETURN_EGL_SUCCESS(disp, EGL_TRUE); |
if (!context && ctx != EGL_NO_CONTEXT) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); |
if (!draw_surf || !read_surf) { |
/* surfaces may be NULL if surfaceless */ |
if (!disp->Extensions.KHR_surfaceless_context) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
if ((!draw_surf && draw != EGL_NO_SURFACE) || |
(!read_surf && read != EGL_NO_SURFACE)) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
if (draw_surf || read_surf) |
RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE); |
} |
ret = drv->API.MakeCurrent(drv, disp, draw_surf, read_surf, context); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryContext(EGLDisplay dpy, EGLContext ctx, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *context = _eglLookupContext(ctx, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv); |
ret = drv->API.QueryContext(drv, disp, context, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, |
EGLNativeWindowType window, const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay)) |
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); |
surf = drv->API.CreateWindowSurface(drv, disp, conf, window, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, |
EGLNativePixmapType pixmap, const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay)) |
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE); |
surf = drv->API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, |
const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglDestroySurface(EGLDisplay dpy, EGLSurface surface) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
_eglUnlinkSurface(surf); |
ret = drv->API.DestroySurface(drv, disp, surf); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQuerySurface(EGLDisplay dpy, EGLSurface surface, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
ret = drv->API.QuerySurface(drv, disp, surf, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, |
EGLint attribute, EGLint value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
ret = drv->API.SurfaceAttrib(drv, disp, surf, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
ret = drv->API.BindTexImage(drv, disp, surf, buffer); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
ret = drv->API.ReleaseTexImage(drv, disp, surf, buffer); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglSwapInterval(EGLDisplay dpy, EGLint interval) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLSurface *surf; |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
ctx->Resource.Display != disp) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); |
surf = ctx->DrawSurface; |
if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
ret = drv->API.SwapInterval(drv, disp, surf, interval); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
/* surface must be bound to current context in EGL 1.4 */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
surf != ctx->DrawSurface) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
ret = drv->API.SwapBuffers(drv, disp, surf); |
RETURN_EGL_EVAL(disp, ret); |
} |
#ifdef EGL_EXT_swap_buffers_with_damage |
EGLBoolean EGLAPIENTRY |
eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLSurface surface, |
EGLint *rects, EGLint n_rects) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
/* surface must be bound to current context in EGL 1.4 */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
surf != ctx->DrawSurface) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
if ((n_rects > 0 && rects == NULL) || n_rects < 0) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.SwapBuffersWithDamageEXT(drv, disp, surf, rects, n_rects); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif /* EGL_EXT_swap_buffers_with_damage */ |
EGLBoolean EGLAPIENTRY |
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay)) |
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE); |
ret = drv->API.CopyBuffers(drv, disp, surf, target); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglWaitClient(void) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp; |
_EGLDriver *drv; |
EGLBoolean ret; |
if (!ctx) |
RETURN_EGL_SUCCESS(NULL, EGL_TRUE); |
disp = ctx->Resource.Display; |
_eglLockMutex(&disp->Mutex); |
/* let bad current context imply bad current surface */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
_eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE) |
RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE); |
/* a valid current context implies an initialized current display */ |
assert(disp->Initialized); |
drv = disp->Driver; |
ret = drv->API.WaitClient(drv, disp, ctx); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglWaitGL(void) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
EGLint api_index = t->CurrentAPIIndex; |
EGLint es_index = _eglConvertApiToIndex(EGL_OPENGL_ES_API); |
EGLBoolean ret; |
if (api_index != es_index && _eglIsCurrentThreadDummy()) |
RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE); |
t->CurrentAPIIndex = es_index; |
ret = eglWaitClient(); |
t->CurrentAPIIndex = api_index; |
return ret; |
} |
EGLBoolean EGLAPIENTRY |
eglWaitNative(EGLint engine) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp; |
_EGLDriver *drv; |
EGLBoolean ret; |
if (!ctx) |
RETURN_EGL_SUCCESS(NULL, EGL_TRUE); |
disp = ctx->Resource.Display; |
_eglLockMutex(&disp->Mutex); |
/* let bad current context imply bad current surface */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
_eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE) |
RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE); |
/* a valid current context implies an initialized current display */ |
assert(disp->Initialized); |
drv = disp->Driver; |
ret = drv->API.WaitNative(drv, disp, engine); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLDisplay EGLAPIENTRY |
eglGetCurrentDisplay(void) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
EGLDisplay ret; |
ret = (ctx) ? _eglGetDisplayHandle(ctx->Resource.Display) : EGL_NO_DISPLAY; |
RETURN_EGL_SUCCESS(NULL, ret); |
} |
EGLContext EGLAPIENTRY |
eglGetCurrentContext(void) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
EGLContext ret; |
ret = _eglGetContextHandle(ctx); |
RETURN_EGL_SUCCESS(NULL, ret); |
} |
EGLSurface EGLAPIENTRY |
eglGetCurrentSurface(EGLint readdraw) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
EGLint err = EGL_SUCCESS; |
_EGLSurface *surf; |
EGLSurface ret; |
if (!ctx) |
RETURN_EGL_SUCCESS(NULL, EGL_NO_SURFACE); |
switch (readdraw) { |
case EGL_DRAW: |
surf = ctx->DrawSurface; |
break; |
case EGL_READ: |
surf = ctx->ReadSurface; |
break; |
default: |
surf = NULL; |
err = EGL_BAD_PARAMETER; |
break; |
} |
ret = _eglGetSurfaceHandle(surf); |
RETURN_EGL_ERROR(NULL, err, ret); |
} |
EGLint EGLAPIENTRY |
eglGetError(void) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
EGLint e = t->LastError; |
if (!_eglIsCurrentThreadDummy()) |
t->LastError = EGL_SUCCESS; |
return e; |
} |
__eglMustCastToProperFunctionPointerType EGLAPIENTRY |
eglGetProcAddress(const char *procname) |
{ |
static const struct { |
const char *name; |
_EGLProc function; |
} egl_functions[] = { |
/* core functions should not be queryable, but, well... */ |
#ifdef _EGL_GET_CORE_ADDRESSES |
/* alphabetical order */ |
{ "eglBindAPI", (_EGLProc) eglBindAPI }, |
{ "eglBindTexImage", (_EGLProc) eglBindTexImage }, |
{ "eglChooseConfig", (_EGLProc) eglChooseConfig }, |
{ "eglCopyBuffers", (_EGLProc) eglCopyBuffers }, |
{ "eglCreateContext", (_EGLProc) eglCreateContext }, |
{ "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer }, |
{ "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface }, |
{ "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface }, |
{ "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface }, |
{ "eglDestroyContext", (_EGLProc) eglDestroyContext }, |
{ "eglDestroySurface", (_EGLProc) eglDestroySurface }, |
{ "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib }, |
{ "eglGetConfigs", (_EGLProc) eglGetConfigs }, |
{ "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext }, |
{ "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay }, |
{ "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface }, |
{ "eglGetDisplay", (_EGLProc) eglGetDisplay }, |
{ "eglGetError", (_EGLProc) eglGetError }, |
{ "eglGetProcAddress", (_EGLProc) eglGetProcAddress }, |
{ "eglInitialize", (_EGLProc) eglInitialize }, |
{ "eglMakeCurrent", (_EGLProc) eglMakeCurrent }, |
{ "eglQueryAPI", (_EGLProc) eglQueryAPI }, |
{ "eglQueryContext", (_EGLProc) eglQueryContext }, |
{ "eglQueryString", (_EGLProc) eglQueryString }, |
{ "eglQuerySurface", (_EGLProc) eglQuerySurface }, |
{ "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage }, |
{ "eglReleaseThread", (_EGLProc) eglReleaseThread }, |
{ "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib }, |
{ "eglSwapBuffers", (_EGLProc) eglSwapBuffers }, |
{ "eglSwapInterval", (_EGLProc) eglSwapInterval }, |
{ "eglTerminate", (_EGLProc) eglTerminate }, |
{ "eglWaitClient", (_EGLProc) eglWaitClient }, |
{ "eglWaitGL", (_EGLProc) eglWaitGL }, |
{ "eglWaitNative", (_EGLProc) eglWaitNative }, |
#endif /* _EGL_GET_CORE_ADDRESSES */ |
#ifdef EGL_MESA_screen_surface |
{ "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA }, |
{ "eglGetModesMESA", (_EGLProc) eglGetModesMESA }, |
{ "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA }, |
{ "eglCopyContextMESA", (_EGLProc) eglCopyContextMESA }, |
{ "eglGetScreensMESA", (_EGLProc) eglGetScreensMESA }, |
{ "eglCreateScreenSurfaceMESA", (_EGLProc) eglCreateScreenSurfaceMESA }, |
{ "eglShowScreenSurfaceMESA", (_EGLProc) eglShowScreenSurfaceMESA }, |
{ "eglScreenPositionMESA", (_EGLProc) eglScreenPositionMESA }, |
{ "eglQueryScreenMESA", (_EGLProc) eglQueryScreenMESA }, |
{ "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA }, |
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA }, |
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA }, |
#endif /* EGL_MESA_screen_surface */ |
#ifdef EGL_MESA_drm_display |
{ "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA }, |
#endif |
{ "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR }, |
{ "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR }, |
{ "eglCreateSyncKHR", (_EGLProc) eglCreateSyncKHR }, |
{ "eglDestroySyncKHR", (_EGLProc) eglDestroySyncKHR }, |
{ "eglClientWaitSyncKHR", (_EGLProc) eglClientWaitSyncKHR }, |
{ "eglSignalSyncKHR", (_EGLProc) eglSignalSyncKHR }, |
{ "eglGetSyncAttribKHR", (_EGLProc) eglGetSyncAttribKHR }, |
#ifdef EGL_NOK_swap_region |
{ "eglSwapBuffersRegionNOK", (_EGLProc) eglSwapBuffersRegionNOK }, |
#endif |
#ifdef EGL_MESA_drm_image |
{ "eglCreateDRMImageMESA", (_EGLProc) eglCreateDRMImageMESA }, |
{ "eglExportDRMImageMESA", (_EGLProc) eglExportDRMImageMESA }, |
#endif |
#ifdef EGL_WL_bind_wayland_display |
{ "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL }, |
{ "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL }, |
{ "eglQueryWaylandBufferWL", (_EGLProc) eglQueryWaylandBufferWL }, |
#endif |
{ "eglPostSubBufferNV", (_EGLProc) eglPostSubBufferNV }, |
#ifdef EGL_EXT_swap_buffers_with_damage |
{ "eglSwapBuffersWithDamageEXT", (_EGLProc) eglSwapBuffersWithDamageEXT }, |
#endif |
{ NULL, NULL } |
}; |
EGLint i; |
_EGLProc ret; |
if (!procname) |
RETURN_EGL_SUCCESS(NULL, NULL); |
ret = NULL; |
if (strncmp(procname, "egl", 3) == 0) { |
for (i = 0; egl_functions[i].name; i++) { |
if (strcmp(egl_functions[i].name, procname) == 0) { |
ret = egl_functions[i].function; |
break; |
} |
} |
} |
if (!ret) |
ret = _eglGetDriverProc(procname); |
RETURN_EGL_SUCCESS(NULL, ret); |
} |
#ifdef EGL_MESA_screen_surface |
/* |
* EGL_MESA_screen extension |
*/ |
EGLBoolean EGLAPIENTRY |
eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, |
const EGLint *attrib_list, EGLModeMESA *modes, |
EGLint modes_size, EGLint *num_modes) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen(screen, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.ChooseModeMESA(drv, disp, scrn, attrib_list, |
modes, modes_size, num_modes); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, |
EGLint mode_size, EGLint *num_mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen(screen, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.GetModesMESA(drv, disp, scrn, modes, mode_size, num_mode); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLMode *m = _eglLookupMode(mode, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_MODE(disp, m, EGL_FALSE, drv); |
ret = drv->API.GetModeAttribMESA(drv, disp, m, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, |
EGLint mask) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *source_context = _eglLookupContext(source, disp); |
_EGLContext *dest_context = _eglLookupContext(dest, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_CONTEXT(disp, source_context, EGL_FALSE, drv); |
if (!dest_context) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); |
ret = drv->API.CopyContextMESA(drv, disp, |
source_context, dest_context, mask); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, |
EGLint max_screens, EGLint *num_screens) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
ret = drv->API.GetScreensMESA(drv, disp, screens, max_screens, num_screens); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, |
const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
surf = drv->API.CreateScreenSurfaceMESA(drv, disp, conf, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, |
EGLSurface surface, EGLModeMESA mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLMode *m = _eglLookupMode(mode, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
if (!surf && surface != EGL_NO_SURFACE) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
if (!m && mode != EGL_NO_MODE_MESA) |
RETURN_EGL_ERROR(disp, EGL_BAD_MODE_MESA, EGL_FALSE); |
ret = drv->API.ShowScreenSurfaceMESA(drv, disp, scrn, surf, m); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen(screen, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.ScreenPositionMESA(drv, disp, scrn, x, y); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen(screen, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.QueryScreenMESA(drv, disp, scrn, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLSurface *surface) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.QueryScreenSurfaceMESA(drv, disp, scrn, &surf); |
if (ret && surface) |
*surface = _eglGetSurfaceHandle(surf); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp); |
_EGLDriver *drv; |
_EGLMode *m; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.QueryScreenModeMESA(drv, disp, scrn, &m); |
if (ret && mode) |
*mode = m->Handle; |
RETURN_EGL_EVAL(disp, ret); |
} |
const char * EGLAPIENTRY |
eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLMode *m = _eglLookupMode(mode, disp); |
_EGLDriver *drv; |
const char *ret; |
_EGL_CHECK_MODE(disp, m, NULL, drv); |
ret = drv->API.QueryModeStringMESA(drv, disp, m); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif /* EGL_MESA_screen_surface */ |
#ifdef EGL_MESA_drm_display |
EGLDisplay EGLAPIENTRY |
eglGetDRMDisplayMESA(int fd) |
{ |
_EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (intptr_t) fd); |
return _eglGetDisplayHandle(dpy); |
} |
#endif /* EGL_MESA_drm_display */ |
/** |
** EGL 1.2 |
**/ |
/** |
* Specify the client API to use for subsequent calls including: |
* eglCreateContext() |
* eglGetCurrentContext() |
* eglGetCurrentDisplay() |
* eglGetCurrentSurface() |
* eglMakeCurrent(when the ctx parameter is EGL NO CONTEXT) |
* eglWaitClient() |
* eglWaitNative() |
* See section 3.7 "Rendering Context" in the EGL specification for details. |
*/ |
EGLBoolean EGLAPIENTRY |
eglBindAPI(EGLenum api) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
if (_eglIsCurrentThreadDummy()) |
RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE); |
if (!_eglIsApiValid(api)) |
RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE); |
t->CurrentAPIIndex = _eglConvertApiToIndex(api); |
RETURN_EGL_SUCCESS(NULL, EGL_TRUE); |
} |
/** |
* Return the last value set with eglBindAPI(). |
*/ |
EGLenum EGLAPIENTRY |
eglQueryAPI(void) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
EGLenum ret; |
/* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */ |
ret = _eglConvertApiFromIndex(t->CurrentAPIIndex); |
RETURN_EGL_SUCCESS(NULL, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, |
EGLClientBuffer buffer, EGLConfig config, |
const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
surf = drv->API.CreatePbufferFromClientBuffer(drv, disp, buftype, buffer, |
conf, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglReleaseThread(void) |
{ |
/* unbind current contexts */ |
if (!_eglIsCurrentThreadDummy()) { |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
EGLint api_index = t->CurrentAPIIndex; |
EGLint i; |
for (i = 0; i < _EGL_API_NUM_APIS; i++) { |
_EGLContext *ctx = t->CurrentContexts[i]; |
if (ctx) { |
_EGLDisplay *disp = ctx->Resource.Display; |
_EGLDriver *drv; |
t->CurrentAPIIndex = i; |
_eglLockMutex(&disp->Mutex); |
drv = disp->Driver; |
(void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); |
_eglUnlockMutex(&disp->Mutex); |
} |
} |
t->CurrentAPIIndex = api_index; |
} |
_eglDestroyCurrentThread(); |
RETURN_EGL_SUCCESS(NULL, EGL_TRUE); |
} |
EGLImageKHR EGLAPIENTRY |
eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *context = _eglLookupContext(ctx, disp); |
_EGLDriver *drv; |
_EGLImage *img; |
EGLImageKHR ret; |
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv); |
if (!disp->Extensions.KHR_image_base) |
RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR); |
if (!context && ctx != EGL_NO_CONTEXT) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR); |
img = drv->API.CreateImageKHR(drv, |
disp, context, target, buffer, attr_list); |
ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLImage *img = _eglLookupImage(image, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
if (!disp->Extensions.KHR_image_base) |
RETURN_EGL_EVAL(disp, EGL_FALSE); |
if (!img) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
_eglUnlinkImage(img); |
ret = drv->API.DestroyImageKHR(drv, disp, img); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSyncKHR EGLAPIENTRY |
eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
_EGLSync *sync; |
EGLSyncKHR ret; |
_EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv); |
if (!disp->Extensions.KHR_reusable_sync) |
RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR); |
sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list); |
ret = (sync) ? _eglLinkSync(sync) : EGL_NO_SYNC_KHR; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSync *s = _eglLookupSync(sync, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); |
assert(disp->Extensions.KHR_reusable_sync); |
_eglUnlinkSync(s); |
ret = drv->API.DestroySyncKHR(drv, disp, s); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLint EGLAPIENTRY |
eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSync *s = _eglLookupSync(sync, disp); |
_EGLDriver *drv; |
EGLint ret; |
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); |
assert(disp->Extensions.KHR_reusable_sync); |
ret = drv->API.ClientWaitSyncKHR(drv, disp, s, flags, timeout); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSync *s = _eglLookupSync(sync, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); |
assert(disp->Extensions.KHR_reusable_sync); |
ret = drv->API.SignalSyncKHR(drv, disp, s, mode); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSync *s = _eglLookupSync(sync, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); |
assert(disp->Extensions.KHR_reusable_sync); |
ret = drv->API.GetSyncAttribKHR(drv, disp, s, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
#ifdef EGL_NOK_swap_region |
EGLBoolean EGLAPIENTRY |
eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, |
EGLint numRects, const EGLint *rects) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
if (!disp->Extensions.NOK_swap_region) |
RETURN_EGL_EVAL(disp, EGL_FALSE); |
/* surface must be bound to current context in EGL 1.4 */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
surf != ctx->DrawSurface) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif /* EGL_NOK_swap_region */ |
#ifdef EGL_MESA_drm_image |
EGLImageKHR EGLAPIENTRY |
eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
_EGLImage *img; |
EGLImageKHR ret; |
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv); |
if (!disp->Extensions.MESA_drm_image) |
RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR); |
img = drv->API.CreateDRMImageMESA(drv, disp, attr_list); |
ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image, |
EGLint *name, EGLint *handle, EGLint *stride) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLImage *img = _eglLookupImage(image, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
assert(disp->Extensions.MESA_drm_image); |
if (!img) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.ExportDRMImageMESA(drv, disp, img, name, handle, stride); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif |
#ifdef EGL_WL_bind_wayland_display |
struct wl_display; |
EGLBoolean EGLAPIENTRY |
eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
assert(disp->Extensions.WL_bind_wayland_display); |
if (!display) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.BindWaylandDisplayWL(drv, disp, display); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
assert(disp->Extensions.WL_bind_wayland_display); |
if (!display) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.UnbindWaylandDisplayWL(drv, disp, display); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryWaylandBufferWL(EGLDisplay dpy,struct wl_buffer *buffer, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
assert(disp->Extensions.WL_bind_wayland_display); |
if (!buffer) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.QueryWaylandBufferWL(drv, disp, buffer, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif |
EGLBoolean EGLAPIENTRY |
eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, |
EGLint x, EGLint y, EGLint width, EGLint height) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
if (!disp->Extensions.NV_post_sub_buffer) |
RETURN_EGL_EVAL(disp, EGL_FALSE); |
ret = drv->API.PostSubBufferNV(drv, disp, surf, x, y, width, height); |
RETURN_EGL_EVAL(disp, ret); |
} |
int atexit(void (*func)(void)) |
{ |
return 0; |
}; |
/contrib/sdk/sources/Mesa/src/egl/main/eglapi.c.bak |
---|
0,0 → 1,1614 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* Public EGL API entrypoints |
* |
* Generally, we use the EGLDisplay parameter as a key to lookup the |
* appropriate device driver handle, then jump though the driver's |
* dispatch table to handle the function. |
* |
* That allows us the option of supporting multiple, simultaneous, |
* heterogeneous hardware devices in the future. |
* |
* The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are |
* opaque handles. Internal objects are linked to a display to |
* create the handles. |
* |
* For each public API entry point, the opaque handles are looked up |
* before being dispatched to the drivers. When it fails to look up |
* a handle, one of |
* |
* EGL_BAD_DISPLAY |
* EGL_BAD_CONFIG |
* EGL_BAD_CONTEXT |
* EGL_BAD_SURFACE |
* EGL_BAD_SCREEN_MESA |
* EGL_BAD_MODE_MESA |
* |
* is generated and the driver function is not called. An |
* uninitialized EGLDisplay has no driver associated with it. When |
* such display is detected, |
* |
* EGL_NOT_INITIALIZED |
* |
* is generated. |
* |
* Some of the entry points use current display, context, or surface |
* implicitly. For such entry points, the implicit objects are also |
* checked before calling the driver function. Other than the |
* errors listed above, |
* |
* EGL_BAD_CURRENT_SURFACE |
* |
* may also be generated. |
* |
* Notes on naming conventions: |
* |
* eglFooBar - public EGL function |
* EGL_FOO_BAR - public EGL token |
* EGLDatatype - public EGL datatype |
* |
* _eglFooBar - private EGL function |
* _EGLDatatype - private EGL datatype, typedef'd struct |
* _egl_struct - private EGL struct, non-typedef'd |
* |
*/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include "eglcontext.h" |
#include "egldisplay.h" |
#include "egltypedefs.h" |
#include "eglcurrent.h" |
#include "egldriver.h" |
#include "eglsurface.h" |
#include "eglconfig.h" |
#include "eglscreen.h" |
#include "eglmode.h" |
#include "eglimage.h" |
#include "eglsync.h" |
/** |
* Macros to help return an API entrypoint. |
* |
* These macros will unlock the display and record the error code. |
*/ |
#define RETURN_EGL_ERROR(disp, err, ret) \ |
do { \ |
if (disp) \ |
_eglUnlockDisplay(disp); \ |
/* EGL error codes are non-zero */ \ |
if (err) \ |
_eglError(err, __FUNCTION__); \ |
return ret; \ |
} while (0) |
#define RETURN_EGL_SUCCESS(disp, ret) \ |
RETURN_EGL_ERROR(disp, EGL_SUCCESS, ret) |
/* record EGL_SUCCESS only when ret evaluates to true */ |
#define RETURN_EGL_EVAL(disp, ret) \ |
RETURN_EGL_ERROR(disp, (ret) ? EGL_SUCCESS : 0, ret) |
/* |
* A bunch of macros and checks to simplify error checking. |
*/ |
#define _EGL_CHECK_DISPLAY(disp, ret, drv) \ |
do { \ |
drv = _eglCheckDisplay(disp, __FUNCTION__); \ |
if (!drv) \ |
RETURN_EGL_ERROR(disp, 0, ret); \ |
} while (0) |
#define _EGL_CHECK_OBJECT(disp, type, obj, ret, drv) \ |
do { \ |
drv = _eglCheck ## type(disp, obj, __FUNCTION__); \ |
if (!drv) \ |
RETURN_EGL_ERROR(disp, 0, ret); \ |
} while (0) |
#define _EGL_CHECK_SURFACE(disp, surf, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Surface, surf, ret, drv) |
#define _EGL_CHECK_CONTEXT(disp, context, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Context, context, ret, drv) |
#define _EGL_CHECK_CONFIG(disp, conf, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Config, conf, ret, drv) |
#define _EGL_CHECK_SCREEN(disp, scrn, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Screen, scrn, ret, drv) |
#define _EGL_CHECK_MODE(disp, m, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Mode, m, ret, drv) |
#define _EGL_CHECK_SYNC(disp, s, ret, drv) \ |
_EGL_CHECK_OBJECT(disp, Sync, s, ret, drv) |
static INLINE _EGLDriver * |
_eglCheckDisplay(_EGLDisplay *disp, const char *msg) |
{ |
if (!disp) { |
_eglError(EGL_BAD_DISPLAY, msg); |
return NULL; |
} |
if (!disp->Initialized) { |
_eglError(EGL_NOT_INITIALIZED, msg); |
return NULL; |
} |
return disp->Driver; |
} |
static INLINE _EGLDriver * |
_eglCheckSurface(_EGLDisplay *disp, _EGLSurface *surf, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!surf) { |
_eglError(EGL_BAD_SURFACE, msg); |
return NULL; |
} |
return drv; |
} |
static INLINE _EGLDriver * |
_eglCheckContext(_EGLDisplay *disp, _EGLContext *context, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!context) { |
_eglError(EGL_BAD_CONTEXT, msg); |
return NULL; |
} |
return drv; |
} |
static INLINE _EGLDriver * |
_eglCheckConfig(_EGLDisplay *disp, _EGLConfig *conf, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!conf) { |
_eglError(EGL_BAD_CONFIG, msg); |
return NULL; |
} |
return drv; |
} |
static INLINE _EGLDriver * |
_eglCheckSync(_EGLDisplay *disp, _EGLSync *s, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!s) { |
_eglError(EGL_BAD_PARAMETER, msg); |
return NULL; |
} |
return drv; |
} |
#ifdef EGL_MESA_screen_surface |
static INLINE _EGLDriver * |
_eglCheckScreen(_EGLDisplay *disp, _EGLScreen *scrn, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!scrn) { |
_eglError(EGL_BAD_SCREEN_MESA, msg); |
return NULL; |
} |
return drv; |
} |
static INLINE _EGLDriver * |
_eglCheckMode(_EGLDisplay *disp, _EGLMode *m, const char *msg) |
{ |
_EGLDriver *drv = _eglCheckDisplay(disp, msg); |
if (!drv) |
return NULL; |
if (!m) { |
_eglError(EGL_BAD_MODE_MESA, msg); |
return NULL; |
} |
return drv; |
} |
#endif /* EGL_MESA_screen_surface */ |
/** |
* Lookup and lock a display. |
*/ |
static INLINE _EGLDisplay * |
_eglLockDisplay(EGLDisplay display) |
{ |
_EGLDisplay *dpy = _eglLookupDisplay(display); |
if (dpy) |
_eglLockMutex(&dpy->Mutex); |
return dpy; |
} |
/** |
* Unlock a display. |
*/ |
static INLINE void |
_eglUnlockDisplay(_EGLDisplay *dpy) |
{ |
_eglUnlockMutex(&dpy->Mutex); |
} |
/** |
* This is typically the first EGL function that an application calls. |
* It associates a private _EGLDisplay object to the native display. |
*/ |
EGLDisplay EGLAPIENTRY |
eglGetDisplay(EGLNativeDisplayType nativeDisplay) |
{ |
_EGLPlatformType plat = _eglGetNativePlatform(nativeDisplay); |
_EGLDisplay *dpy = _eglFindDisplay(plat, (void *) nativeDisplay); |
return _eglGetDisplayHandle(dpy); |
} |
/** |
* This is typically the second EGL function that an application calls. |
* Here we load/initialize the actual hardware driver. |
*/ |
EGLBoolean EGLAPIENTRY |
eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
if (!disp) |
RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); |
if (!disp->Initialized) { |
if (!_eglMatchDriver(disp, EGL_FALSE)) |
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); |
/* limit to APIs supported by core */ |
disp->ClientAPIs &= _EGL_API_ALL_BITS; |
} |
/* Update applications version of major and minor if not NULL */ |
if ((major != NULL) && (minor != NULL)) { |
*major = disp->VersionMajor; |
*minor = disp->VersionMinor; |
} |
RETURN_EGL_SUCCESS(disp, EGL_TRUE); |
} |
EGLBoolean EGLAPIENTRY |
eglTerminate(EGLDisplay dpy) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
if (!disp) |
RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); |
if (disp->Initialized) { |
_EGLDriver *drv = disp->Driver; |
drv->API.Terminate(drv, disp); |
/* do not reset disp->Driver */ |
disp->Initialized = EGL_FALSE; |
} |
RETURN_EGL_SUCCESS(disp, EGL_TRUE); |
} |
const char * EGLAPIENTRY |
eglQueryString(EGLDisplay dpy, EGLint name) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
const char *ret; |
_EGL_CHECK_DISPLAY(disp, NULL, drv); |
ret = drv->API.QueryString(drv, disp, name); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, |
EGLint config_size, EGLint *num_config) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, |
EGLint config_size, EGLint *num_config) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, |
config_size, num_config); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv); |
ret = drv->API.GetConfigAttrib(drv, disp, conf, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLContext EGLAPIENTRY |
eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, |
const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLContext *share = _eglLookupContext(share_list, disp); |
_EGLDriver *drv; |
_EGLContext *context; |
EGLContext ret; |
_EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv); |
if (!config) { |
/* config may be NULL if surfaceless */ |
if (!disp->Extensions.KHR_surfaceless_context) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT); |
} |
if (!share && share_list != EGL_NO_CONTEXT) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT); |
context = drv->API.CreateContext(drv, disp, conf, share, attrib_list); |
ret = (context) ? _eglLinkContext(context) : EGL_NO_CONTEXT; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglDestroyContext(EGLDisplay dpy, EGLContext ctx) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *context = _eglLookupContext(ctx, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv); |
_eglUnlinkContext(context); |
ret = drv->API.DestroyContext(drv, disp, context); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, |
EGLContext ctx) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *context = _eglLookupContext(ctx, disp); |
_EGLSurface *draw_surf = _eglLookupSurface(draw, disp); |
_EGLSurface *read_surf = _eglLookupSurface(read, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
if (!disp) |
RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE); |
drv = disp->Driver; |
/* display is allowed to be uninitialized under certain condition */ |
if (!disp->Initialized) { |
if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE || |
ctx != EGL_NO_CONTEXT) |
RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_FALSE); |
} |
if (!drv) |
RETURN_EGL_SUCCESS(disp, EGL_TRUE); |
if (!context && ctx != EGL_NO_CONTEXT) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); |
if (!draw_surf || !read_surf) { |
/* surfaces may be NULL if surfaceless */ |
if (!disp->Extensions.KHR_surfaceless_context) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
if ((!draw_surf && draw != EGL_NO_SURFACE) || |
(!read_surf && read != EGL_NO_SURFACE)) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
if (draw_surf || read_surf) |
RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE); |
} |
ret = drv->API.MakeCurrent(drv, disp, draw_surf, read_surf, context); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryContext(EGLDisplay dpy, EGLContext ctx, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *context = _eglLookupContext(ctx, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv); |
ret = drv->API.QueryContext(drv, disp, context, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, |
EGLNativeWindowType window, const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay)) |
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); |
surf = drv->API.CreateWindowSurface(drv, disp, conf, window, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, |
EGLNativePixmapType pixmap, const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay)) |
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE); |
surf = drv->API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, |
const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list); |
printf("%s surface: %p\n", __FUNCTION__, surf); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglDestroySurface(EGLDisplay dpy, EGLSurface surface) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
_eglUnlinkSurface(surf); |
ret = drv->API.DestroySurface(drv, disp, surf); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQuerySurface(EGLDisplay dpy, EGLSurface surface, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
ret = drv->API.QuerySurface(drv, disp, surf, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, |
EGLint attribute, EGLint value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
ret = drv->API.SurfaceAttrib(drv, disp, surf, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
ret = drv->API.BindTexImage(drv, disp, surf, buffer); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
ret = drv->API.ReleaseTexImage(drv, disp, surf, buffer); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglSwapInterval(EGLDisplay dpy, EGLint interval) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLSurface *surf; |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
ctx->Resource.Display != disp) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); |
surf = ctx->DrawSurface; |
if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
ret = drv->API.SwapInterval(drv, disp, surf, interval); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
/* surface must be bound to current context in EGL 1.4 */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
surf != ctx->DrawSurface) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
ret = drv->API.SwapBuffers(drv, disp, surf); |
RETURN_EGL_EVAL(disp, ret); |
} |
#ifdef EGL_EXT_swap_buffers_with_damage |
EGLBoolean EGLAPIENTRY |
eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLSurface surface, |
EGLint *rects, EGLint n_rects) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
/* surface must be bound to current context in EGL 1.4 */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
surf != ctx->DrawSurface) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
if ((n_rects > 0 && rects == NULL) || n_rects < 0) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.SwapBuffersWithDamageEXT(drv, disp, surf, rects, n_rects); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif /* EGL_EXT_swap_buffers_with_damage */ |
EGLBoolean EGLAPIENTRY |
eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
if (disp->Platform != _eglGetNativePlatform(disp->PlatformDisplay)) |
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE); |
ret = drv->API.CopyBuffers(drv, disp, surf, target); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglWaitClient(void) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp; |
_EGLDriver *drv; |
EGLBoolean ret; |
if (!ctx) |
RETURN_EGL_SUCCESS(NULL, EGL_TRUE); |
disp = ctx->Resource.Display; |
_eglLockMutex(&disp->Mutex); |
/* let bad current context imply bad current surface */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
_eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE) |
RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE); |
/* a valid current context implies an initialized current display */ |
assert(disp->Initialized); |
drv = disp->Driver; |
ret = drv->API.WaitClient(drv, disp, ctx); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglWaitGL(void) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
EGLint api_index = t->CurrentAPIIndex; |
EGLint es_index = _eglConvertApiToIndex(EGL_OPENGL_ES_API); |
EGLBoolean ret; |
if (api_index != es_index && _eglIsCurrentThreadDummy()) |
RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE); |
t->CurrentAPIIndex = es_index; |
ret = eglWaitClient(); |
t->CurrentAPIIndex = api_index; |
return ret; |
} |
EGLBoolean EGLAPIENTRY |
eglWaitNative(EGLint engine) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp; |
_EGLDriver *drv; |
EGLBoolean ret; |
if (!ctx) |
RETURN_EGL_SUCCESS(NULL, EGL_TRUE); |
disp = ctx->Resource.Display; |
_eglLockMutex(&disp->Mutex); |
/* let bad current context imply bad current surface */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
_eglGetSurfaceHandle(ctx->DrawSurface) == EGL_NO_SURFACE) |
RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE); |
/* a valid current context implies an initialized current display */ |
assert(disp->Initialized); |
drv = disp->Driver; |
ret = drv->API.WaitNative(drv, disp, engine); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLDisplay EGLAPIENTRY |
eglGetCurrentDisplay(void) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
EGLDisplay ret; |
ret = (ctx) ? _eglGetDisplayHandle(ctx->Resource.Display) : EGL_NO_DISPLAY; |
RETURN_EGL_SUCCESS(NULL, ret); |
} |
EGLContext EGLAPIENTRY |
eglGetCurrentContext(void) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
EGLContext ret; |
ret = _eglGetContextHandle(ctx); |
RETURN_EGL_SUCCESS(NULL, ret); |
} |
EGLSurface EGLAPIENTRY |
eglGetCurrentSurface(EGLint readdraw) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
EGLint err = EGL_SUCCESS; |
_EGLSurface *surf; |
EGLSurface ret; |
if (!ctx) |
RETURN_EGL_SUCCESS(NULL, EGL_NO_SURFACE); |
switch (readdraw) { |
case EGL_DRAW: |
surf = ctx->DrawSurface; |
break; |
case EGL_READ: |
surf = ctx->ReadSurface; |
break; |
default: |
surf = NULL; |
err = EGL_BAD_PARAMETER; |
break; |
} |
ret = _eglGetSurfaceHandle(surf); |
RETURN_EGL_ERROR(NULL, err, ret); |
} |
EGLint EGLAPIENTRY |
eglGetError(void) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
EGLint e = t->LastError; |
if (!_eglIsCurrentThreadDummy()) |
t->LastError = EGL_SUCCESS; |
return e; |
} |
__eglMustCastToProperFunctionPointerType EGLAPIENTRY |
eglGetProcAddress(const char *procname) |
{ |
static const struct { |
const char *name; |
_EGLProc function; |
} egl_functions[] = { |
/* core functions should not be queryable, but, well... */ |
#ifdef _EGL_GET_CORE_ADDRESSES |
/* alphabetical order */ |
{ "eglBindAPI", (_EGLProc) eglBindAPI }, |
{ "eglBindTexImage", (_EGLProc) eglBindTexImage }, |
{ "eglChooseConfig", (_EGLProc) eglChooseConfig }, |
{ "eglCopyBuffers", (_EGLProc) eglCopyBuffers }, |
{ "eglCreateContext", (_EGLProc) eglCreateContext }, |
{ "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer }, |
{ "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface }, |
{ "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface }, |
{ "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface }, |
{ "eglDestroyContext", (_EGLProc) eglDestroyContext }, |
{ "eglDestroySurface", (_EGLProc) eglDestroySurface }, |
{ "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib }, |
{ "eglGetConfigs", (_EGLProc) eglGetConfigs }, |
{ "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext }, |
{ "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay }, |
{ "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface }, |
{ "eglGetDisplay", (_EGLProc) eglGetDisplay }, |
{ "eglGetError", (_EGLProc) eglGetError }, |
{ "eglGetProcAddress", (_EGLProc) eglGetProcAddress }, |
{ "eglInitialize", (_EGLProc) eglInitialize }, |
{ "eglMakeCurrent", (_EGLProc) eglMakeCurrent }, |
{ "eglQueryAPI", (_EGLProc) eglQueryAPI }, |
{ "eglQueryContext", (_EGLProc) eglQueryContext }, |
{ "eglQueryString", (_EGLProc) eglQueryString }, |
{ "eglQuerySurface", (_EGLProc) eglQuerySurface }, |
{ "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage }, |
{ "eglReleaseThread", (_EGLProc) eglReleaseThread }, |
{ "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib }, |
{ "eglSwapBuffers", (_EGLProc) eglSwapBuffers }, |
{ "eglSwapInterval", (_EGLProc) eglSwapInterval }, |
{ "eglTerminate", (_EGLProc) eglTerminate }, |
{ "eglWaitClient", (_EGLProc) eglWaitClient }, |
{ "eglWaitGL", (_EGLProc) eglWaitGL }, |
{ "eglWaitNative", (_EGLProc) eglWaitNative }, |
#endif /* _EGL_GET_CORE_ADDRESSES */ |
#ifdef EGL_MESA_screen_surface |
{ "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA }, |
{ "eglGetModesMESA", (_EGLProc) eglGetModesMESA }, |
{ "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA }, |
{ "eglCopyContextMESA", (_EGLProc) eglCopyContextMESA }, |
{ "eglGetScreensMESA", (_EGLProc) eglGetScreensMESA }, |
{ "eglCreateScreenSurfaceMESA", (_EGLProc) eglCreateScreenSurfaceMESA }, |
{ "eglShowScreenSurfaceMESA", (_EGLProc) eglShowScreenSurfaceMESA }, |
{ "eglScreenPositionMESA", (_EGLProc) eglScreenPositionMESA }, |
{ "eglQueryScreenMESA", (_EGLProc) eglQueryScreenMESA }, |
{ "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA }, |
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA }, |
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA }, |
#endif /* EGL_MESA_screen_surface */ |
#ifdef EGL_MESA_drm_display |
{ "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA }, |
#endif |
{ "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR }, |
{ "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR }, |
{ "eglCreateSyncKHR", (_EGLProc) eglCreateSyncKHR }, |
{ "eglDestroySyncKHR", (_EGLProc) eglDestroySyncKHR }, |
{ "eglClientWaitSyncKHR", (_EGLProc) eglClientWaitSyncKHR }, |
{ "eglSignalSyncKHR", (_EGLProc) eglSignalSyncKHR }, |
{ "eglGetSyncAttribKHR", (_EGLProc) eglGetSyncAttribKHR }, |
#ifdef EGL_NOK_swap_region |
{ "eglSwapBuffersRegionNOK", (_EGLProc) eglSwapBuffersRegionNOK }, |
#endif |
#ifdef EGL_MESA_drm_image |
{ "eglCreateDRMImageMESA", (_EGLProc) eglCreateDRMImageMESA }, |
{ "eglExportDRMImageMESA", (_EGLProc) eglExportDRMImageMESA }, |
#endif |
#ifdef EGL_WL_bind_wayland_display |
{ "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL }, |
{ "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL }, |
{ "eglQueryWaylandBufferWL", (_EGLProc) eglQueryWaylandBufferWL }, |
#endif |
{ "eglPostSubBufferNV", (_EGLProc) eglPostSubBufferNV }, |
#ifdef EGL_EXT_swap_buffers_with_damage |
{ "eglSwapBuffersWithDamageEXT", (_EGLProc) eglSwapBuffersWithDamageEXT }, |
#endif |
{ NULL, NULL } |
}; |
EGLint i; |
_EGLProc ret; |
if (!procname) |
RETURN_EGL_SUCCESS(NULL, NULL); |
ret = NULL; |
if (strncmp(procname, "egl", 3) == 0) { |
for (i = 0; egl_functions[i].name; i++) { |
if (strcmp(egl_functions[i].name, procname) == 0) { |
ret = egl_functions[i].function; |
break; |
} |
} |
} |
if (!ret) |
ret = _eglGetDriverProc(procname); |
RETURN_EGL_SUCCESS(NULL, ret); |
} |
#ifdef EGL_MESA_screen_surface |
/* |
* EGL_MESA_screen extension |
*/ |
EGLBoolean EGLAPIENTRY |
eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, |
const EGLint *attrib_list, EGLModeMESA *modes, |
EGLint modes_size, EGLint *num_modes) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen(screen, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.ChooseModeMESA(drv, disp, scrn, attrib_list, |
modes, modes_size, num_modes); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, |
EGLint mode_size, EGLint *num_mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen(screen, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.GetModesMESA(drv, disp, scrn, modes, mode_size, num_mode); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLMode *m = _eglLookupMode(mode, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_MODE(disp, m, EGL_FALSE, drv); |
ret = drv->API.GetModeAttribMESA(drv, disp, m, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, |
EGLint mask) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *source_context = _eglLookupContext(source, disp); |
_EGLContext *dest_context = _eglLookupContext(dest, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_CONTEXT(disp, source_context, EGL_FALSE, drv); |
if (!dest_context) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE); |
ret = drv->API.CopyContextMESA(drv, disp, |
source_context, dest_context, mask); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, |
EGLint max_screens, EGLint *num_screens) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
ret = drv->API.GetScreensMESA(drv, disp, screens, max_screens, num_screens); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, |
const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
surf = drv->API.CreateScreenSurfaceMESA(drv, disp, conf, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, |
EGLSurface surface, EGLModeMESA mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLMode *m = _eglLookupMode(mode, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
if (!surf && surface != EGL_NO_SURFACE) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
if (!m && mode != EGL_NO_MODE_MESA) |
RETURN_EGL_ERROR(disp, EGL_BAD_MODE_MESA, EGL_FALSE); |
ret = drv->API.ShowScreenSurfaceMESA(drv, disp, scrn, surf, m); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen(screen, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.ScreenPositionMESA(drv, disp, scrn, x, y); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen(screen, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.QueryScreenMESA(drv, disp, scrn, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, |
EGLSurface *surface) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.QueryScreenSurfaceMESA(drv, disp, scrn, &surf); |
if (ret && surface) |
*surface = _eglGetSurfaceHandle(surf); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp); |
_EGLDriver *drv; |
_EGLMode *m; |
EGLBoolean ret; |
_EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv); |
ret = drv->API.QueryScreenModeMESA(drv, disp, scrn, &m); |
if (ret && mode) |
*mode = m->Handle; |
RETURN_EGL_EVAL(disp, ret); |
} |
const char * EGLAPIENTRY |
eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLMode *m = _eglLookupMode(mode, disp); |
_EGLDriver *drv; |
const char *ret; |
_EGL_CHECK_MODE(disp, m, NULL, drv); |
ret = drv->API.QueryModeStringMESA(drv, disp, m); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif /* EGL_MESA_screen_surface */ |
#ifdef EGL_MESA_drm_display |
EGLDisplay EGLAPIENTRY |
eglGetDRMDisplayMESA(int fd) |
{ |
_EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (intptr_t) fd); |
return _eglGetDisplayHandle(dpy); |
} |
#endif /* EGL_MESA_drm_display */ |
/** |
** EGL 1.2 |
**/ |
/** |
* Specify the client API to use for subsequent calls including: |
* eglCreateContext() |
* eglGetCurrentContext() |
* eglGetCurrentDisplay() |
* eglGetCurrentSurface() |
* eglMakeCurrent(when the ctx parameter is EGL NO CONTEXT) |
* eglWaitClient() |
* eglWaitNative() |
* See section 3.7 "Rendering Context" in the EGL specification for details. |
*/ |
EGLBoolean EGLAPIENTRY |
eglBindAPI(EGLenum api) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
if (_eglIsCurrentThreadDummy()) |
RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE); |
if (!_eglIsApiValid(api)) |
RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE); |
t->CurrentAPIIndex = _eglConvertApiToIndex(api); |
RETURN_EGL_SUCCESS(NULL, EGL_TRUE); |
} |
/** |
* Return the last value set with eglBindAPI(). |
*/ |
EGLenum EGLAPIENTRY |
eglQueryAPI(void) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
EGLenum ret; |
/* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */ |
ret = _eglConvertApiFromIndex(t->CurrentAPIIndex); |
RETURN_EGL_SUCCESS(NULL, ret); |
} |
EGLSurface EGLAPIENTRY |
eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, |
EGLClientBuffer buffer, EGLConfig config, |
const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLConfig *conf = _eglLookupConfig(config, disp); |
_EGLDriver *drv; |
_EGLSurface *surf; |
EGLSurface ret; |
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); |
surf = drv->API.CreatePbufferFromClientBuffer(drv, disp, buftype, buffer, |
conf, attrib_list); |
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglReleaseThread(void) |
{ |
/* unbind current contexts */ |
if (!_eglIsCurrentThreadDummy()) { |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
EGLint api_index = t->CurrentAPIIndex; |
EGLint i; |
for (i = 0; i < _EGL_API_NUM_APIS; i++) { |
_EGLContext *ctx = t->CurrentContexts[i]; |
if (ctx) { |
_EGLDisplay *disp = ctx->Resource.Display; |
_EGLDriver *drv; |
t->CurrentAPIIndex = i; |
_eglLockMutex(&disp->Mutex); |
drv = disp->Driver; |
(void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); |
_eglUnlockMutex(&disp->Mutex); |
} |
} |
t->CurrentAPIIndex = api_index; |
} |
_eglDestroyCurrentThread(); |
RETURN_EGL_SUCCESS(NULL, EGL_TRUE); |
} |
EGLImageKHR EGLAPIENTRY |
eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, |
EGLClientBuffer buffer, const EGLint *attr_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLContext *context = _eglLookupContext(ctx, disp); |
_EGLDriver *drv; |
_EGLImage *img; |
EGLImageKHR ret; |
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv); |
if (!disp->Extensions.KHR_image_base) |
RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR); |
if (!context && ctx != EGL_NO_CONTEXT) |
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR); |
img = drv->API.CreateImageKHR(drv, |
disp, context, target, buffer, attr_list); |
ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLImage *img = _eglLookupImage(image, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
if (!disp->Extensions.KHR_image_base) |
RETURN_EGL_EVAL(disp, EGL_FALSE); |
if (!img) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
_eglUnlinkImage(img); |
ret = drv->API.DestroyImageKHR(drv, disp, img); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLSyncKHR EGLAPIENTRY |
eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
_EGLSync *sync; |
EGLSyncKHR ret; |
_EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv); |
if (!disp->Extensions.KHR_reusable_sync) |
RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR); |
sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list); |
ret = (sync) ? _eglLinkSync(sync) : EGL_NO_SYNC_KHR; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSync *s = _eglLookupSync(sync, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); |
assert(disp->Extensions.KHR_reusable_sync); |
_eglUnlinkSync(s); |
ret = drv->API.DestroySyncKHR(drv, disp, s); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLint EGLAPIENTRY |
eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSync *s = _eglLookupSync(sync, disp); |
_EGLDriver *drv; |
EGLint ret; |
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); |
assert(disp->Extensions.KHR_reusable_sync); |
ret = drv->API.ClientWaitSyncKHR(drv, disp, s, flags, timeout); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSync *s = _eglLookupSync(sync, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); |
assert(disp->Extensions.KHR_reusable_sync); |
ret = drv->API.SignalSyncKHR(drv, disp, s, mode); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSync *s = _eglLookupSync(sync, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); |
assert(disp->Extensions.KHR_reusable_sync); |
ret = drv->API.GetSyncAttribKHR(drv, disp, s, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
#ifdef EGL_NOK_swap_region |
EGLBoolean EGLAPIENTRY |
eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, |
EGLint numRects, const EGLint *rects) |
{ |
_EGLContext *ctx = _eglGetCurrentContext(); |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
if (!disp->Extensions.NOK_swap_region) |
RETURN_EGL_EVAL(disp, EGL_FALSE); |
/* surface must be bound to current context in EGL 1.4 */ |
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT || |
surf != ctx->DrawSurface) |
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); |
ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif /* EGL_NOK_swap_region */ |
#ifdef EGL_MESA_drm_image |
EGLImageKHR EGLAPIENTRY |
eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
_EGLImage *img; |
EGLImageKHR ret; |
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv); |
if (!disp->Extensions.MESA_drm_image) |
RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR); |
img = drv->API.CreateDRMImageMESA(drv, disp, attr_list); |
ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR; |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image, |
EGLint *name, EGLint *handle, EGLint *stride) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLImage *img = _eglLookupImage(image, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
assert(disp->Extensions.MESA_drm_image); |
if (!img) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.ExportDRMImageMESA(drv, disp, img, name, handle, stride); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif |
#ifdef EGL_WL_bind_wayland_display |
struct wl_display; |
EGLBoolean EGLAPIENTRY |
eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
assert(disp->Extensions.WL_bind_wayland_display); |
if (!display) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.BindWaylandDisplayWL(drv, disp, display); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
assert(disp->Extensions.WL_bind_wayland_display); |
if (!display) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.UnbindWaylandDisplayWL(drv, disp, display); |
RETURN_EGL_EVAL(disp, ret); |
} |
EGLBoolean EGLAPIENTRY |
eglQueryWaylandBufferWL(EGLDisplay dpy,struct wl_buffer *buffer, |
EGLint attribute, EGLint *value) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); |
assert(disp->Extensions.WL_bind_wayland_display); |
if (!buffer) |
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); |
ret = drv->API.QueryWaylandBufferWL(drv, disp, buffer, attribute, value); |
RETURN_EGL_EVAL(disp, ret); |
} |
#endif |
EGLBoolean EGLAPIENTRY |
eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, |
EGLint x, EGLint y, EGLint width, EGLint height) |
{ |
_EGLDisplay *disp = _eglLockDisplay(dpy); |
_EGLSurface *surf = _eglLookupSurface(surface, disp); |
_EGLDriver *drv; |
EGLBoolean ret; |
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); |
if (!disp->Extensions.NV_post_sub_buffer) |
RETURN_EGL_EVAL(disp, EGL_FALSE); |
ret = drv->API.PostSubBufferNV(drv, disp, surf, x, y, width, height); |
RETURN_EGL_EVAL(disp, ret); |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglapi.h |
---|
0,0 → 1,222 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLAPI_INCLUDED |
#define EGLAPI_INCLUDED |
/** |
* A generic function ptr type |
*/ |
typedef void (*_EGLProc)(void); |
/** |
* Typedefs for all EGL API entrypoint functions. |
*/ |
/* driver funcs */ |
typedef EGLBoolean (*Initialize_t)(_EGLDriver *, _EGLDisplay *dpy); |
typedef EGLBoolean (*Terminate_t)(_EGLDriver *, _EGLDisplay *dpy); |
/* config funcs */ |
typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); |
typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); |
typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLint attribute, EGLint *value); |
/* context funcs */ |
typedef _EGLContext *(*CreateContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, _EGLContext *share_list, const EGLint *attrib_list); |
typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx); |
/* this is the only function (other than Initialize) that may be called with an uninitialized display */ |
typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx); |
typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value); |
/* surface funcs */ |
typedef _EGLSurface *(*CreateWindowSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativeWindowType window, const EGLint *attrib_list); |
typedef _EGLSurface *(*CreatePixmapSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativePixmapType pixmap, const EGLint *attrib_list); |
typedef _EGLSurface *(*CreatePbufferSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list); |
typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface); |
typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint *value); |
typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint value); |
typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer); |
typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer); |
typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval); |
typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw); |
typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLNativePixmapType target); |
/* misc funcs */ |
typedef const char *(*QueryString_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name); |
typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx); |
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine); |
/* this function may be called from multiple threads at the same time */ |
typedef _EGLProc (*GetProcAddress_t)(_EGLDriver *drv, const char *procname); |
#ifdef EGL_MESA_screen_surface |
typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); |
typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode); |
typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *mode, EGLint attribute, EGLint *value); |
typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *source, _EGLContext *dest, EGLint mask); |
typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); |
typedef _EGLSurface *(*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list); |
typedef EGLBoolean (*ShowScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface *surface, _EGLMode *mode); |
typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLint x, EGLint y); |
typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLint attribute, EGLint *value); |
typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface **surface); |
typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLMode **mode); |
typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *mode); |
#endif /* EGL_MESA_screen_surface */ |
typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum buftype, EGLClientBuffer buffer, _EGLConfig *config, const EGLint *attrib_list); |
typedef _EGLImage *(*CreateImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list); |
typedef EGLBoolean (*DestroyImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image); |
typedef _EGLSync *(*CreateSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum type, const EGLint *attrib_list); |
typedef EGLBoolean (*DestroySyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync); |
typedef EGLint (*ClientWaitSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint flags, EGLTimeKHR timeout); |
typedef EGLBoolean (*SignalSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLenum mode); |
typedef EGLBoolean (*GetSyncAttribKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint attribute, EGLint *value); |
#ifdef EGL_NOK_swap_region |
typedef EGLBoolean (*SwapBuffersRegionNOK_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint numRects, const EGLint *rects); |
#endif |
#ifdef EGL_MESA_drm_image |
typedef _EGLImage *(*CreateDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attr_list); |
typedef EGLBoolean (*ExportDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *name, EGLint *handle, EGLint *stride); |
#endif |
#ifdef EGL_WL_bind_wayland_display |
struct wl_display; |
typedef EGLBoolean (*BindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display); |
typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display); |
typedef EGLBoolean (*QueryWaylandBufferWL_t)(_EGLDriver *drv, _EGLDisplay *displ, struct wl_buffer *buffer, EGLint attribute, EGLint *value); |
#endif |
typedef EGLBoolean (*PostSubBufferNV_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surface, EGLint x, EGLint y, EGLint width, EGLint height); |
typedef EGLint (*QueryBufferAge_t)(_EGLDriver *drv, |
_EGLDisplay *dpy, _EGLSurface *surface); |
#ifdef EGL_EXT_swap_buffers_with_damage |
typedef EGLBoolean (*SwapBuffersWithDamageEXT_t) (_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, const EGLint *rects, EGLint n_rects); |
#endif |
/** |
* The API dispatcher jumps through these functions |
*/ |
struct _egl_api |
{ |
Initialize_t Initialize; |
Terminate_t Terminate; |
GetConfigs_t GetConfigs; |
ChooseConfig_t ChooseConfig; |
GetConfigAttrib_t GetConfigAttrib; |
CreateContext_t CreateContext; |
DestroyContext_t DestroyContext; |
MakeCurrent_t MakeCurrent; |
QueryContext_t QueryContext; |
CreateWindowSurface_t CreateWindowSurface; |
CreatePixmapSurface_t CreatePixmapSurface; |
CreatePbufferSurface_t CreatePbufferSurface; |
DestroySurface_t DestroySurface; |
QuerySurface_t QuerySurface; |
SurfaceAttrib_t SurfaceAttrib; |
BindTexImage_t BindTexImage; |
ReleaseTexImage_t ReleaseTexImage; |
SwapInterval_t SwapInterval; |
SwapBuffers_t SwapBuffers; |
CopyBuffers_t CopyBuffers; |
QueryString_t QueryString; |
WaitClient_t WaitClient; |
WaitNative_t WaitNative; |
GetProcAddress_t GetProcAddress; |
#ifdef EGL_MESA_screen_surface |
ChooseModeMESA_t ChooseModeMESA; |
GetModesMESA_t GetModesMESA; |
GetModeAttribMESA_t GetModeAttribMESA; |
CopyContextMESA_t CopyContextMESA; |
GetScreensMESA_t GetScreensMESA; |
CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA; |
ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA; |
ScreenPositionMESA_t ScreenPositionMESA; |
QueryScreenMESA_t QueryScreenMESA; |
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA; |
QueryScreenModeMESA_t QueryScreenModeMESA; |
QueryModeStringMESA_t QueryModeStringMESA; |
#endif /* EGL_MESA_screen_surface */ |
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer; |
CreateImageKHR_t CreateImageKHR; |
DestroyImageKHR_t DestroyImageKHR; |
CreateSyncKHR_t CreateSyncKHR; |
DestroySyncKHR_t DestroySyncKHR; |
ClientWaitSyncKHR_t ClientWaitSyncKHR; |
SignalSyncKHR_t SignalSyncKHR; |
GetSyncAttribKHR_t GetSyncAttribKHR; |
#ifdef EGL_NOK_swap_region |
SwapBuffersRegionNOK_t SwapBuffersRegionNOK; |
#endif |
#ifdef EGL_MESA_drm_image |
CreateDRMImageMESA_t CreateDRMImageMESA; |
ExportDRMImageMESA_t ExportDRMImageMESA; |
#endif |
#ifdef EGL_WL_bind_wayland_display |
BindWaylandDisplayWL_t BindWaylandDisplayWL; |
UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL; |
QueryWaylandBufferWL_t QueryWaylandBufferWL; |
#endif |
#ifdef EGL_EXT_swap_buffers_with_damage |
SwapBuffersWithDamageEXT_t SwapBuffersWithDamageEXT; |
#endif /* EGL_EXT_swap_buffers_with_damage */ |
PostSubBufferNV_t PostSubBufferNV; |
QueryBufferAge_t QueryBufferAge; |
}; |
#endif /* EGLAPI_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglarray.c |
---|
0,0 → 1,209 |
/************************************************************************** |
* |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#include <stdlib.h> |
#include <string.h> |
#include "egllog.h" |
#include "eglarray.h" |
/** |
* Grow the size of the array. |
*/ |
static EGLBoolean |
_eglGrowArray(_EGLArray *array) |
{ |
EGLint new_size; |
void **elems; |
new_size = array->MaxSize; |
while (new_size <= array->Size) |
new_size *= 2; |
elems = realloc(array->Elements, new_size * sizeof(array->Elements[0])); |
if (!elems) { |
_eglLog(_EGL_DEBUG, "failed to grow %s array to %d", |
array->Name, new_size); |
return EGL_FALSE; |
} |
array->Elements = elems; |
array->MaxSize = new_size; |
return EGL_TRUE; |
} |
/** |
* Create an array. |
*/ |
_EGLArray * |
_eglCreateArray(const char *name, EGLint init_size) |
{ |
_EGLArray *array; |
array = calloc(1, sizeof(*array)); |
if (array) { |
array->Name = name; |
array->MaxSize = (init_size > 0) ? init_size : 1; |
if (!_eglGrowArray(array)) { |
free(array); |
array = NULL; |
} |
} |
return array; |
} |
/** |
* Destroy an array, optionally free the data. |
*/ |
void |
_eglDestroyArray(_EGLArray *array, void (*free_cb)(void *)) |
{ |
if (free_cb) { |
EGLint i; |
for (i = 0; i < array->Size; i++) |
free_cb(array->Elements[i]); |
} |
free(array->Elements); |
free(array); |
} |
/** |
* Append a element to an array. |
*/ |
void |
_eglAppendArray(_EGLArray *array, void *elem) |
{ |
if (array->Size >= array->MaxSize && !_eglGrowArray(array)) |
return; |
array->Elements[array->Size++] = elem; |
} |
/** |
* Erase an element from an array. |
*/ |
void |
_eglEraseArray(_EGLArray *array, EGLint i, void (*free_cb)(void *)) |
{ |
if (free_cb) |
free_cb(array->Elements[i]); |
if (i < array->Size - 1) { |
memmove(&array->Elements[i], &array->Elements[i + 1], |
(array->Size - i - 1) * sizeof(array->Elements[0])); |
} |
array->Size--; |
} |
/** |
* Find in an array for the given element. |
*/ |
void * |
_eglFindArray(_EGLArray *array, void *elem) |
{ |
EGLint i; |
if (!array) |
return NULL; |
for (i = 0; i < array->Size; i++) |
if (array->Elements[i] == elem) |
return elem; |
return NULL; |
} |
/** |
* Filter an array and return the number of filtered elements. |
*/ |
EGLint |
_eglFilterArray(_EGLArray *array, void **data, EGLint size, |
_EGLArrayForEach filter, void *filter_data) |
{ |
EGLint count = 0, i; |
if (!array) |
return 0; |
if (filter) { |
for (i = 0; i < array->Size; i++) { |
if (filter(array->Elements[i], filter_data)) { |
if (data && count < size) |
data[count] = array->Elements[i]; |
count++; |
} |
if (data && count >= size) |
break; |
} |
} |
else { |
if (data) { |
count = (size < array->Size) ? size : array->Size; |
memcpy(data, array->Elements, count * sizeof(array->Elements[0])); |
} |
else { |
count = array->Size; |
} |
} |
return count; |
} |
/** |
* Flatten an array by converting array elements into another form and store |
* them in a buffer. |
*/ |
EGLint |
_eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size, |
_EGLArrayForEach flatten) |
{ |
EGLint i, count; |
if (!array) |
return 0; |
count = array->Size; |
if (buffer) { |
/* do not exceed buffer size */ |
if (count > size) |
count = size; |
for (i = 0; i < count; i++) |
flatten(array->Elements[i], |
(void *) ((char *) buffer + elem_size * i)); |
} |
return count; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglarray.c.bak |
---|
0,0 → 1,213 |
/************************************************************************** |
* |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#include <stdlib.h> |
#include <string.h> |
#define EGL_EGLEXT_PROTOTYPES |
#include <EGL/egl.h> |
#include <EGL/eglext.h> |
#include "egllog.h" |
#include "eglarray.h" |
/** |
* Grow the size of the array. |
*/ |
static EGLBoolean |
_eglGrowArray(_EGLArray *array) |
{ |
EGLint new_size; |
void **elems; |
new_size = array->MaxSize; |
while (new_size <= array->Size) |
new_size *= 2; |
elems = realloc(array->Elements, new_size * sizeof(array->Elements[0])); |
if (!elems) { |
_eglLog(_EGL_DEBUG, "failed to grow %s array to %d", |
array->Name, new_size); |
return EGL_FALSE; |
} |
array->Elements = elems; |
array->MaxSize = new_size; |
return EGL_TRUE; |
} |
/** |
* Create an array. |
*/ |
_EGLArray * |
_eglCreateArray(const char *name, EGLint init_size) |
{ |
_EGLArray *array; |
array = calloc(1, sizeof(*array)); |
if (array) { |
array->Name = name; |
array->MaxSize = (init_size > 0) ? init_size : 1; |
if (!_eglGrowArray(array)) { |
free(array); |
array = NULL; |
} |
} |
return array; |
} |
/** |
* Destroy an array, optionally free the data. |
*/ |
void |
_eglDestroyArray(_EGLArray *array, void (*free_cb)(void *)) |
{ |
if (free_cb) { |
EGLint i; |
for (i = 0; i < array->Size; i++) |
free_cb(array->Elements[i]); |
} |
free(array->Elements); |
free(array); |
} |
/** |
* Append a element to an array. |
*/ |
void |
_eglAppendArray(_EGLArray *array, void *elem) |
{ |
if (array->Size >= array->MaxSize && !_eglGrowArray(array)) |
return; |
array->Elements[array->Size++] = elem; |
} |
/** |
* Erase an element from an array. |
*/ |
void |
_eglEraseArray(_EGLArray *array, EGLint i, void (*free_cb)(void *)) |
{ |
if (free_cb) |
free_cb(array->Elements[i]); |
if (i < array->Size - 1) { |
memmove(&array->Elements[i], &array->Elements[i + 1], |
(array->Size - i - 1) * sizeof(array->Elements[0])); |
} |
array->Size--; |
} |
/** |
* Find in an array for the given element. |
*/ |
void * |
_eglFindArray(_EGLArray *array, void *elem) |
{ |
EGLint i; |
if (!array) |
return NULL; |
for (i = 0; i < array->Size; i++) |
if (array->Elements[i] == elem) |
return elem; |
return NULL; |
} |
/** |
* Filter an array and return the number of filtered elements. |
*/ |
EGLint |
_eglFilterArray(_EGLArray *array, void **data, EGLint size, |
_EGLArrayForEach filter, void *filter_data) |
{ |
EGLint count = 0, i; |
if (!array) |
return 0; |
if (filter) { |
for (i = 0; i < array->Size; i++) { |
if (filter(array->Elements[i], filter_data)) { |
if (data && count < size) |
data[count] = array->Elements[i]; |
count++; |
} |
if (data && count >= size) |
break; |
} |
} |
else { |
if (data) { |
count = (size < array->Size) ? size : array->Size; |
memcpy(data, array->Elements, count * sizeof(array->Elements[0])); |
} |
else { |
count = array->Size; |
} |
} |
return count; |
} |
/** |
* Flatten an array by converting array elements into another form and store |
* them in a buffer. |
*/ |
EGLint |
_eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size, |
_EGLArrayForEach flatten) |
{ |
EGLint i, count; |
if (!array) |
return 0; |
count = array->Size; |
if (buffer) { |
/* do not exceed buffer size */ |
if (count > size) |
count = size; |
for (i = 0; i < count; i++) |
flatten(array->Elements[i], |
(void *) ((char *) buffer + elem_size * i)); |
} |
return count; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglarray.h |
---|
0,0 → 1,85 |
/************************************************************************** |
* |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#ifndef EGLARRAY_INCLUDED |
#define EGLARRAY_INCLUDED |
#include "egltypedefs.h" |
typedef EGLBoolean (*_EGLArrayForEach)(void *elem, void *foreach_data); |
struct _egl_array { |
const char *Name; |
EGLint MaxSize; |
void **Elements; |
EGLint Size; |
}; |
extern _EGLArray * |
_eglCreateArray(const char *name, EGLint init_size); |
PUBLIC void |
_eglDestroyArray(_EGLArray *array, void (*free_cb)(void *)); |
extern void |
_eglAppendArray(_EGLArray *array, void *elem); |
extern void |
_eglEraseArray(_EGLArray *array, EGLint i, void (*free_cb)(void *)); |
void * |
_eglFindArray(_EGLArray *array, void *elem); |
PUBLIC EGLint |
_eglFilterArray(_EGLArray *array, void **data, EGLint size, |
_EGLArrayForEach filter, void *filter_data); |
EGLint |
_eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size, |
_EGLArrayForEach flatten); |
static INLINE EGLint |
_eglGetArraySize(_EGLArray *array) |
{ |
return (array) ? array->Size : 0; |
} |
#endif /* EGLARRAY_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglcompiler.h |
---|
0,0 → 1,92 |
/************************************************************************** |
* |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#ifndef EGLCOMPILER_INCLUDED |
#define EGLCOMPILER_INCLUDED |
#include "c99_compat.h" /* inline, __func__, etc. */ |
/** |
* Get standard integer types |
*/ |
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) |
# include <stdint.h> |
#elif defined(_MSC_VER) |
typedef __int8 int8_t; |
typedef unsigned __int8 uint8_t; |
typedef __int16 int16_t; |
typedef unsigned __int16 uint16_t; |
typedef __int32 int32_t; |
typedef unsigned __int32 uint32_t; |
typedef __int64 int64_t; |
typedef unsigned __int64 uint64_t; |
# if defined(_WIN64) |
typedef __int64 intptr_t; |
typedef unsigned __int64 uintptr_t; |
# else |
typedef __int32 intptr_t; |
typedef unsigned __int32 uintptr_t; |
# endif |
# define INT64_C(__val) __val##i64 |
# define UINT64_C(__val) __val##ui64 |
#else |
/* hope the best instead of adding a bunch of ifdef's */ |
# include <stdint.h> |
#endif |
/* XXX: Use standard `inline` keyword instead */ |
#ifndef INLINE |
# define INLINE inline |
#endif |
/** |
* Function visibility |
*/ |
#ifndef PUBLIC |
# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) |
# define PUBLIC __attribute__((visibility("default"))) |
# elif defined(_MSC_VER) |
# define PUBLIC __declspec(dllexport) |
# else |
# define PUBLIC |
# endif |
#endif |
/* XXX: Use standard `__func__` instead */ |
#ifndef __FUNCTION__ |
# define __FUNCTION__ __func__ |
#endif |
#endif /* EGLCOMPILER_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglconfig.c |
---|
0,0 → 1,842 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* EGL Configuration (pixel format) functions. |
*/ |
#include <stdlib.h> |
#include <string.h> |
#include <assert.h> |
#include "eglconfig.h" |
#include "egldisplay.h" |
#include "eglcurrent.h" |
#include "egllog.h" |
#define MIN2(A, B) (((A) < (B)) ? (A) : (B)) |
/** |
* Init the given _EGLconfig to default values. |
* \param id the configuration's ID. |
* |
* Note that id must be positive for the config to be valid. |
* It is also recommended that when there are N configs, their |
* IDs are from 1 to N respectively. |
*/ |
void |
_eglInitConfig(_EGLConfig *conf, _EGLDisplay *dpy, EGLint id) |
{ |
memset(conf, 0, sizeof(*conf)); |
conf->Display = dpy; |
/* some attributes take non-zero default values */ |
conf->ConfigID = id; |
conf->ConfigCaveat = EGL_NONE; |
conf->TransparentType = EGL_NONE; |
conf->NativeVisualType = EGL_NONE; |
conf->ColorBufferType = EGL_RGB_BUFFER; |
} |
/** |
* Link a config to its display and return the handle of the link. |
* The handle can be passed to client directly. |
* |
* Note that we just save the ptr to the config (we don't copy the config). |
*/ |
PUBLIC EGLConfig |
_eglLinkConfig(_EGLConfig *conf) |
{ |
_EGLDisplay *dpy = conf->Display; |
/* sanity check */ |
assert(dpy && conf->ConfigID > 0); |
if (!dpy->Configs) { |
dpy->Configs = _eglCreateArray("Config", 16); |
if (!dpy->Configs) |
return (EGLConfig) NULL; |
} |
_eglAppendArray(dpy->Configs, (void *) conf); |
return (EGLConfig) conf; |
} |
/** |
* Lookup a handle to find the linked config. |
* Return NULL if the handle has no corresponding linked config. |
*/ |
_EGLConfig * |
_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy) |
{ |
_EGLConfig *conf; |
if (!dpy) |
return NULL; |
conf = (_EGLConfig *) _eglFindArray(dpy->Configs, (void *) config); |
if (conf) |
assert(conf->Display == dpy); |
return conf; |
} |
enum { |
/* types */ |
ATTRIB_TYPE_INTEGER, |
ATTRIB_TYPE_BOOLEAN, |
ATTRIB_TYPE_BITMASK, |
ATTRIB_TYPE_ENUM, |
ATTRIB_TYPE_PSEUDO, /* non-queryable */ |
ATTRIB_TYPE_PLATFORM, /* platform-dependent */ |
/* criteria */ |
ATTRIB_CRITERION_EXACT, |
ATTRIB_CRITERION_ATLEAST, |
ATTRIB_CRITERION_MASK, |
ATTRIB_CRITERION_SPECIAL, |
ATTRIB_CRITERION_IGNORE |
}; |
/* EGL spec Table 3.1 and 3.4 */ |
static const struct { |
EGLint attr; |
EGLint type; |
EGLint criterion; |
EGLint default_value; |
} _eglValidationTable[] = |
{ |
/* core */ |
{ EGL_BUFFER_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_RED_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_GREEN_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_BLUE_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_LUMINANCE_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_ALPHA_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_ALPHA_MASK_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_BIND_TO_TEXTURE_RGB, ATTRIB_TYPE_BOOLEAN, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_BIND_TO_TEXTURE_RGBA, ATTRIB_TYPE_BOOLEAN, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_COLOR_BUFFER_TYPE, ATTRIB_TYPE_ENUM, |
ATTRIB_CRITERION_EXACT, |
EGL_RGB_BUFFER }, |
{ EGL_CONFIG_CAVEAT, ATTRIB_TYPE_ENUM, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_CONFIG_ID, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_CONFORMANT, ATTRIB_TYPE_BITMASK, |
ATTRIB_CRITERION_MASK, |
0 }, |
{ EGL_DEPTH_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_LEVEL, ATTRIB_TYPE_PLATFORM, |
ATTRIB_CRITERION_EXACT, |
0 }, |
{ EGL_MAX_PBUFFER_WIDTH, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_IGNORE, |
0 }, |
{ EGL_MAX_PBUFFER_HEIGHT, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_IGNORE, |
0 }, |
{ EGL_MAX_PBUFFER_PIXELS, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_IGNORE, |
0 }, |
{ EGL_MAX_SWAP_INTERVAL, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_MIN_SWAP_INTERVAL, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_NATIVE_RENDERABLE, ATTRIB_TYPE_BOOLEAN, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_NATIVE_VISUAL_ID, ATTRIB_TYPE_PLATFORM, |
ATTRIB_CRITERION_IGNORE, |
0 }, |
{ EGL_NATIVE_VISUAL_TYPE, ATTRIB_TYPE_PLATFORM, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_RENDERABLE_TYPE, ATTRIB_TYPE_BITMASK, |
ATTRIB_CRITERION_MASK, |
EGL_OPENGL_ES_BIT }, |
{ EGL_SAMPLE_BUFFERS, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_SAMPLES, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_STENCIL_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_SURFACE_TYPE, ATTRIB_TYPE_BITMASK, |
ATTRIB_CRITERION_MASK, |
EGL_WINDOW_BIT }, |
{ EGL_TRANSPARENT_TYPE, ATTRIB_TYPE_ENUM, |
ATTRIB_CRITERION_EXACT, |
EGL_NONE }, |
{ EGL_TRANSPARENT_RED_VALUE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_TRANSPARENT_GREEN_VALUE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_TRANSPARENT_BLUE_VALUE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_MATCH_NATIVE_PIXMAP, ATTRIB_TYPE_PSEUDO, |
ATTRIB_CRITERION_SPECIAL, |
EGL_NONE }, |
/* extensions */ |
{ EGL_Y_INVERTED_NOK, ATTRIB_TYPE_BOOLEAN, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE } |
}; |
/** |
* Return true if a config is valid. When for_matching is true, |
* EGL_DONT_CARE is accepted as a valid attribute value, and checks |
* for conflicting attribute values are skipped. |
* |
* Note that some attributes are platform-dependent and are not |
* checked. |
*/ |
EGLBoolean |
_eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching) |
{ |
EGLint i, attr, val; |
EGLBoolean valid = EGL_TRUE; |
/* check attributes by their types */ |
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { |
EGLint mask; |
attr = _eglValidationTable[i].attr; |
val = _eglGetConfigKey(conf, attr); |
switch (_eglValidationTable[i].type) { |
case ATTRIB_TYPE_INTEGER: |
switch (attr) { |
case EGL_CONFIG_ID: |
/* config id must be positive */ |
if (val <= 0) |
valid = EGL_FALSE; |
break; |
case EGL_SAMPLE_BUFFERS: |
/* there can be at most 1 sample buffer */ |
if (val > 1 || val < 0) |
valid = EGL_FALSE; |
break; |
default: |
if (val < 0) |
valid = EGL_FALSE; |
break; |
} |
break; |
case ATTRIB_TYPE_BOOLEAN: |
if (val != EGL_TRUE && val != EGL_FALSE) |
valid = EGL_FALSE; |
break; |
case ATTRIB_TYPE_ENUM: |
switch (attr) { |
case EGL_CONFIG_CAVEAT: |
if (val != EGL_NONE && val != EGL_SLOW_CONFIG && |
val != EGL_NON_CONFORMANT_CONFIG) |
valid = EGL_FALSE; |
break; |
case EGL_TRANSPARENT_TYPE: |
if (val != EGL_NONE && val != EGL_TRANSPARENT_RGB) |
valid = EGL_FALSE; |
break; |
case EGL_COLOR_BUFFER_TYPE: |
if (val != EGL_RGB_BUFFER && val != EGL_LUMINANCE_BUFFER) |
valid = EGL_FALSE; |
break; |
default: |
assert(0); |
break; |
} |
break; |
case ATTRIB_TYPE_BITMASK: |
switch (attr) { |
case EGL_SURFACE_TYPE: |
mask = EGL_PBUFFER_BIT | |
EGL_PIXMAP_BIT | |
EGL_WINDOW_BIT | |
EGL_VG_COLORSPACE_LINEAR_BIT | |
EGL_VG_ALPHA_FORMAT_PRE_BIT | |
EGL_MULTISAMPLE_RESOLVE_BOX_BIT | |
EGL_SWAP_BEHAVIOR_PRESERVED_BIT; |
#ifdef EGL_MESA_screen_surface |
if (conf->Display->Extensions.MESA_screen_surface) |
mask |= EGL_SCREEN_BIT_MESA; |
#endif |
break; |
case EGL_RENDERABLE_TYPE: |
case EGL_CONFORMANT: |
mask = EGL_OPENGL_ES_BIT | |
EGL_OPENVG_BIT | |
EGL_OPENGL_ES2_BIT | |
EGL_OPENGL_ES3_BIT_KHR | |
EGL_OPENGL_BIT; |
break; |
default: |
assert(0); |
mask = 0; |
break; |
} |
if (val & ~mask) |
valid = EGL_FALSE; |
break; |
case ATTRIB_TYPE_PLATFORM: |
/* unable to check platform-dependent attributes here */ |
break; |
case ATTRIB_TYPE_PSEUDO: |
/* pseudo attributes should not be set */ |
if (val != 0) |
valid = EGL_FALSE; |
break; |
default: |
assert(0); |
break; |
} |
if (!valid && for_matching) { |
/* accept EGL_DONT_CARE as a valid value */ |
if (val == EGL_DONT_CARE) |
valid = EGL_TRUE; |
if (_eglValidationTable[i].criterion == ATTRIB_CRITERION_SPECIAL) |
valid = EGL_TRUE; |
} |
if (!valid) { |
_eglLog(_EGL_DEBUG, |
"attribute 0x%04x has an invalid value 0x%x", attr, val); |
break; |
} |
} |
/* any invalid attribute value should have been catched */ |
if (!valid || for_matching) |
return valid; |
/* now check for conflicting attribute values */ |
switch (conf->ColorBufferType) { |
case EGL_RGB_BUFFER: |
if (conf->LuminanceSize) |
valid = EGL_FALSE; |
if (conf->RedSize + conf->GreenSize + |
conf->BlueSize + conf->AlphaSize != conf->BufferSize) |
valid = EGL_FALSE; |
break; |
case EGL_LUMINANCE_BUFFER: |
if (conf->RedSize || conf->GreenSize || conf->BlueSize) |
valid = EGL_FALSE; |
if (conf->LuminanceSize + conf->AlphaSize != conf->BufferSize) |
valid = EGL_FALSE; |
break; |
} |
if (!valid) { |
_eglLog(_EGL_DEBUG, "conflicting color buffer type and channel sizes"); |
return EGL_FALSE; |
} |
if (!conf->SampleBuffers && conf->Samples) |
valid = EGL_FALSE; |
if (!valid) { |
_eglLog(_EGL_DEBUG, "conflicting samples and sample buffers"); |
return EGL_FALSE; |
} |
if (!(conf->SurfaceType & EGL_WINDOW_BIT)) { |
if (conf->NativeVisualID != 0 || conf->NativeVisualType != EGL_NONE) |
valid = EGL_FALSE; |
} |
if (!(conf->SurfaceType & EGL_PBUFFER_BIT)) { |
if (conf->BindToTextureRGB || conf->BindToTextureRGBA) |
valid = EGL_FALSE; |
} |
if (!valid) { |
_eglLog(_EGL_DEBUG, "conflicting surface type and native visual/texture binding"); |
return EGL_FALSE; |
} |
return valid; |
} |
/** |
* Return true if a config matches the criteria. This and |
* _eglParseConfigAttribList together implement the algorithm |
* described in "Selection of EGLConfigs". |
* |
* Note that attributes that are special (currently, only |
* EGL_MATCH_NATIVE_PIXMAP) are ignored. |
*/ |
EGLBoolean |
_eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria) |
{ |
EGLint attr, val, i; |
EGLBoolean matched = EGL_TRUE; |
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { |
EGLint cmp; |
if (_eglValidationTable[i].criterion == ATTRIB_CRITERION_IGNORE) |
continue; |
attr = _eglValidationTable[i].attr; |
cmp = _eglGetConfigKey(criteria, attr); |
if (cmp == EGL_DONT_CARE) |
continue; |
val = _eglGetConfigKey(conf, attr); |
switch (_eglValidationTable[i].criterion) { |
case ATTRIB_CRITERION_EXACT: |
if (val != cmp) |
matched = EGL_FALSE; |
break; |
case ATTRIB_CRITERION_ATLEAST: |
if (val < cmp) |
matched = EGL_FALSE; |
break; |
case ATTRIB_CRITERION_MASK: |
if ((val & cmp) != cmp) |
matched = EGL_FALSE; |
break; |
case ATTRIB_CRITERION_SPECIAL: |
/* ignored here */ |
break; |
default: |
assert(0); |
break; |
} |
if (!matched) { |
#ifndef DEBUG |
/* only print the common errors when DEBUG is not defined */ |
if (attr != EGL_RENDERABLE_TYPE) |
break; |
#endif |
_eglLog(_EGL_DEBUG, |
"the value (0x%x) of attribute 0x%04x did not meet the criteria (0x%x)", |
val, attr, cmp); |
break; |
} |
} |
return matched; |
} |
static INLINE EGLBoolean |
_eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr) |
{ |
if (_eglOffsetOfConfig(attr) < 0) |
return EGL_FALSE; |
switch (attr) { |
case EGL_Y_INVERTED_NOK: |
return conf->Display->Extensions.NOK_texture_from_pixmap; |
default: |
break; |
} |
return EGL_TRUE; |
} |
/** |
* Initialize a criteria config from the given attribute list. |
* Return EGL_FALSE if any of the attribute is invalid. |
*/ |
EGLBoolean |
_eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy, |
const EGLint *attrib_list) |
{ |
EGLint attr, val, i; |
_eglInitConfig(conf, dpy, EGL_DONT_CARE); |
/* reset to default values */ |
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { |
attr = _eglValidationTable[i].attr; |
val = _eglValidationTable[i].default_value; |
_eglSetConfigKey(conf, attr, val); |
} |
/* parse the list */ |
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i += 2) { |
attr = attrib_list[i]; |
val = attrib_list[i + 1]; |
if (!_eglIsConfigAttribValid(conf, attr)) |
return EGL_FALSE; |
_eglSetConfigKey(conf, attr, val); |
} |
if (!_eglValidateConfig(conf, EGL_TRUE)) |
return EGL_FALSE; |
/* EGL_LEVEL and EGL_MATCH_NATIVE_PIXMAP cannot be EGL_DONT_CARE */ |
if (conf->Level == EGL_DONT_CARE || |
conf->MatchNativePixmap == EGL_DONT_CARE) |
return EGL_FALSE; |
/* ignore other attributes when EGL_CONFIG_ID is given */ |
if (conf->ConfigID != EGL_DONT_CARE) { |
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { |
attr = _eglValidationTable[i].attr; |
if (attr != EGL_CONFIG_ID) |
_eglSetConfigKey(conf, attr, EGL_DONT_CARE); |
} |
} |
else { |
if (!(conf->SurfaceType & EGL_WINDOW_BIT)) |
conf->NativeVisualType = EGL_DONT_CARE; |
if (conf->TransparentType == EGL_NONE) { |
conf->TransparentRedValue = EGL_DONT_CARE; |
conf->TransparentGreenValue = EGL_DONT_CARE; |
conf->TransparentBlueValue = EGL_DONT_CARE; |
} |
} |
return EGL_TRUE; |
} |
/** |
* Decide the ordering of conf1 and conf2, under the given criteria. |
* When compare_id is true, this implements the algorithm described |
* in "Sorting of EGLConfigs". When compare_id is false, |
* EGL_CONFIG_ID is not compared. |
* |
* It returns a negative integer if conf1 is considered to come |
* before conf2; a positive integer if conf2 is considered to come |
* before conf1; zero if the ordering cannot be decided. |
* |
* Note that EGL_NATIVE_VISUAL_TYPE is platform-dependent and is |
* ignored here. |
*/ |
EGLint |
_eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2, |
const _EGLConfig *criteria, EGLBoolean compare_id) |
{ |
const EGLint compare_attribs[] = { |
EGL_BUFFER_SIZE, |
EGL_SAMPLE_BUFFERS, |
EGL_SAMPLES, |
EGL_DEPTH_SIZE, |
EGL_STENCIL_SIZE, |
EGL_ALPHA_MASK_SIZE, |
}; |
EGLint val1, val2; |
EGLint i; |
if (conf1 == conf2) |
return 0; |
/* the enum values have the desired ordering */ |
assert(EGL_NONE < EGL_SLOW_CONFIG); |
assert(EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG); |
val1 = conf1->ConfigCaveat - conf2->ConfigCaveat; |
if (val1) |
return val1; |
/* the enum values have the desired ordering */ |
assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER); |
val1 = conf1->ColorBufferType - conf2->ColorBufferType; |
if (val1) |
return val1; |
if (criteria) { |
val1 = val2 = 0; |
if (conf1->ColorBufferType == EGL_RGB_BUFFER) { |
if (criteria->RedSize > 0) { |
val1 += conf1->RedSize; |
val2 += conf2->RedSize; |
} |
if (criteria->GreenSize > 0) { |
val1 += conf1->GreenSize; |
val2 += conf2->GreenSize; |
} |
if (criteria->BlueSize > 0) { |
val1 += conf1->BlueSize; |
val2 += conf2->BlueSize; |
} |
} |
else { |
if (criteria->LuminanceSize > 0) { |
val1 += conf1->LuminanceSize; |
val2 += conf2->LuminanceSize; |
} |
} |
if (criteria->AlphaSize > 0) { |
val1 += conf1->AlphaSize; |
val2 += conf2->AlphaSize; |
} |
} |
else { |
/* assume the default criteria, which gives no specific ordering */ |
val1 = val2 = 0; |
} |
/* for color bits, larger one is preferred */ |
if (val1 != val2) |
return (val2 - val1); |
for (i = 0; i < ARRAY_SIZE(compare_attribs); i++) { |
val1 = _eglGetConfigKey(conf1, compare_attribs[i]); |
val2 = _eglGetConfigKey(conf2, compare_attribs[i]); |
if (val1 != val2) |
return (val1 - val2); |
} |
/* EGL_NATIVE_VISUAL_TYPE cannot be compared here */ |
return (compare_id) ? (conf1->ConfigID - conf2->ConfigID) : 0; |
} |
static INLINE |
void _eglSwapConfigs(const _EGLConfig **conf1, const _EGLConfig **conf2) |
{ |
const _EGLConfig *tmp = *conf1; |
*conf1 = *conf2; |
*conf2 = tmp; |
} |
/** |
* Quick sort an array of configs. This differs from the standard |
* qsort() in that the compare function accepts an additional |
* argument. |
*/ |
static void |
_eglSortConfigs(const _EGLConfig **configs, EGLint count, |
EGLint (*compare)(const _EGLConfig *, const _EGLConfig *, |
void *), |
void *priv_data) |
{ |
const EGLint pivot = 0; |
EGLint i, j; |
if (count <= 1) |
return; |
_eglSwapConfigs(&configs[pivot], &configs[count / 2]); |
i = 1; |
j = count - 1; |
do { |
while (i < count && compare(configs[i], configs[pivot], priv_data) < 0) |
i++; |
while (compare(configs[j], configs[pivot], priv_data) > 0) |
j--; |
if (i < j) { |
_eglSwapConfigs(&configs[i], &configs[j]); |
i++; |
j--; |
} |
else if (i == j) { |
i++; |
j--; |
break; |
} |
} while (i <= j); |
_eglSwapConfigs(&configs[pivot], &configs[j]); |
_eglSortConfigs(configs, j, compare, priv_data); |
_eglSortConfigs(configs + i, count - i, compare, priv_data); |
} |
/** |
* A helper function for implementing eglChooseConfig. See _eglFilterArray and |
* _eglSortConfigs for the meanings of match and compare. |
*/ |
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) |
{ |
_EGLConfig **configList; |
EGLint i, count; |
if (!num_configs) |
return _eglError(EGL_BAD_PARAMETER, "eglChooseConfigs"); |
/* get the number of matched configs */ |
count = _eglFilterArray(array, NULL, 0, |
(_EGLArrayForEach) match, priv_data); |
if (!count) { |
*num_configs = count; |
return EGL_TRUE; |
} |
configList = malloc(sizeof(*configList) * count); |
if (!configList) |
return _eglError(EGL_BAD_ALLOC, "eglChooseConfig(out of memory)"); |
/* get the matched configs */ |
_eglFilterArray(array, (void **) configList, count, |
(_EGLArrayForEach) match, priv_data); |
/* perform sorting of configs */ |
if (configs && count) { |
_eglSortConfigs((const _EGLConfig **) configList, count, |
compare, priv_data); |
count = MIN2(count, config_size); |
for (i = 0; i < count; i++) |
configs[i] = _eglGetConfigHandle(configList[i]); |
} |
free(configList); |
*num_configs = count; |
return EGL_TRUE; |
} |
static EGLBoolean |
_eglFallbackMatch(const _EGLConfig *conf, void *priv_data) |
{ |
return _eglMatchConfig(conf, (const _EGLConfig *) priv_data); |
} |
static EGLint |
_eglFallbackCompare(const _EGLConfig *conf1, const _EGLConfig *conf2, |
void *priv_data) |
{ |
return _eglCompareConfigs(conf1, conf2, |
(const _EGLConfig *) priv_data, EGL_TRUE); |
} |
/** |
* Typical fallback routine for eglChooseConfig |
*/ |
EGLBoolean |
_eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list, |
EGLConfig *configs, EGLint config_size, EGLint *num_configs) |
{ |
_EGLConfig criteria; |
if (!_eglParseConfigAttribList(&criteria, disp, attrib_list)) |
return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); |
return _eglFilterConfigArray(disp->Configs, |
configs, config_size, num_configs, |
_eglFallbackMatch, _eglFallbackCompare, |
(void *) &criteria); |
} |
/** |
* Fallback for eglGetConfigAttrib. |
*/ |
EGLBoolean |
_eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, |
EGLint attribute, EGLint *value) |
{ |
if (!_eglIsConfigAttribValid(conf, attribute)) |
return _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib"); |
/* nonqueryable attributes */ |
switch (attribute) { |
case EGL_MATCH_NATIVE_PIXMAP: |
return _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib"); |
break; |
default: |
break; |
} |
if (!value) |
return _eglError(EGL_BAD_PARAMETER, "eglGetConfigAttrib"); |
*value = _eglGetConfigKey(conf, attribute); |
return EGL_TRUE; |
} |
static EGLBoolean |
_eglFlattenConfig(void *elem, void *buffer) |
{ |
_EGLConfig *conf = (_EGLConfig *) elem; |
EGLConfig *handle = (EGLConfig *) buffer; |
*handle = _eglGetConfigHandle(conf); |
return EGL_TRUE; |
} |
/** |
* Fallback for eglGetConfigs. |
*/ |
EGLBoolean |
_eglGetConfigs(_EGLDriver *drv, _EGLDisplay *disp, EGLConfig *configs, |
EGLint config_size, EGLint *num_config) |
{ |
if (!num_config) |
return _eglError(EGL_BAD_PARAMETER, "eglGetConfigs"); |
*num_config = _eglFlattenArray(disp->Configs, (void *) configs, |
sizeof(configs[0]), config_size, _eglFlattenConfig); |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglconfig.c.bak |
---|
0,0 → 1,852 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* EGL Configuration (pixel format) functions. |
*/ |
#include <stdlib.h> |
#include <string.h> |
#include <assert.h> |
#include "eglconfig.h" |
#include "egldisplay.h" |
#include "eglcurrent.h" |
#include "egllog.h" |
#define MIN2(A, B) (((A) < (B)) ? (A) : (B)) |
/** |
* Init the given _EGLconfig to default values. |
* \param id the configuration's ID. |
* |
* Note that id must be positive for the config to be valid. |
* It is also recommended that when there are N configs, their |
* IDs are from 1 to N respectively. |
*/ |
void |
_eglInitConfig(_EGLConfig *conf, _EGLDisplay *dpy, EGLint id) |
{ |
memset(conf, 0, sizeof(*conf)); |
conf->Display = dpy; |
/* some attributes take non-zero default values */ |
conf->ConfigID = id; |
conf->ConfigCaveat = EGL_NONE; |
conf->TransparentType = EGL_NONE; |
conf->NativeVisualType = EGL_NONE; |
conf->ColorBufferType = EGL_RGB_BUFFER; |
} |
/** |
* Link a config to its display and return the handle of the link. |
* The handle can be passed to client directly. |
* |
* Note that we just save the ptr to the config (we don't copy the config). |
*/ |
PUBLIC EGLConfig |
_eglLinkConfig(_EGLConfig *conf) |
{ |
_EGLDisplay *dpy = conf->Display; |
/* sanity check */ |
assert(dpy && conf->ConfigID > 0); |
if (!dpy->Configs) { |
dpy->Configs = _eglCreateArray("Config", 16); |
if (!dpy->Configs) |
return (EGLConfig) NULL; |
} |
_eglAppendArray(dpy->Configs, (void *) conf); |
return (EGLConfig) conf; |
} |
/** |
* Lookup a handle to find the linked config. |
* Return NULL if the handle has no corresponding linked config. |
*/ |
_EGLConfig * |
_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy) |
{ |
_EGLConfig *conf; |
if (!dpy) |
return NULL; |
conf = (_EGLConfig *) _eglFindArray(dpy->Configs, (void *) config); |
if (conf) |
assert(conf->Display == dpy); |
return conf; |
} |
enum { |
/* types */ |
ATTRIB_TYPE_INTEGER, |
ATTRIB_TYPE_BOOLEAN, |
ATTRIB_TYPE_BITMASK, |
ATTRIB_TYPE_ENUM, |
ATTRIB_TYPE_PSEUDO, /* non-queryable */ |
ATTRIB_TYPE_PLATFORM, /* platform-dependent */ |
/* criteria */ |
ATTRIB_CRITERION_EXACT, |
ATTRIB_CRITERION_ATLEAST, |
ATTRIB_CRITERION_MASK, |
ATTRIB_CRITERION_SPECIAL, |
ATTRIB_CRITERION_IGNORE |
}; |
/* EGL spec Table 3.1 and 3.4 */ |
static const struct { |
EGLint attr; |
EGLint type; |
EGLint criterion; |
EGLint default_value; |
} _eglValidationTable[] = |
{ |
/* core */ |
{ EGL_BUFFER_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_RED_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_GREEN_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_BLUE_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_LUMINANCE_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_ALPHA_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_ALPHA_MASK_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_BIND_TO_TEXTURE_RGB, ATTRIB_TYPE_BOOLEAN, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_BIND_TO_TEXTURE_RGBA, ATTRIB_TYPE_BOOLEAN, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_COLOR_BUFFER_TYPE, ATTRIB_TYPE_ENUM, |
ATTRIB_CRITERION_EXACT, |
EGL_RGB_BUFFER }, |
{ EGL_CONFIG_CAVEAT, ATTRIB_TYPE_ENUM, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_CONFIG_ID, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_CONFORMANT, ATTRIB_TYPE_BITMASK, |
ATTRIB_CRITERION_MASK, |
0 }, |
{ EGL_DEPTH_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_LEVEL, ATTRIB_TYPE_PLATFORM, |
ATTRIB_CRITERION_EXACT, |
0 }, |
{ EGL_MAX_PBUFFER_WIDTH, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_IGNORE, |
0 }, |
{ EGL_MAX_PBUFFER_HEIGHT, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_IGNORE, |
0 }, |
{ EGL_MAX_PBUFFER_PIXELS, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_IGNORE, |
0 }, |
{ EGL_MAX_SWAP_INTERVAL, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_MIN_SWAP_INTERVAL, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_NATIVE_RENDERABLE, ATTRIB_TYPE_BOOLEAN, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_NATIVE_VISUAL_ID, ATTRIB_TYPE_PLATFORM, |
ATTRIB_CRITERION_IGNORE, |
0 }, |
{ EGL_NATIVE_VISUAL_TYPE, ATTRIB_TYPE_PLATFORM, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_RENDERABLE_TYPE, ATTRIB_TYPE_BITMASK, |
ATTRIB_CRITERION_MASK, |
EGL_OPENGL_ES_BIT }, |
{ EGL_SAMPLE_BUFFERS, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_SAMPLES, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_STENCIL_SIZE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_ATLEAST, |
0 }, |
{ EGL_SURFACE_TYPE, ATTRIB_TYPE_BITMASK, |
ATTRIB_CRITERION_MASK, |
EGL_WINDOW_BIT }, |
{ EGL_TRANSPARENT_TYPE, ATTRIB_TYPE_ENUM, |
ATTRIB_CRITERION_EXACT, |
EGL_NONE }, |
{ EGL_TRANSPARENT_RED_VALUE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_TRANSPARENT_GREEN_VALUE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_TRANSPARENT_BLUE_VALUE, ATTRIB_TYPE_INTEGER, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE }, |
{ EGL_MATCH_NATIVE_PIXMAP, ATTRIB_TYPE_PSEUDO, |
ATTRIB_CRITERION_SPECIAL, |
EGL_NONE }, |
/* extensions */ |
{ EGL_Y_INVERTED_NOK, ATTRIB_TYPE_BOOLEAN, |
ATTRIB_CRITERION_EXACT, |
EGL_DONT_CARE } |
}; |
/** |
* Return true if a config is valid. When for_matching is true, |
* EGL_DONT_CARE is accepted as a valid attribute value, and checks |
* for conflicting attribute values are skipped. |
* |
* Note that some attributes are platform-dependent and are not |
* checked. |
*/ |
EGLBoolean |
_eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching) |
{ |
EGLint i, attr, val; |
EGLBoolean valid = EGL_TRUE; |
/* check attributes by their types */ |
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { |
EGLint mask; |
attr = _eglValidationTable[i].attr; |
val = _eglGetConfigKey(conf, attr); |
switch (_eglValidationTable[i].type) { |
case ATTRIB_TYPE_INTEGER: |
switch (attr) { |
case EGL_CONFIG_ID: |
/* config id must be positive */ |
if (val <= 0) |
valid = EGL_FALSE; |
break; |
case EGL_SAMPLE_BUFFERS: |
/* there can be at most 1 sample buffer */ |
if (val > 1 || val < 0) |
valid = EGL_FALSE; |
break; |
default: |
if (val < 0) |
valid = EGL_FALSE; |
break; |
} |
break; |
case ATTRIB_TYPE_BOOLEAN: |
if (val != EGL_TRUE && val != EGL_FALSE) |
valid = EGL_FALSE; |
break; |
case ATTRIB_TYPE_ENUM: |
switch (attr) { |
case EGL_CONFIG_CAVEAT: |
if (val != EGL_NONE && val != EGL_SLOW_CONFIG && |
val != EGL_NON_CONFORMANT_CONFIG) |
valid = EGL_FALSE; |
break; |
case EGL_TRANSPARENT_TYPE: |
if (val != EGL_NONE && val != EGL_TRANSPARENT_RGB) |
valid = EGL_FALSE; |
break; |
case EGL_COLOR_BUFFER_TYPE: |
if (val != EGL_RGB_BUFFER && val != EGL_LUMINANCE_BUFFER) |
valid = EGL_FALSE; |
break; |
default: |
assert(0); |
break; |
} |
break; |
case ATTRIB_TYPE_BITMASK: |
switch (attr) { |
case EGL_SURFACE_TYPE: |
mask = EGL_PBUFFER_BIT | |
EGL_PIXMAP_BIT | |
EGL_WINDOW_BIT | |
EGL_VG_COLORSPACE_LINEAR_BIT | |
EGL_VG_ALPHA_FORMAT_PRE_BIT | |
EGL_MULTISAMPLE_RESOLVE_BOX_BIT | |
EGL_SWAP_BEHAVIOR_PRESERVED_BIT; |
#ifdef EGL_MESA_screen_surface |
if (conf->Display->Extensions.MESA_screen_surface) |
mask |= EGL_SCREEN_BIT_MESA; |
#endif |
break; |
case EGL_RENDERABLE_TYPE: |
case EGL_CONFORMANT: |
mask = EGL_OPENGL_ES_BIT | |
EGL_OPENVG_BIT | |
EGL_OPENGL_ES2_BIT | |
EGL_OPENGL_ES3_BIT_KHR | |
EGL_OPENGL_BIT; |
break; |
default: |
assert(0); |
mask = 0; |
break; |
} |
if (val & ~mask) |
valid = EGL_FALSE; |
break; |
case ATTRIB_TYPE_PLATFORM: |
/* unable to check platform-dependent attributes here */ |
break; |
case ATTRIB_TYPE_PSEUDO: |
/* pseudo attributes should not be set */ |
if (val != 0) |
valid = EGL_FALSE; |
break; |
default: |
assert(0); |
break; |
} |
if (!valid && for_matching) { |
/* accept EGL_DONT_CARE as a valid value */ |
if (val == EGL_DONT_CARE) |
valid = EGL_TRUE; |
if (_eglValidationTable[i].criterion == ATTRIB_CRITERION_SPECIAL) |
valid = EGL_TRUE; |
} |
if (!valid) { |
_eglLog(_EGL_DEBUG, |
"attribute 0x%04x has an invalid value 0x%x", attr, val); |
break; |
} |
} |
/* any invalid attribute value should have been catched */ |
if (!valid || for_matching) |
return valid; |
/* now check for conflicting attribute values */ |
switch (conf->ColorBufferType) { |
case EGL_RGB_BUFFER: |
if (conf->LuminanceSize) |
valid = EGL_FALSE; |
if (conf->RedSize + conf->GreenSize + |
conf->BlueSize + conf->AlphaSize != conf->BufferSize) |
valid = EGL_FALSE; |
break; |
case EGL_LUMINANCE_BUFFER: |
if (conf->RedSize || conf->GreenSize || conf->BlueSize) |
valid = EGL_FALSE; |
if (conf->LuminanceSize + conf->AlphaSize != conf->BufferSize) |
valid = EGL_FALSE; |
break; |
} |
if (!valid) { |
_eglLog(_EGL_DEBUG, "conflicting color buffer type and channel sizes"); |
return EGL_FALSE; |
} |
if (!conf->SampleBuffers && conf->Samples) |
valid = EGL_FALSE; |
if (!valid) { |
_eglLog(_EGL_DEBUG, "conflicting samples and sample buffers"); |
return EGL_FALSE; |
} |
if (!(conf->SurfaceType & EGL_WINDOW_BIT)) { |
if (conf->NativeVisualID != 0 || conf->NativeVisualType != EGL_NONE) |
valid = EGL_FALSE; |
} |
if (!(conf->SurfaceType & EGL_PBUFFER_BIT)) { |
if (conf->BindToTextureRGB || conf->BindToTextureRGBA) |
valid = EGL_FALSE; |
} |
if (!valid) { |
_eglLog(_EGL_DEBUG, "conflicting surface type and native visual/texture binding"); |
return EGL_FALSE; |
} |
return valid; |
} |
/** |
* Return true if a config matches the criteria. This and |
* _eglParseConfigAttribList together implement the algorithm |
* described in "Selection of EGLConfigs". |
* |
* Note that attributes that are special (currently, only |
* EGL_MATCH_NATIVE_PIXMAP) are ignored. |
*/ |
EGLBoolean |
_eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria) |
{ |
EGLint attr, val, i; |
EGLBoolean matched = EGL_TRUE; |
printf("_eglMatchConfig\n"); |
asm volatile ("int3"); |
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { |
EGLint cmp; |
if (_eglValidationTable[i].criterion == ATTRIB_CRITERION_IGNORE) |
continue; |
attr = _eglValidationTable[i].attr; |
cmp = _eglGetConfigKey(criteria, attr); |
if (cmp == EGL_DONT_CARE) |
continue; |
val = _eglGetConfigKey(conf, attr); |
switch (_eglValidationTable[i].criterion) { |
case ATTRIB_CRITERION_EXACT: |
if (val != cmp) |
matched = EGL_FALSE; |
break; |
case ATTRIB_CRITERION_ATLEAST: |
if (val < cmp) |
matched = EGL_FALSE; |
break; |
case ATTRIB_CRITERION_MASK: |
if ((val & cmp) != cmp) |
matched = EGL_FALSE; |
break; |
case ATTRIB_CRITERION_SPECIAL: |
/* ignored here */ |
break; |
default: |
assert(0); |
break; |
} |
if (!matched) { |
#ifndef DEBUG |
/* only print the common errors when DEBUG is not defined */ |
if (attr != EGL_RENDERABLE_TYPE) |
break; |
#endif |
// _eglLog(_EGL_DEBUG, |
// "the value (0x%x) of attribute 0x%04x did not meet the criteria (0x%x)", |
// val, attr, cmp); |
printf("the value (0x%x) of attribute 0x%04x did not meet the criteria (0x%x)", |
val, attr, cmp); |
break; |
} |
} |
return matched; |
} |
static INLINE EGLBoolean |
_eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr) |
{ |
if (_eglOffsetOfConfig(attr) < 0) |
return EGL_FALSE; |
switch (attr) { |
case EGL_Y_INVERTED_NOK: |
return conf->Display->Extensions.NOK_texture_from_pixmap; |
default: |
break; |
} |
return EGL_TRUE; |
} |
/** |
* Initialize a criteria config from the given attribute list. |
* Return EGL_FALSE if any of the attribute is invalid. |
*/ |
EGLBoolean |
_eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy, |
const EGLint *attrib_list) |
{ |
EGLint attr, val, i; |
_eglInitConfig(conf, dpy, EGL_DONT_CARE); |
/* reset to default values */ |
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { |
attr = _eglValidationTable[i].attr; |
val = _eglValidationTable[i].default_value; |
_eglSetConfigKey(conf, attr, val); |
} |
/* parse the list */ |
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i += 2) { |
attr = attrib_list[i]; |
val = attrib_list[i + 1]; |
if (!_eglIsConfigAttribValid(conf, attr)) |
return EGL_FALSE; |
_eglSetConfigKey(conf, attr, val); |
} |
if (!_eglValidateConfig(conf, EGL_TRUE)) |
return EGL_FALSE; |
/* EGL_LEVEL and EGL_MATCH_NATIVE_PIXMAP cannot be EGL_DONT_CARE */ |
if (conf->Level == EGL_DONT_CARE || |
conf->MatchNativePixmap == EGL_DONT_CARE) |
return EGL_FALSE; |
/* ignore other attributes when EGL_CONFIG_ID is given */ |
if (conf->ConfigID != EGL_DONT_CARE) { |
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { |
attr = _eglValidationTable[i].attr; |
if (attr != EGL_CONFIG_ID) |
_eglSetConfigKey(conf, attr, EGL_DONT_CARE); |
} |
} |
else { |
if (!(conf->SurfaceType & EGL_WINDOW_BIT)) |
conf->NativeVisualType = EGL_DONT_CARE; |
if (conf->TransparentType == EGL_NONE) { |
conf->TransparentRedValue = EGL_DONT_CARE; |
conf->TransparentGreenValue = EGL_DONT_CARE; |
conf->TransparentBlueValue = EGL_DONT_CARE; |
} |
} |
return EGL_TRUE; |
} |
/** |
* Decide the ordering of conf1 and conf2, under the given criteria. |
* When compare_id is true, this implements the algorithm described |
* in "Sorting of EGLConfigs". When compare_id is false, |
* EGL_CONFIG_ID is not compared. |
* |
* It returns a negative integer if conf1 is considered to come |
* before conf2; a positive integer if conf2 is considered to come |
* before conf1; zero if the ordering cannot be decided. |
* |
* Note that EGL_NATIVE_VISUAL_TYPE is platform-dependent and is |
* ignored here. |
*/ |
EGLint |
_eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2, |
const _EGLConfig *criteria, EGLBoolean compare_id) |
{ |
const EGLint compare_attribs[] = { |
EGL_BUFFER_SIZE, |
EGL_SAMPLE_BUFFERS, |
EGL_SAMPLES, |
EGL_DEPTH_SIZE, |
EGL_STENCIL_SIZE, |
EGL_ALPHA_MASK_SIZE, |
}; |
EGLint val1, val2; |
EGLint i; |
if (conf1 == conf2) |
return 0; |
/* the enum values have the desired ordering */ |
assert(EGL_NONE < EGL_SLOW_CONFIG); |
assert(EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG); |
val1 = conf1->ConfigCaveat - conf2->ConfigCaveat; |
if (val1) |
return val1; |
/* the enum values have the desired ordering */ |
assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER); |
val1 = conf1->ColorBufferType - conf2->ColorBufferType; |
if (val1) |
return val1; |
if (criteria) { |
val1 = val2 = 0; |
if (conf1->ColorBufferType == EGL_RGB_BUFFER) { |
if (criteria->RedSize > 0) { |
val1 += conf1->RedSize; |
val2 += conf2->RedSize; |
} |
if (criteria->GreenSize > 0) { |
val1 += conf1->GreenSize; |
val2 += conf2->GreenSize; |
} |
if (criteria->BlueSize > 0) { |
val1 += conf1->BlueSize; |
val2 += conf2->BlueSize; |
} |
} |
else { |
if (criteria->LuminanceSize > 0) { |
val1 += conf1->LuminanceSize; |
val2 += conf2->LuminanceSize; |
} |
} |
if (criteria->AlphaSize > 0) { |
val1 += conf1->AlphaSize; |
val2 += conf2->AlphaSize; |
} |
} |
else { |
/* assume the default criteria, which gives no specific ordering */ |
val1 = val2 = 0; |
} |
/* for color bits, larger one is preferred */ |
if (val1 != val2) |
return (val2 - val1); |
for (i = 0; i < ARRAY_SIZE(compare_attribs); i++) { |
val1 = _eglGetConfigKey(conf1, compare_attribs[i]); |
val2 = _eglGetConfigKey(conf2, compare_attribs[i]); |
if (val1 != val2) |
return (val1 - val2); |
} |
/* EGL_NATIVE_VISUAL_TYPE cannot be compared here */ |
return (compare_id) ? (conf1->ConfigID - conf2->ConfigID) : 0; |
} |
static INLINE |
void _eglSwapConfigs(const _EGLConfig **conf1, const _EGLConfig **conf2) |
{ |
const _EGLConfig *tmp = *conf1; |
*conf1 = *conf2; |
*conf2 = tmp; |
} |
/** |
* Quick sort an array of configs. This differs from the standard |
* qsort() in that the compare function accepts an additional |
* argument. |
*/ |
static void |
_eglSortConfigs(const _EGLConfig **configs, EGLint count, |
EGLint (*compare)(const _EGLConfig *, const _EGLConfig *, |
void *), |
void *priv_data) |
{ |
const EGLint pivot = 0; |
EGLint i, j; |
if (count <= 1) |
return; |
_eglSwapConfigs(&configs[pivot], &configs[count / 2]); |
i = 1; |
j = count - 1; |
do { |
while (i < count && compare(configs[i], configs[pivot], priv_data) < 0) |
i++; |
while (compare(configs[j], configs[pivot], priv_data) > 0) |
j--; |
if (i < j) { |
_eglSwapConfigs(&configs[i], &configs[j]); |
i++; |
j--; |
} |
else if (i == j) { |
i++; |
j--; |
break; |
} |
} while (i <= j); |
_eglSwapConfigs(&configs[pivot], &configs[j]); |
_eglSortConfigs(configs, j, compare, priv_data); |
_eglSortConfigs(configs + i, count - i, compare, priv_data); |
} |
/** |
* A helper function for implementing eglChooseConfig. See _eglFilterArray and |
* _eglSortConfigs for the meanings of match and compare. |
*/ |
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) |
{ |
_EGLConfig **configList; |
EGLint i, count; |
if (!num_configs) |
return _eglError(EGL_BAD_PARAMETER, "eglChooseConfigs"); |
/* get the number of matched configs */ |
count = _eglFilterArray(array, NULL, 0, |
(_EGLArrayForEach) match, priv_data); |
if (!count) { |
*num_configs = count; |
printf("_eglFilterConfigArray count %d\n", count); |
return EGL_TRUE; |
} |
configList = malloc(sizeof(*configList) * count); |
if (!configList) |
return _eglError(EGL_BAD_ALLOC, "eglChooseConfig(out of memory)"); |
/* get the matched configs */ |
_eglFilterArray(array, (void **) configList, count, |
(_EGLArrayForEach) match, priv_data); |
/* perform sorting of configs */ |
if (configs && count) { |
_eglSortConfigs((const _EGLConfig **) configList, count, |
compare, priv_data); |
count = MIN2(count, config_size); |
for (i = 0; i < count; i++) |
configs[i] = _eglGetConfigHandle(configList[i]); |
} |
free(configList); |
*num_configs = count; |
return EGL_TRUE; |
} |
static EGLBoolean |
_eglFallbackMatch(const _EGLConfig *conf, void *priv_data) |
{ |
return _eglMatchConfig(conf, (const _EGLConfig *) priv_data); |
} |
static EGLint |
_eglFallbackCompare(const _EGLConfig *conf1, const _EGLConfig *conf2, |
void *priv_data) |
{ |
return _eglCompareConfigs(conf1, conf2, |
(const _EGLConfig *) priv_data, EGL_TRUE); |
} |
/** |
* Typical fallback routine for eglChooseConfig |
*/ |
EGLBoolean |
_eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list, |
EGLConfig *configs, EGLint config_size, EGLint *num_configs) |
{ |
_EGLConfig criteria; |
if (!_eglParseConfigAttribList(&criteria, disp, attrib_list)) |
return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); |
printf("%s attrib %p size %d\n", __FUNCTION__, attrib_list, config_size); |
asm volatile ("int3"); |
return _eglFilterConfigArray(disp->Configs, |
configs, config_size, num_configs, |
_eglFallbackMatch, _eglFallbackCompare, |
(void *) &criteria); |
} |
/** |
* Fallback for eglGetConfigAttrib. |
*/ |
EGLBoolean |
_eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, |
EGLint attribute, EGLint *value) |
{ |
if (!_eglIsConfigAttribValid(conf, attribute)) |
return _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib"); |
/* nonqueryable attributes */ |
switch (attribute) { |
case EGL_MATCH_NATIVE_PIXMAP: |
return _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib"); |
break; |
default: |
break; |
} |
if (!value) |
return _eglError(EGL_BAD_PARAMETER, "eglGetConfigAttrib"); |
*value = _eglGetConfigKey(conf, attribute); |
return EGL_TRUE; |
} |
static EGLBoolean |
_eglFlattenConfig(void *elem, void *buffer) |
{ |
_EGLConfig *conf = (_EGLConfig *) elem; |
EGLConfig *handle = (EGLConfig *) buffer; |
*handle = _eglGetConfigHandle(conf); |
return EGL_TRUE; |
} |
/** |
* Fallback for eglGetConfigs. |
*/ |
EGLBoolean |
_eglGetConfigs(_EGLDriver *drv, _EGLDisplay *disp, EGLConfig *configs, |
EGLint config_size, EGLint *num_config) |
{ |
if (!num_config) |
return _eglError(EGL_BAD_PARAMETER, "eglGetConfigs"); |
*num_config = _eglFlattenArray(disp->Configs, (void *) configs, |
sizeof(configs[0]), config_size, _eglFlattenConfig); |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglconfig.h |
---|
0,0 → 1,226 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLCONFIG_INCLUDED |
#define EGLCONFIG_INCLUDED |
#include <assert.h> |
#include <stddef.h> |
#include "egltypedefs.h" |
/* update _eglValidationTable and _eglOffsetOfConfig before updating this |
* struct */ |
struct _egl_config |
{ |
_EGLDisplay *Display; |
/* core */ |
EGLint BufferSize; |
EGLint AlphaSize; |
EGLint BlueSize; |
EGLint GreenSize; |
EGLint RedSize; |
EGLint DepthSize; |
EGLint StencilSize; |
EGLint ConfigCaveat; |
EGLint ConfigID; |
EGLint Level; |
EGLint MaxPbufferHeight; |
EGLint MaxPbufferPixels; |
EGLint MaxPbufferWidth; |
EGLint NativeRenderable; |
EGLint NativeVisualID; |
EGLint NativeVisualType; |
EGLint Samples; |
EGLint SampleBuffers; |
EGLint SurfaceType; |
EGLint TransparentType; |
EGLint TransparentBlueValue; |
EGLint TransparentGreenValue; |
EGLint TransparentRedValue; |
EGLint BindToTextureRGB; |
EGLint BindToTextureRGBA; |
EGLint MinSwapInterval; |
EGLint MaxSwapInterval; |
EGLint LuminanceSize; |
EGLint AlphaMaskSize; |
EGLint ColorBufferType; |
EGLint RenderableType; |
EGLint MatchNativePixmap; |
EGLint Conformant; |
/* extensions */ |
EGLint YInvertedNOK; |
}; |
/** |
* Map an EGL attribute enum to the offset of the member in _EGLConfig. |
*/ |
static INLINE EGLint |
_eglOffsetOfConfig(EGLint attr) |
{ |
switch (attr) { |
#define ATTRIB_MAP(attr, memb) case attr: return offsetof(_EGLConfig, memb) |
/* core */ |
ATTRIB_MAP(EGL_BUFFER_SIZE, BufferSize); |
ATTRIB_MAP(EGL_ALPHA_SIZE, AlphaSize); |
ATTRIB_MAP(EGL_BLUE_SIZE, BlueSize); |
ATTRIB_MAP(EGL_GREEN_SIZE, GreenSize); |
ATTRIB_MAP(EGL_RED_SIZE, RedSize); |
ATTRIB_MAP(EGL_DEPTH_SIZE, DepthSize); |
ATTRIB_MAP(EGL_STENCIL_SIZE, StencilSize); |
ATTRIB_MAP(EGL_CONFIG_CAVEAT, ConfigCaveat); |
ATTRIB_MAP(EGL_CONFIG_ID, ConfigID); |
ATTRIB_MAP(EGL_LEVEL, Level); |
ATTRIB_MAP(EGL_MAX_PBUFFER_HEIGHT, MaxPbufferHeight); |
ATTRIB_MAP(EGL_MAX_PBUFFER_PIXELS, MaxPbufferPixels); |
ATTRIB_MAP(EGL_MAX_PBUFFER_WIDTH, MaxPbufferWidth); |
ATTRIB_MAP(EGL_NATIVE_RENDERABLE, NativeRenderable); |
ATTRIB_MAP(EGL_NATIVE_VISUAL_ID, NativeVisualID); |
ATTRIB_MAP(EGL_NATIVE_VISUAL_TYPE, NativeVisualType); |
ATTRIB_MAP(EGL_SAMPLES, Samples); |
ATTRIB_MAP(EGL_SAMPLE_BUFFERS, SampleBuffers); |
ATTRIB_MAP(EGL_SURFACE_TYPE, SurfaceType); |
ATTRIB_MAP(EGL_TRANSPARENT_TYPE, TransparentType); |
ATTRIB_MAP(EGL_TRANSPARENT_BLUE_VALUE, TransparentBlueValue); |
ATTRIB_MAP(EGL_TRANSPARENT_GREEN_VALUE, TransparentGreenValue); |
ATTRIB_MAP(EGL_TRANSPARENT_RED_VALUE, TransparentRedValue); |
ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGB, BindToTextureRGB); |
ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGBA, BindToTextureRGBA); |
ATTRIB_MAP(EGL_MIN_SWAP_INTERVAL, MinSwapInterval); |
ATTRIB_MAP(EGL_MAX_SWAP_INTERVAL, MaxSwapInterval); |
ATTRIB_MAP(EGL_LUMINANCE_SIZE, LuminanceSize); |
ATTRIB_MAP(EGL_ALPHA_MASK_SIZE, AlphaMaskSize); |
ATTRIB_MAP(EGL_COLOR_BUFFER_TYPE, ColorBufferType); |
ATTRIB_MAP(EGL_RENDERABLE_TYPE, RenderableType); |
ATTRIB_MAP(EGL_MATCH_NATIVE_PIXMAP, MatchNativePixmap); |
ATTRIB_MAP(EGL_CONFORMANT, Conformant); |
/* extensions */ |
ATTRIB_MAP(EGL_Y_INVERTED_NOK, YInvertedNOK); |
#undef ATTRIB_MAP |
default: |
return -1; |
} |
} |
/** |
* Update a config for a given key. |
* |
* Note that a valid key is not necessarily a valid attribute. There are gaps |
* in the attribute enums. The separation is to catch application errors. |
* Drivers should never set a key that is an invalid attribute. |
*/ |
static INLINE void |
_eglSetConfigKey(_EGLConfig *conf, EGLint key, EGLint val) |
{ |
EGLint offset = _eglOffsetOfConfig(key); |
assert(offset >= 0); |
*((EGLint *) ((char *) conf + offset)) = val; |
} |
/** |
* Return the value for a given key. |
*/ |
static INLINE EGLint |
_eglGetConfigKey(const _EGLConfig *conf, EGLint key) |
{ |
EGLint offset = _eglOffsetOfConfig(key); |
assert(offset >= 0); |
return *((EGLint *) ((char *) conf + offset)); |
} |
PUBLIC void |
_eglInitConfig(_EGLConfig *config, _EGLDisplay *dpy, EGLint id); |
PUBLIC EGLConfig |
_eglLinkConfig(_EGLConfig *conf); |
extern _EGLConfig * |
_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy); |
/** |
* Return the handle of a linked config. |
*/ |
static INLINE EGLConfig |
_eglGetConfigHandle(_EGLConfig *conf) |
{ |
return (EGLConfig) conf; |
} |
PUBLIC EGLBoolean |
_eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching); |
PUBLIC EGLBoolean |
_eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria); |
PUBLIC EGLBoolean |
_eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy, |
const EGLint *attrib_list); |
PUBLIC EGLint |
_eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2, |
const _EGLConfig *criteria, EGLBoolean compare_id); |
PUBLIC 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 *filter_data); |
extern EGLBoolean |
_eglChooseConfig(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); |
extern EGLBoolean |
_eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, EGLint attribute, EGLint *value); |
extern EGLBoolean |
_eglGetConfigs(_EGLDriver *drv, _EGLDisplay *dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); |
#endif /* EGLCONFIG_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglcontext.c |
---|
0,0 → 1,614 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#include "eglconfig.h" |
#include "eglcontext.h" |
#include "egldisplay.h" |
#include "eglcurrent.h" |
#include "eglsurface.h" |
#include "egllog.h" |
/** |
* Return the API bit (one of EGL_xxx_BIT) of the context. |
*/ |
static EGLint |
_eglGetContextAPIBit(_EGLContext *ctx) |
{ |
EGLint bit = 0; |
switch (ctx->ClientAPI) { |
case EGL_OPENGL_ES_API: |
switch (ctx->ClientMajorVersion) { |
case 1: |
bit = EGL_OPENGL_ES_BIT; |
break; |
case 2: |
bit = EGL_OPENGL_ES2_BIT; |
break; |
case 3: |
bit = EGL_OPENGL_ES3_BIT_KHR; |
break; |
default: |
break; |
} |
break; |
case EGL_OPENVG_API: |
bit = EGL_OPENVG_BIT; |
break; |
case EGL_OPENGL_API: |
bit = EGL_OPENGL_BIT; |
break; |
default: |
break; |
} |
return bit; |
} |
/** |
* Parse the list of context attributes and return the proper error code. |
*/ |
static EGLint |
_eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy, |
const EGLint *attrib_list) |
{ |
EGLenum api = ctx->ClientAPI; |
EGLint i, err = EGL_SUCCESS; |
if (!attrib_list) |
return EGL_SUCCESS; |
if (api == EGL_OPENVG_API && attrib_list[0] != EGL_NONE) { |
_eglLog(_EGL_DEBUG, "bad context attribute 0x%04x", attrib_list[0]); |
return EGL_BAD_ATTRIBUTE; |
} |
for (i = 0; attrib_list[i] != EGL_NONE; i++) { |
EGLint attr = attrib_list[i++]; |
EGLint val = attrib_list[i]; |
switch (attr) { |
case EGL_CONTEXT_CLIENT_VERSION: |
ctx->ClientMajorVersion = val; |
break; |
case EGL_CONTEXT_MINOR_VERSION_KHR: |
if (!dpy->Extensions.KHR_create_context) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->ClientMinorVersion = val; |
break; |
case EGL_CONTEXT_FLAGS_KHR: |
if (!dpy->Extensions.KHR_create_context) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
/* The EGL_KHR_create_context spec says: |
* |
* "Flags are only defined for OpenGL context creation, and |
* specifying a flags value other than zero for other types of |
* contexts, including OpenGL ES contexts, will generate an |
* error." |
*/ |
if (api != EGL_OPENGL_API && val != 0) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->Flags = val; |
break; |
case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR: |
if (!dpy->Extensions.KHR_create_context) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
/* The EGL_KHR_create_context spec says: |
* |
* "[EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR] is only meaningful for |
* OpenGL contexts, and specifying it for other types of |
* contexts, including OpenGL ES contexts, will generate an |
* error." |
*/ |
if (api != EGL_OPENGL_API) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->Profile = val; |
break; |
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR: |
/* The EGL_KHR_create_context spec says: |
* |
* "[EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR] is only |
* meaningful for OpenGL contexts, and specifying it for other |
* types of contexts, including OpenGL ES contexts, will generate |
* an error." |
*/ |
if (!dpy->Extensions.KHR_create_context |
|| api != EGL_OPENGL_API) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->ResetNotificationStrategy = val; |
break; |
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT: |
/* The EGL_EXT_create_context_robustness spec says: |
* |
* "[EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT] is only |
* meaningful for OpenGL ES contexts, and specifying it for other |
* types of contexts will generate an EGL_BAD_ATTRIBUTE error." |
*/ |
if (!dpy->Extensions.EXT_create_context_robustness |
|| api != EGL_OPENGL_ES_API) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->ResetNotificationStrategy = val; |
break; |
case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT: |
if (!dpy->Extensions.EXT_create_context_robustness) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->Flags = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) { |
_eglLog(_EGL_DEBUG, "bad context attribute 0x%04x", attr); |
break; |
} |
} |
if (api == EGL_OPENGL_API) { |
/* The EGL_KHR_create_context spec says: |
* |
* "If the requested OpenGL version is less than 3.2, |
* EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR is ignored and the |
* functionality of the context is determined solely by the |
* requested version." |
* |
* Since the value is ignored, only validate the setting if the version |
* is >= 3.2. |
*/ |
if (ctx->ClientMajorVersion >= 4 |
|| (ctx->ClientMajorVersion == 3 && ctx->ClientMinorVersion >= 2)) { |
switch (ctx->Profile) { |
case EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR: |
case EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR: |
break; |
default: |
/* The EGL_KHR_create_context spec says: |
* |
* "* If an OpenGL context is requested, the requested version |
* is greater than 3.2, and the value for attribute |
* EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR has no bits set; has |
* any bits set other than EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR |
* and EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; has |
* more than one of these bits set; or if the implementation does |
* not support the requested profile, then an EGL_BAD_MATCH error |
* is generated." |
*/ |
err = EGL_BAD_MATCH; |
break; |
} |
} |
/* The EGL_KHR_create_context spec says: |
* |
* "* If an OpenGL context is requested and the values for |
* attributes EGL_CONTEXT_MAJOR_VERSION_KHR and |
* EGL_CONTEXT_MINOR_VERSION_KHR, when considered together with |
* the value for attribute |
* EGL_CONTEXT_FORWARD_COMPATIBLE_BIT_KHR, specify an OpenGL |
* version and feature set that are not defined, than an |
* EGL_BAD_MATCH error is generated. |
* |
* ... Thus, examples of invalid combinations of attributes |
* include: |
* |
* - Major version < 1 or > 4 |
* - Major version == 1 and minor version < 0 or > 5 |
* - Major version == 2 and minor version < 0 or > 1 |
* - Major version == 3 and minor version < 0 or > 2 |
* - Major version == 4 and minor version < 0 or > 2 |
* - Forward-compatible flag set and major version < 3" |
*/ |
if (ctx->ClientMajorVersion < 1 || ctx->ClientMinorVersion < 0) |
err = EGL_BAD_MATCH; |
switch (ctx->ClientMajorVersion) { |
case 1: |
if (ctx->ClientMinorVersion > 5 |
|| (ctx->Flags & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) != 0) |
err = EGL_BAD_MATCH; |
break; |
case 2: |
if (ctx->ClientMinorVersion > 1 |
|| (ctx->Flags & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) != 0) |
err = EGL_BAD_MATCH; |
break; |
case 3: |
/* Note: The text above is incorrect. There *is* an OpenGL 3.3! |
*/ |
if (ctx->ClientMinorVersion > 3) |
err = EGL_BAD_MATCH; |
break; |
case 4: |
default: |
/* Don't put additional version checks here. We don't know that |
* there won't be versions > 4.2. |
*/ |
break; |
} |
} else if (api == EGL_OPENGL_ES_API) { |
/* The EGL_KHR_create_context spec says: |
* |
* "* If an OpenGL ES context is requested and the values for |
* attributes EGL_CONTEXT_MAJOR_VERSION_KHR and |
* EGL_CONTEXT_MINOR_VERSION_KHR specify an OpenGL ES version that |
* is not defined, than an EGL_BAD_MATCH error is generated. |
* |
* ... Examples of invalid combinations of attributes include: |
* |
* - Major version < 1 or > 2 |
* - Major version == 1 and minor version < 0 or > 1 |
* - Major version == 2 and minor version != 0 |
*/ |
if (ctx->ClientMajorVersion < 1 || ctx->ClientMinorVersion < 0) |
err = EGL_BAD_MATCH; |
switch (ctx->ClientMajorVersion) { |
case 1: |
if (ctx->ClientMinorVersion > 1) |
err = EGL_BAD_MATCH; |
break; |
case 2: |
if (ctx->ClientMinorVersion > 0) |
err = EGL_BAD_MATCH; |
break; |
case 3: |
default: |
/* Don't put additional version checks here. We don't know that |
* there won't be versions > 3.0. |
*/ |
break; |
} |
} |
switch (ctx->ResetNotificationStrategy) { |
case EGL_NO_RESET_NOTIFICATION_KHR: |
case EGL_LOSE_CONTEXT_ON_RESET_KHR: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if ((ctx->Flags & ~(EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR |
| EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR |
| EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR)) != 0) { |
err = EGL_BAD_ATTRIBUTE; |
} |
return err; |
} |
/** |
* Initialize the given _EGLContext object to defaults and/or the values |
* in the attrib_list. |
*/ |
EGLBoolean |
_eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf, |
const EGLint *attrib_list) |
{ |
const EGLenum api = eglQueryAPI(); |
EGLint err; |
if (api == EGL_NONE) { |
_eglError(EGL_BAD_MATCH, "eglCreateContext(no client API)"); |
return EGL_FALSE; |
} |
_eglInitResource(&ctx->Resource, sizeof(*ctx), dpy); |
ctx->ClientAPI = api; |
ctx->Config = conf; |
ctx->WindowRenderBuffer = EGL_NONE; |
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; |
ctx->ClientMajorVersion = 1; /* the default, per EGL spec */ |
ctx->ClientMinorVersion = 0; |
ctx->Flags = 0; |
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; |
ctx->ResetNotificationStrategy = EGL_NO_RESET_NOTIFICATION_KHR; |
err = _eglParseContextAttribList(ctx, dpy, attrib_list); |
if (err == EGL_SUCCESS && ctx->Config) { |
EGLint api_bit; |
api_bit = _eglGetContextAPIBit(ctx); |
if (!(ctx->Config->RenderableType & api_bit)) { |
_eglLog(_EGL_DEBUG, "context api is 0x%x while config supports 0x%x", |
api_bit, ctx->Config->RenderableType); |
err = EGL_BAD_CONFIG; |
} |
} |
if (err != EGL_SUCCESS) |
return _eglError(err, "eglCreateContext"); |
return EGL_TRUE; |
} |
static EGLint |
_eglQueryContextRenderBuffer(_EGLContext *ctx) |
{ |
_EGLSurface *surf = ctx->DrawSurface; |
EGLint rb; |
if (!surf) |
return EGL_NONE; |
if (surf->Type == EGL_WINDOW_BIT && ctx->WindowRenderBuffer != EGL_NONE) |
rb = ctx->WindowRenderBuffer; |
else |
rb = surf->RenderBuffer; |
return rb; |
} |
EGLBoolean |
_eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c, |
EGLint attribute, EGLint *value) |
{ |
(void) drv; |
(void) dpy; |
if (!value) |
return _eglError(EGL_BAD_PARAMETER, "eglQueryContext"); |
switch (attribute) { |
case EGL_CONFIG_ID: |
if (!c->Config) |
return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); |
*value = c->Config->ConfigID; |
break; |
case EGL_CONTEXT_CLIENT_VERSION: |
*value = c->ClientMajorVersion; |
break; |
case EGL_CONTEXT_CLIENT_TYPE: |
*value = c->ClientAPI; |
break; |
case EGL_RENDER_BUFFER: |
*value = _eglQueryContextRenderBuffer(c); |
break; |
default: |
return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); |
} |
return EGL_TRUE; |
} |
/** |
* Bind the context to the thread and return the previous context. |
* |
* Note that the context may be NULL. |
*/ |
static _EGLContext * |
_eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t) |
{ |
EGLint apiIndex; |
_EGLContext *oldCtx; |
apiIndex = (ctx) ? |
_eglConvertApiToIndex(ctx->ClientAPI) : t->CurrentAPIIndex; |
oldCtx = t->CurrentContexts[apiIndex]; |
if (ctx != oldCtx) { |
if (oldCtx) |
oldCtx->Binding = NULL; |
if (ctx) |
ctx->Binding = t; |
t->CurrentContexts[apiIndex] = ctx; |
} |
return oldCtx; |
} |
/** |
* Return true if the given context and surfaces can be made current. |
*/ |
static EGLBoolean |
_eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
_EGLDisplay *dpy; |
EGLint conflict_api; |
if (_eglIsCurrentThreadDummy()) |
return _eglError(EGL_BAD_ALLOC, "eglMakeCurrent"); |
/* this is easy */ |
if (!ctx) { |
if (draw || read) |
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); |
return EGL_TRUE; |
} |
dpy = ctx->Resource.Display; |
if (!dpy->Extensions.KHR_surfaceless_context |
&& (draw == NULL || read == NULL)) |
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); |
/* |
* The spec says |
* |
* "If ctx is current to some other thread, or if either draw or read are |
* bound to contexts in another thread, an EGL_BAD_ACCESS error is |
* generated." |
* |
* and |
* |
* "at most one context may be bound to a particular surface at a given |
* time" |
*/ |
if (ctx->Binding && ctx->Binding != t) |
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); |
if (draw && draw->CurrentContext && draw->CurrentContext != ctx) { |
if (draw->CurrentContext->Binding != t || |
draw->CurrentContext->ClientAPI != ctx->ClientAPI) |
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); |
} |
if (read && read->CurrentContext && read->CurrentContext != ctx) { |
if (read->CurrentContext->Binding != t || |
read->CurrentContext->ClientAPI != ctx->ClientAPI) |
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); |
} |
/* simply require the configs to be equal */ |
if ((draw && draw->Config != ctx->Config) || |
(read && read->Config != ctx->Config)) |
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); |
switch (ctx->ClientAPI) { |
/* OpenGL and OpenGL ES are conflicting */ |
case EGL_OPENGL_ES_API: |
conflict_api = EGL_OPENGL_API; |
break; |
case EGL_OPENGL_API: |
conflict_api = EGL_OPENGL_ES_API; |
break; |
default: |
conflict_api = -1; |
break; |
} |
if (conflict_api >= 0 && _eglGetAPIContext(conflict_api)) |
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); |
return EGL_TRUE; |
} |
/** |
* Bind the context to the current thread and given surfaces. Return the |
* previous bound context and surfaces. The caller should unreference the |
* returned context and surfaces. |
* |
* Making a second call with the resources returned by the first call |
* unsurprisingly undoes the first call, except for the resouce reference |
* counts. |
*/ |
EGLBoolean |
_eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read, |
_EGLContext **old_ctx, |
_EGLSurface **old_draw, _EGLSurface **old_read) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
_EGLContext *prev_ctx; |
_EGLSurface *prev_draw, *prev_read; |
if (!_eglCheckMakeCurrent(ctx, draw, read)) |
return EGL_FALSE; |
/* increment refcounts before binding */ |
_eglGetContext(ctx); |
_eglGetSurface(draw); |
_eglGetSurface(read); |
/* bind the new context */ |
prev_ctx = _eglBindContextToThread(ctx, t); |
/* break previous bindings */ |
if (prev_ctx) { |
prev_draw = prev_ctx->DrawSurface; |
prev_read = prev_ctx->ReadSurface; |
if (prev_draw) |
prev_draw->CurrentContext = NULL; |
if (prev_read) |
prev_read->CurrentContext = NULL; |
prev_ctx->DrawSurface = NULL; |
prev_ctx->ReadSurface = NULL; |
} |
else { |
prev_draw = prev_read = NULL; |
} |
/* establish new bindings */ |
if (ctx) { |
if (draw) |
draw->CurrentContext = ctx; |
if (read) |
read->CurrentContext = ctx; |
ctx->DrawSurface = draw; |
ctx->ReadSurface = read; |
} |
assert(old_ctx && old_draw && old_read); |
*old_ctx = prev_ctx; |
*old_draw = prev_draw; |
*old_read = prev_read; |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglcontext.c.bak |
---|
0,0 → 1,618 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#include "eglconfig.h" |
#include "eglcontext.h" |
#include "egldisplay.h" |
#include "eglcurrent.h" |
#include "eglsurface.h" |
#include "egllog.h" |
/** |
* Return the API bit (one of EGL_xxx_BIT) of the context. |
*/ |
static EGLint |
_eglGetContextAPIBit(_EGLContext *ctx) |
{ |
EGLint bit = 0; |
switch (ctx->ClientAPI) { |
case EGL_OPENGL_ES_API: |
switch (ctx->ClientMajorVersion) { |
case 1: |
bit = EGL_OPENGL_ES_BIT; |
break; |
case 2: |
bit = EGL_OPENGL_ES2_BIT; |
break; |
case 3: |
bit = EGL_OPENGL_ES3_BIT_KHR; |
break; |
default: |
break; |
} |
break; |
case EGL_OPENVG_API: |
bit = EGL_OPENVG_BIT; |
break; |
case EGL_OPENGL_API: |
bit = EGL_OPENGL_BIT; |
break; |
default: |
break; |
} |
return bit; |
} |
/** |
* Parse the list of context attributes and return the proper error code. |
*/ |
static EGLint |
_eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy, |
const EGLint *attrib_list) |
{ |
EGLenum api = ctx->ClientAPI; |
EGLint i, err = EGL_SUCCESS; |
if (!attrib_list) |
return EGL_SUCCESS; |
if (api == EGL_OPENVG_API && attrib_list[0] != EGL_NONE) { |
_eglLog(_EGL_DEBUG, "bad context attribute 0x%04x", attrib_list[0]); |
return EGL_BAD_ATTRIBUTE; |
} |
for (i = 0; attrib_list[i] != EGL_NONE; i++) { |
EGLint attr = attrib_list[i++]; |
EGLint val = attrib_list[i]; |
switch (attr) { |
case EGL_CONTEXT_CLIENT_VERSION: |
ctx->ClientMajorVersion = val; |
break; |
case EGL_CONTEXT_MINOR_VERSION_KHR: |
if (!dpy->Extensions.KHR_create_context) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->ClientMinorVersion = val; |
break; |
case EGL_CONTEXT_FLAGS_KHR: |
if (!dpy->Extensions.KHR_create_context) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
/* The EGL_KHR_create_context spec says: |
* |
* "Flags are only defined for OpenGL context creation, and |
* specifying a flags value other than zero for other types of |
* contexts, including OpenGL ES contexts, will generate an |
* error." |
*/ |
if (api != EGL_OPENGL_API && val != 0) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->Flags = val; |
break; |
case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR: |
if (!dpy->Extensions.KHR_create_context) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
/* The EGL_KHR_create_context spec says: |
* |
* "[EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR] is only meaningful for |
* OpenGL contexts, and specifying it for other types of |
* contexts, including OpenGL ES contexts, will generate an |
* error." |
*/ |
if (api != EGL_OPENGL_API) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->Profile = val; |
break; |
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR: |
/* The EGL_KHR_create_context spec says: |
* |
* "[EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR] is only |
* meaningful for OpenGL contexts, and specifying it for other |
* types of contexts, including OpenGL ES contexts, will generate |
* an error." |
*/ |
if (!dpy->Extensions.KHR_create_context |
|| api != EGL_OPENGL_API) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->ResetNotificationStrategy = val; |
break; |
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT: |
/* The EGL_EXT_create_context_robustness spec says: |
* |
* "[EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT] is only |
* meaningful for OpenGL ES contexts, and specifying it for other |
* types of contexts will generate an EGL_BAD_ATTRIBUTE error." |
*/ |
if (!dpy->Extensions.EXT_create_context_robustness |
|| api != EGL_OPENGL_ES_API) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->ResetNotificationStrategy = val; |
break; |
case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT: |
if (!dpy->Extensions.EXT_create_context_robustness) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
ctx->Flags = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) { |
_eglLog(_EGL_DEBUG, "bad context attribute 0x%04x", attr); |
break; |
} |
} |
if (api == EGL_OPENGL_API) { |
/* The EGL_KHR_create_context spec says: |
* |
* "If the requested OpenGL version is less than 3.2, |
* EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR is ignored and the |
* functionality of the context is determined solely by the |
* requested version." |
* |
* Since the value is ignored, only validate the setting if the version |
* is >= 3.2. |
*/ |
if (ctx->ClientMajorVersion >= 4 |
|| (ctx->ClientMajorVersion == 3 && ctx->ClientMinorVersion >= 2)) { |
switch (ctx->Profile) { |
case EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR: |
case EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR: |
break; |
default: |
/* The EGL_KHR_create_context spec says: |
* |
* "* If an OpenGL context is requested, the requested version |
* is greater than 3.2, and the value for attribute |
* EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR has no bits set; has |
* any bits set other than EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR |
* and EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; has |
* more than one of these bits set; or if the implementation does |
* not support the requested profile, then an EGL_BAD_MATCH error |
* is generated." |
*/ |
err = EGL_BAD_MATCH; |
break; |
} |
} |
/* The EGL_KHR_create_context spec says: |
* |
* "* If an OpenGL context is requested and the values for |
* attributes EGL_CONTEXT_MAJOR_VERSION_KHR and |
* EGL_CONTEXT_MINOR_VERSION_KHR, when considered together with |
* the value for attribute |
* EGL_CONTEXT_FORWARD_COMPATIBLE_BIT_KHR, specify an OpenGL |
* version and feature set that are not defined, than an |
* EGL_BAD_MATCH error is generated. |
* |
* ... Thus, examples of invalid combinations of attributes |
* include: |
* |
* - Major version < 1 or > 4 |
* - Major version == 1 and minor version < 0 or > 5 |
* - Major version == 2 and minor version < 0 or > 1 |
* - Major version == 3 and minor version < 0 or > 2 |
* - Major version == 4 and minor version < 0 or > 2 |
* - Forward-compatible flag set and major version < 3" |
*/ |
if (ctx->ClientMajorVersion < 1 || ctx->ClientMinorVersion < 0) |
err = EGL_BAD_MATCH; |
switch (ctx->ClientMajorVersion) { |
case 1: |
if (ctx->ClientMinorVersion > 5 |
|| (ctx->Flags & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) != 0) |
err = EGL_BAD_MATCH; |
break; |
case 2: |
if (ctx->ClientMinorVersion > 1 |
|| (ctx->Flags & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) != 0) |
err = EGL_BAD_MATCH; |
break; |
case 3: |
/* Note: The text above is incorrect. There *is* an OpenGL 3.3! |
*/ |
if (ctx->ClientMinorVersion > 3) |
err = EGL_BAD_MATCH; |
break; |
case 4: |
default: |
/* Don't put additional version checks here. We don't know that |
* there won't be versions > 4.2. |
*/ |
break; |
} |
} else if (api == EGL_OPENGL_ES_API) { |
/* The EGL_KHR_create_context spec says: |
* |
* "* If an OpenGL ES context is requested and the values for |
* attributes EGL_CONTEXT_MAJOR_VERSION_KHR and |
* EGL_CONTEXT_MINOR_VERSION_KHR specify an OpenGL ES version that |
* is not defined, than an EGL_BAD_MATCH error is generated. |
* |
* ... Examples of invalid combinations of attributes include: |
* |
* - Major version < 1 or > 2 |
* - Major version == 1 and minor version < 0 or > 1 |
* - Major version == 2 and minor version != 0 |
*/ |
if (ctx->ClientMajorVersion < 1 || ctx->ClientMinorVersion < 0) |
err = EGL_BAD_MATCH; |
switch (ctx->ClientMajorVersion) { |
case 1: |
if (ctx->ClientMinorVersion > 1) |
err = EGL_BAD_MATCH; |
break; |
case 2: |
if (ctx->ClientMinorVersion > 0) |
err = EGL_BAD_MATCH; |
break; |
case 3: |
default: |
/* Don't put additional version checks here. We don't know that |
* there won't be versions > 3.0. |
*/ |
break; |
} |
} |
switch (ctx->ResetNotificationStrategy) { |
case EGL_NO_RESET_NOTIFICATION_KHR: |
case EGL_LOSE_CONTEXT_ON_RESET_KHR: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if ((ctx->Flags & ~(EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR |
| EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR |
| EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR)) != 0) { |
err = EGL_BAD_ATTRIBUTE; |
} |
return err; |
} |
/** |
* Initialize the given _EGLContext object to defaults and/or the values |
* in the attrib_list. |
*/ |
EGLBoolean |
_eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf, |
const EGLint *attrib_list) |
{ |
const EGLenum api = eglQueryAPI(); |
EGLint err; |
if (api == EGL_NONE) { |
_eglError(EGL_BAD_MATCH, "eglCreateContext(no client API)"); |
return EGL_FALSE; |
} |
_eglInitResource(&ctx->Resource, sizeof(*ctx), dpy); |
ctx->ClientAPI = api; |
ctx->Config = conf; |
ctx->WindowRenderBuffer = EGL_NONE; |
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; |
ctx->ClientMajorVersion = 1; /* the default, per EGL spec */ |
ctx->ClientMinorVersion = 0; |
ctx->Flags = 0; |
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; |
ctx->ResetNotificationStrategy = EGL_NO_RESET_NOTIFICATION_KHR; |
err = _eglParseContextAttribList(ctx, dpy, attrib_list); |
if (err == EGL_SUCCESS && ctx->Config) { |
EGLint api_bit; |
api_bit = _eglGetContextAPIBit(ctx); |
if (!(ctx->Config->RenderableType & api_bit)) { |
_eglLog(_EGL_DEBUG, "context api is 0x%x while config supports 0x%x", |
api_bit, ctx->Config->RenderableType); |
err = EGL_BAD_CONFIG; |
} |
} |
if (err != EGL_SUCCESS) |
return _eglError(err, "eglCreateContext"); |
return EGL_TRUE; |
} |
static EGLint |
_eglQueryContextRenderBuffer(_EGLContext *ctx) |
{ |
_EGLSurface *surf = ctx->DrawSurface; |
EGLint rb; |
if (!surf) |
return EGL_NONE; |
if (surf->Type == EGL_WINDOW_BIT && ctx->WindowRenderBuffer != EGL_NONE) |
rb = ctx->WindowRenderBuffer; |
else |
rb = surf->RenderBuffer; |
return rb; |
} |
EGLBoolean |
_eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c, |
EGLint attribute, EGLint *value) |
{ |
(void) drv; |
(void) dpy; |
if (!value) |
return _eglError(EGL_BAD_PARAMETER, "eglQueryContext"); |
switch (attribute) { |
case EGL_CONFIG_ID: |
if (!c->Config) |
return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); |
*value = c->Config->ConfigID; |
break; |
case EGL_CONTEXT_CLIENT_VERSION: |
*value = c->ClientMajorVersion; |
break; |
case EGL_CONTEXT_CLIENT_TYPE: |
*value = c->ClientAPI; |
break; |
case EGL_RENDER_BUFFER: |
*value = _eglQueryContextRenderBuffer(c); |
break; |
default: |
return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); |
} |
return EGL_TRUE; |
} |
/** |
* Bind the context to the thread and return the previous context. |
* |
* Note that the context may be NULL. |
*/ |
static _EGLContext * |
_eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t) |
{ |
EGLint apiIndex; |
_EGLContext *oldCtx; |
apiIndex = (ctx) ? |
_eglConvertApiToIndex(ctx->ClientAPI) : t->CurrentAPIIndex; |
oldCtx = t->CurrentContexts[apiIndex]; |
if (ctx != oldCtx) { |
if (oldCtx) |
oldCtx->Binding = NULL; |
if (ctx) |
ctx->Binding = t; |
t->CurrentContexts[apiIndex] = ctx; |
} |
return oldCtx; |
} |
/** |
* Return true if the given context and surfaces can be made current. |
*/ |
static EGLBoolean |
_eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
_EGLDisplay *dpy; |
EGLint conflict_api; |
if (_eglIsCurrentThreadDummy()) |
return _eglError(EGL_BAD_ALLOC, "eglMakeCurrent"); |
/* this is easy */ |
if (!ctx) { |
if (draw || read) |
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); |
return EGL_TRUE; |
} |
dpy = ctx->Resource.Display; |
if (!dpy->Extensions.KHR_surfaceless_context |
&& (draw == NULL || read == NULL)) |
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); |
/* |
* The spec says |
* |
* "If ctx is current to some other thread, or if either draw or read are |
* bound to contexts in another thread, an EGL_BAD_ACCESS error is |
* generated." |
* |
* and |
* |
* "at most one context may be bound to a particular surface at a given |
* time" |
*/ |
if (ctx->Binding && ctx->Binding != t) |
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); |
if (draw && draw->CurrentContext && draw->CurrentContext != ctx) { |
if (draw->CurrentContext->Binding != t || |
draw->CurrentContext->ClientAPI != ctx->ClientAPI) |
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); |
} |
if (read && read->CurrentContext && read->CurrentContext != ctx) { |
if (read->CurrentContext->Binding != t || |
read->CurrentContext->ClientAPI != ctx->ClientAPI) |
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); |
} |
/* simply require the configs to be equal */ |
if ((draw && draw->Config != ctx->Config) || |
(read && read->Config != ctx->Config)) |
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); |
switch (ctx->ClientAPI) { |
/* OpenGL and OpenGL ES are conflicting */ |
case EGL_OPENGL_ES_API: |
conflict_api = EGL_OPENGL_API; |
break; |
case EGL_OPENGL_API: |
conflict_api = EGL_OPENGL_ES_API; |
break; |
default: |
conflict_api = -1; |
break; |
} |
if (conflict_api >= 0 && _eglGetAPIContext(conflict_api)) |
return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); |
return EGL_TRUE; |
} |
/** |
* Bind the context to the current thread and given surfaces. Return the |
* previous bound context and surfaces. The caller should unreference the |
* returned context and surfaces. |
* |
* Making a second call with the resources returned by the first call |
* unsurprisingly undoes the first call, except for the resouce reference |
* counts. |
*/ |
EGLBoolean |
_eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read, |
_EGLContext **old_ctx, |
_EGLSurface **old_draw, _EGLSurface **old_read) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
_EGLContext *prev_ctx; |
_EGLSurface *prev_draw, *prev_read; |
printf("%s\n",__FUNCTION__); |
if (!_eglCheckMakeCurrent(ctx, draw, read)) |
return EGL_FALSE; |
/* increment refcounts before binding */ |
_eglGetContext(ctx); |
_eglGetSurface(draw); |
_eglGetSurface(read); |
/* bind the new context */ |
prev_ctx = _eglBindContextToThread(ctx, t); |
/* break previous bindings */ |
if (prev_ctx) { |
prev_draw = prev_ctx->DrawSurface; |
prev_read = prev_ctx->ReadSurface; |
if (prev_draw) |
prev_draw->CurrentContext = NULL; |
if (prev_read) |
prev_read->CurrentContext = NULL; |
prev_ctx->DrawSurface = NULL; |
prev_ctx->ReadSurface = NULL; |
} |
else { |
prev_draw = prev_read = NULL; |
} |
/* establish new bindings */ |
if (ctx) { |
if (draw) |
draw->CurrentContext = ctx; |
if (read) |
read->CurrentContext = ctx; |
ctx->DrawSurface = draw; |
ctx->ReadSurface = read; |
} |
assert(old_ctx && old_draw && old_read); |
*old_ctx = prev_ctx; |
*old_draw = prev_draw; |
*old_read = prev_read; |
printf("leave %s\n",__FUNCTION__); |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglcontext.h |
---|
0,0 → 1,152 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLCONTEXT_INCLUDED |
#define EGLCONTEXT_INCLUDED |
#include "egltypedefs.h" |
#include "egldisplay.h" |
/** |
* "Base" class for device driver contexts. |
*/ |
struct _egl_context |
{ |
/* A context is a display resource */ |
_EGLResource Resource; |
/* The bound status of the context */ |
_EGLThreadInfo *Binding; |
_EGLSurface *DrawSurface; |
_EGLSurface *ReadSurface; |
_EGLConfig *Config; |
EGLint ClientAPI; /**< EGL_OPENGL_ES_API, EGL_OPENGL_API, EGL_OPENVG_API */ |
EGLint ClientMajorVersion; |
EGLint ClientMinorVersion; |
EGLint Flags; |
EGLint Profile; |
EGLint ResetNotificationStrategy; |
/* The real render buffer when a window surface is bound */ |
EGLint WindowRenderBuffer; |
}; |
PUBLIC EGLBoolean |
_eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, |
_EGLConfig *config, const EGLint *attrib_list); |
extern EGLBoolean |
_eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value); |
PUBLIC EGLBoolean |
_eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read, |
_EGLContext **old_ctx, |
_EGLSurface **old_draw, _EGLSurface **old_read); |
/** |
* Increment reference count for the context. |
*/ |
static INLINE _EGLContext * |
_eglGetContext(_EGLContext *ctx) |
{ |
if (ctx) |
_eglGetResource(&ctx->Resource); |
return ctx; |
} |
/** |
* Decrement reference count for the context. |
*/ |
static INLINE EGLBoolean |
_eglPutContext(_EGLContext *ctx) |
{ |
return (ctx) ? _eglPutResource(&ctx->Resource) : EGL_FALSE; |
} |
/** |
* Link a context to its display and return the handle of the link. |
* The handle can be passed to client directly. |
*/ |
static INLINE EGLContext |
_eglLinkContext(_EGLContext *ctx) |
{ |
_eglLinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT); |
return (EGLContext) ctx; |
} |
/** |
* Unlink a linked context from its display. |
* Accessing an unlinked context should generate EGL_BAD_CONTEXT error. |
*/ |
static INLINE void |
_eglUnlinkContext(_EGLContext *ctx) |
{ |
_eglUnlinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT); |
} |
/** |
* Lookup a handle to find the linked context. |
* Return NULL if the handle has no corresponding linked context. |
*/ |
static INLINE _EGLContext * |
_eglLookupContext(EGLContext context, _EGLDisplay *dpy) |
{ |
_EGLContext *ctx = (_EGLContext *) context; |
if (!dpy || !_eglCheckResource((void *) ctx, _EGL_RESOURCE_CONTEXT, dpy)) |
ctx = NULL; |
return ctx; |
} |
/** |
* Return the handle of a linked context, or EGL_NO_CONTEXT. |
*/ |
static INLINE EGLContext |
_eglGetContextHandle(_EGLContext *ctx) |
{ |
_EGLResource *res = (_EGLResource *) ctx; |
return (res && _eglIsResourceLinked(res)) ? |
(EGLContext) ctx : EGL_NO_CONTEXT; |
} |
#endif /* EGLCONTEXT_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglcurrent.c |
---|
0,0 → 1,335 |
/************************************************************************** |
* |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* 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. |
* |
**************************************************************************/ |
#include <stdlib.h> |
#include <string.h> |
#include "egllog.h" |
#include "eglmutex.h" |
#include "eglcurrent.h" |
#include "eglglobals.h" |
/* This should be kept in sync with _eglInitThreadInfo() */ |
#define _EGL_THREAD_INFO_INITIALIZER \ |
{ EGL_SUCCESS, { NULL }, 0 } |
/* a fallback thread info to guarantee that every thread always has one */ |
static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER; |
#if HAVE_PTHREAD |
#include <pthread.h> |
static _EGL_DECLARE_MUTEX(_egl_TSDMutex); |
static EGLBoolean _egl_TSDInitialized; |
static pthread_key_t _egl_TSD; |
static void (*_egl_FreeTSD)(_EGLThreadInfo *); |
#ifdef GLX_USE_TLS |
static __thread const _EGLThreadInfo *_egl_TLS |
__attribute__ ((tls_model("initial-exec"))); |
#endif |
static INLINE void _eglSetTSD(const _EGLThreadInfo *t) |
{ |
pthread_setspecific(_egl_TSD, (const void *) t); |
#ifdef GLX_USE_TLS |
_egl_TLS = t; |
#endif |
} |
static INLINE _EGLThreadInfo *_eglGetTSD(void) |
{ |
#ifdef GLX_USE_TLS |
return (_EGLThreadInfo *) _egl_TLS; |
#else |
return (_EGLThreadInfo *) pthread_getspecific(_egl_TSD); |
#endif |
} |
static INLINE void _eglFiniTSD(void) |
{ |
_eglLockMutex(&_egl_TSDMutex); |
if (_egl_TSDInitialized) { |
_EGLThreadInfo *t = _eglGetTSD(); |
_egl_TSDInitialized = EGL_FALSE; |
if (t && _egl_FreeTSD) |
_egl_FreeTSD((void *) t); |
pthread_key_delete(_egl_TSD); |
} |
_eglUnlockMutex(&_egl_TSDMutex); |
} |
static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *)) |
{ |
if (!_egl_TSDInitialized) { |
_eglLockMutex(&_egl_TSDMutex); |
/* check again after acquiring lock */ |
if (!_egl_TSDInitialized) { |
if (pthread_key_create(&_egl_TSD, (void (*)(void *)) dtor) != 0) { |
_eglUnlockMutex(&_egl_TSDMutex); |
return EGL_FALSE; |
} |
_egl_FreeTSD = dtor; |
_eglAddAtExitCall(_eglFiniTSD); |
_egl_TSDInitialized = EGL_TRUE; |
} |
_eglUnlockMutex(&_egl_TSDMutex); |
} |
return EGL_TRUE; |
} |
#else /* HAVE_PTHREAD */ |
static const _EGLThreadInfo *_egl_TSD; |
static void (*_egl_FreeTSD)(_EGLThreadInfo *); |
static INLINE void _eglSetTSD(const _EGLThreadInfo *t) |
{ |
_egl_TSD = t; |
} |
static INLINE _EGLThreadInfo *_eglGetTSD(void) |
{ |
return (_EGLThreadInfo *) _egl_TSD; |
} |
static INLINE void _eglFiniTSD(void) |
{ |
if (_egl_FreeTSD && _egl_TSD) |
_egl_FreeTSD((_EGLThreadInfo *) _egl_TSD); |
} |
static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *)) |
{ |
if (!_egl_FreeTSD && dtor) { |
_egl_FreeTSD = dtor; |
_eglAddAtExitCall(_eglFiniTSD); |
} |
return EGL_TRUE; |
} |
#endif /* !HAVE_PTHREAD */ |
static void |
_eglInitThreadInfo(_EGLThreadInfo *t) |
{ |
memset(t, 0, sizeof(*t)); |
t->LastError = EGL_SUCCESS; |
/* default, per EGL spec */ |
t->CurrentAPIIndex = _eglConvertApiToIndex(EGL_OPENGL_ES_API); |
} |
/** |
* Allocate and init a new _EGLThreadInfo object. |
*/ |
static _EGLThreadInfo * |
_eglCreateThreadInfo(void) |
{ |
_EGLThreadInfo *t = calloc(1, sizeof(_EGLThreadInfo)); |
if (t) |
_eglInitThreadInfo(t); |
else |
t = &dummy_thread; |
return t; |
} |
/** |
* Delete/free a _EGLThreadInfo object. |
*/ |
static void |
_eglDestroyThreadInfo(_EGLThreadInfo *t) |
{ |
if (t != &dummy_thread) |
free(t); |
} |
/** |
* Make sure TSD is initialized and return current value. |
*/ |
static INLINE _EGLThreadInfo * |
_eglCheckedGetTSD(void) |
{ |
if (_eglInitTSD(&_eglDestroyThreadInfo) != EGL_TRUE) { |
_eglLog(_EGL_FATAL, "failed to initialize \"current\" system"); |
return NULL; |
} |
return _eglGetTSD(); |
} |
/** |
* Return the calling thread's thread info. |
* If the calling thread nevers calls this function before, or if its thread |
* info was destroyed, a new one is created. This function never returns NULL. |
* In the case allocation fails, a dummy one is returned. See also |
* _eglIsCurrentThreadDummy. |
*/ |
_EGLThreadInfo * |
_eglGetCurrentThread(void) |
{ |
_EGLThreadInfo *t = _eglCheckedGetTSD(); |
if (!t) { |
t = _eglCreateThreadInfo(); |
_eglSetTSD(t); |
} |
return t; |
} |
/** |
* Destroy the calling thread's thread info. |
*/ |
void |
_eglDestroyCurrentThread(void) |
{ |
_EGLThreadInfo *t = _eglCheckedGetTSD(); |
if (t) { |
_eglDestroyThreadInfo(t); |
_eglSetTSD(NULL); |
} |
} |
/** |
* Return true if the calling thread's thread info is dummy. |
* A dummy thread info is shared by all threads and should not be modified. |
* Functions like eglBindAPI or eglMakeCurrent should check for dummy-ness |
* before updating the thread info. |
*/ |
EGLBoolean |
_eglIsCurrentThreadDummy(void) |
{ |
_EGLThreadInfo *t = _eglCheckedGetTSD(); |
return (!t || t == &dummy_thread); |
} |
/** |
* Return the currently bound context of the given API, or NULL. |
*/ |
PUBLIC _EGLContext * |
_eglGetAPIContext(EGLenum api) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
return t->CurrentContexts[_eglConvertApiToIndex(api)]; |
} |
/** |
* Return the currently bound context of the current API, or NULL. |
*/ |
_EGLContext * |
_eglGetCurrentContext(void) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
return t->CurrentContexts[t->CurrentAPIIndex]; |
} |
/** |
* Record EGL error code and return EGL_FALSE. |
*/ |
EGLBoolean |
_eglError(EGLint errCode, const char *msg) |
{ |
_EGLThreadInfo *t = _eglGetCurrentThread(); |
if (t == &dummy_thread) |
return EGL_FALSE; |
t->LastError = errCode; |
if (errCode != EGL_SUCCESS) { |
const char *s; |
switch (errCode) { |
case EGL_BAD_ACCESS: |
s = "EGL_BAD_ACCESS"; |
break; |
case EGL_BAD_ALLOC: |
s = "EGL_BAD_ALLOC"; |
break; |
case EGL_BAD_ATTRIBUTE: |
s = "EGL_BAD_ATTRIBUTE"; |
break; |
case EGL_BAD_CONFIG: |
s = "EGL_BAD_CONFIG"; |
break; |
case EGL_BAD_CONTEXT: |
s = "EGL_BAD_CONTEXT"; |
break; |
case EGL_BAD_CURRENT_SURFACE: |
s = "EGL_BAD_CURRENT_SURFACE"; |
break; |
case EGL_BAD_DISPLAY: |
s = "EGL_BAD_DISPLAY"; |
break; |
case EGL_BAD_MATCH: |
s = "EGL_BAD_MATCH"; |
break; |
case EGL_BAD_NATIVE_PIXMAP: |
s = "EGL_BAD_NATIVE_PIXMAP"; |
break; |
case EGL_BAD_NATIVE_WINDOW: |
s = "EGL_BAD_NATIVE_WINDOW"; |
break; |
case EGL_BAD_PARAMETER: |
s = "EGL_BAD_PARAMETER"; |
break; |
case EGL_BAD_SURFACE: |
s = "EGL_BAD_SURFACE"; |
break; |
case EGL_NOT_INITIALIZED: |
s = "EGL_NOT_INITIALIZED"; |
break; |
#ifdef EGL_MESA_screen_surface |
case EGL_BAD_SCREEN_MESA: |
s = "EGL_BAD_SCREEN_MESA"; |
break; |
case EGL_BAD_MODE_MESA: |
s = "EGL_BAD_MODE_MESA"; |
break; |
#endif |
default: |
s = "other EGL error"; |
} |
_eglLog(_EGL_DEBUG, "EGL user error 0x%x (%s) in %s\n", errCode, s, msg); |
} |
return EGL_FALSE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglcurrent.h |
---|
0,0 → 1,117 |
/************************************************************************** |
* |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLCURRENT_INCLUDED |
#define EGLCURRENT_INCLUDED |
#include "egltypedefs.h" |
#define _EGL_API_ALL_BITS \ |
(EGL_OPENGL_ES_BIT | \ |
EGL_OPENVG_BIT | \ |
EGL_OPENGL_ES2_BIT | \ |
EGL_OPENGL_ES3_BIT_KHR | \ |
EGL_OPENGL_BIT) |
#define _EGL_API_FIRST_API EGL_OPENGL_ES_API |
#define _EGL_API_LAST_API EGL_OPENGL_API |
#define _EGL_API_NUM_APIS (_EGL_API_LAST_API - _EGL_API_FIRST_API + 1) |
/** |
* Per-thread info |
*/ |
struct _egl_thread_info |
{ |
EGLint LastError; |
_EGLContext *CurrentContexts[_EGL_API_NUM_APIS]; |
/* use index for fast access to current context */ |
EGLint CurrentAPIIndex; |
}; |
/** |
* Return true if a client API enum is recognized. |
*/ |
static INLINE EGLBoolean |
_eglIsApiValid(EGLenum api) |
{ |
return (api >= _EGL_API_FIRST_API && api <= _EGL_API_LAST_API); |
} |
/** |
* Convert a client API enum to an index, for use by thread info. |
* The client API enum is assumed to be valid. |
*/ |
static INLINE EGLint |
_eglConvertApiToIndex(EGLenum api) |
{ |
return api - _EGL_API_FIRST_API; |
} |
/** |
* Convert an index, used by thread info, to a client API enum. |
* The index is assumed to be valid. |
*/ |
static INLINE EGLenum |
_eglConvertApiFromIndex(EGLint idx) |
{ |
return _EGL_API_FIRST_API + idx; |
} |
PUBLIC _EGLThreadInfo * |
_eglGetCurrentThread(void); |
extern void |
_eglDestroyCurrentThread(void); |
extern EGLBoolean |
_eglIsCurrentThreadDummy(void); |
PUBLIC _EGLContext * |
_eglGetAPIContext(EGLenum api); |
PUBLIC _EGLContext * |
_eglGetCurrentContext(void); |
PUBLIC EGLBoolean |
_eglError(EGLint errCode, const char *msg); |
#endif /* EGLCURRENT_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/egldefines.h |
---|
0,0 → 1,45 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* 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. |
* |
**************************************************************************/ |
/** |
* Internal EGL defines |
*/ |
#ifndef EGLDEFINES_INCLUDED |
#define EGLDEFINES_INCLUDED |
#define _EGL_MAX_EXTENSIONS_LEN 1000 |
#define _EGL_VENDOR_STRING "Mesa Project" |
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
#endif /* EGLDEFINES_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/egldisplay.c |
---|
0,0 → 1,393 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* Functions related to EGLDisplay. |
*/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#include "eglcontext.h" |
#include "eglsurface.h" |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "eglglobals.h" |
#include "eglmutex.h" |
#include "egllog.h" |
/* Includes for _eglNativePlatformDetectNativeDisplay */ |
#ifdef HAVE_MINCORE |
#include <unistd.h> |
#include <sys/mman.h> |
#endif |
#ifdef HAVE_WAYLAND_PLATFORM |
#include <wayland-client.h> |
#endif |
#ifdef HAVE_DRM_PLATFORM |
#include <gbm.h> |
#endif |
#ifdef HAVE_FBDEV_PLATFORM |
#include <stdint.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#endif |
/** |
* Map --with-egl-platforms names to platform types. |
*/ |
static const struct { |
_EGLPlatformType platform; |
const char *name; |
} egl_platforms[_EGL_NUM_PLATFORMS] = { |
{ _EGL_PLATFORM_DRM, "drm" } |
}; |
/** |
* Return the native platform by parsing EGL_PLATFORM. |
*/ |
static _EGLPlatformType |
_eglGetNativePlatformFromEnv(void) |
{ |
_EGLPlatformType plat = _EGL_INVALID_PLATFORM; |
const char *plat_name; |
EGLint i; |
plat_name = getenv("EGL_PLATFORM"); |
/* try deprecated env variable */ |
if (!plat_name || !plat_name[0]) |
plat_name = getenv("EGL_DISPLAY"); |
if (!plat_name || !plat_name[0]) |
return _EGL_INVALID_PLATFORM; |
for (i = 0; i < _EGL_NUM_PLATFORMS; i++) { |
if (strcmp(egl_platforms[i].name, plat_name) == 0) { |
plat = egl_platforms[i].platform; |
break; |
} |
} |
return plat; |
} |
/** |
* Perform validity checks on a generic pointer. |
*/ |
static EGLBoolean |
_eglPointerIsDereferencable(void *p) |
{ |
#ifdef HAVE_MINCORE |
uintptr_t addr = (uintptr_t) p; |
unsigned char valid = 0; |
const long page_size = getpagesize(); |
if (p == NULL) |
return EGL_FALSE; |
/* align addr to page_size */ |
addr &= ~(page_size - 1); |
if (mincore((void *) addr, page_size, &valid) < 0) { |
_eglLog(_EGL_DEBUG, "mincore failed: %m"); |
return EGL_FALSE; |
} |
return (valid & 0x01) == 0x01; |
#else |
return p != NULL; |
#endif |
} |
/** |
* Try detecting native platform with the help of native display characteristcs. |
*/ |
static _EGLPlatformType |
_eglNativePlatformDetectNativeDisplay(EGLNativeDisplayType nativeDisplay) |
{ |
return _EGL_PLATFORM_DRM; |
} |
/** |
* Return the native platform. It is the platform of the EGL native types. |
*/ |
_EGLPlatformType |
_eglGetNativePlatform(EGLNativeDisplayType nativeDisplay) |
{ |
return _EGL_PLATFORM_DRM; |
} |
/** |
* Finish display management. |
*/ |
void |
_eglFiniDisplay(void) |
{ |
_EGLDisplay *dpyList, *dpy; |
/* atexit function is called with global mutex locked */ |
dpyList = _eglGlobal.DisplayList; |
while (dpyList) { |
EGLint i; |
/* pop list head */ |
dpy = dpyList; |
dpyList = dpyList->Next; |
for (i = 0; i < _EGL_NUM_RESOURCES; i++) { |
if (dpy->ResourceLists[i]) { |
_eglLog(_EGL_DEBUG, "Display %p is destroyed with resources", dpy); |
break; |
} |
} |
free(dpy); |
} |
_eglGlobal.DisplayList = NULL; |
} |
/** |
* Find the display corresponding to the specified native display, or create a |
* new one. |
*/ |
_EGLDisplay * |
_eglFindDisplay(_EGLPlatformType plat, void *plat_dpy) |
{ |
_EGLDisplay *dpy; |
if (plat == _EGL_INVALID_PLATFORM) |
return NULL; |
_eglLockMutex(_eglGlobal.Mutex); |
/* search the display list first */ |
dpy = _eglGlobal.DisplayList; |
while (dpy) { |
if (dpy->Platform == plat && dpy->PlatformDisplay == plat_dpy) |
break; |
dpy = dpy->Next; |
} |
/* create a new display */ |
if (!dpy) { |
dpy = calloc(1, sizeof(_EGLDisplay)); |
if (dpy) { |
_eglInitMutex(&dpy->Mutex); |
dpy->Platform = plat; |
dpy->PlatformDisplay = plat_dpy; |
/* add to the display list */ |
dpy->Next = _eglGlobal.DisplayList; |
_eglGlobal.DisplayList = dpy; |
} |
} |
_eglUnlockMutex(_eglGlobal.Mutex); |
return dpy; |
} |
/** |
* Destroy the contexts and surfaces that are linked to the display. |
*/ |
void |
_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) |
{ |
_EGLResource *list; |
list = display->ResourceLists[_EGL_RESOURCE_CONTEXT]; |
while (list) { |
_EGLContext *ctx = (_EGLContext *) list; |
list = list->Next; |
_eglUnlinkContext(ctx); |
drv->API.DestroyContext(drv, display, ctx); |
} |
assert(!display->ResourceLists[_EGL_RESOURCE_CONTEXT]); |
list = display->ResourceLists[_EGL_RESOURCE_SURFACE]; |
while (list) { |
_EGLSurface *surf = (_EGLSurface *) list; |
list = list->Next; |
_eglUnlinkSurface(surf); |
drv->API.DestroySurface(drv, display, surf); |
} |
assert(!display->ResourceLists[_EGL_RESOURCE_SURFACE]); |
} |
/** |
* Free all the data hanging of an _EGLDisplay object, but not |
* the object itself. |
*/ |
void |
_eglCleanupDisplay(_EGLDisplay *disp) |
{ |
if (disp->Configs) { |
_eglDestroyArray(disp->Configs, free); |
disp->Configs = NULL; |
} |
/* XXX incomplete */ |
} |
/** |
* Return EGL_TRUE if the given handle is a valid handle to a display. |
*/ |
EGLBoolean |
_eglCheckDisplayHandle(EGLDisplay dpy) |
{ |
_EGLDisplay *cur; |
_eglLockMutex(_eglGlobal.Mutex); |
cur = _eglGlobal.DisplayList; |
while (cur) { |
if (cur == (_EGLDisplay *) dpy) |
break; |
cur = cur->Next; |
} |
_eglUnlockMutex(_eglGlobal.Mutex); |
return (cur != NULL); |
} |
/** |
* Return EGL_TRUE if the given resource is valid. That is, the display does |
* own the resource. |
*/ |
EGLBoolean |
_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy) |
{ |
_EGLResource *list = dpy->ResourceLists[type]; |
if (!res) |
return EGL_FALSE; |
while (list) { |
if (res == (void *) list) { |
assert(list->Display == dpy); |
break; |
} |
list = list->Next; |
} |
return (list != NULL); |
} |
/** |
* Initialize a display resource. |
*/ |
void |
_eglInitResource(_EGLResource *res, EGLint size, _EGLDisplay *dpy) |
{ |
memset(res, 0, size); |
res->Display = dpy; |
res->RefCount = 1; |
} |
/** |
* Increment reference count for the resource. |
*/ |
void |
_eglGetResource(_EGLResource *res) |
{ |
assert(res && res->RefCount > 0); |
/* hopefully a resource is always manipulated with its display locked */ |
res->RefCount++; |
} |
/** |
* Decrement reference count for the resource. |
*/ |
EGLBoolean |
_eglPutResource(_EGLResource *res) |
{ |
assert(res && res->RefCount > 0); |
res->RefCount--; |
return (!res->RefCount); |
} |
/** |
* Link a resource to its display. |
*/ |
void |
_eglLinkResource(_EGLResource *res, _EGLResourceType type) |
{ |
assert(res->Display); |
res->IsLinked = EGL_TRUE; |
res->Next = res->Display->ResourceLists[type]; |
res->Display->ResourceLists[type] = res; |
_eglGetResource(res); |
} |
/** |
* Unlink a linked resource from its display. |
*/ |
void |
_eglUnlinkResource(_EGLResource *res, _EGLResourceType type) |
{ |
_EGLResource *prev; |
prev = res->Display->ResourceLists[type]; |
if (prev != res) { |
while (prev) { |
if (prev->Next == res) |
break; |
prev = prev->Next; |
} |
assert(prev); |
prev->Next = res->Next; |
} |
else { |
res->Display->ResourceLists[type] = res->Next; |
} |
res->Next = NULL; |
res->IsLinked = EGL_FALSE; |
_eglPutResource(res); |
/* We always unlink before destroy. The driver still owns a reference */ |
assert(res->RefCount); |
} |
/contrib/sdk/sources/Mesa/src/egl/main/egldisplay.c.bak |
---|
0,0 → 1,395 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* Functions related to EGLDisplay. |
*/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#include "eglcontext.h" |
#include "eglsurface.h" |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "eglglobals.h" |
#include "eglmutex.h" |
#include "egllog.h" |
/* Includes for _eglNativePlatformDetectNativeDisplay */ |
#ifdef HAVE_MINCORE |
#include <unistd.h> |
#include <sys/mman.h> |
#endif |
#ifdef HAVE_WAYLAND_PLATFORM |
#include <wayland-client.h> |
#endif |
#ifdef HAVE_DRM_PLATFORM |
#include <gbm.h> |
#endif |
#ifdef HAVE_FBDEV_PLATFORM |
#include <stdint.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#endif |
/** |
* Map --with-egl-platforms names to platform types. |
*/ |
static const struct { |
_EGLPlatformType platform; |
const char *name; |
} egl_platforms[_EGL_NUM_PLATFORMS] = { |
{ _EGL_PLATFORM_DRM, "drm" } |
}; |
/** |
* Return the native platform by parsing EGL_PLATFORM. |
*/ |
static _EGLPlatformType |
_eglGetNativePlatformFromEnv(void) |
{ |
_EGLPlatformType plat = _EGL_INVALID_PLATFORM; |
const char *plat_name; |
EGLint i; |
plat_name = getenv("EGL_PLATFORM"); |
/* try deprecated env variable */ |
if (!plat_name || !plat_name[0]) |
plat_name = getenv("EGL_DISPLAY"); |
if (!plat_name || !plat_name[0]) |
return _EGL_INVALID_PLATFORM; |
for (i = 0; i < _EGL_NUM_PLATFORMS; i++) { |
if (strcmp(egl_platforms[i].name, plat_name) == 0) { |
plat = egl_platforms[i].platform; |
break; |
} |
} |
return plat; |
} |
/** |
* Perform validity checks on a generic pointer. |
*/ |
static EGLBoolean |
_eglPointerIsDereferencable(void *p) |
{ |
#ifdef HAVE_MINCORE |
uintptr_t addr = (uintptr_t) p; |
unsigned char valid = 0; |
const long page_size = getpagesize(); |
if (p == NULL) |
return EGL_FALSE; |
/* align addr to page_size */ |
addr &= ~(page_size - 1); |
if (mincore((void *) addr, page_size, &valid) < 0) { |
_eglLog(_EGL_DEBUG, "mincore failed: %m"); |
return EGL_FALSE; |
} |
return (valid & 0x01) == 0x01; |
#else |
return p != NULL; |
#endif |
} |
/** |
* Try detecting native platform with the help of native display characteristcs. |
*/ |
static _EGLPlatformType |
_eglNativePlatformDetectNativeDisplay(EGLNativeDisplayType nativeDisplay) |
{ |
return _EGL_PLATFORM_DRM; |
} |
/** |
* Return the native platform. It is the platform of the EGL native types. |
*/ |
_EGLPlatformType |
_eglGetNativePlatform(EGLNativeDisplayType nativeDisplay) |
{ |
return _EGL_PLATFORM_DRM; |
} |
/** |
* Finish display management. |
*/ |
void |
_eglFiniDisplay(void) |
{ |
_EGLDisplay *dpyList, *dpy; |
/* atexit function is called with global mutex locked */ |
dpyList = _eglGlobal.DisplayList; |
while (dpyList) { |
EGLint i; |
/* pop list head */ |
dpy = dpyList; |
dpyList = dpyList->Next; |
for (i = 0; i < _EGL_NUM_RESOURCES; i++) { |
if (dpy->ResourceLists[i]) { |
_eglLog(_EGL_DEBUG, "Display %p is destroyed with resources", dpy); |
break; |
} |
} |
free(dpy); |
} |
_eglGlobal.DisplayList = NULL; |
} |
/** |
* Find the display corresponding to the specified native display, or create a |
* new one. |
*/ |
_EGLDisplay * |
_eglFindDisplay(_EGLPlatformType plat, void *plat_dpy) |
{ |
_EGLDisplay *dpy; |
if (plat == _EGL_INVALID_PLATFORM) |
return NULL; |
_eglLockMutex(_eglGlobal.Mutex); |
/* search the display list first */ |
dpy = _eglGlobal.DisplayList; |
while (dpy) { |
if (dpy->Platform == plat && dpy->PlatformDisplay == plat_dpy) |
break; |
dpy = dpy->Next; |
} |
/* create a new display */ |
if (!dpy) { |
dpy = calloc(1, sizeof(_EGLDisplay)); |
if (dpy) { |
_eglInitMutex(&dpy->Mutex); |
dpy->Platform = plat; |
dpy->PlatformDisplay = plat_dpy; |
/* add to the display list */ |
dpy->Next = _eglGlobal.DisplayList; |
_eglGlobal.DisplayList = dpy; |
} |
} |
_eglUnlockMutex(_eglGlobal.Mutex); |
return dpy; |
} |
/** |
* Destroy the contexts and surfaces that are linked to the display. |
*/ |
void |
_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) |
{ |
_EGLResource *list; |
list = display->ResourceLists[_EGL_RESOURCE_CONTEXT]; |
while (list) { |
_EGLContext *ctx = (_EGLContext *) list; |
list = list->Next; |
_eglUnlinkContext(ctx); |
drv->API.DestroyContext(drv, display, ctx); |
} |
assert(!display->ResourceLists[_EGL_RESOURCE_CONTEXT]); |
list = display->ResourceLists[_EGL_RESOURCE_SURFACE]; |
while (list) { |
_EGLSurface *surf = (_EGLSurface *) list; |
list = list->Next; |
_eglUnlinkSurface(surf); |
drv->API.DestroySurface(drv, display, surf); |
} |
assert(!display->ResourceLists[_EGL_RESOURCE_SURFACE]); |
} |
/** |
* Free all the data hanging of an _EGLDisplay object, but not |
* the object itself. |
*/ |
void |
_eglCleanupDisplay(_EGLDisplay *disp) |
{ |
if (disp->Configs) { |
_eglDestroyArray(disp->Configs, free); |
disp->Configs = NULL; |
} |
/* XXX incomplete */ |
} |
/** |
* Return EGL_TRUE if the given handle is a valid handle to a display. |
*/ |
EGLBoolean |
_eglCheckDisplayHandle(EGLDisplay dpy) |
{ |
_EGLDisplay *cur; |
_eglLockMutex(_eglGlobal.Mutex); |
cur = _eglGlobal.DisplayList; |
while (cur) { |
if (cur == (_EGLDisplay *) dpy) |
break; |
cur = cur->Next; |
} |
_eglUnlockMutex(_eglGlobal.Mutex); |
return (cur != NULL); |
} |
/** |
* Return EGL_TRUE if the given resource is valid. That is, the display does |
* own the resource. |
*/ |
EGLBoolean |
_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy) |
{ |
_EGLResource *list = dpy->ResourceLists[type]; |
if (!res) |
return EGL_FALSE; |
while (list) { |
if (res == (void *) list) { |
assert(list->Display == dpy); |
break; |
} |
list = list->Next; |
} |
return (list != NULL); |
} |
/** |
* Initialize a display resource. |
*/ |
void |
_eglInitResource(_EGLResource *res, EGLint size, _EGLDisplay *dpy) |
{ |
memset(res, 0, size); |
res->Display = dpy; |
res->RefCount = 1; |
} |
/** |
* Increment reference count for the resource. |
*/ |
void |
_eglGetResource(_EGLResource *res) |
{ |
assert(res && res->RefCount > 0); |
/* hopefully a resource is always manipulated with its display locked */ |
res->RefCount++; |
} |
/** |
* Decrement reference count for the resource. |
*/ |
EGLBoolean |
_eglPutResource(_EGLResource *res) |
{ |
assert(res && res->RefCount > 0); |
res->RefCount--; |
return (!res->RefCount); |
} |
/** |
* Link a resource to its display. |
*/ |
void |
_eglLinkResource(_EGLResource *res, _EGLResourceType type) |
{ |
assert(res->Display); |
printf("%s Resource: %p\n", __FUNCTION__, res); |
res->IsLinked = EGL_TRUE; |
res->Next = res->Display->ResourceLists[type]; |
res->Display->ResourceLists[type] = res; |
_eglGetResource(res); |
} |
/** |
* Unlink a linked resource from its display. |
*/ |
void |
_eglUnlinkResource(_EGLResource *res, _EGLResourceType type) |
{ |
_EGLResource *prev; |
prev = res->Display->ResourceLists[type]; |
if (prev != res) { |
while (prev) { |
if (prev->Next == res) |
break; |
prev = prev->Next; |
} |
assert(prev); |
prev->Next = res->Next; |
} |
else { |
res->Display->ResourceLists[type] = res->Next; |
} |
res->Next = NULL; |
res->IsLinked = EGL_FALSE; |
_eglPutResource(res); |
/* We always unlink before destroy. The driver still owns a reference */ |
assert(res->RefCount); |
} |
/contrib/sdk/sources/Mesa/src/egl/main/egldisplay.h |
---|
0,0 → 1,237 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLDISPLAY_INCLUDED |
#define EGLDISPLAY_INCLUDED |
#include "egltypedefs.h" |
#include "egldefines.h" |
#include "eglmutex.h" |
#include "eglarray.h" |
enum _egl_platform_type { |
_EGL_PLATFORM_DRM, |
_EGL_NUM_PLATFORMS, |
_EGL_INVALID_PLATFORM = -1 |
}; |
typedef enum _egl_platform_type _EGLPlatformType; |
enum _egl_resource_type { |
_EGL_RESOURCE_CONTEXT, |
_EGL_RESOURCE_SURFACE, |
_EGL_RESOURCE_IMAGE, |
_EGL_RESOURCE_SYNC, |
_EGL_NUM_RESOURCES |
}; |
/* this cannot and need not go into egltypedefs.h */ |
typedef enum _egl_resource_type _EGLResourceType; |
/** |
* A resource of a display. |
*/ |
struct _egl_resource |
{ |
/* which display the resource belongs to */ |
_EGLDisplay *Display; |
EGLBoolean IsLinked; |
EGLint RefCount; |
/* used to link resources of the same type */ |
_EGLResource *Next; |
}; |
/** |
* Optional EGL extensions info. |
*/ |
struct _egl_extensions |
{ |
EGLBoolean MESA_screen_surface; |
EGLBoolean MESA_copy_context; |
EGLBoolean MESA_drm_display; |
EGLBoolean MESA_drm_image; |
EGLBoolean WL_bind_wayland_display; |
EGLBoolean KHR_image_base; |
EGLBoolean KHR_image_pixmap; |
EGLBoolean KHR_vg_parent_image; |
EGLBoolean KHR_gl_texture_2D_image; |
EGLBoolean KHR_gl_texture_cubemap_image; |
EGLBoolean KHR_gl_texture_3D_image; |
EGLBoolean KHR_gl_renderbuffer_image; |
EGLBoolean KHR_reusable_sync; |
EGLBoolean KHR_fence_sync; |
EGLBoolean KHR_surfaceless_context; |
EGLBoolean KHR_create_context; |
EGLBoolean NOK_swap_region; |
EGLBoolean NOK_texture_from_pixmap; |
EGLBoolean ANDROID_image_native_buffer; |
EGLBoolean NV_post_sub_buffer; |
EGLBoolean EXT_create_context_robustness; |
EGLBoolean EXT_buffer_age; |
EGLBoolean EXT_swap_buffers_with_damage; |
}; |
struct _egl_display |
{ |
/* used to link displays */ |
_EGLDisplay *Next; |
_EGLMutex Mutex; |
_EGLPlatformType Platform; /**< The type of the platform display */ |
void *PlatformDisplay; /**< A pointer to the platform display */ |
_EGLDriver *Driver; /**< Matched driver of the display */ |
EGLBoolean Initialized; /**< True if the display is initialized */ |
/* options that affect how the driver initializes the display */ |
struct { |
EGLBoolean TestOnly; /**< Driver should not set fields when true */ |
EGLBoolean UseFallback; /**< Use fallback driver (sw or less features) */ |
} Options; |
/* these fields are set by the driver during init */ |
void *DriverData; /**< Driver private data */ |
EGLint VersionMajor; /**< EGL major version */ |
EGLint VersionMinor; /**< EGL minor version */ |
EGLint ClientAPIs; /**< Bitmask of APIs supported (EGL_xxx_BIT) */ |
_EGLExtensions Extensions; /**< Extensions supported */ |
/* these fields are derived from above */ |
char VersionString[1000]; /**< EGL_VERSION */ |
char ClientAPIsString[1000]; /**< EGL_CLIENT_APIS */ |
char ExtensionsString[_EGL_MAX_EXTENSIONS_LEN]; /**< EGL_EXTENSIONS */ |
_EGLArray *Screens; |
_EGLArray *Configs; |
/* lists of resources */ |
_EGLResource *ResourceLists[_EGL_NUM_RESOURCES]; |
}; |
extern _EGLPlatformType |
_eglGetNativePlatform(EGLNativeDisplayType nativeDisplay); |
extern void |
_eglFiniDisplay(void); |
extern _EGLDisplay * |
_eglFindDisplay(_EGLPlatformType plat, void *plat_dpy); |
PUBLIC void |
_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *dpy); |
PUBLIC void |
_eglCleanupDisplay(_EGLDisplay *disp); |
extern EGLBoolean |
_eglCheckDisplayHandle(EGLDisplay dpy); |
PUBLIC EGLBoolean |
_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy); |
/** |
* Lookup a handle to find the linked display. |
* Return NULL if the handle has no corresponding linked display. |
*/ |
static INLINE _EGLDisplay * |
_eglLookupDisplay(EGLDisplay display) |
{ |
_EGLDisplay *dpy = (_EGLDisplay *) display; |
if (!_eglCheckDisplayHandle(display)) |
dpy = NULL; |
return dpy; |
} |
/** |
* Return the handle of a linked display, or EGL_NO_DISPLAY. |
*/ |
static INLINE EGLDisplay |
_eglGetDisplayHandle(_EGLDisplay *dpy) |
{ |
return (EGLDisplay) ((dpy) ? dpy : EGL_NO_DISPLAY); |
} |
extern void |
_eglInitResource(_EGLResource *res, EGLint size, _EGLDisplay *dpy); |
PUBLIC void |
_eglGetResource(_EGLResource *res); |
PUBLIC EGLBoolean |
_eglPutResource(_EGLResource *res); |
extern void |
_eglLinkResource(_EGLResource *res, _EGLResourceType type); |
extern void |
_eglUnlinkResource(_EGLResource *res, _EGLResourceType type); |
/** |
* Return true if the resource is linked. |
*/ |
static INLINE EGLBoolean |
_eglIsResourceLinked(_EGLResource *res) |
{ |
return res->IsLinked; |
} |
#endif /* EGLDISPLAY_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/egldriver.c |
---|
0,0 → 1,690 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* Functions for choosing and opening/loading device drivers. |
*/ |
#include <assert.h> |
#include <string.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include "eglstring.h" |
#include "egldefines.h" |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "egllog.h" |
#include "eglmutex.h" |
typedef unsigned int lib_handle; |
lib_handle load_library(const char *name); |
void *get_proc_address(lib_handle lib, char *proc_name); |
typedef struct _egl_module { |
char *Path; |
_EGLMain_t BuiltIn; |
void *Handle; |
_EGLDriver *Driver; |
} _EGLModule; |
static _EGL_DECLARE_MUTEX(_eglModuleMutex); |
static _EGLArray *_eglModules; |
const struct { |
const char *name; |
_EGLMain_t main; |
} _eglBuiltInDrivers[] = { |
#ifdef _EGL_BUILT_IN_DRIVER_GALLIUM |
{ "egl_gallium", _eglBuiltInDriverGALLIUM }, |
#endif |
#ifdef _EGL_BUILT_IN_DRIVER_DRI2 |
{ "egl_dri2", _eglBuiltInDriverDRI2 }, |
#endif |
#ifdef _EGL_BUILT_IN_DRIVER_GLX |
{ "egl_glx", _eglBuiltInDriverGLX }, |
#endif |
{ NULL, NULL } |
}; |
/** |
* Wrappers for dlopen/dlclose() |
*/ |
#if defined(_EGL_OS_WINDOWS) |
typedef HMODULE lib_handle; |
static HMODULE |
open_library(const char *filename) |
{ |
return LoadLibrary(filename); |
} |
static void |
close_library(HMODULE lib) |
{ |
FreeLibrary(lib); |
} |
static const char * |
library_suffix(void) |
{ |
return ".dll"; |
} |
#elif defined(_EGL_OS_UNIX) |
typedef void * lib_handle; |
static void * |
open_library(const char *filename) |
{ |
return dlopen(filename, RTLD_LAZY); |
} |
static void |
close_library(void *lib) |
{ |
dlclose(lib); |
} |
static const char * |
library_suffix(void) |
{ |
return ".so"; |
} |
#endif |
/** |
* Open the named driver and find its bootstrap function: _eglMain(). |
*/ |
static _EGLMain_t |
_eglOpenLibrary(const char *driverPath, lib_handle *handle) |
{ |
lib_handle lib; |
_EGLMain_t mainFunc = NULL; |
const char *error = "unknown error"; |
assert(driverPath); |
_eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath); |
lib = load_library(driverPath); |
if (!lib) { |
_eglLog(_EGL_WARNING, "Could not open driver %s (%s)", |
driverPath, error); |
return NULL; |
} |
mainFunc = (_EGLMain_t) get_proc_address(lib, "_eglMain"); |
if (!mainFunc) { |
_eglLog(_EGL_WARNING, "_eglMain not found in %s (%s)", |
driverPath, error); |
return NULL; |
} |
*handle = lib; |
return mainFunc; |
} |
/** |
* Load a module and create the driver object. |
*/ |
static EGLBoolean |
_eglLoadModule(_EGLModule *mod) |
{ |
_EGLMain_t mainFunc; |
lib_handle lib; |
_EGLDriver *drv; |
if (mod->Driver) |
return EGL_TRUE; |
if (mod->BuiltIn) { |
lib = (lib_handle) NULL; |
mainFunc = mod->BuiltIn; |
} |
else { |
mainFunc = _eglOpenLibrary(mod->Path, &lib); |
if (!mainFunc) |
return EGL_FALSE; |
} |
drv = mainFunc(NULL); |
if (!drv) { |
return EGL_FALSE; |
} |
if (!drv->Name) { |
_eglLog(_EGL_WARNING, "Driver loaded from %s has no name", mod->Path); |
drv->Name = "UNNAMED"; |
} |
mod->Handle = (void *) lib; |
mod->Driver = drv; |
return EGL_TRUE; |
} |
/** |
* Unload a module. |
*/ |
static void |
_eglUnloadModule(_EGLModule *mod) |
{ |
#if defined(_EGL_OS_UNIX) |
/* destroy the driver */ |
if (mod->Driver && mod->Driver->Unload) |
mod->Driver->Unload(mod->Driver); |
/* |
* XXX At this point (atexit), the module might be the last reference to |
* libEGL. Closing the module might unmap libEGL and give problems. |
*/ |
#if 0 |
if (mod->Handle) |
close_library(mod->Handle); |
#endif |
#elif defined(_EGL_OS_WINDOWS) |
/* XXX Windows unloads DLLs before atexit */ |
#endif |
mod->Driver = NULL; |
mod->Handle = NULL; |
} |
/** |
* Add a module to the module array. |
*/ |
static _EGLModule * |
_eglAddModule(const char *path) |
{ |
_EGLModule *mod; |
EGLint i; |
if (!_eglModules) { |
_eglModules = _eglCreateArray("Module", 8); |
if (!_eglModules) |
return NULL; |
} |
/* find duplicates */ |
for (i = 0; i < _eglModules->Size; i++) { |
mod = _eglModules->Elements[i]; |
if (strcmp(mod->Path, path) == 0) |
return mod; |
} |
/* allocate a new one */ |
mod = calloc(1, sizeof(*mod)); |
if (mod) { |
mod->Path = _eglstrdup(path); |
if (!mod->Path) { |
free(mod); |
mod = NULL; |
} |
} |
if (mod) { |
_eglAppendArray(_eglModules, (void *) mod); |
_eglLog(_EGL_DEBUG, "added %s to module array", mod->Path); |
} |
return mod; |
} |
/** |
* Free a module. |
*/ |
static void |
_eglFreeModule(void *module) |
{ |
_EGLModule *mod = (_EGLModule *) module; |
_eglUnloadModule(mod); |
free(mod->Path); |
free(mod); |
} |
#if 0 |
/** |
* A loader function for use with _eglPreloadForEach. The loader data is the |
* filename of the driver. This function stops on the first valid driver. |
*/ |
static EGLBoolean |
_eglLoaderFile(const char *dir, size_t len, void *loader_data) |
{ |
char path[1024]; |
const char *filename = (const char *) loader_data; |
size_t flen = strlen(filename); |
/* make a full path */ |
if (len + flen + 2 > sizeof(path)) |
return EGL_TRUE; |
if (len) { |
memcpy(path, dir, len); |
path[len++] = '/'; |
} |
memcpy(path + len, filename, flen); |
len += flen; |
path[len] = '\0'; |
if (library_suffix()) { |
const char *suffix = library_suffix(); |
size_t slen = strlen(suffix); |
const char *p; |
EGLBoolean need_suffix; |
p = filename + flen - slen; |
need_suffix = (p < filename || strcmp(p, suffix) != 0); |
if (need_suffix) { |
/* overflow */ |
if (len + slen + 1 > sizeof(path)) |
return EGL_TRUE; |
strcpy(path + len, suffix); |
} |
} |
#if defined(_EGL_OS_UNIX) |
/* check if the file exists */ |
if (access(path, F_OK)) |
return EGL_TRUE; |
#endif |
_eglAddModule(path); |
return EGL_TRUE; |
} |
/** |
* Run the callback function on each driver directory. |
* |
* The process may end prematurely if the callback function returns false. |
*/ |
static void |
_eglPreloadForEach(const char *search_path, |
EGLBoolean (*loader)(const char *, size_t, void *), |
void *loader_data) |
{ |
const char *cur, *next; |
size_t len; |
cur = search_path; |
while (cur) { |
next = strchr(cur, ':'); |
len = (next) ? next - cur : strlen(cur); |
if (!loader(cur, len, loader_data)) |
break; |
cur = (next) ? next + 1 : NULL; |
} |
} |
/** |
* Return a list of colon-separated driver directories. |
*/ |
static const char * |
_eglGetSearchPath(void) |
{ |
static char search_path[1024]; |
#if defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) |
if (search_path[0] == '\0') { |
char *buf = search_path; |
size_t len = sizeof(search_path); |
EGLBoolean use_env; |
char dir_sep; |
int ret; |
#if defined(_EGL_OS_UNIX) |
use_env = (geteuid() == getuid() && getegid() == getgid()); |
dir_sep = '/'; |
#else |
use_env = EGL_TRUE; |
dir_sep = '\\'; |
#endif |
if (use_env) { |
char *p; |
/* extract the dirname from EGL_DRIVER */ |
p = getenv("EGL_DRIVER"); |
if (p && strchr(p, dir_sep)) { |
ret = _eglsnprintf(buf, len, "%s", p); |
if (ret > 0 && ret < len) { |
p = strrchr(buf, dir_sep); |
*p++ = ':'; |
len -= p - buf; |
buf = p; |
} |
} |
/* append EGL_DRIVERS_PATH */ |
p = getenv("EGL_DRIVERS_PATH"); |
if (p) { |
ret = _eglsnprintf(buf, len, "%s:", p); |
if (ret > 0 && ret < len) { |
buf += ret; |
len -= ret; |
} |
} |
} |
else { |
_eglLog(_EGL_DEBUG, |
"ignore EGL_DRIVERS_PATH for setuid/setgid binaries"); |
} |
ret = _eglsnprintf(buf, len, "%s", _EGL_DRIVER_SEARCH_DIR); |
if (ret < 0 || ret >= len) |
search_path[0] = '\0'; |
_eglLog(_EGL_DEBUG, "EGL search path is %s", search_path); |
} |
#endif /* defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) */ |
return search_path; |
} |
/** |
* Add the user driver to the module array. |
* |
* The user driver is specified by EGL_DRIVER. |
*/ |
static EGLBoolean |
_eglAddUserDriver(void) |
{ |
const char *search_path = _eglGetSearchPath(); |
char *env; |
size_t name_len = 0; |
env = getenv("EGL_DRIVER"); |
#if defined(_EGL_OS_UNIX) |
if (env && strchr(env, '/')) { |
search_path = ""; |
if ((geteuid() != getuid() || getegid() != getgid())) { |
_eglLog(_EGL_DEBUG, |
"ignore EGL_DRIVER for setuid/setgid binaries"); |
env = NULL; |
} |
} |
else if (env) { |
char *suffix = strchr(env, '.'); |
name_len = (suffix) ? suffix - env : strlen(env); |
} |
#else |
if (env) |
name_len = strlen(env); |
#endif /* _EGL_OS_UNIX */ |
/* |
* Try built-in drivers first if we know the driver name. This makes sure |
* we do not load the outdated external driver that is still on the |
* filesystem. |
*/ |
if (name_len) { |
_EGLModule *mod; |
EGLint i; |
for (i = 0; _eglBuiltInDrivers[i].name; i++) { |
if (strlen(_eglBuiltInDrivers[i].name) == name_len && |
!strncmp(_eglBuiltInDrivers[i].name, env, name_len)) { |
mod = _eglAddModule(env); |
if (mod) |
mod->BuiltIn = _eglBuiltInDrivers[i].main; |
return EGL_TRUE; |
} |
} |
} |
/* otherwise, treat env as a path */ |
if (env) { |
_eglPreloadForEach(search_path, _eglLoaderFile, (void *) env); |
return EGL_TRUE; |
} |
return EGL_FALSE; |
} |
/** |
* Add egl_gallium to the module array. |
*/ |
static void |
_eglAddGalliumDriver(void) |
{ |
#ifndef _EGL_BUILT_IN_DRIVER_GALLIUM |
void *external = (void *) "egl_gallium"; |
_eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external); |
#endif |
} |
#endif |
/** |
* Add built-in drivers to the module array. |
*/ |
static void |
_eglAddBuiltInDrivers(void) |
{ |
_EGLModule *mod; |
EGLint i; |
for (i = 0; _eglBuiltInDrivers[i].name; i++) { |
mod = _eglAddModule(_eglBuiltInDrivers[i].name); |
if (mod) |
mod->BuiltIn = _eglBuiltInDrivers[i].main; |
} |
} |
/** |
* Add drivers to the module array. Drivers will be loaded as they are matched |
* to displays. |
*/ |
static EGLBoolean |
_eglAddDrivers(void) |
{ |
if (_eglModules) |
return EGL_TRUE; |
// if (!_eglAddUserDriver()) { |
/* |
* Add other drivers only when EGL_DRIVER is not set. The order here |
* decides the priorities. |
*/ |
// _eglAddGalliumDriver(); |
_eglAddBuiltInDrivers(); |
// } |
return (_eglModules != NULL); |
} |
/** |
* A helper function for _eglMatchDriver. It finds the first driver that can |
* initialize the display and return. |
*/ |
static _EGLDriver * |
_eglMatchAndInitialize(_EGLDisplay *dpy) |
{ |
_EGLDriver *drv = NULL; |
EGLint i = 0; |
if (!_eglAddDrivers()) { |
_eglLog(_EGL_WARNING, "failed to find any driver"); |
return NULL; |
} |
if (dpy->Driver) { |
drv = dpy->Driver; |
/* no re-matching? */ |
if (!drv->API.Initialize(drv, dpy)) |
drv = NULL; |
return drv; |
} |
while (i < _eglModules->Size) { |
_EGLModule *mod = (_EGLModule *) _eglModules->Elements[i]; |
if (!_eglLoadModule(mod)) { |
/* remove invalid modules */ |
_eglEraseArray(_eglModules, i, _eglFreeModule); |
continue; |
} |
if (mod->Driver->API.Initialize(mod->Driver, dpy)) { |
drv = mod->Driver; |
break; |
} |
else { |
i++; |
} |
} |
return drv; |
} |
/** |
* Match a display to a driver. The display is initialized unless test_only is |
* true. The matching is done by finding the first driver that can initialize |
* the display. |
*/ |
_EGLDriver * |
_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only) |
{ |
_EGLDriver *best_drv; |
assert(!dpy->Initialized); |
_eglLockMutex(&_eglModuleMutex); |
/* set options */ |
dpy->Options.TestOnly = test_only; |
dpy->Options.UseFallback = EGL_FALSE; |
best_drv = _eglMatchAndInitialize(dpy); |
if (!best_drv) { |
dpy->Options.UseFallback = EGL_TRUE; |
best_drv = _eglMatchAndInitialize(dpy); |
} |
_eglUnlockMutex(&_eglModuleMutex); |
if (best_drv) { |
_eglLog(_EGL_DEBUG, "the best driver is %s%s", |
best_drv->Name, (test_only) ? " (test only) " : ""); |
if (!test_only) { |
dpy->Driver = best_drv; |
dpy->Initialized = EGL_TRUE; |
} |
} |
return best_drv; |
} |
__eglMustCastToProperFunctionPointerType |
_eglGetDriverProc(const char *procname) |
{ |
EGLint i; |
_EGLProc proc = NULL; |
if (!_eglModules) { |
/* load the driver for the default display */ |
EGLDisplay egldpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
_EGLDisplay *dpy = _eglLookupDisplay(egldpy); |
if (!dpy || !_eglMatchDriver(dpy, EGL_TRUE)) |
return NULL; |
} |
for (i = 0; i < _eglModules->Size; i++) { |
_EGLModule *mod = (_EGLModule *) _eglModules->Elements[i]; |
if (!mod->Driver) |
break; |
proc = mod->Driver->API.GetProcAddress(mod->Driver, procname); |
if (proc) |
break; |
} |
return proc; |
} |
/** |
* Unload all drivers. |
*/ |
void |
_eglUnloadDrivers(void) |
{ |
/* this is called at atexit time */ |
if (_eglModules) { |
_eglDestroyArray(_eglModules, _eglFreeModule); |
_eglModules = NULL; |
} |
} |
#if 0 |
/** |
* Invoke a callback function on each EGL search path. |
* |
* The first argument of the callback function is the name of the search path. |
* The second argument is the length of the name. |
*/ |
void |
_eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *), |
void *callback_data) |
{ |
const char *search_path = _eglGetSearchPath(); |
_eglPreloadForEach(search_path, callback, callback_data); |
} |
#endif |
/contrib/sdk/sources/Mesa/src/egl/main/egldriver.c.bak |
---|
0,0 → 1,689 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* Functions for choosing and opening/loading device drivers. |
*/ |
#include <assert.h> |
#include <string.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include "eglstring.h" |
#include "egldefines.h" |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "egllog.h" |
#include "eglmutex.h" |
typedef unsigned int lib_handle; |
lib_handle load_library(const char *name); |
void *get_proc_address(lib_handle lib, char *proc_name); |
typedef struct _egl_module { |
char *Path; |
_EGLMain_t BuiltIn; |
void *Handle; |
_EGLDriver *Driver; |
} _EGLModule; |
static _EGL_DECLARE_MUTEX(_eglModuleMutex); |
static _EGLArray *_eglModules; |
const struct { |
const char *name; |
_EGLMain_t main; |
} _eglBuiltInDrivers[] = { |
#ifdef _EGL_BUILT_IN_DRIVER_GALLIUM |
{ "egl_gallium", _eglBuiltInDriverGALLIUM }, |
#endif |
#ifdef _EGL_BUILT_IN_DRIVER_DRI2 |
{ "egl_dri2", _eglBuiltInDriverDRI2 }, |
#endif |
#ifdef _EGL_BUILT_IN_DRIVER_GLX |
{ "egl_glx", _eglBuiltInDriverGLX }, |
#endif |
{ NULL, NULL } |
}; |
/** |
* Wrappers for dlopen/dlclose() |
*/ |
#if defined(_EGL_OS_WINDOWS) |
typedef HMODULE lib_handle; |
static HMODULE |
open_library(const char *filename) |
{ |
return LoadLibrary(filename); |
} |
static void |
close_library(HMODULE lib) |
{ |
FreeLibrary(lib); |
} |
static const char * |
library_suffix(void) |
{ |
return ".dll"; |
} |
#elif defined(_EGL_OS_UNIX) |
typedef void * lib_handle; |
static void * |
open_library(const char *filename) |
{ |
return dlopen(filename, RTLD_LAZY); |
} |
static void |
close_library(void *lib) |
{ |
dlclose(lib); |
} |
static const char * |
library_suffix(void) |
{ |
return ".so"; |
} |
#endif |
/** |
* Open the named driver and find its bootstrap function: _eglMain(). |
*/ |
static _EGLMain_t |
_eglOpenLibrary(const char *driverPath, lib_handle *handle) |
{ |
lib_handle lib; |
_EGLMain_t mainFunc = NULL; |
const char *error = "unknown error"; |
assert(driverPath); |
_eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath); |
lib = load_library(driverPath); |
if (!lib) { |
_eglLog(_EGL_WARNING, "Could not open driver %s (%s)", |
driverPath, error); |
return NULL; |
} |
mainFunc = (_EGLMain_t) get_proc_address(lib, "_eglMain"); |
if (!mainFunc) { |
_eglLog(_EGL_WARNING, "_eglMain not found in %s (%s)", |
driverPath, error); |
return NULL; |
} |
*handle = lib; |
return mainFunc; |
} |
/** |
* Load a module and create the driver object. |
*/ |
static EGLBoolean |
_eglLoadModule(_EGLModule *mod) |
{ |
_EGLMain_t mainFunc; |
lib_handle lib; |
_EGLDriver *drv; |
if (mod->Driver) |
return EGL_TRUE; |
if (mod->BuiltIn) { |
lib = (lib_handle) NULL; |
mainFunc = mod->BuiltIn; |
} |
else { |
mainFunc = _eglOpenLibrary(mod->Path, &lib); |
if (!mainFunc) |
return EGL_FALSE; |
} |
drv = mainFunc(NULL); |
if (!drv) { |
return EGL_FALSE; |
} |
if (!drv->Name) { |
_eglLog(_EGL_WARNING, "Driver loaded from %s has no name", mod->Path); |
drv->Name = "UNNAMED"; |
} |
mod->Handle = (void *) lib; |
mod->Driver = drv; |
return EGL_TRUE; |
} |
/** |
* Unload a module. |
*/ |
static void |
_eglUnloadModule(_EGLModule *mod) |
{ |
#if defined(_EGL_OS_UNIX) |
/* destroy the driver */ |
if (mod->Driver && mod->Driver->Unload) |
mod->Driver->Unload(mod->Driver); |
/* |
* XXX At this point (atexit), the module might be the last reference to |
* libEGL. Closing the module might unmap libEGL and give problems. |
*/ |
#if 0 |
if (mod->Handle) |
close_library(mod->Handle); |
#endif |
#elif defined(_EGL_OS_WINDOWS) |
/* XXX Windows unloads DLLs before atexit */ |
#endif |
mod->Driver = NULL; |
mod->Handle = NULL; |
} |
/** |
* Add a module to the module array. |
*/ |
static _EGLModule * |
_eglAddModule(const char *path) |
{ |
_EGLModule *mod; |
EGLint i; |
if (!_eglModules) { |
_eglModules = _eglCreateArray("Module", 8); |
if (!_eglModules) |
return NULL; |
} |
/* find duplicates */ |
for (i = 0; i < _eglModules->Size; i++) { |
mod = _eglModules->Elements[i]; |
if (strcmp(mod->Path, path) == 0) |
return mod; |
} |
/* allocate a new one */ |
mod = calloc(1, sizeof(*mod)); |
if (mod) { |
mod->Path = _eglstrdup(path); |
if (!mod->Path) { |
free(mod); |
mod = NULL; |
} |
} |
if (mod) { |
_eglAppendArray(_eglModules, (void *) mod); |
_eglLog(_EGL_DEBUG, "added %s to module array", mod->Path); |
} |
return mod; |
} |
/** |
* Free a module. |
*/ |
static void |
_eglFreeModule(void *module) |
{ |
_EGLModule *mod = (_EGLModule *) module; |
_eglUnloadModule(mod); |
free(mod->Path); |
free(mod); |
} |
#if 0 |
/** |
* A loader function for use with _eglPreloadForEach. The loader data is the |
* filename of the driver. This function stops on the first valid driver. |
*/ |
static EGLBoolean |
_eglLoaderFile(const char *dir, size_t len, void *loader_data) |
{ |
char path[1024]; |
const char *filename = (const char *) loader_data; |
size_t flen = strlen(filename); |
/* make a full path */ |
if (len + flen + 2 > sizeof(path)) |
return EGL_TRUE; |
if (len) { |
memcpy(path, dir, len); |
path[len++] = '/'; |
} |
memcpy(path + len, filename, flen); |
len += flen; |
path[len] = '\0'; |
if (library_suffix()) { |
const char *suffix = library_suffix(); |
size_t slen = strlen(suffix); |
const char *p; |
EGLBoolean need_suffix; |
p = filename + flen - slen; |
need_suffix = (p < filename || strcmp(p, suffix) != 0); |
if (need_suffix) { |
/* overflow */ |
if (len + slen + 1 > sizeof(path)) |
return EGL_TRUE; |
strcpy(path + len, suffix); |
} |
} |
#if defined(_EGL_OS_UNIX) |
/* check if the file exists */ |
if (access(path, F_OK)) |
return EGL_TRUE; |
#endif |
_eglAddModule(path); |
return EGL_TRUE; |
} |
/** |
* Run the callback function on each driver directory. |
* |
* The process may end prematurely if the callback function returns false. |
*/ |
static void |
_eglPreloadForEach(const char *search_path, |
EGLBoolean (*loader)(const char *, size_t, void *), |
void *loader_data) |
{ |
const char *cur, *next; |
size_t len; |
cur = search_path; |
while (cur) { |
next = strchr(cur, ':'); |
len = (next) ? next - cur : strlen(cur); |
if (!loader(cur, len, loader_data)) |
break; |
cur = (next) ? next + 1 : NULL; |
} |
} |
/** |
* Return a list of colon-separated driver directories. |
*/ |
static const char * |
_eglGetSearchPath(void) |
{ |
static char search_path[1024]; |
#if defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) |
if (search_path[0] == '\0') { |
char *buf = search_path; |
size_t len = sizeof(search_path); |
EGLBoolean use_env; |
char dir_sep; |
int ret; |
#if defined(_EGL_OS_UNIX) |
use_env = (geteuid() == getuid() && getegid() == getgid()); |
dir_sep = '/'; |
#else |
use_env = EGL_TRUE; |
dir_sep = '\\'; |
#endif |
if (use_env) { |
char *p; |
/* extract the dirname from EGL_DRIVER */ |
p = getenv("EGL_DRIVER"); |
if (p && strchr(p, dir_sep)) { |
ret = _eglsnprintf(buf, len, "%s", p); |
if (ret > 0 && ret < len) { |
p = strrchr(buf, dir_sep); |
*p++ = ':'; |
len -= p - buf; |
buf = p; |
} |
} |
/* append EGL_DRIVERS_PATH */ |
p = getenv("EGL_DRIVERS_PATH"); |
if (p) { |
ret = _eglsnprintf(buf, len, "%s:", p); |
if (ret > 0 && ret < len) { |
buf += ret; |
len -= ret; |
} |
} |
} |
else { |
_eglLog(_EGL_DEBUG, |
"ignore EGL_DRIVERS_PATH for setuid/setgid binaries"); |
} |
ret = _eglsnprintf(buf, len, "%s", _EGL_DRIVER_SEARCH_DIR); |
if (ret < 0 || ret >= len) |
search_path[0] = '\0'; |
_eglLog(_EGL_DEBUG, "EGL search path is %s", search_path); |
} |
#endif /* defined(_EGL_OS_UNIX) || defined(_EGL_OS_WINDOWS) */ |
return search_path; |
} |
/** |
* Add the user driver to the module array. |
* |
* The user driver is specified by EGL_DRIVER. |
*/ |
static EGLBoolean |
_eglAddUserDriver(void) |
{ |
const char *search_path = _eglGetSearchPath(); |
char *env; |
size_t name_len = 0; |
env = getenv("EGL_DRIVER"); |
#if defined(_EGL_OS_UNIX) |
if (env && strchr(env, '/')) { |
search_path = ""; |
if ((geteuid() != getuid() || getegid() != getgid())) { |
_eglLog(_EGL_DEBUG, |
"ignore EGL_DRIVER for setuid/setgid binaries"); |
env = NULL; |
} |
} |
else if (env) { |
char *suffix = strchr(env, '.'); |
name_len = (suffix) ? suffix - env : strlen(env); |
} |
#else |
if (env) |
name_len = strlen(env); |
#endif /* _EGL_OS_UNIX */ |
/* |
* Try built-in drivers first if we know the driver name. This makes sure |
* we do not load the outdated external driver that is still on the |
* filesystem. |
*/ |
if (name_len) { |
_EGLModule *mod; |
EGLint i; |
for (i = 0; _eglBuiltInDrivers[i].name; i++) { |
if (strlen(_eglBuiltInDrivers[i].name) == name_len && |
!strncmp(_eglBuiltInDrivers[i].name, env, name_len)) { |
mod = _eglAddModule(env); |
if (mod) |
mod->BuiltIn = _eglBuiltInDrivers[i].main; |
return EGL_TRUE; |
} |
} |
} |
/* otherwise, treat env as a path */ |
if (env) { |
_eglPreloadForEach(search_path, _eglLoaderFile, (void *) env); |
return EGL_TRUE; |
} |
return EGL_FALSE; |
} |
/** |
* Add egl_gallium to the module array. |
*/ |
static void |
_eglAddGalliumDriver(void) |
{ |
#ifndef _EGL_BUILT_IN_DRIVER_GALLIUM |
void *external = (void *) "egl_gallium"; |
_eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external); |
#endif |
} |
#endif |
/** |
* Add built-in drivers to the module array. |
*/ |
static void |
_eglAddBuiltInDrivers(void) |
{ |
_EGLModule *mod; |
EGLint i; |
for (i = 0; _eglBuiltInDrivers[i].name; i++) { |
mod = _eglAddModule(_eglBuiltInDrivers[i].name); |
if (mod) |
mod->BuiltIn = _eglBuiltInDrivers[i].main; |
} |
} |
/** |
* Add drivers to the module array. Drivers will be loaded as they are matched |
* to displays. |
*/ |
static EGLBoolean |
_eglAddDrivers(void) |
{ |
if (_eglModules) |
return EGL_TRUE; |
// if (!_eglAddUserDriver()) { |
/* |
* Add other drivers only when EGL_DRIVER is not set. The order here |
* decides the priorities. |
*/ |
// _eglAddGalliumDriver(); |
_eglAddBuiltInDrivers(); |
// } |
return (_eglModules != NULL); |
} |
/** |
* A helper function for _eglMatchDriver. It finds the first driver that can |
* initialize the display and return. |
*/ |
static _EGLDriver * |
_eglMatchAndInitialize(_EGLDisplay *dpy) |
{ |
_EGLDriver *drv = NULL; |
EGLint i = 0; |
if (!_eglAddDrivers()) { |
_eglLog(_EGL_WARNING, "failed to find any driver"); |
return NULL; |
} |
if (dpy->Driver) { |
drv = dpy->Driver; |
/* no re-matching? */ |
if (!drv->API.Initialize(drv, dpy)) |
drv = NULL; |
return drv; |
} |
while (i < _eglModules->Size) { |
_EGLModule *mod = (_EGLModule *) _eglModules->Elements[i]; |
if (!_eglLoadModule(mod)) { |
/* remove invalid modules */ |
_eglEraseArray(_eglModules, i, _eglFreeModule); |
continue; |
} |
if (mod->Driver->API.Initialize(mod->Driver, dpy)) { |
drv = mod->Driver; |
break; |
} |
else { |
i++; |
} |
} |
return drv; |
} |
/** |
* Match a display to a driver. The display is initialized unless test_only is |
* true. The matching is done by finding the first driver that can initialize |
* the display. |
*/ |
_EGLDriver * |
_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only) |
{ |
_EGLDriver *best_drv; |
assert(!dpy->Initialized); |
_eglLockMutex(&_eglModuleMutex); |
/* set options */ |
dpy->Options.TestOnly = test_only; |
dpy->Options.UseFallback = EGL_FALSE; |
best_drv = _eglMatchAndInitialize(dpy); |
if (!best_drv) { |
dpy->Options.UseFallback = EGL_TRUE; |
best_drv = _eglMatchAndInitialize(dpy); |
} |
_eglUnlockMutex(&_eglModuleMutex); |
if (best_drv) { |
_eglLog(_EGL_DEBUG, "the best driver is %s%s", |
best_drv->Name, (test_only) ? " (test only) " : ""); |
if (!test_only) { |
dpy->Driver = best_drv; |
dpy->Initialized = EGL_TRUE; |
} |
} |
return best_drv; |
} |
__eglMustCastToProperFunctionPointerType |
_eglGetDriverProc(const char *procname) |
{ |
EGLint i; |
_EGLProc proc = NULL; |
if (!_eglModules) { |
/* load the driver for the default display */ |
EGLDisplay egldpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
_EGLDisplay *dpy = _eglLookupDisplay(egldpy); |
if (!dpy || !_eglMatchDriver(dpy, EGL_TRUE)) |
return NULL; |
} |
for (i = 0; i < _eglModules->Size; i++) { |
_EGLModule *mod = (_EGLModule *) _eglModules->Elements[i]; |
if (!mod->Driver) |
break; |
proc = mod->Driver->API.GetProcAddress(mod->Driver, procname); |
if (proc) |
break; |
} |
return proc; |
} |
/** |
* Unload all drivers. |
*/ |
void |
_eglUnloadDrivers(void) |
{ |
/* this is called at atexit time */ |
if (_eglModules) { |
_eglDestroyArray(_eglModules, _eglFreeModule); |
_eglModules = NULL; |
} |
} |
#if 0 |
/** |
* Invoke a callback function on each EGL search path. |
* |
* The first argument of the callback function is the name of the search path. |
* The second argument is the length of the name. |
*/ |
void |
_eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *), |
void *callback_data) |
{ |
const char *search_path = _eglGetSearchPath(); |
_eglPreloadForEach(search_path, callback, callback_data); |
} |
#endif |
/contrib/sdk/sources/Mesa/src/egl/main/egldriver.h |
---|
0,0 → 1,125 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLDRIVER_INCLUDED |
#define EGLDRIVER_INCLUDED |
#include "egltypedefs.h" |
#include "eglapi.h" |
#include <stddef.h> |
/** |
* Define an inline driver typecast function. |
* |
* Note that this macro defines a function and should not be ended with a |
* semicolon when used. |
*/ |
#define _EGL_DRIVER_TYPECAST(drvtype, egltype, code) \ |
static INLINE struct drvtype *drvtype(const egltype *obj) \ |
{ return (struct drvtype *) code; } |
/** |
* Define the driver typecast functions for _EGLDriver, _EGLDisplay, |
* _EGLContext, _EGLSurface, and _EGLConfig. |
* |
* Note that this macro defines several functions and should not be ended with |
* a semicolon when used. |
*/ |
#define _EGL_DRIVER_STANDARD_TYPECASTS(drvname) \ |
_EGL_DRIVER_TYPECAST(drvname ## _driver, _EGLDriver, obj) \ |
/* note that this is not a direct cast */ \ |
_EGL_DRIVER_TYPECAST(drvname ## _display, _EGLDisplay, obj->DriverData) \ |
_EGL_DRIVER_TYPECAST(drvname ## _context, _EGLContext, obj) \ |
_EGL_DRIVER_TYPECAST(drvname ## _surface, _EGLSurface, obj) \ |
_EGL_DRIVER_TYPECAST(drvname ## _config, _EGLConfig, obj) |
typedef _EGLDriver *(*_EGLMain_t)(const char *args); |
/** |
* Base class for device drivers. |
*/ |
struct _egl_driver |
{ |
const char *Name; /**< name of this driver */ |
/** |
* Release the driver resource. |
* |
* It is called before dlclose(). |
*/ |
void (*Unload)(_EGLDriver *drv); |
_EGLAPI API; /**< EGL API dispatch table */ |
}; |
extern _EGLDriver * |
_eglBuiltInDriverGALLIUM(const char *args); |
extern _EGLDriver * |
_eglBuiltInDriverDRI2(const char *args); |
extern _EGLDriver * |
_eglBuiltInDriverGLX(const char *args); |
PUBLIC _EGLDriver * |
_eglMain(const char *args); |
extern _EGLDriver * |
_eglMatchDriver(_EGLDisplay *dpy, EGLBoolean test_only); |
extern __eglMustCastToProperFunctionPointerType |
_eglGetDriverProc(const char *procname); |
extern void |
_eglUnloadDrivers(void); |
/* defined in eglfallbacks.c */ |
PUBLIC void |
_eglInitDriverFallbacks(_EGLDriver *drv); |
PUBLIC void |
_eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *), |
void *callback_data); |
#endif /* EGLDRIVER_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglfallbacks.c |
---|
0,0 → 1,123 |
/************************************************************************** |
* |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#include <string.h> |
#include "egltypedefs.h" |
#include "egldriver.h" |
#include "eglconfig.h" |
#include "eglcontext.h" |
#include "eglsurface.h" |
#include "eglmisc.h" |
#include "eglscreen.h" |
#include "eglmode.h" |
#include "eglsync.h" |
static EGLBoolean |
_eglReturnFalse(void) |
{ |
return EGL_FALSE; |
} |
/** |
* Plug all the available fallback routines into the given driver's |
* dispatch table. |
*/ |
void |
_eglInitDriverFallbacks(_EGLDriver *drv) |
{ |
memset(&drv->API, 0, sizeof(drv->API)); |
/* the driver has to implement these */ |
drv->API.Initialize = NULL; |
drv->API.Terminate = NULL; |
drv->API.GetConfigs = _eglGetConfigs; |
drv->API.ChooseConfig = _eglChooseConfig; |
drv->API.GetConfigAttrib = _eglGetConfigAttrib; |
drv->API.CreateContext = (CreateContext_t) _eglReturnFalse; |
drv->API.DestroyContext = (DestroyContext_t) _eglReturnFalse; |
drv->API.MakeCurrent = (MakeCurrent_t) _eglReturnFalse; |
drv->API.QueryContext = _eglQueryContext; |
drv->API.CreateWindowSurface = (CreateWindowSurface_t) _eglReturnFalse; |
drv->API.CreatePixmapSurface = (CreatePixmapSurface_t) _eglReturnFalse; |
drv->API.CreatePbufferSurface = (CreatePbufferSurface_t) _eglReturnFalse; |
drv->API.CreatePbufferFromClientBuffer = |
(CreatePbufferFromClientBuffer_t) _eglReturnFalse; |
drv->API.DestroySurface = (DestroySurface_t) _eglReturnFalse; |
drv->API.QuerySurface = _eglQuerySurface; |
drv->API.SurfaceAttrib = _eglSurfaceAttrib; |
drv->API.BindTexImage = (BindTexImage_t) _eglReturnFalse; |
drv->API.ReleaseTexImage = (ReleaseTexImage_t) _eglReturnFalse; |
drv->API.CopyBuffers = (CopyBuffers_t) _eglReturnFalse; |
drv->API.SwapBuffers = (SwapBuffers_t) _eglReturnFalse; |
drv->API.SwapInterval = _eglSwapInterval; |
drv->API.WaitClient = (WaitClient_t) _eglReturnFalse; |
drv->API.WaitNative = (WaitNative_t) _eglReturnFalse; |
drv->API.GetProcAddress = (GetProcAddress_t) _eglReturnFalse; |
drv->API.QueryString = _eglQueryString; |
#ifdef EGL_MESA_screen_surface |
drv->API.CopyContextMESA = (CopyContextMESA_t) _eglReturnFalse; |
drv->API.CreateScreenSurfaceMESA = |
(CreateScreenSurfaceMESA_t) _eglReturnFalse; |
drv->API.ShowScreenSurfaceMESA = (ShowScreenSurfaceMESA_t) _eglReturnFalse; |
drv->API.ChooseModeMESA = _eglChooseModeMESA; |
drv->API.GetModesMESA = _eglGetModesMESA; |
drv->API.GetModeAttribMESA = _eglGetModeAttribMESA; |
drv->API.GetScreensMESA = _eglGetScreensMESA; |
drv->API.ScreenPositionMESA = _eglScreenPositionMESA; |
drv->API.QueryScreenMESA = _eglQueryScreenMESA; |
drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA; |
drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA; |
drv->API.QueryModeStringMESA = _eglQueryModeStringMESA; |
#endif /* EGL_MESA_screen_surface */ |
drv->API.CreateImageKHR = NULL; |
drv->API.DestroyImageKHR = NULL; |
drv->API.CreateSyncKHR = NULL; |
drv->API.DestroySyncKHR = NULL; |
drv->API.ClientWaitSyncKHR = NULL; |
drv->API.SignalSyncKHR = NULL; |
drv->API.GetSyncAttribKHR = _eglGetSyncAttribKHR; |
#ifdef EGL_MESA_drm_image |
drv->API.CreateDRMImageMESA = NULL; |
drv->API.ExportDRMImageMESA = NULL; |
#endif |
#ifdef EGL_NOK_swap_region |
drv->API.SwapBuffersRegionNOK = NULL; |
#endif |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglglobals.c |
---|
0,0 → 1,80 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#include <stdlib.h> |
#include <assert.h> |
#include "eglglobals.h" |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "eglmutex.h" |
static _EGL_DECLARE_MUTEX(_eglGlobalMutex); |
struct _egl_global _eglGlobal = |
{ |
&_eglGlobalMutex, /* Mutex */ |
NULL, /* DisplayList */ |
2, /* NumAtExitCalls */ |
{ |
/* default AtExitCalls, called in reverse order */ |
_eglUnloadDrivers, /* always called last */ |
_eglFiniDisplay |
}, |
}; |
static void |
_eglAtExit(void) |
{ |
EGLint i; |
for (i = _eglGlobal.NumAtExitCalls - 1; i >= 0; i--) |
_eglGlobal.AtExitCalls[i](); |
} |
void |
_eglAddAtExitCall(void (*func)(void)) |
{ |
if (func) { |
static EGLBoolean registered = EGL_FALSE; |
_eglLockMutex(_eglGlobal.Mutex); |
if (!registered) { |
atexit(_eglAtExit); |
registered = EGL_TRUE; |
} |
assert(_eglGlobal.NumAtExitCalls < ARRAY_SIZE(_eglGlobal.AtExitCalls)); |
_eglGlobal.AtExitCalls[_eglGlobal.NumAtExitCalls++] = func; |
_eglUnlockMutex(_eglGlobal.Mutex); |
} |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglglobals.h |
---|
0,0 → 1,61 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLGLOBALS_INCLUDED |
#define EGLGLOBALS_INCLUDED |
#include "egltypedefs.h" |
#include "eglmutex.h" |
/** |
* Global library data |
*/ |
struct _egl_global |
{ |
_EGLMutex *Mutex; |
/* the list of all displays */ |
_EGLDisplay *DisplayList; |
EGLint NumAtExitCalls; |
void (*AtExitCalls[10])(void); |
}; |
extern struct _egl_global _eglGlobal; |
extern void |
_eglAddAtExitCall(void (*func)(void)); |
#endif /* EGLGLOBALS_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglimage.c |
---|
0,0 → 1,117 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#include <assert.h> |
#include <string.h> |
#include "eglimage.h" |
#include "egllog.h" |
/** |
* Parse the list of image attributes and return the proper error code. |
*/ |
EGLint |
_eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, |
const EGLint *attrib_list) |
{ |
EGLint i, err = EGL_SUCCESS; |
(void) dpy; |
memset(attrs, 0, sizeof(*attrs)); |
attrs->ImagePreserved = EGL_FALSE; |
attrs->GLTextureLevel = 0; |
attrs->GLTextureZOffset = 0; |
if (!attrib_list) |
return err; |
for (i = 0; attrib_list[i] != EGL_NONE; i++) { |
EGLint attr = attrib_list[i++]; |
EGLint val = attrib_list[i]; |
switch (attr) { |
/* EGL_KHR_image_base */ |
case EGL_IMAGE_PRESERVED_KHR: |
attrs->ImagePreserved = val; |
break; |
/* EGL_KHR_gl_image */ |
case EGL_GL_TEXTURE_LEVEL_KHR: |
attrs->GLTextureLevel = val; |
break; |
case EGL_GL_TEXTURE_ZOFFSET_KHR: |
attrs->GLTextureZOffset = val; |
break; |
/* EGL_MESA_drm_image */ |
case EGL_WIDTH: |
attrs->Width = val; |
break; |
case EGL_HEIGHT: |
attrs->Height = val; |
break; |
case EGL_DRM_BUFFER_FORMAT_MESA: |
attrs->DRMBufferFormatMESA = val; |
break; |
case EGL_DRM_BUFFER_USE_MESA: |
attrs->DRMBufferUseMESA = val; |
break; |
case EGL_DRM_BUFFER_STRIDE_MESA: |
attrs->DRMBufferStrideMESA = val; |
break; |
/* EGL_WL_bind_wayland_display */ |
case EGL_WAYLAND_PLANE_WL: |
attrs->PlaneWL = val; |
break; |
default: |
/* unknown attrs are ignored */ |
break; |
} |
if (err != EGL_SUCCESS) { |
_eglLog(_EGL_DEBUG, "bad image attribute 0x%04x", attr); |
break; |
} |
} |
return err; |
} |
EGLBoolean |
_eglInitImage(_EGLImage *img, _EGLDisplay *dpy) |
{ |
_eglInitResource(&img->Resource, sizeof(*img), dpy); |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglimage.h |
---|
0,0 → 1,148 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLIMAGE_INCLUDED |
#define EGLIMAGE_INCLUDED |
#include "egltypedefs.h" |
#include "egldisplay.h" |
struct _egl_image_attribs |
{ |
/* EGL_KHR_image_base */ |
EGLBoolean ImagePreserved; |
/* EGL_KHR_gl_image */ |
EGLint GLTextureLevel; |
EGLint GLTextureZOffset; |
/* EGL_MESA_drm_image */ |
EGLint Width; |
EGLint Height; |
EGLint DRMBufferFormatMESA; |
EGLint DRMBufferUseMESA; |
EGLint DRMBufferStrideMESA; |
/* EGL_WL_bind_wayland_display */ |
EGLint PlaneWL; |
}; |
/** |
* "Base" class for device driver images. |
*/ |
struct _egl_image |
{ |
/* An image is a display resource */ |
_EGLResource Resource; |
}; |
PUBLIC EGLint |
_eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy, |
const EGLint *attrib_list); |
PUBLIC EGLBoolean |
_eglInitImage(_EGLImage *img, _EGLDisplay *dpy); |
/** |
* Increment reference count for the image. |
*/ |
static INLINE _EGLImage * |
_eglGetImage(_EGLImage *img) |
{ |
if (img) |
_eglGetResource(&img->Resource); |
return img; |
} |
/** |
* Decrement reference count for the image. |
*/ |
static INLINE EGLBoolean |
_eglPutImage(_EGLImage *img) |
{ |
return (img) ? _eglPutResource(&img->Resource) : EGL_FALSE; |
} |
/** |
* Link an image to its display and return the handle of the link. |
* The handle can be passed to client directly. |
*/ |
static INLINE EGLImageKHR |
_eglLinkImage(_EGLImage *img) |
{ |
_eglLinkResource(&img->Resource, _EGL_RESOURCE_IMAGE); |
return (EGLImageKHR) img; |
} |
/** |
* Unlink a linked image from its display. |
* Accessing an unlinked image should generate EGL_BAD_PARAMETER error. |
*/ |
static INLINE void |
_eglUnlinkImage(_EGLImage *img) |
{ |
_eglUnlinkResource(&img->Resource, _EGL_RESOURCE_IMAGE); |
} |
/** |
* Lookup a handle to find the linked image. |
* Return NULL if the handle has no corresponding linked image. |
*/ |
static INLINE _EGLImage * |
_eglLookupImage(EGLImageKHR image, _EGLDisplay *dpy) |
{ |
_EGLImage *img = (_EGLImage *) image; |
if (!dpy || !_eglCheckResource((void *) img, _EGL_RESOURCE_IMAGE, dpy)) |
img = NULL; |
return img; |
} |
/** |
* Return the handle of a linked image, or EGL_NO_IMAGE_KHR. |
*/ |
static INLINE EGLImageKHR |
_eglGetImageHandle(_EGLImage *img) |
{ |
_EGLResource *res = (_EGLResource *) img; |
return (res && _eglIsResourceLinked(res)) ? |
(EGLImageKHR) img : EGL_NO_IMAGE_KHR; |
} |
#endif /* EGLIMAGE_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/egllog.c |
---|
0,0 → 1,208 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
/** |
* Logging facility for debug/info messages. |
* _EGL_FATAL messages are printed to stderr |
* The EGL_LOG_LEVEL var controls the output of other warning/info/debug msgs. |
*/ |
#include <stdarg.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include "egllog.h" |
#include "eglstring.h" |
#include "eglmutex.h" |
#define MAXSTRING 1000 |
#define FALLBACK_LOG_LEVEL _EGL_WARNING |
static struct { |
_EGLMutex mutex; |
EGLBoolean initialized; |
EGLint level; |
_EGLLogProc logger; |
EGLint num_messages; |
} logging = { |
_EGL_MUTEX_INITIALIZER, |
EGL_FALSE, |
FALLBACK_LOG_LEVEL, |
NULL, |
0 |
}; |
static const char *level_strings[] = { |
/* the order is important */ |
"fatal", |
"warning", |
"info", |
"debug", |
NULL |
}; |
/** |
* Set the function to be called when there is a message to log. |
* Note that the function will be called with an internal lock held. |
* Recursive logging is not allowed. |
*/ |
void |
_eglSetLogProc(_EGLLogProc logger) |
{ |
EGLint num_messages = 0; |
_eglLockMutex(&logging.mutex); |
if (logging.logger != logger) { |
logging.logger = logger; |
num_messages = logging.num_messages; |
logging.num_messages = 0; |
} |
_eglUnlockMutex(&logging.mutex); |
if (num_messages) |
_eglLog(_EGL_DEBUG, |
"New logger installed. " |
"Messages before the new logger might not be available."); |
} |
/** |
* Set the log reporting level. |
*/ |
void |
_eglSetLogLevel(EGLint level) |
{ |
switch (level) { |
case _EGL_FATAL: |
case _EGL_WARNING: |
case _EGL_INFO: |
case _EGL_DEBUG: |
_eglLockMutex(&logging.mutex); |
logging.level = level; |
_eglUnlockMutex(&logging.mutex); |
break; |
default: |
break; |
} |
} |
/** |
* The default logger. It prints the message to stderr. |
*/ |
static void |
_eglDefaultLogger(EGLint level, const char *msg) |
{ |
fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg); |
} |
/** |
* Initialize the logging facility. |
*/ |
static void |
_eglInitLogger(void) |
{ |
const char *log_env; |
EGLint i, level = -1; |
if (logging.initialized) |
return; |
log_env = getenv("EGL_LOG_LEVEL"); |
if (log_env) { |
for (i = 0; level_strings[i]; i++) { |
if (_eglstrcasecmp(log_env, level_strings[i]) == 0) { |
level = i; |
break; |
} |
} |
} |
else { |
level = FALLBACK_LOG_LEVEL; |
} |
logging.logger = _eglDefaultLogger; |
logging.level = (level >= 0) ? level : FALLBACK_LOG_LEVEL; |
logging.initialized = EGL_TRUE; |
/* it is fine to call _eglLog now */ |
if (log_env && level < 0) { |
_eglLog(_EGL_WARNING, |
"Unrecognized EGL_LOG_LEVEL environment variable value. " |
"Expected one of \"fatal\", \"warning\", \"info\", \"debug\". " |
"Got \"%s\". Falling back to \"%s\".", |
log_env, level_strings[FALLBACK_LOG_LEVEL]); |
} |
} |
/** |
* Log a message with message logger. |
* \param level one of _EGL_FATAL, _EGL_WARNING, _EGL_INFO, _EGL_DEBUG. |
*/ |
void |
_eglLog(EGLint level, const char *fmtStr, ...) |
{ |
va_list args; |
char msg[MAXSTRING]; |
int ret; |
/* one-time initialization; a little race here is fine */ |
if (!logging.initialized) |
_eglInitLogger(); |
if (level > logging.level || level < 0) |
return; |
_eglLockMutex(&logging.mutex); |
if (logging.logger) { |
va_start(args, fmtStr); |
ret = vsnprintf(msg, MAXSTRING, fmtStr, args); |
if (ret < 0 || ret >= MAXSTRING) |
strcpy(msg, "<message truncated>"); |
va_end(args); |
logging.logger(level, msg); |
logging.num_messages++; |
} |
_eglUnlockMutex(&logging.mutex); |
if (level == _EGL_FATAL) |
exit(1); /* or abort()? */ |
} |
/contrib/sdk/sources/Mesa/src/egl/main/egllog.h |
---|
0,0 → 1,58 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLLOG_INCLUDED |
#define EGLLOG_INCLUDED |
#include "egltypedefs.h" |
#define _EGL_FATAL 0 /* unrecoverable error */ |
#define _EGL_WARNING 1 /* recoverable error/problem */ |
#define _EGL_INFO 2 /* just useful info */ |
#define _EGL_DEBUG 3 /* useful info for debugging */ |
typedef void (*_EGLLogProc)(EGLint level, const char *msg); |
PUBLIC void |
_eglSetLogProc(_EGLLogProc logger); |
PUBLIC void |
_eglSetLogLevel(EGLint level); |
PUBLIC void |
_eglLog(EGLint level, const char *fmtStr, ...); |
#endif /* EGLLOG_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglmisc.c |
---|
0,0 → 1,177 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* Small/misc EGL functions |
*/ |
#include <assert.h> |
#include <string.h> |
#include "eglcurrent.h" |
#include "eglmisc.h" |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "eglstring.h" |
/** |
* Copy the extension into the string and update the string pointer. |
*/ |
static EGLint |
_eglAppendExtension(char **str, const char *ext) |
{ |
char *s = *str; |
size_t len = strlen(ext); |
if (s) { |
memcpy(s, ext, len); |
s[len++] = ' '; |
s[len] = '\0'; |
*str += len; |
} |
else { |
len++; |
} |
return (EGLint) len; |
} |
/** |
* Examine the individual extension enable/disable flags and recompute |
* the driver's Extensions string. |
*/ |
static void |
_eglUpdateExtensionsString(_EGLDisplay *dpy) |
{ |
#define _EGL_CHECK_EXTENSION(ext) \ |
do { \ |
if (dpy->Extensions.ext) { \ |
_eglAppendExtension(&exts, "EGL_" #ext); \ |
assert(exts <= dpy->ExtensionsString + _EGL_MAX_EXTENSIONS_LEN); \ |
} \ |
} while (0) |
char *exts = dpy->ExtensionsString; |
if (exts[0]) |
return; |
_EGL_CHECK_EXTENSION(MESA_screen_surface); |
_EGL_CHECK_EXTENSION(MESA_copy_context); |
_EGL_CHECK_EXTENSION(MESA_drm_display); |
_EGL_CHECK_EXTENSION(MESA_drm_image); |
_EGL_CHECK_EXTENSION(WL_bind_wayland_display); |
_EGL_CHECK_EXTENSION(KHR_image_base); |
_EGL_CHECK_EXTENSION(KHR_image_pixmap); |
if (dpy->Extensions.KHR_image_base && dpy->Extensions.KHR_image_pixmap) |
_eglAppendExtension(&exts, "EGL_KHR_image"); |
_EGL_CHECK_EXTENSION(KHR_vg_parent_image); |
_EGL_CHECK_EXTENSION(KHR_gl_texture_2D_image); |
_EGL_CHECK_EXTENSION(KHR_gl_texture_cubemap_image); |
_EGL_CHECK_EXTENSION(KHR_gl_texture_3D_image); |
_EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image); |
_EGL_CHECK_EXTENSION(KHR_reusable_sync); |
_EGL_CHECK_EXTENSION(KHR_fence_sync); |
_EGL_CHECK_EXTENSION(KHR_surfaceless_context); |
_EGL_CHECK_EXTENSION(KHR_create_context); |
_EGL_CHECK_EXTENSION(NOK_swap_region); |
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap); |
_EGL_CHECK_EXTENSION(ANDROID_image_native_buffer); |
_EGL_CHECK_EXTENSION(EXT_create_context_robustness); |
_EGL_CHECK_EXTENSION(EXT_buffer_age); |
_EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage); |
_EGL_CHECK_EXTENSION(NV_post_sub_buffer); |
#undef _EGL_CHECK_EXTENSION |
} |
static void |
_eglUpdateAPIsString(_EGLDisplay *dpy) |
{ |
char *apis = dpy->ClientAPIsString; |
if (apis[0] || !dpy->ClientAPIs) |
return; |
if (dpy->ClientAPIs & EGL_OPENGL_BIT) |
strcat(apis, "OpenGL "); |
if (dpy->ClientAPIs & EGL_OPENGL_ES_BIT) |
strcat(apis, "OpenGL_ES "); |
if (dpy->ClientAPIs & EGL_OPENGL_ES2_BIT) |
strcat(apis, "OpenGL_ES2 "); |
if (dpy->ClientAPIs & EGL_OPENGL_ES3_BIT_KHR) |
strcat(apis, "OpenGL_ES3 "); |
if (dpy->ClientAPIs & EGL_OPENVG_BIT) |
strcat(apis, "OpenVG "); |
assert(strlen(apis) < sizeof(dpy->ClientAPIsString)); |
} |
const char * |
_eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name) |
{ |
(void) drv; |
switch (name) { |
case EGL_VENDOR: |
return _EGL_VENDOR_STRING; |
case EGL_VERSION: |
_eglsnprintf(dpy->VersionString, sizeof(dpy->VersionString), |
"%d.%d (%s)", dpy->VersionMajor, dpy->VersionMinor, |
dpy->Driver->Name); |
return dpy->VersionString; |
case EGL_EXTENSIONS: |
_eglUpdateExtensionsString(dpy); |
return dpy->ExtensionsString; |
case EGL_CLIENT_APIS: |
_eglUpdateAPIsString(dpy); |
return dpy->ClientAPIsString; |
default: |
_eglError(EGL_BAD_PARAMETER, "eglQueryString"); |
return NULL; |
} |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglmisc.h |
---|
0,0 → 1,42 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLMISC_INCLUDED |
#define EGLMISC_INCLUDED |
#include "egltypedefs.h" |
extern const char * |
_eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name); |
#endif /* EGLMISC_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglmode.c |
---|
0,0 → 1,357 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#include "egldisplay.h" |
#include "eglmode.h" |
#include "eglcurrent.h" |
#include "eglscreen.h" |
#ifdef EGL_MESA_screen_surface |
#define MIN2(A, B) (((A) < (B)) ? (A) : (B)) |
/** |
* Given an EGLModeMESA handle, return the corresponding _EGLMode object |
* or null if non-existant. |
*/ |
_EGLMode * |
_eglLookupMode(EGLModeMESA mode, _EGLDisplay *disp) |
{ |
EGLint scrnum; |
if (!disp || !disp->Screens) |
return NULL; |
/* loop over all screens on the display */ |
for (scrnum = 0; scrnum < disp->Screens->Size; scrnum++) { |
const _EGLScreen *scrn = disp->Screens->Elements[scrnum]; |
EGLint idx; |
/* |
* the mode ids of a screen ranges from scrn->Handle to scrn->Handle + |
* scrn->NumModes |
*/ |
if (mode >= scrn->Handle && |
mode < scrn->Handle + _EGL_SCREEN_MAX_MODES) { |
idx = mode - scrn->Handle; |
assert(idx < scrn->NumModes && scrn->Modes[idx].Handle == mode); |
return &scrn->Modes[idx]; |
} |
} |
return NULL; |
} |
/** |
* Parse the attrib_list to fill in the fields of the given _eglMode |
* Return EGL_FALSE if any errors, EGL_TRUE otherwise. |
*/ |
static EGLBoolean |
_eglParseModeAttribs(_EGLMode *mode, const EGLint *attrib_list) |
{ |
EGLint i; |
/* init all attribs to EGL_DONT_CARE */ |
mode->Handle = EGL_DONT_CARE; |
mode->Width = EGL_DONT_CARE; |
mode->Height = EGL_DONT_CARE; |
mode->RefreshRate = EGL_DONT_CARE; |
mode->Optimal = EGL_DONT_CARE; |
mode->Interlaced = EGL_DONT_CARE; |
mode->Name = NULL; |
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { |
switch (attrib_list[i]) { |
case EGL_MODE_ID_MESA: |
mode->Handle = attrib_list[++i]; |
if (mode->Handle <= 0) { |
_eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(handle)"); |
return EGL_FALSE; |
} |
break; |
case EGL_WIDTH: |
mode->Width = attrib_list[++i]; |
if (mode->Width <= 0) { |
_eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(width)"); |
return EGL_FALSE; |
} |
break; |
case EGL_HEIGHT: |
mode->Height = attrib_list[++i]; |
if (mode->Height <= 0) { |
_eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(height)"); |
return EGL_FALSE; |
} |
break; |
case EGL_REFRESH_RATE_MESA: |
mode->RefreshRate = attrib_list[++i]; |
if (mode->RefreshRate <= 0) { |
_eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(refresh rate)"); |
return EGL_FALSE; |
} |
break; |
case EGL_INTERLACED_MESA: |
mode->Interlaced = attrib_list[++i]; |
if (mode->Interlaced != EGL_TRUE && mode->Interlaced != EGL_FALSE) { |
_eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(interlaced)"); |
return EGL_FALSE; |
} |
break; |
case EGL_OPTIMAL_MESA: |
mode->Optimal = attrib_list[++i]; |
if (mode->Optimal != EGL_TRUE && mode->Optimal != EGL_FALSE) { |
_eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(optimal)"); |
return EGL_FALSE; |
} |
break; |
default: |
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseModeMESA"); |
return EGL_FALSE; |
} |
} |
return EGL_TRUE; |
} |
/** |
* Determine if the candidate mode's attributes are at least as good |
* as the minimal mode's. |
* \return EGL_TRUE if qualifies, EGL_FALSE otherwise |
*/ |
static EGLBoolean |
_eglModeQualifies(const _EGLMode *c, const _EGLMode *min) |
{ |
if (min->Handle != EGL_DONT_CARE && c->Handle != min->Handle) |
return EGL_FALSE; |
if (min->Width != EGL_DONT_CARE && c->Width < min->Width) |
return EGL_FALSE; |
if (min->Height != EGL_DONT_CARE && c->Height < min->Height) |
return EGL_FALSE; |
if (min->RefreshRate != EGL_DONT_CARE && c->RefreshRate < min->RefreshRate) |
return EGL_FALSE; |
if (min->Optimal != EGL_DONT_CARE && c->Optimal != min->Optimal) |
return EGL_FALSE; |
if (min->Interlaced != EGL_DONT_CARE && c->Interlaced != min->Interlaced) |
return EGL_FALSE; |
return EGL_TRUE; |
} |
/** |
* Return value of given mode attribute, or -1 if bad attrib. |
*/ |
static EGLint |
getModeAttrib(const _EGLMode *m, EGLint attrib) |
{ |
switch (attrib) { |
case EGL_MODE_ID_MESA: |
return m->Handle; |
case EGL_WIDTH: |
return m->Width; |
case EGL_HEIGHT: |
return m->Height; |
case EGL_REFRESH_RATE_MESA: |
return m->RefreshRate; |
case EGL_OPTIMAL_MESA: |
return m->Optimal; |
case EGL_INTERLACED_MESA: |
return m->Interlaced; |
default: |
return -1; |
} |
} |
#define SMALLER 1 |
#define LARGER 2 |
struct sort_info { |
EGLint Attrib; |
EGLint Order; /* SMALLER or LARGER */ |
}; |
/* the order of these entries is the priority */ |
static struct sort_info SortInfo[] = { |
{ EGL_OPTIMAL_MESA, LARGER }, |
{ EGL_INTERLACED_MESA, SMALLER }, |
{ EGL_WIDTH, LARGER }, |
{ EGL_HEIGHT, LARGER }, |
{ EGL_REFRESH_RATE_MESA, LARGER }, |
{ EGL_MODE_ID_MESA, SMALLER }, |
{ 0, 0 } |
}; |
/** |
* Compare modes 'a' and 'b' and return -1 if a belongs before b, or 1 if a |
* belongs after b, or 0 if they're equal. |
* Used by qsort(). |
*/ |
static int |
_eglCompareModes(const void *a, const void *b) |
{ |
const _EGLMode *aMode = *((const _EGLMode **) a); |
const _EGLMode *bMode = *((const _EGLMode **) b); |
EGLint i; |
for (i = 0; SortInfo[i].Attrib; i++) { |
const EGLint aVal = getModeAttrib(aMode, SortInfo[i].Attrib); |
const EGLint bVal = getModeAttrib(bMode, SortInfo[i].Attrib); |
if (aVal == bVal) { |
/* a tie */ |
continue; |
} |
else if (SortInfo[i].Order == SMALLER) { |
return (aVal < bVal) ? -1 : 1; |
} |
else if (SortInfo[i].Order == LARGER) { |
return (aVal > bVal) ? -1 : 1; |
} |
} |
/* all attributes identical */ |
return 0; |
} |
/** |
* Search for EGLModes which match the given attribute list. |
* Called via eglChooseModeMESA API function. |
*/ |
EGLBoolean |
_eglChooseModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, |
const EGLint *attrib_list, EGLModeMESA *modes, |
EGLint modes_size, EGLint *num_modes) |
{ |
_EGLMode **modeList, min; |
EGLint i, count; |
if (!_eglParseModeAttribs(&min, attrib_list)) { |
/* error code will have been recorded */ |
return EGL_FALSE; |
} |
/* allocate array of mode pointers */ |
modeList = malloc(modes_size * sizeof(_EGLMode *)); |
if (!modeList) { |
_eglError(EGL_BAD_MODE_MESA, "eglChooseModeMESA(out of memory)"); |
return EGL_FALSE; |
} |
/* make array of pointers to qualifying modes */ |
for (i = count = 0; i < scrn->NumModes && count < modes_size; i++) { |
if (_eglModeQualifies(scrn->Modes + i, &min)) { |
modeList[count++] = scrn->Modes + i; |
} |
} |
/* sort array of pointers */ |
qsort(modeList, count, sizeof(_EGLMode *), _eglCompareModes); |
/* copy mode handles to output array */ |
for (i = 0; i < count; i++) { |
modes[i] = modeList[i]->Handle; |
} |
free(modeList); |
*num_modes = count; |
return EGL_TRUE; |
} |
/** |
* Return all possible modes for the given screen. No sorting of results. |
* Called via eglGetModesMESA() API function. |
*/ |
EGLBoolean |
_eglGetModesMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, |
EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes) |
{ |
if (modes) { |
EGLint i; |
*num_modes = MIN2(scrn->NumModes, modes_size); |
for (i = 0; i < *num_modes; i++) { |
modes[i] = scrn->Modes[i].Handle; |
} |
} |
else { |
/* just return total number of supported modes */ |
*num_modes = scrn->NumModes; |
} |
return EGL_TRUE; |
} |
/** |
* Query an attribute of a mode. |
*/ |
EGLBoolean |
_eglGetModeAttribMESA(_EGLDriver *drv, _EGLDisplay *dpy, |
_EGLMode *m, EGLint attribute, EGLint *value) |
{ |
EGLint v; |
v = getModeAttrib(m, attribute); |
if (v < 0) { |
_eglError(EGL_BAD_ATTRIBUTE, "eglGetModeAttribMESA"); |
return EGL_FALSE; |
} |
*value = v; |
return EGL_TRUE; |
} |
/** |
* Return human-readable string for given mode. |
* This is the default function called by eglQueryModeStringMESA(). |
*/ |
const char * |
_eglQueryModeStringMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m) |
{ |
return m->Name; |
} |
#endif /* EGL_MESA_screen_surface */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglmode.h |
---|
0,0 → 1,88 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#ifndef EGLMODE_INCLUDED |
#define EGLMODE_INCLUDED |
#include "egltypedefs.h" |
#ifdef EGL_MESA_screen_surface |
#define EGL_NO_MODE_MESA 0 |
/** |
* Data structure which corresponds to an EGLModeMESA. |
*/ |
struct _egl_mode |
{ |
EGLModeMESA Handle; /* the public/opaque handle which names this mode */ |
EGLint Width, Height; /* size in pixels */ |
EGLint RefreshRate; /* rate * 1000.0 */ |
EGLint Optimal; |
EGLint Interlaced; |
const char *Name; |
/* Other possible attributes */ |
/* interlaced */ |
/* external sync */ |
}; |
extern _EGLMode * |
_eglLookupMode(EGLModeMESA mode, _EGLDisplay *dpy); |
extern EGLBoolean |
_eglChooseModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, |
const EGLint *attrib_list, EGLModeMESA *modes, |
EGLint modes_size, EGLint *num_modes); |
extern EGLBoolean |
_eglGetModesMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, |
EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); |
extern EGLBoolean |
_eglGetModeAttribMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m, |
EGLint attribute, EGLint *value); |
extern const char * |
_eglQueryModeStringMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m); |
#endif /* EGL_MESA_screen_surface */ |
#endif /* EGLMODE_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglmutex.h |
---|
0,0 → 1,80 |
/************************************************************************** |
* |
* Copyright 2009 Chia-I Wu <olvaffe@gmail.com> |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLMUTEX_INCLUDED |
#define EGLMUTEX_INCLUDED |
#include "eglcompiler.h" |
#ifdef HAVE_PTHREAD |
#include <pthread.h> |
typedef pthread_mutex_t _EGLMutex; |
static INLINE void _eglInitMutex(_EGLMutex *m) |
{ |
pthread_mutex_init(m, NULL); |
} |
static INLINE void |
_eglDestroyMutex(_EGLMutex *m) |
{ |
pthread_mutex_destroy(m); |
} |
static INLINE void |
_eglLockMutex(_EGLMutex *m) |
{ |
pthread_mutex_lock(m); |
} |
static INLINE void |
_eglUnlockMutex(_EGLMutex *m) |
{ |
pthread_mutex_unlock(m); |
} |
#define _EGL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER |
#define _EGL_DECLARE_MUTEX(m) \ |
_EGLMutex m = _EGL_MUTEX_INITIALIZER |
#else |
typedef int _EGLMutex; |
static INLINE void _eglInitMutex(_EGLMutex *m) { (void) m; } |
static INLINE void _eglDestroyMutex(_EGLMutex *m) { (void) m; } |
static INLINE void _eglLockMutex(_EGLMutex *m) { (void) m; } |
static INLINE void _eglUnlockMutex(_EGLMutex *m) { (void) m; } |
#define _EGL_MUTEX_INITIALIZER 0 |
#define _EGL_DECLARE_MUTEX(m) \ |
_EGLMutex m = _EGL_MUTEX_INITIALIZER |
#endif |
#endif /* EGLMUTEX_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglscreen.c |
---|
0,0 → 1,235 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
/* |
* Ideas for screen management extension to EGL. |
* |
* Each EGLDisplay has one or more screens (CRTs, Flat Panels, etc). |
* The screens' handles can be obtained with eglGetScreensMESA(). |
* |
* A new kind of EGLSurface is possible- one which can be directly scanned |
* out on a screen. Such a surface is created with eglCreateScreenSurface(). |
* |
* To actually display a screen surface on a screen, the eglShowSurface() |
* function is called. |
*/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#include "egldisplay.h" |
#include "eglcurrent.h" |
#include "eglmode.h" |
#include "eglsurface.h" |
#include "eglscreen.h" |
#include "eglmutex.h" |
#ifdef EGL_MESA_screen_surface |
/* ugh, no atomic op? */ |
static _EGL_DECLARE_MUTEX(_eglNextScreenHandleMutex); |
static EGLScreenMESA _eglNextScreenHandle = 1; |
/** |
* Return a new screen handle/ID. |
* NOTE: we never reuse these! |
*/ |
static EGLScreenMESA |
_eglAllocScreenHandle(void) |
{ |
EGLScreenMESA s; |
_eglLockMutex(&_eglNextScreenHandleMutex); |
s = _eglNextScreenHandle; |
_eglNextScreenHandle += _EGL_SCREEN_MAX_MODES; |
_eglUnlockMutex(&_eglNextScreenHandleMutex); |
return s; |
} |
/** |
* Initialize an _EGLScreen object to default values. |
*/ |
void |
_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes) |
{ |
memset(screen, 0, sizeof(_EGLScreen)); |
screen->Display = dpy; |
screen->NumModes = num_modes; |
screen->StepX = 1; |
screen->StepY = 1; |
if (num_modes > _EGL_SCREEN_MAX_MODES) |
num_modes = _EGL_SCREEN_MAX_MODES; |
screen->Modes = calloc(num_modes, sizeof(*screen->Modes)); |
screen->NumModes = (screen->Modes) ? num_modes : 0; |
} |
/** |
* Link a screen to its display and return the handle of the link. |
* The handle can be passed to client directly. |
*/ |
EGLScreenMESA |
_eglLinkScreen(_EGLScreen *screen) |
{ |
_EGLDisplay *display; |
EGLint i; |
assert(screen && screen->Display); |
display = screen->Display; |
if (!display->Screens) { |
display->Screens = _eglCreateArray("Screen", 4); |
if (!display->Screens) |
return (EGLScreenMESA) 0; |
} |
screen->Handle = _eglAllocScreenHandle(); |
for (i = 0; i < screen->NumModes; i++) |
screen->Modes[i].Handle = screen->Handle + i; |
_eglAppendArray(display->Screens, (void *) screen); |
return screen->Handle; |
} |
/** |
* Lookup a handle to find the linked config. |
* Return NULL if the handle has no corresponding linked config. |
*/ |
_EGLScreen * |
_eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display) |
{ |
EGLint i; |
if (!display || !display->Screens) |
return NULL; |
for (i = 0; i < display->Screens->Size; i++) { |
_EGLScreen *scr = (_EGLScreen *) display->Screens->Elements[i]; |
if (scr->Handle == screen) { |
assert(scr->Display == display); |
return scr; |
} |
} |
return NULL; |
} |
static EGLBoolean |
_eglFlattenScreen(void *elem, void *buffer) |
{ |
_EGLScreen *scr = (_EGLScreen *) elem; |
EGLScreenMESA *handle = (EGLScreenMESA *) buffer; |
*handle = _eglGetScreenHandle(scr); |
return EGL_TRUE; |
} |
EGLBoolean |
_eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *display, EGLScreenMESA *screens, |
EGLint max_screens, EGLint *num_screens) |
{ |
*num_screens = _eglFlattenArray(display->Screens, (void *) screens, |
sizeof(screens[0]), max_screens, _eglFlattenScreen); |
return EGL_TRUE; |
} |
/** |
* Set a screen's surface origin. |
*/ |
EGLBoolean |
_eglScreenPositionMESA(_EGLDriver *drv, _EGLDisplay *dpy, |
_EGLScreen *scrn, EGLint x, EGLint y) |
{ |
scrn->OriginX = x; |
scrn->OriginY = y; |
return EGL_TRUE; |
} |
/** |
* Query a screen's current surface. |
*/ |
EGLBoolean |
_eglQueryScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy, |
_EGLScreen *scrn, _EGLSurface **surf) |
{ |
*surf = scrn->CurrentSurface; |
return EGL_TRUE; |
} |
/** |
* Query a screen's current mode. |
*/ |
EGLBoolean |
_eglQueryScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, |
_EGLMode **m) |
{ |
*m = scrn->CurrentMode; |
return EGL_TRUE; |
} |
EGLBoolean |
_eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, |
EGLint attribute, EGLint *value) |
{ |
switch (attribute) { |
case EGL_SCREEN_POSITION_MESA: |
value[0] = scrn->OriginX; |
value[1] = scrn->OriginY; |
break; |
case EGL_SCREEN_POSITION_GRANULARITY_MESA: |
value[0] = scrn->StepX; |
value[1] = scrn->StepY; |
break; |
default: |
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryScreenMESA"); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
#endif /* EGL_MESA_screen_surface */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglscreen.c.bak |
---|
0,0 → 1,240 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
/* |
* Ideas for screen management extension to EGL. |
* |
* Each EGLDisplay has one or more screens (CRTs, Flat Panels, etc). |
* The screens' handles can be obtained with eglGetScreensMESA(). |
* |
* A new kind of EGLSurface is possible- one which can be directly scanned |
* out on a screen. Such a surface is created with eglCreateScreenSurface(). |
* |
* To actually display a screen surface on a screen, the eglShowSurface() |
* function is called. |
*/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#define EGL_EGLEXT_PROTOTYPES |
#include <EGL/egl.h> |
#include <EGL/eglext.h> |
#include "egldisplay.h" |
#include "eglcurrent.h" |
#include "eglmode.h" |
#include "eglsurface.h" |
#include "eglscreen.h" |
#include "eglmutex.h" |
//#define EGL_MESA_screen_surface |
#ifdef EGL_MESA_screen_surface |
/* ugh, no atomic op? */ |
static _EGL_DECLARE_MUTEX(_eglNextScreenHandleMutex); |
static EGLScreenMESA _eglNextScreenHandle = 1; |
/** |
* Return a new screen handle/ID. |
* NOTE: we never reuse these! |
*/ |
static EGLScreenMESA |
_eglAllocScreenHandle(void) |
{ |
EGLScreenMESA s; |
_eglLockMutex(&_eglNextScreenHandleMutex); |
s = _eglNextScreenHandle; |
_eglNextScreenHandle += _EGL_SCREEN_MAX_MODES; |
_eglUnlockMutex(&_eglNextScreenHandleMutex); |
return s; |
} |
/** |
* Initialize an _EGLScreen object to default values. |
*/ |
void |
_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes) |
{ |
memset(screen, 0, sizeof(_EGLScreen)); |
screen->Display = dpy; |
screen->NumModes = num_modes; |
screen->StepX = 1; |
screen->StepY = 1; |
if (num_modes > _EGL_SCREEN_MAX_MODES) |
num_modes = _EGL_SCREEN_MAX_MODES; |
screen->Modes = calloc(num_modes, sizeof(*screen->Modes)); |
screen->NumModes = (screen->Modes) ? num_modes : 0; |
} |
/** |
* Link a screen to its display and return the handle of the link. |
* The handle can be passed to client directly. |
*/ |
EGLScreenMESA |
_eglLinkScreen(_EGLScreen *screen) |
{ |
_EGLDisplay *display; |
EGLint i; |
assert(screen && screen->Display); |
display = screen->Display; |
if (!display->Screens) { |
display->Screens = _eglCreateArray("Screen", 4); |
if (!display->Screens) |
return (EGLScreenMESA) 0; |
} |
screen->Handle = _eglAllocScreenHandle(); |
for (i = 0; i < screen->NumModes; i++) |
screen->Modes[i].Handle = screen->Handle + i; |
_eglAppendArray(display->Screens, (void *) screen); |
return screen->Handle; |
} |
/** |
* Lookup a handle to find the linked config. |
* Return NULL if the handle has no corresponding linked config. |
*/ |
_EGLScreen * |
_eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display) |
{ |
EGLint i; |
if (!display || !display->Screens) |
return NULL; |
for (i = 0; i < display->Screens->Size; i++) { |
_EGLScreen *scr = (_EGLScreen *) display->Screens->Elements[i]; |
if (scr->Handle == screen) { |
assert(scr->Display == display); |
return scr; |
} |
} |
return NULL; |
} |
static EGLBoolean |
_eglFlattenScreen(void *elem, void *buffer) |
{ |
_EGLScreen *scr = (_EGLScreen *) elem; |
EGLScreenMESA *handle = (EGLScreenMESA *) buffer; |
*handle = _eglGetScreenHandle(scr); |
return EGL_TRUE; |
} |
EGLBoolean |
_eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *display, EGLScreenMESA *screens, |
EGLint max_screens, EGLint *num_screens) |
{ |
*num_screens = _eglFlattenArray(display->Screens, (void *) screens, |
sizeof(screens[0]), max_screens, _eglFlattenScreen); |
return EGL_TRUE; |
} |
/** |
* Set a screen's surface origin. |
*/ |
EGLBoolean |
_eglScreenPositionMESA(_EGLDriver *drv, _EGLDisplay *dpy, |
_EGLScreen *scrn, EGLint x, EGLint y) |
{ |
scrn->OriginX = x; |
scrn->OriginY = y; |
return EGL_TRUE; |
} |
/** |
* Query a screen's current surface. |
*/ |
EGLBoolean |
_eglQueryScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy, |
_EGLScreen *scrn, _EGLSurface **surf) |
{ |
*surf = scrn->CurrentSurface; |
return EGL_TRUE; |
} |
/** |
* Query a screen's current mode. |
*/ |
EGLBoolean |
_eglQueryScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, |
_EGLMode **m) |
{ |
*m = scrn->CurrentMode; |
return EGL_TRUE; |
} |
EGLBoolean |
_eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, |
EGLint attribute, EGLint *value) |
{ |
switch (attribute) { |
case EGL_SCREEN_POSITION_MESA: |
value[0] = scrn->OriginX; |
value[1] = scrn->OriginY; |
break; |
case EGL_SCREEN_POSITION_GRANULARITY_MESA: |
value[0] = scrn->StepX; |
value[1] = scrn->StepY; |
break; |
default: |
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryScreenMESA"); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
#endif /* EGL_MESA_screen_surface */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglscreen.h |
---|
0,0 → 1,116 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#ifndef EGLSCREEN_INCLUDED |
#define EGLSCREEN_INCLUDED |
#include "egltypedefs.h" |
#ifdef EGL_MESA_screen_surface |
#define _EGL_SCREEN_MAX_MODES 16 |
/** |
* Per-screen information. |
* Note that an EGL screen doesn't have a size. A screen may be set to |
* one of several display modes (width/height/scanrate). The screen |
* then displays a drawing surface. The drawing surface must be at least |
* as large as the display mode's resolution. If it's larger, the |
* OriginX and OriginY fields control what part of the surface is visible |
* on the screen. |
*/ |
struct _egl_screen |
{ |
_EGLDisplay *Display; |
EGLScreenMESA Handle; /* The public/opaque handle which names this object */ |
_EGLMode *CurrentMode; |
_EGLSurface *CurrentSurface; |
EGLint OriginX, OriginY; /**< Origin of scan-out region w.r.t. surface */ |
EGLint StepX, StepY; /**< Screen position/origin granularity */ |
EGLint NumModes; |
_EGLMode *Modes; /**< array [NumModes] */ |
}; |
PUBLIC void |
_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes); |
PUBLIC EGLScreenMESA |
_eglLinkScreen(_EGLScreen *screen); |
extern _EGLScreen * |
_eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *dpy); |
/** |
* Return the handle of a linked screen. |
*/ |
static INLINE EGLScreenMESA |
_eglGetScreenHandle(_EGLScreen *screen) |
{ |
return (screen) ? screen->Handle : (EGLScreenMESA) 0; |
} |
extern EGLBoolean |
_eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); |
extern EGLBoolean |
_eglScreenPositionMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint x, EGLint y); |
extern EGLBoolean |
_eglQueryScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy, |
_EGLScreen *scrn, _EGLSurface **surface); |
extern EGLBoolean |
_eglQueryScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, _EGLMode **m); |
extern EGLBoolean |
_eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint attribute, EGLint *value); |
#endif /* EGL_MESA_screen_surface */ |
#endif /* EGLSCREEN_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglstring.c |
---|
0,0 → 1,54 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
/** |
* String utils. |
*/ |
#include <stdlib.h> |
#include <string.h> |
#include "eglstring.h" |
char * |
_eglstrdup(const char *s) |
{ |
if (s) { |
size_t l = strlen(s); |
char *s2 = malloc(l + 1); |
if (s2) |
strcpy(s2, s); |
return s2; |
} |
return NULL; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglstring.h |
---|
0,0 → 1,50 |
/************************************************************************** |
* |
* 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. |
* |
**************************************************************************/ |
#ifndef EGLSTRING_INCLUDED |
#define EGLSTRING_INCLUDED |
#include <string.h> |
#include <stdio.h> |
#ifdef _EGL_OS_WINDOWS |
#define _eglstrcasecmp _stricmp |
#define _eglsnprintf _snprintf |
#else |
#include <strings.h> // for strcasecmp |
#define _eglstrcasecmp strcasecmp |
#define _eglsnprintf snprintf |
#endif |
extern char * |
_eglstrdup(const char *s); |
#endif /* EGLSTRING_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglsurface.c |
---|
0,0 → 1,541 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
/** |
* Surface-related functions. |
*/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "eglcontext.h" |
#include "eglconfig.h" |
#include "eglcurrent.h" |
#include "egllog.h" |
#include "eglsurface.h" |
static void |
_eglClampSwapInterval(_EGLSurface *surf, EGLint interval) |
{ |
EGLint bound = surf->Config->MaxSwapInterval; |
if (interval >= bound) { |
interval = bound; |
} |
else { |
bound = surf->Config->MinSwapInterval; |
if (interval < bound) |
interval = bound; |
} |
surf->SwapInterval = interval; |
} |
#ifdef EGL_MESA_screen_surface |
static EGLint |
_eglParseScreenSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list) |
{ |
EGLint i, err = EGL_SUCCESS; |
if (!attrib_list) |
return EGL_SUCCESS; |
for (i = 0; attrib_list[i] != EGL_NONE; i++) { |
EGLint attr = attrib_list[i++]; |
EGLint val = attrib_list[i]; |
switch (attr) { |
case EGL_WIDTH: |
if (val < 0) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->Width = val; |
break; |
case EGL_HEIGHT: |
if (val < 0) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->Height = val; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) { |
_eglLog(_EGL_WARNING, "bad surface attribute 0x%04x", attr); |
break; |
} |
} |
return err; |
} |
#endif /* EGL_MESA_screen_surface */ |
/** |
* Parse the list of surface attributes and return the proper error code. |
*/ |
static EGLint |
_eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list) |
{ |
_EGLDisplay *dpy = surf->Resource.Display; |
EGLint type = surf->Type; |
EGLint texture_type = EGL_PBUFFER_BIT; |
EGLint i, err = EGL_SUCCESS; |
if (!attrib_list) |
return EGL_SUCCESS; |
#ifdef EGL_MESA_screen_surface |
if (type == EGL_SCREEN_BIT_MESA) |
return _eglParseScreenSurfaceAttribList(surf, attrib_list); |
#endif |
if (dpy->Extensions.NOK_texture_from_pixmap) |
texture_type |= EGL_PIXMAP_BIT; |
for (i = 0; attrib_list[i] != EGL_NONE; i++) { |
EGLint attr = attrib_list[i++]; |
EGLint val = attrib_list[i]; |
switch (attr) { |
/* common attributes */ |
case EGL_VG_COLORSPACE: |
switch (val) { |
case EGL_VG_COLORSPACE_sRGB: |
case EGL_VG_COLORSPACE_LINEAR: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surf->VGColorspace = val; |
break; |
case EGL_VG_ALPHA_FORMAT: |
switch (val) { |
case EGL_VG_ALPHA_FORMAT_NONPRE: |
case EGL_VG_ALPHA_FORMAT_PRE: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surf->VGAlphaFormat = val; |
break; |
/* window surface attributes */ |
case EGL_RENDER_BUFFER: |
if (type != EGL_WINDOW_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (val != EGL_BACK_BUFFER && val != EGL_SINGLE_BUFFER) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
surf->RenderBuffer = val; |
break; |
case EGL_POST_SUB_BUFFER_SUPPORTED_NV: |
if (!dpy->Extensions.NV_post_sub_buffer || |
type != EGL_WINDOW_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (val != EGL_TRUE && val != EGL_FALSE) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->PostSubBufferSupportedNV = val; |
break; |
/* pbuffer surface attributes */ |
case EGL_WIDTH: |
if (type != EGL_PBUFFER_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (val < 0) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->Width = val; |
break; |
case EGL_HEIGHT: |
if (type != EGL_PBUFFER_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (val < 0) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->Height = val; |
break; |
case EGL_LARGEST_PBUFFER: |
if (type != EGL_PBUFFER_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
surf->LargestPbuffer = !!val; |
break; |
/* for eglBindTexImage */ |
case EGL_TEXTURE_FORMAT: |
if (!(type & texture_type)) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
switch (val) { |
case EGL_TEXTURE_RGB: |
case EGL_TEXTURE_RGBA: |
case EGL_NO_TEXTURE: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surf->TextureFormat = val; |
break; |
case EGL_TEXTURE_TARGET: |
if (!(type & texture_type)) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
switch (val) { |
case EGL_TEXTURE_2D: |
case EGL_NO_TEXTURE: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surf->TextureTarget = val; |
break; |
case EGL_MIPMAP_TEXTURE: |
if (!(type & texture_type)) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
surf->MipmapTexture = !!val; |
break; |
/* no pixmap surface specific attributes */ |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) { |
_eglLog(_EGL_WARNING, "bad surface attribute 0x%04x", attr); |
break; |
} |
} |
return err; |
} |
/** |
* Do error check on parameters and initialize the given _EGLSurface object. |
* \return EGL_TRUE if no errors, EGL_FALSE otherwise. |
*/ |
EGLBoolean |
_eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type, |
_EGLConfig *conf, const EGLint *attrib_list) |
{ |
const char *func; |
EGLint renderBuffer = EGL_BACK_BUFFER; |
EGLint swapBehavior = EGL_BUFFER_PRESERVED; |
EGLint err; |
switch (type) { |
case EGL_WINDOW_BIT: |
func = "eglCreateWindowSurface"; |
swapBehavior = EGL_BUFFER_DESTROYED; |
break; |
case EGL_PIXMAP_BIT: |
func = "eglCreatePixmapSurface"; |
renderBuffer = EGL_SINGLE_BUFFER; |
break; |
case EGL_PBUFFER_BIT: |
func = "eglCreatePBufferSurface"; |
break; |
#ifdef EGL_MESA_screen_surface |
case EGL_SCREEN_BIT_MESA: |
func = "eglCreateScreenSurface"; |
renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */ |
break; |
#endif |
default: |
_eglLog(_EGL_WARNING, "Bad type in _eglInitSurface"); |
return EGL_FALSE; |
} |
if ((conf->SurfaceType & type) == 0) { |
/* The config can't be used to create a surface of this type */ |
_eglError(EGL_BAD_CONFIG, func); |
return EGL_FALSE; |
} |
_eglInitResource(&surf->Resource, sizeof(*surf), dpy); |
surf->Type = type; |
surf->Config = conf; |
surf->Width = 0; |
surf->Height = 0; |
surf->TextureFormat = EGL_NO_TEXTURE; |
surf->TextureTarget = EGL_NO_TEXTURE; |
surf->MipmapTexture = EGL_FALSE; |
surf->LargestPbuffer = EGL_FALSE; |
surf->RenderBuffer = renderBuffer; |
surf->VGAlphaFormat = EGL_VG_ALPHA_FORMAT_NONPRE; |
surf->VGColorspace = EGL_VG_COLORSPACE_sRGB; |
surf->MipmapLevel = 0; |
surf->MultisampleResolve = EGL_MULTISAMPLE_RESOLVE_DEFAULT; |
surf->SwapBehavior = swapBehavior; |
surf->HorizontalResolution = EGL_UNKNOWN; |
surf->VerticalResolution = EGL_UNKNOWN; |
surf->AspectRatio = EGL_UNKNOWN; |
surf->PostSubBufferSupportedNV = EGL_FALSE; |
/* the default swap interval is 1 */ |
_eglClampSwapInterval(surf, 1); |
err = _eglParseSurfaceAttribList(surf, attrib_list); |
if (err != EGL_SUCCESS) |
return _eglError(err, func); |
return EGL_TRUE; |
} |
EGLBoolean |
_eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, |
EGLint attribute, EGLint *value) |
{ |
switch (attribute) { |
case EGL_WIDTH: |
*value = surface->Width; |
break; |
case EGL_HEIGHT: |
*value = surface->Height; |
break; |
case EGL_CONFIG_ID: |
*value = surface->Config->ConfigID; |
break; |
case EGL_LARGEST_PBUFFER: |
*value = surface->LargestPbuffer; |
break; |
case EGL_TEXTURE_FORMAT: |
/* texture attributes: only for pbuffers, no error otherwise */ |
if (surface->Type == EGL_PBUFFER_BIT) |
*value = surface->TextureFormat; |
break; |
case EGL_TEXTURE_TARGET: |
if (surface->Type == EGL_PBUFFER_BIT) |
*value = surface->TextureTarget; |
break; |
case EGL_MIPMAP_TEXTURE: |
if (surface->Type == EGL_PBUFFER_BIT) |
*value = surface->MipmapTexture; |
break; |
case EGL_MIPMAP_LEVEL: |
if (surface->Type == EGL_PBUFFER_BIT) |
*value = surface->MipmapLevel; |
break; |
case EGL_SWAP_BEHAVIOR: |
*value = surface->SwapBehavior; |
break; |
case EGL_RENDER_BUFFER: |
*value = surface->RenderBuffer; |
break; |
case EGL_PIXEL_ASPECT_RATIO: |
*value = surface->AspectRatio; |
break; |
case EGL_HORIZONTAL_RESOLUTION: |
*value = surface->HorizontalResolution; |
break; |
case EGL_VERTICAL_RESOLUTION: |
*value = surface->VerticalResolution; |
break; |
case EGL_MULTISAMPLE_RESOLVE: |
*value = surface->MultisampleResolve; |
break; |
case EGL_VG_ALPHA_FORMAT: |
*value = surface->VGAlphaFormat; |
break; |
case EGL_VG_COLORSPACE: |
*value = surface->VGColorspace; |
break; |
case EGL_POST_SUB_BUFFER_SUPPORTED_NV: |
*value = surface->PostSubBufferSupportedNV; |
break; |
case EGL_BUFFER_AGE_EXT: |
if (!dpy->Extensions.EXT_buffer_age) { |
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface"); |
return EGL_FALSE; |
} |
*value = drv->API.QueryBufferAge(drv, dpy, surface); |
break; |
default: |
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface"); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
/** |
* Default fallback routine - drivers might override this. |
*/ |
EGLBoolean |
_eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, |
EGLint attribute, EGLint value) |
{ |
EGLint confval; |
EGLint err = EGL_SUCCESS; |
EGLint all_es_bits = EGL_OPENGL_ES_BIT | |
EGL_OPENGL_ES2_BIT | |
EGL_OPENGL_ES3_BIT_KHR; |
switch (attribute) { |
case EGL_MIPMAP_LEVEL: |
confval = surface->Config->RenderableType; |
if (!(confval & all_es_bits)) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surface->MipmapLevel = value; |
break; |
case EGL_MULTISAMPLE_RESOLVE: |
switch (value) { |
case EGL_MULTISAMPLE_RESOLVE_DEFAULT: |
break; |
case EGL_MULTISAMPLE_RESOLVE_BOX: |
confval = surface->Config->SurfaceType; |
if (!(confval & EGL_MULTISAMPLE_RESOLVE_BOX_BIT)) |
err = EGL_BAD_MATCH; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surface->MultisampleResolve = value; |
break; |
case EGL_SWAP_BEHAVIOR: |
switch (value) { |
case EGL_BUFFER_DESTROYED: |
break; |
case EGL_BUFFER_PRESERVED: |
confval = surface->Config->SurfaceType; |
if (!(confval & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)) |
err = EGL_BAD_MATCH; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surface->SwapBehavior = value; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
return _eglError(err, "eglSurfaceAttrib"); |
return EGL_TRUE; |
} |
EGLBoolean |
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, |
EGLint buffer) |
{ |
EGLint texture_type = EGL_PBUFFER_BIT; |
/* Just do basic error checking and return success/fail. |
* Drivers must implement the real stuff. |
*/ |
if (dpy->Extensions.NOK_texture_from_pixmap) |
texture_type |= EGL_PIXMAP_BIT; |
if (!(surface->Type & texture_type)) { |
_eglError(EGL_BAD_SURFACE, "eglBindTexImage"); |
return EGL_FALSE; |
} |
if (surface->TextureFormat == EGL_NO_TEXTURE) { |
_eglError(EGL_BAD_MATCH, "eglBindTexImage"); |
return EGL_FALSE; |
} |
if (surface->TextureTarget == EGL_NO_TEXTURE) { |
_eglError(EGL_BAD_MATCH, "eglBindTexImage"); |
return EGL_FALSE; |
} |
if (buffer != EGL_BACK_BUFFER) { |
_eglError(EGL_BAD_PARAMETER, "eglBindTexImage"); |
return EGL_FALSE; |
} |
surface->BoundToTexture = EGL_TRUE; |
return EGL_TRUE; |
} |
EGLBoolean |
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, |
EGLint interval) |
{ |
_eglClampSwapInterval(surf, interval); |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglsurface.c.bak |
---|
0,0 → 1,543 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
/** |
* Surface-related functions. |
*/ |
#include <assert.h> |
#include <stdlib.h> |
#include <string.h> |
#include "egldisplay.h" |
#include "egldriver.h" |
#include "eglcontext.h" |
#include "eglconfig.h" |
#include "eglcurrent.h" |
#include "egllog.h" |
#include "eglsurface.h" |
static void |
_eglClampSwapInterval(_EGLSurface *surf, EGLint interval) |
{ |
EGLint bound = surf->Config->MaxSwapInterval; |
if (interval >= bound) { |
interval = bound; |
} |
else { |
bound = surf->Config->MinSwapInterval; |
if (interval < bound) |
interval = bound; |
} |
surf->SwapInterval = interval; |
} |
#ifdef EGL_MESA_screen_surface |
static EGLint |
_eglParseScreenSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list) |
{ |
EGLint i, err = EGL_SUCCESS; |
if (!attrib_list) |
return EGL_SUCCESS; |
for (i = 0; attrib_list[i] != EGL_NONE; i++) { |
EGLint attr = attrib_list[i++]; |
EGLint val = attrib_list[i]; |
switch (attr) { |
case EGL_WIDTH: |
if (val < 0) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->Width = val; |
break; |
case EGL_HEIGHT: |
if (val < 0) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->Height = val; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) { |
_eglLog(_EGL_WARNING, "bad surface attribute 0x%04x", attr); |
break; |
} |
} |
return err; |
} |
#endif /* EGL_MESA_screen_surface */ |
/** |
* Parse the list of surface attributes and return the proper error code. |
*/ |
static EGLint |
_eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list) |
{ |
_EGLDisplay *dpy = surf->Resource.Display; |
EGLint type = surf->Type; |
EGLint texture_type = EGL_PBUFFER_BIT; |
EGLint i, err = EGL_SUCCESS; |
if (!attrib_list) |
return EGL_SUCCESS; |
#ifdef EGL_MESA_screen_surface |
if (type == EGL_SCREEN_BIT_MESA) |
return _eglParseScreenSurfaceAttribList(surf, attrib_list); |
#endif |
if (dpy->Extensions.NOK_texture_from_pixmap) |
texture_type |= EGL_PIXMAP_BIT; |
for (i = 0; attrib_list[i] != EGL_NONE; i++) { |
EGLint attr = attrib_list[i++]; |
EGLint val = attrib_list[i]; |
switch (attr) { |
/* common attributes */ |
case EGL_VG_COLORSPACE: |
switch (val) { |
case EGL_VG_COLORSPACE_sRGB: |
case EGL_VG_COLORSPACE_LINEAR: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surf->VGColorspace = val; |
break; |
case EGL_VG_ALPHA_FORMAT: |
switch (val) { |
case EGL_VG_ALPHA_FORMAT_NONPRE: |
case EGL_VG_ALPHA_FORMAT_PRE: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surf->VGAlphaFormat = val; |
break; |
/* window surface attributes */ |
case EGL_RENDER_BUFFER: |
if (type != EGL_WINDOW_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (val != EGL_BACK_BUFFER && val != EGL_SINGLE_BUFFER) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
surf->RenderBuffer = val; |
break; |
case EGL_POST_SUB_BUFFER_SUPPORTED_NV: |
if (!dpy->Extensions.NV_post_sub_buffer || |
type != EGL_WINDOW_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (val != EGL_TRUE && val != EGL_FALSE) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->PostSubBufferSupportedNV = val; |
break; |
/* pbuffer surface attributes */ |
case EGL_WIDTH: |
if (type != EGL_PBUFFER_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (val < 0) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->Width = val; |
break; |
case EGL_HEIGHT: |
if (type != EGL_PBUFFER_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (val < 0) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surf->Height = val; |
break; |
case EGL_LARGEST_PBUFFER: |
if (type != EGL_PBUFFER_BIT) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
surf->LargestPbuffer = !!val; |
break; |
/* for eglBindTexImage */ |
case EGL_TEXTURE_FORMAT: |
if (!(type & texture_type)) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
switch (val) { |
case EGL_TEXTURE_RGB: |
case EGL_TEXTURE_RGBA: |
case EGL_NO_TEXTURE: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surf->TextureFormat = val; |
break; |
case EGL_TEXTURE_TARGET: |
if (!(type & texture_type)) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
switch (val) { |
case EGL_TEXTURE_2D: |
case EGL_NO_TEXTURE: |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surf->TextureTarget = val; |
break; |
case EGL_MIPMAP_TEXTURE: |
if (!(type & texture_type)) { |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
surf->MipmapTexture = !!val; |
break; |
/* no pixmap surface specific attributes */ |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) { |
_eglLog(_EGL_WARNING, "bad surface attribute 0x%04x", attr); |
break; |
} |
} |
return err; |
} |
/** |
* Do error check on parameters and initialize the given _EGLSurface object. |
* \return EGL_TRUE if no errors, EGL_FALSE otherwise. |
*/ |
EGLBoolean |
_eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type, |
_EGLConfig *conf, const EGLint *attrib_list) |
{ |
const char *func; |
EGLint renderBuffer = EGL_BACK_BUFFER; |
EGLint swapBehavior = EGL_BUFFER_PRESERVED; |
EGLint err; |
printf("%s\n",__FUNCTION__); |
switch (type) { |
case EGL_WINDOW_BIT: |
func = "eglCreateWindowSurface"; |
swapBehavior = EGL_BUFFER_DESTROYED; |
break; |
case EGL_PIXMAP_BIT: |
func = "eglCreatePixmapSurface"; |
renderBuffer = EGL_SINGLE_BUFFER; |
break; |
case EGL_PBUFFER_BIT: |
func = "eglCreatePBufferSurface"; |
break; |
#ifdef EGL_MESA_screen_surface |
case EGL_SCREEN_BIT_MESA: |
func = "eglCreateScreenSurface"; |
renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */ |
break; |
#endif |
default: |
_eglLog(_EGL_WARNING, "Bad type in _eglInitSurface"); |
return EGL_FALSE; |
} |
if ((conf->SurfaceType & type) == 0) { |
/* The config can't be used to create a surface of this type */ |
_eglError(EGL_BAD_CONFIG, func); |
return EGL_FALSE; |
} |
_eglInitResource(&surf->Resource, sizeof(*surf), dpy); |
surf->Type = type; |
surf->Config = conf; |
surf->Width = 0; |
surf->Height = 0; |
surf->TextureFormat = EGL_NO_TEXTURE; |
surf->TextureTarget = EGL_NO_TEXTURE; |
surf->MipmapTexture = EGL_FALSE; |
surf->LargestPbuffer = EGL_FALSE; |
surf->RenderBuffer = renderBuffer; |
surf->VGAlphaFormat = EGL_VG_ALPHA_FORMAT_NONPRE; |
surf->VGColorspace = EGL_VG_COLORSPACE_sRGB; |
surf->MipmapLevel = 0; |
surf->MultisampleResolve = EGL_MULTISAMPLE_RESOLVE_DEFAULT; |
surf->SwapBehavior = swapBehavior; |
surf->HorizontalResolution = EGL_UNKNOWN; |
surf->VerticalResolution = EGL_UNKNOWN; |
surf->AspectRatio = EGL_UNKNOWN; |
surf->PostSubBufferSupportedNV = EGL_FALSE; |
/* the default swap interval is 1 */ |
_eglClampSwapInterval(surf, 1); |
err = _eglParseSurfaceAttribList(surf, attrib_list); |
if (err != EGL_SUCCESS) |
return _eglError(err, func); |
return EGL_TRUE; |
} |
EGLBoolean |
_eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, |
EGLint attribute, EGLint *value) |
{ |
switch (attribute) { |
case EGL_WIDTH: |
*value = surface->Width; |
break; |
case EGL_HEIGHT: |
*value = surface->Height; |
break; |
case EGL_CONFIG_ID: |
*value = surface->Config->ConfigID; |
break; |
case EGL_LARGEST_PBUFFER: |
*value = surface->LargestPbuffer; |
break; |
case EGL_TEXTURE_FORMAT: |
/* texture attributes: only for pbuffers, no error otherwise */ |
if (surface->Type == EGL_PBUFFER_BIT) |
*value = surface->TextureFormat; |
break; |
case EGL_TEXTURE_TARGET: |
if (surface->Type == EGL_PBUFFER_BIT) |
*value = surface->TextureTarget; |
break; |
case EGL_MIPMAP_TEXTURE: |
if (surface->Type == EGL_PBUFFER_BIT) |
*value = surface->MipmapTexture; |
break; |
case EGL_MIPMAP_LEVEL: |
if (surface->Type == EGL_PBUFFER_BIT) |
*value = surface->MipmapLevel; |
break; |
case EGL_SWAP_BEHAVIOR: |
*value = surface->SwapBehavior; |
break; |
case EGL_RENDER_BUFFER: |
*value = surface->RenderBuffer; |
break; |
case EGL_PIXEL_ASPECT_RATIO: |
*value = surface->AspectRatio; |
break; |
case EGL_HORIZONTAL_RESOLUTION: |
*value = surface->HorizontalResolution; |
break; |
case EGL_VERTICAL_RESOLUTION: |
*value = surface->VerticalResolution; |
break; |
case EGL_MULTISAMPLE_RESOLVE: |
*value = surface->MultisampleResolve; |
break; |
case EGL_VG_ALPHA_FORMAT: |
*value = surface->VGAlphaFormat; |
break; |
case EGL_VG_COLORSPACE: |
*value = surface->VGColorspace; |
break; |
case EGL_POST_SUB_BUFFER_SUPPORTED_NV: |
*value = surface->PostSubBufferSupportedNV; |
break; |
case EGL_BUFFER_AGE_EXT: |
if (!dpy->Extensions.EXT_buffer_age) { |
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface"); |
return EGL_FALSE; |
} |
*value = drv->API.QueryBufferAge(drv, dpy, surface); |
break; |
default: |
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface"); |
return EGL_FALSE; |
} |
return EGL_TRUE; |
} |
/** |
* Default fallback routine - drivers might override this. |
*/ |
EGLBoolean |
_eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, |
EGLint attribute, EGLint value) |
{ |
EGLint confval; |
EGLint err = EGL_SUCCESS; |
EGLint all_es_bits = EGL_OPENGL_ES_BIT | |
EGL_OPENGL_ES2_BIT | |
EGL_OPENGL_ES3_BIT_KHR; |
switch (attribute) { |
case EGL_MIPMAP_LEVEL: |
confval = surface->Config->RenderableType; |
if (!(confval & all_es_bits)) { |
err = EGL_BAD_PARAMETER; |
break; |
} |
surface->MipmapLevel = value; |
break; |
case EGL_MULTISAMPLE_RESOLVE: |
switch (value) { |
case EGL_MULTISAMPLE_RESOLVE_DEFAULT: |
break; |
case EGL_MULTISAMPLE_RESOLVE_BOX: |
confval = surface->Config->SurfaceType; |
if (!(confval & EGL_MULTISAMPLE_RESOLVE_BOX_BIT)) |
err = EGL_BAD_MATCH; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surface->MultisampleResolve = value; |
break; |
case EGL_SWAP_BEHAVIOR: |
switch (value) { |
case EGL_BUFFER_DESTROYED: |
break; |
case EGL_BUFFER_PRESERVED: |
confval = surface->Config->SurfaceType; |
if (!(confval & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)) |
err = EGL_BAD_MATCH; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
break; |
surface->SwapBehavior = value; |
break; |
default: |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) |
return _eglError(err, "eglSurfaceAttrib"); |
return EGL_TRUE; |
} |
EGLBoolean |
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, |
EGLint buffer) |
{ |
EGLint texture_type = EGL_PBUFFER_BIT; |
/* Just do basic error checking and return success/fail. |
* Drivers must implement the real stuff. |
*/ |
if (dpy->Extensions.NOK_texture_from_pixmap) |
texture_type |= EGL_PIXMAP_BIT; |
if (!(surface->Type & texture_type)) { |
_eglError(EGL_BAD_SURFACE, "eglBindTexImage"); |
return EGL_FALSE; |
} |
if (surface->TextureFormat == EGL_NO_TEXTURE) { |
_eglError(EGL_BAD_MATCH, "eglBindTexImage"); |
return EGL_FALSE; |
} |
if (surface->TextureTarget == EGL_NO_TEXTURE) { |
_eglError(EGL_BAD_MATCH, "eglBindTexImage"); |
return EGL_FALSE; |
} |
if (buffer != EGL_BACK_BUFFER) { |
_eglError(EGL_BAD_PARAMETER, "eglBindTexImage"); |
return EGL_FALSE; |
} |
surface->BoundToTexture = EGL_TRUE; |
return EGL_TRUE; |
} |
EGLBoolean |
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, |
EGLint interval) |
{ |
_eglClampSwapInterval(surf, interval); |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglsurface.h |
---|
0,0 → 1,173 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#ifndef EGLSURFACE_INCLUDED |
#define EGLSURFACE_INCLUDED |
#include "egltypedefs.h" |
#include "egldisplay.h" |
/** |
* "Base" class for device driver surfaces. |
*/ |
struct _egl_surface |
{ |
/* A surface is a display resource */ |
_EGLResource Resource; |
/* The context that is currently bound to the surface */ |
_EGLContext *CurrentContext; |
_EGLConfig *Config; |
EGLint Type; /* one of EGL_WINDOW_BIT, EGL_PIXMAP_BIT or EGL_PBUFFER_BIT */ |
/* attributes set by attribute list */ |
EGLint Width, Height; |
EGLenum TextureFormat; |
EGLenum TextureTarget; |
EGLBoolean MipmapTexture; |
EGLBoolean LargestPbuffer; |
EGLenum RenderBuffer; |
EGLenum VGAlphaFormat; |
EGLenum VGColorspace; |
/* attributes set by eglSurfaceAttrib */ |
EGLint MipmapLevel; |
EGLenum MultisampleResolve; |
EGLenum SwapBehavior; |
EGLint HorizontalResolution, VerticalResolution; |
EGLint AspectRatio; |
EGLint SwapInterval; |
/* True if the surface is bound to an OpenGL ES texture */ |
EGLBoolean BoundToTexture; |
EGLBoolean PostSubBufferSupportedNV; |
}; |
PUBLIC EGLBoolean |
_eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type, |
_EGLConfig *config, const EGLint *attrib_list); |
extern EGLBoolean |
_eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint *value); |
extern EGLBoolean |
_eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint value); |
PUBLIC extern EGLBoolean |
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint buffer); |
extern EGLBoolean |
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval); |
/** |
* Increment reference count for the surface. |
*/ |
static INLINE _EGLSurface * |
_eglGetSurface(_EGLSurface *surf) |
{ |
if (surf) |
_eglGetResource(&surf->Resource); |
return surf; |
} |
/** |
* Decrement reference count for the surface. |
*/ |
static INLINE EGLBoolean |
_eglPutSurface(_EGLSurface *surf) |
{ |
return (surf) ? _eglPutResource(&surf->Resource) : EGL_FALSE; |
} |
/** |
* Link a surface to its display and return the handle of the link. |
* The handle can be passed to client directly. |
*/ |
static INLINE EGLSurface |
_eglLinkSurface(_EGLSurface *surf) |
{ |
_eglLinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE); |
return (EGLSurface) surf; |
} |
/** |
* Unlink a linked surface from its display. |
* Accessing an unlinked surface should generate EGL_BAD_SURFACE error. |
*/ |
static INLINE void |
_eglUnlinkSurface(_EGLSurface *surf) |
{ |
_eglUnlinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE); |
} |
/** |
* Lookup a handle to find the linked surface. |
* Return NULL if the handle has no corresponding linked surface. |
*/ |
static INLINE _EGLSurface * |
_eglLookupSurface(EGLSurface surface, _EGLDisplay *dpy) |
{ |
_EGLSurface *surf = (_EGLSurface *) surface; |
if (!dpy || !_eglCheckResource((void *) surf, _EGL_RESOURCE_SURFACE, dpy)) |
surf = NULL; |
return surf; |
} |
/** |
* Return the handle of a linked surface, or EGL_NO_SURFACE. |
*/ |
static INLINE EGLSurface |
_eglGetSurfaceHandle(_EGLSurface *surf) |
{ |
_EGLResource *res = (_EGLResource *) surf; |
return (res && _eglIsResourceLinked(res)) ? |
(EGLSurface) surf : EGL_NO_SURFACE; |
} |
#endif /* EGLSURFACE_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglsurface.h.bak |
---|
0,0 → 1,175 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#ifndef EGLSURFACE_INCLUDED |
#define EGLSURFACE_INCLUDED |
#include "egltypedefs.h" |
#include "egldisplay.h" |
/** |
* "Base" class for device driver surfaces. |
*/ |
struct _egl_surface |
{ |
/* A surface is a display resource */ |
_EGLResource Resource; |
/* The context that is currently bound to the surface */ |
_EGLContext *CurrentContext; |
_EGLConfig *Config; |
EGLint Type; /* one of EGL_WINDOW_BIT, EGL_PIXMAP_BIT or EGL_PBUFFER_BIT */ |
/* attributes set by attribute list */ |
EGLint Width, Height; |
EGLenum TextureFormat; |
EGLenum TextureTarget; |
EGLBoolean MipmapTexture; |
EGLBoolean LargestPbuffer; |
EGLenum RenderBuffer; |
EGLenum VGAlphaFormat; |
EGLenum VGColorspace; |
/* attributes set by eglSurfaceAttrib */ |
EGLint MipmapLevel; |
EGLenum MultisampleResolve; |
EGLenum SwapBehavior; |
EGLint HorizontalResolution, VerticalResolution; |
EGLint AspectRatio; |
EGLint SwapInterval; |
/* True if the surface is bound to an OpenGL ES texture */ |
EGLBoolean BoundToTexture; |
EGLBoolean PostSubBufferSupportedNV; |
}; |
PUBLIC EGLBoolean |
_eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type, |
_EGLConfig *config, const EGLint *attrib_list); |
extern EGLBoolean |
_eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint *value); |
extern EGLBoolean |
_eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint value); |
PUBLIC extern EGLBoolean |
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint buffer); |
extern EGLBoolean |
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval); |
/** |
* Increment reference count for the surface. |
*/ |
static INLINE _EGLSurface * |
_eglGetSurface(_EGLSurface *surf) |
{ |
if (surf) |
_eglGetResource(&surf->Resource); |
return surf; |
} |
/** |
* Decrement reference count for the surface. |
*/ |
static INLINE EGLBoolean |
_eglPutSurface(_EGLSurface *surf) |
{ |
return (surf) ? _eglPutResource(&surf->Resource) : EGL_FALSE; |
} |
/** |
* Link a surface to its display and return the handle of the link. |
* The handle can be passed to client directly. |
*/ |
static INLINE EGLSurface |
_eglLinkSurface(_EGLSurface *surf) |
{ |
printf("%s surface: %p\n", __FUNCTION__, surf); |
_eglLinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE); |
return (EGLSurface) surf; |
} |
/** |
* Unlink a linked surface from its display. |
* Accessing an unlinked surface should generate EGL_BAD_SURFACE error. |
*/ |
static INLINE void |
_eglUnlinkSurface(_EGLSurface *surf) |
{ |
_eglUnlinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE); |
} |
/** |
* Lookup a handle to find the linked surface. |
* Return NULL if the handle has no corresponding linked surface. |
*/ |
static INLINE _EGLSurface * |
_eglLookupSurface(EGLSurface surface, _EGLDisplay *dpy) |
{ |
_EGLSurface *surf = (_EGLSurface *) surface; |
if (!dpy || !_eglCheckResource((void *) surf, _EGL_RESOURCE_SURFACE, dpy)) |
surf = NULL; |
return surf; |
} |
/** |
* Return the handle of a linked surface, or EGL_NO_SURFACE. |
*/ |
static INLINE EGLSurface |
_eglGetSurfaceHandle(_EGLSurface *surf) |
{ |
_EGLResource *res = (_EGLResource *) surf; |
return (res && _eglIsResourceLinked(res)) ? |
(EGLSurface) surf : EGL_NO_SURFACE; |
} |
#endif /* EGLSURFACE_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/eglsync.c |
---|
0,0 → 1,116 |
/************************************************************************** |
* |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#include <string.h> |
#include "eglsync.h" |
#include "eglcurrent.h" |
#include "egllog.h" |
/** |
* Parse the list of sync attributes and return the proper error code. |
*/ |
static EGLint |
_eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list) |
{ |
EGLint i, err = EGL_SUCCESS; |
if (!attrib_list) |
return EGL_SUCCESS; |
for (i = 0; attrib_list[i] != EGL_NONE; i++) { |
EGLint attr = attrib_list[i++]; |
EGLint val = attrib_list[i]; |
switch (attr) { |
default: |
(void) val; |
err = EGL_BAD_ATTRIBUTE; |
break; |
} |
if (err != EGL_SUCCESS) { |
_eglLog(_EGL_DEBUG, "bad sync attribute 0x%04x", attr); |
break; |
} |
} |
return err; |
} |
EGLBoolean |
_eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, |
const EGLint *attrib_list) |
{ |
EGLint err; |
if (!(type == EGL_SYNC_REUSABLE_KHR && dpy->Extensions.KHR_reusable_sync) && |
!(type == EGL_SYNC_FENCE_KHR && dpy->Extensions.KHR_fence_sync)) |
return _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR"); |
_eglInitResource(&sync->Resource, sizeof(*sync), dpy); |
sync->Type = type; |
sync->SyncStatus = EGL_UNSIGNALED_KHR; |
sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; |
err = _eglParseSyncAttribList(sync, attrib_list); |
if (err != EGL_SUCCESS) |
return _eglError(err, "eglCreateSyncKHR"); |
return EGL_TRUE; |
} |
EGLBoolean |
_eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, |
EGLint attribute, EGLint *value) |
{ |
if (!value) |
return _eglError(EGL_BAD_PARAMETER, "eglGetConfigs"); |
switch (attribute) { |
case EGL_SYNC_TYPE_KHR: |
*value = sync->Type; |
break; |
case EGL_SYNC_STATUS_KHR: |
*value = sync->SyncStatus; |
break; |
case EGL_SYNC_CONDITION_KHR: |
if (sync->Type != EGL_SYNC_FENCE_KHR) |
return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); |
*value = sync->SyncCondition; |
break; |
default: |
return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); |
break; |
} |
return EGL_TRUE; |
} |
/contrib/sdk/sources/Mesa/src/egl/main/eglsync.h |
---|
0,0 → 1,131 |
/************************************************************************** |
* |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#ifndef EGLSYNC_INCLUDED |
#define EGLSYNC_INCLUDED |
#include "egltypedefs.h" |
#include "egldisplay.h" |
/** |
* "Base" class for device driver syncs. |
*/ |
struct _egl_sync |
{ |
/* A sync is a display resource */ |
_EGLResource Resource; |
EGLenum Type; |
EGLenum SyncStatus; |
EGLenum SyncCondition; |
}; |
PUBLIC EGLBoolean |
_eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, |
const EGLint *attrib_list); |
extern EGLBoolean |
_eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, |
EGLint attribute, EGLint *value); |
/** |
* Increment reference count for the sync. |
*/ |
static INLINE _EGLSync * |
_eglGetSync(_EGLSync *sync) |
{ |
if (sync) |
_eglGetResource(&sync->Resource); |
return sync; |
} |
/** |
* Decrement reference count for the sync. |
*/ |
static INLINE EGLBoolean |
_eglPutSync(_EGLSync *sync) |
{ |
return (sync) ? _eglPutResource(&sync->Resource) : EGL_FALSE; |
} |
/** |
* Link a sync to its display and return the handle of the link. |
* The handle can be passed to client directly. |
*/ |
static INLINE EGLSyncKHR |
_eglLinkSync(_EGLSync *sync) |
{ |
_eglLinkResource(&sync->Resource, _EGL_RESOURCE_SYNC); |
return (EGLSyncKHR) sync; |
} |
/** |
* Unlink a linked sync from its display. |
*/ |
static INLINE void |
_eglUnlinkSync(_EGLSync *sync) |
{ |
_eglUnlinkResource(&sync->Resource, _EGL_RESOURCE_SYNC); |
} |
/** |
* Lookup a handle to find the linked sync. |
* Return NULL if the handle has no corresponding linked sync. |
*/ |
static INLINE _EGLSync * |
_eglLookupSync(EGLSyncKHR handle, _EGLDisplay *dpy) |
{ |
_EGLSync *sync = (_EGLSync *) handle; |
if (!dpy || !_eglCheckResource((void *) sync, _EGL_RESOURCE_SYNC, dpy)) |
sync = NULL; |
return sync; |
} |
/** |
* Return the handle of a linked sync, or EGL_NO_SYNC_KHR. |
*/ |
static INLINE EGLSyncKHR |
_eglGetSyncHandle(_EGLSync *sync) |
{ |
_EGLResource *res = (_EGLResource *) sync; |
return (res && _eglIsResourceLinked(res)) ? |
(EGLSyncKHR) sync : EGL_NO_SYNC_KHR; |
} |
#endif /* EGLSYNC_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/main/egltypedefs.h |
---|
0,0 → 1,71 |
/************************************************************************** |
* |
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com> |
* Copyright 2010 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. |
* |
**************************************************************************/ |
#ifndef EGLTYPEDEFS_INCLUDED |
#define EGLTYPEDEFS_INCLUDED |
#define EGL_EGLEXT_PROTOTYPES |
#include <EGL/egl.h> |
#include <EGL/eglext.h> |
#include "eglcompiler.h" |
typedef struct _egl_api _EGLAPI; |
typedef struct _egl_array _EGLArray; |
typedef struct _egl_config _EGLConfig; |
typedef struct _egl_context _EGLContext; |
typedef struct _egl_display _EGLDisplay; |
typedef struct _egl_driver _EGLDriver; |
typedef struct _egl_extensions _EGLExtensions; |
typedef struct _egl_image _EGLImage; |
typedef struct _egl_image_attribs _EGLImageAttribs; |
typedef struct _egl_mode _EGLMode; |
typedef struct _egl_resource _EGLResource; |
typedef struct _egl_screen _EGLScreen; |
typedef struct _egl_surface _EGLSurface; |
typedef struct _egl_sync _EGLSync; |
typedef struct _egl_thread_info _EGLThreadInfo; |
#endif /* EGLTYPEDEFS_INCLUDED */ |
/contrib/sdk/sources/Mesa/src/egl/wayland/Makefile.am |
---|
0,0 → 1,0 |
SUBDIRS = wayland-drm wayland-egl |
/contrib/sdk/sources/Mesa/src/egl/wayland/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@ |
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/wayland |
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am |
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 = |
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 = |
SOURCES = |
DIST_SOURCES = |
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ |
ctags-recursive dvi-recursive html-recursive info-recursive \ |
install-data-recursive install-dvi-recursive \ |
install-exec-recursive install-html-recursive \ |
install-info-recursive install-pdf-recursive \ |
install-ps-recursive install-recursive installcheck-recursive \ |
installdirs-recursive pdf-recursive ps-recursive \ |
tags-recursive uninstall-recursive |
am__can_run_installinfo = \ |
case $$AM_UPDATE_INFO_DIR in \ |
n|no|NO) false;; \ |
*) (install-info --version) >/dev/null 2>&1;; \ |
esac |
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ |
distclean-recursive maintainer-clean-recursive |
am__recursive_targets = \ |
$(RECURSIVE_TARGETS) \ |
$(RECURSIVE_CLEAN_TARGETS) \ |
$(am__extra_recursive_targets) |
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ |
distdir |
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 |
DIST_SUBDIRS = $(SUBDIRS) |
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
am__relativize = \ |
dir0=`pwd`; \ |
sed_first='s,^\([^/]*\)/.*$$,\1,'; \ |
sed_rest='s,^[^/]*/*,,'; \ |
sed_last='s,^.*/\([^/]*\)$$,\1,'; \ |
sed_butlast='s,/*[^/]*$$,,'; \ |
while test -n "$$dir1"; do \ |
first=`echo "$$dir1" | sed -e "$$sed_first"`; \ |
if test "$$first" != "."; then \ |
if test "$$first" = ".."; then \ |
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ |
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ |
else \ |
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ |
if test "$$first2" = "$$first"; then \ |
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ |
else \ |
dir2="../$$dir2"; \ |
fi; \ |
dir0="$$dir0"/"$$first"; \ |
fi; \ |
fi; \ |
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ |
done; \ |
reldir="$$dir2" |
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@ |
SUBDIRS = wayland-drm wayland-egl |
all: all-recursive |
.SUFFIXES: |
$(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/wayland/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/egl/wayland/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): |
mostlyclean-libtool: |
-rm -f *.lo |
clean-libtool: |
-rm -rf .libs _libs |
# This directory's subdirectories are mostly independent; you can cd |
# into them and run 'make' without going through this Makefile. |
# To change the values of 'make' variables: instead of editing Makefiles, |
# (1) if the variable is set in 'config.status', edit 'config.status' |
# (which will cause the Makefiles to be regenerated when you run 'make'); |
# (2) otherwise, pass the desired values on the 'make' command line. |
$(am__recursive_targets): |
@fail=; \ |
if $(am__make_keepgoing); then \ |
failcom='fail=yes'; \ |
else \ |
failcom='exit 1'; \ |
fi; \ |
dot_seen=no; \ |
target=`echo $@ | sed s/-recursive//`; \ |
case "$@" in \ |
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ |
*) list='$(SUBDIRS)' ;; \ |
esac; \ |
for subdir in $$list; do \ |
echo "Making $$target in $$subdir"; \ |
if test "$$subdir" = "."; then \ |
dot_seen=yes; \ |
local_target="$$target-am"; \ |
else \ |
local_target="$$target"; \ |
fi; \ |
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ |
|| eval $$failcom; \ |
done; \ |
if test "$$dot_seen" = "no"; then \ |
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ |
fi; test -z "$$fail" |
ID: $(am__tagged_files) |
$(am__define_uniq_tagged_files); mkid -fID $$unique |
tags: tags-recursive |
TAGS: tags |
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) |
set x; \ |
here=`pwd`; \ |
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ |
include_option=--etags-include; \ |
empty_fix=.; \ |
else \ |
include_option=--include; \ |
empty_fix=; \ |
fi; \ |
list='$(SUBDIRS)'; for subdir in $$list; do \ |
if test "$$subdir" = .; then :; else \ |
test ! -f $$subdir/TAGS || \ |
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ |
fi; \ |
done; \ |
$(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-recursive |
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-recursive |
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 |
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ |
if test "$$subdir" = .; then :; else \ |
$(am__make_dryrun) \ |
|| test -d "$(distdir)/$$subdir" \ |
|| $(MKDIR_P) "$(distdir)/$$subdir" \ |
|| exit 1; \ |
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ |
$(am__relativize); \ |
new_distdir=$$reldir; \ |
dir1=$$subdir; dir2="$(top_distdir)"; \ |
$(am__relativize); \ |
new_top_distdir=$$reldir; \ |
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ |
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ |
($(am__cd) $$subdir && \ |
$(MAKE) $(AM_MAKEFLAGS) \ |
top_distdir="$$new_top_distdir" \ |
distdir="$$new_distdir" \ |
am__remove_distdir=: \ |
am__skip_length_check=: \ |
am__skip_mode_fix=: \ |
distdir) \ |
|| exit 1; \ |
fi; \ |
done |
check-am: all-am |
check: check-recursive |
all-am: Makefile |
installdirs: installdirs-recursive |
installdirs-am: |
install: install-recursive |
install-exec: install-exec-recursive |
install-data: install-data-recursive |
uninstall: uninstall-recursive |
install-am: all-am |
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am |
installcheck: installcheck-recursive |
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-recursive |
clean-am: clean-generic clean-libtool mostlyclean-am |
distclean: distclean-recursive |
-rm -f Makefile |
distclean-am: clean-am distclean-generic distclean-tags |
dvi: dvi-recursive |
dvi-am: |
html: html-recursive |
html-am: |
info: info-recursive |
info-am: |
install-data-am: |
install-dvi: install-dvi-recursive |
install-dvi-am: |
install-exec-am: |
install-html: install-html-recursive |
install-html-am: |
install-info: install-info-recursive |
install-info-am: |
install-man: |
install-pdf: install-pdf-recursive |
install-pdf-am: |
install-ps: install-ps-recursive |
install-ps-am: |
installcheck-am: |
maintainer-clean: maintainer-clean-recursive |
-rm -f Makefile |
maintainer-clean-am: distclean-am maintainer-clean-generic |
mostlyclean: mostlyclean-recursive |
mostlyclean-am: mostlyclean-generic mostlyclean-libtool |
pdf: pdf-recursive |
pdf-am: |
ps: ps-recursive |
ps-am: |
uninstall-am: |
.MAKE: $(am__recursive_targets) install-am install-strip |
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ |
check-am clean clean-generic clean-libtool cscopelist-am ctags \ |
ctags-am distclean 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 \ |
installdirs-am maintainer-clean maintainer-clean-generic \ |
mostlyclean 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/wayland/wayland-drm/Makefile.am |
---|
0,0 → 1,23 |
AM_CFLAGS = -I$(top_srcdir)/src/egl/main \ |
-I$(top_srcdir)/include \ |
$(DEFINES) \ |
$(VISIBILITY_CFLAGS) \ |
$(WAYLAND_CFLAGS) |
noinst_LTLIBRARIES = libwayland-drm.la |
libwayland_drm_la_SOURCES = wayland-drm.c wayland-drm-protocol.c |
noinst_HEADERS = wayland-drm.h |
BUILT_SOURCES = wayland-drm-protocol.c \ |
wayland-drm-client-protocol.h \ |
wayland-drm-server-protocol.h |
CLEANFILES = $(BUILT_SOURCES) |
%-protocol.c : %.xml |
$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ |
%-server-protocol.h : %.xml |
$(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@ |
%-client-protocol.h : %.xml |
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ |
/contrib/sdk/sources/Mesa/src/egl/wayland/wayland-drm/Makefile.in |
---|
0,0 → 1,772 |
# 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@ |
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/wayland/wayland-drm |
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ |
$(top_srcdir)/bin/depcomp $(noinst_HEADERS) |
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) |
libwayland_drm_la_LIBADD = |
am_libwayland_drm_la_OBJECTS = wayland-drm.lo wayland-drm-protocol.lo |
libwayland_drm_la_OBJECTS = $(am_libwayland_drm_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 = $(libwayland_drm_la_SOURCES) |
DIST_SOURCES = $(libwayland_drm_la_SOURCES) |
am__can_run_installinfo = \ |
case $$AM_UPDATE_INFO_DIR in \ |
n|no|NO) false;; \ |
*) (install-info --version) >/dev/null 2>&1;; \ |
esac |
HEADERS = $(noinst_HEADERS) |
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)/src/egl/main \ |
-I$(top_srcdir)/include \ |
$(DEFINES) \ |
$(VISIBILITY_CFLAGS) \ |
$(WAYLAND_CFLAGS) |
noinst_LTLIBRARIES = libwayland-drm.la |
libwayland_drm_la_SOURCES = wayland-drm.c wayland-drm-protocol.c |
noinst_HEADERS = wayland-drm.h |
BUILT_SOURCES = wayland-drm-protocol.c \ |
wayland-drm-client-protocol.h \ |
wayland-drm-server-protocol.h |
CLEANFILES = $(BUILT_SOURCES) |
all: $(BUILT_SOURCES) |
$(MAKE) $(AM_MAKEFLAGS) 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/wayland/wayland-drm/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/egl/wayland/wayland-drm/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}; \ |
} |
libwayland-drm.la: $(libwayland_drm_la_OBJECTS) $(libwayland_drm_la_DEPENDENCIES) $(EXTRA_libwayland_drm_la_DEPENDENCIES) |
$(AM_V_CCLD)$(LINK) $(libwayland_drm_la_OBJECTS) $(libwayland_drm_la_LIBADD) $(LIBS) |
mostlyclean-compile: |
-rm -f *.$(OBJEXT) |
distclean-compile: |
-rm -f *.tab.c |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wayland-drm-protocol.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wayland-drm.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: $(BUILT_SOURCES) |
$(MAKE) $(AM_MAKEFLAGS) check-am |
all-am: Makefile $(LTLIBRARIES) $(HEADERS) |
installdirs: |
install: $(BUILT_SOURCES) |
$(MAKE) $(AM_MAKEFLAGS) 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: |
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) |
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." |
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) |
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: all check install 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 |
%-protocol.c : %.xml |
$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ |
%-server-protocol.h : %.xml |
$(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@ |
%-client-protocol.h : %.xml |
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ |
# 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/wayland/wayland-drm/wayland-drm.c |
---|
0,0 → 1,286 |
/* |
* Copyright © 2011 Kristian Høgsberg |
* Copyright © 2011 Benjamin Franzke |
* |
* 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. |
* |
* Authors: |
* Kristian Høgsberg <krh@bitplanet.net> |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <stddef.h> |
#include <unistd.h> |
#include <wayland-server.h> |
#include "wayland-drm.h" |
#include "wayland-drm-server-protocol.h" |
struct wl_drm { |
struct wl_display *display; |
void *user_data; |
char *device_name; |
uint32_t flags; |
struct wayland_drm_callbacks *callbacks; |
}; |
static void |
destroy_buffer(struct wl_resource *resource) |
{ |
struct wl_drm_buffer *buffer = resource->data; |
struct wl_drm *drm = buffer->drm; |
drm->callbacks->release_buffer(drm->user_data, buffer); |
free(buffer); |
} |
static void |
buffer_destroy(struct wl_client *client, struct wl_resource *resource) |
{ |
wl_resource_destroy(resource); |
} |
const static struct wl_buffer_interface drm_buffer_interface = { |
buffer_destroy |
}; |
static void |
create_buffer(struct wl_client *client, struct wl_resource *resource, |
uint32_t id, uint32_t name, int fd, |
int32_t width, int32_t height, |
uint32_t format, |
int32_t offset0, int32_t stride0, |
int32_t offset1, int32_t stride1, |
int32_t offset2, int32_t stride2) |
{ |
struct wl_drm *drm = resource->data; |
struct wl_drm_buffer *buffer; |
buffer = calloc(1, sizeof *buffer); |
if (buffer == NULL) { |
wl_resource_post_no_memory(resource); |
return; |
} |
buffer->drm = drm; |
buffer->buffer.width = width; |
buffer->buffer.height = height; |
buffer->format = format; |
buffer->offset[0] = offset0; |
buffer->stride[0] = stride0; |
buffer->offset[1] = offset1; |
buffer->stride[1] = stride1; |
buffer->offset[2] = offset2; |
buffer->stride[2] = stride2; |
drm->callbacks->reference_buffer(drm->user_data, name, fd, buffer); |
if (buffer->driver_buffer == NULL) { |
wl_resource_post_error(resource, |
WL_DRM_ERROR_INVALID_NAME, |
"invalid name"); |
return; |
} |
buffer->buffer.resource.object.id = id; |
buffer->buffer.resource.object.interface = &wl_buffer_interface; |
buffer->buffer.resource.object.implementation = |
(void (**)(void)) &drm_buffer_interface; |
buffer->buffer.resource.data = buffer; |
buffer->buffer.resource.destroy = destroy_buffer; |
buffer->buffer.resource.client = resource->client; |
wl_client_add_resource(resource->client, &buffer->buffer.resource); |
} |
static void |
drm_create_buffer(struct wl_client *client, struct wl_resource *resource, |
uint32_t id, uint32_t name, int32_t width, int32_t height, |
uint32_t stride, uint32_t format) |
{ |
switch (format) { |
case WL_DRM_FORMAT_ARGB8888: |
case WL_DRM_FORMAT_XRGB8888: |
case WL_DRM_FORMAT_YUYV: |
break; |
default: |
wl_resource_post_error(resource, |
WL_DRM_ERROR_INVALID_FORMAT, |
"invalid format"); |
return; |
} |
create_buffer(client, resource, id, |
name, -1, width, height, format, 0, stride, 0, 0, 0, 0); |
} |
static void |
drm_create_planar_buffer(struct wl_client *client, |
struct wl_resource *resource, |
uint32_t id, uint32_t name, |
int32_t width, int32_t height, uint32_t format, |
int32_t offset0, int32_t stride0, |
int32_t offset1, int32_t stride1, |
int32_t offset2, int32_t stride2) |
{ |
switch (format) { |
case WL_DRM_FORMAT_YUV410: |
case WL_DRM_FORMAT_YUV411: |
case WL_DRM_FORMAT_YUV420: |
case WL_DRM_FORMAT_YUV422: |
case WL_DRM_FORMAT_YUV444: |
case WL_DRM_FORMAT_NV12: |
case WL_DRM_FORMAT_NV16: |
break; |
default: |
wl_resource_post_error(resource, |
WL_DRM_ERROR_INVALID_FORMAT, |
"invalid format"); |
return; |
} |
create_buffer(client, resource, id, name, -1, width, height, format, |
offset0, stride0, offset1, stride1, offset2, stride2); |
} |
static void |
drm_create_prime_buffer(struct wl_client *client, |
struct wl_resource *resource, |
uint32_t id, int fd, |
int32_t width, int32_t height, uint32_t format, |
int32_t offset0, int32_t stride0, |
int32_t offset1, int32_t stride1, |
int32_t offset2, int32_t stride2) |
{ |
create_buffer(client, resource, id, 0, fd, width, height, format, |
offset0, stride0, offset1, stride1, offset2, stride2); |
close(fd); |
} |
static void |
drm_authenticate(struct wl_client *client, |
struct wl_resource *resource, uint32_t id) |
{ |
struct wl_drm *drm = resource->data; |
if (drm->callbacks->authenticate(drm->user_data, id) < 0) |
wl_resource_post_error(resource, |
WL_DRM_ERROR_AUTHENTICATE_FAIL, |
"authenicate failed"); |
else |
wl_resource_post_event(resource, WL_DRM_AUTHENTICATED); |
} |
const static struct wl_drm_interface drm_interface = { |
drm_authenticate, |
drm_create_buffer, |
drm_create_planar_buffer, |
drm_create_prime_buffer |
}; |
static void |
bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id) |
{ |
struct wl_drm *drm = data; |
struct wl_resource *resource; |
uint32_t capabilities; |
resource = wl_client_add_object(client, &wl_drm_interface, |
&drm_interface, id, data); |
wl_resource_post_event(resource, WL_DRM_DEVICE, drm->device_name); |
wl_resource_post_event(resource, WL_DRM_FORMAT, |
WL_DRM_FORMAT_ARGB8888); |
wl_resource_post_event(resource, WL_DRM_FORMAT, |
WL_DRM_FORMAT_XRGB8888); |
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV410); |
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV411); |
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV420); |
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV422); |
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV444); |
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_NV12); |
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_NV16); |
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUYV); |
capabilities = 0; |
if (drm->flags & WAYLAND_DRM_PRIME) |
capabilities |= WL_DRM_CAPABILITY_PRIME; |
if (version >= 2) |
wl_resource_post_event(resource, WL_DRM_CAPABILITIES, capabilities); |
} |
struct wl_drm * |
wayland_drm_init(struct wl_display *display, char *device_name, |
struct wayland_drm_callbacks *callbacks, void *user_data, |
uint32_t flags) |
{ |
struct wl_drm *drm; |
drm = malloc(sizeof *drm); |
drm->display = display; |
drm->device_name = strdup(device_name); |
drm->callbacks = callbacks; |
drm->user_data = user_data; |
drm->flags = flags; |
wl_display_add_global(display, &wl_drm_interface, drm, bind_drm); |
return drm; |
} |
void |
wayland_drm_uninit(struct wl_drm *drm) |
{ |
free(drm->device_name); |
/* FIXME: need wl_display_del_{object,global} */ |
free(drm); |
} |
int |
wayland_buffer_is_drm(struct wl_buffer *buffer) |
{ |
return buffer->resource.object.implementation == |
(void (**)(void)) &drm_buffer_interface; |
} |
uint32_t |
wayland_drm_buffer_get_format(struct wl_buffer *buffer_base) |
{ |
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) buffer_base; |
return buffer->format; |
} |
void * |
wayland_drm_buffer_get_buffer(struct wl_buffer *buffer_base) |
{ |
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) buffer_base; |
return buffer->driver_buffer; |
} |
/contrib/sdk/sources/Mesa/src/egl/wayland/wayland-drm/wayland-drm.h |
---|
0,0 → 1,110 |
#ifndef WAYLAND_DRM_H |
#define WAYLAND_DRM_H |
#include <wayland-server.h> |
#ifndef WL_DRM_FORMAT_ENUM |
#define WL_DRM_FORMAT_ENUM |
enum wl_drm_format { |
WL_DRM_FORMAT_C8 = 0x20203843, |
WL_DRM_FORMAT_RGB332 = 0x38424752, |
WL_DRM_FORMAT_BGR233 = 0x38524742, |
WL_DRM_FORMAT_XRGB4444 = 0x32315258, |
WL_DRM_FORMAT_XBGR4444 = 0x32314258, |
WL_DRM_FORMAT_RGBX4444 = 0x32315852, |
WL_DRM_FORMAT_BGRX4444 = 0x32315842, |
WL_DRM_FORMAT_ARGB4444 = 0x32315241, |
WL_DRM_FORMAT_ABGR4444 = 0x32314241, |
WL_DRM_FORMAT_RGBA4444 = 0x32314152, |
WL_DRM_FORMAT_BGRA4444 = 0x32314142, |
WL_DRM_FORMAT_XRGB1555 = 0x35315258, |
WL_DRM_FORMAT_XBGR1555 = 0x35314258, |
WL_DRM_FORMAT_RGBX5551 = 0x35315852, |
WL_DRM_FORMAT_BGRX5551 = 0x35315842, |
WL_DRM_FORMAT_ARGB1555 = 0x35315241, |
WL_DRM_FORMAT_ABGR1555 = 0x35314241, |
WL_DRM_FORMAT_RGBA5551 = 0x35314152, |
WL_DRM_FORMAT_BGRA5551 = 0x35314142, |
WL_DRM_FORMAT_RGB565 = 0x36314752, |
WL_DRM_FORMAT_BGR565 = 0x36314742, |
WL_DRM_FORMAT_RGB888 = 0x34324752, |
WL_DRM_FORMAT_BGR888 = 0x34324742, |
WL_DRM_FORMAT_XRGB8888 = 0x34325258, |
WL_DRM_FORMAT_XBGR8888 = 0x34324258, |
WL_DRM_FORMAT_RGBX8888 = 0x34325852, |
WL_DRM_FORMAT_BGRX8888 = 0x34325842, |
WL_DRM_FORMAT_ARGB8888 = 0x34325241, |
WL_DRM_FORMAT_ABGR8888 = 0x34324241, |
WL_DRM_FORMAT_RGBA8888 = 0x34324152, |
WL_DRM_FORMAT_BGRA8888 = 0x34324142, |
WL_DRM_FORMAT_XRGB2101010 = 0x30335258, |
WL_DRM_FORMAT_XBGR2101010 = 0x30334258, |
WL_DRM_FORMAT_RGBX1010102 = 0x30335852, |
WL_DRM_FORMAT_BGRX1010102 = 0x30335842, |
WL_DRM_FORMAT_ARGB2101010 = 0x30335241, |
WL_DRM_FORMAT_ABGR2101010 = 0x30334241, |
WL_DRM_FORMAT_RGBA1010102 = 0x30334152, |
WL_DRM_FORMAT_BGRA1010102 = 0x30334142, |
WL_DRM_FORMAT_YUYV = 0x56595559, |
WL_DRM_FORMAT_YVYU = 0x55595659, |
WL_DRM_FORMAT_UYVY = 0x59565955, |
WL_DRM_FORMAT_VYUY = 0x59555956, |
WL_DRM_FORMAT_AYUV = 0x56555941, |
WL_DRM_FORMAT_NV12 = 0x3231564e, |
WL_DRM_FORMAT_NV21 = 0x3132564e, |
WL_DRM_FORMAT_NV16 = 0x3631564e, |
WL_DRM_FORMAT_NV61 = 0x3136564e, |
WL_DRM_FORMAT_YUV410 = 0x39565559, |
WL_DRM_FORMAT_YVU410 = 0x39555659, |
WL_DRM_FORMAT_YUV411 = 0x31315559, |
WL_DRM_FORMAT_YVU411 = 0x31315659, |
WL_DRM_FORMAT_YUV420 = 0x32315559, |
WL_DRM_FORMAT_YVU420 = 0x32315659, |
WL_DRM_FORMAT_YUV422 = 0x36315559, |
WL_DRM_FORMAT_YVU422 = 0x36315659, |
WL_DRM_FORMAT_YUV444 = 0x34325559, |
WL_DRM_FORMAT_YVU444 = 0x34325659, |
}; |
#endif /* WL_DRM_FORMAT_ENUM */ |
struct wl_drm; |
struct wl_drm_buffer { |
struct wl_buffer buffer; |
struct wl_drm *drm; |
uint32_t format; |
const void *driver_format; |
int32_t offset[3]; |
int32_t stride[3]; |
void *driver_buffer; |
}; |
struct wayland_drm_callbacks { |
int (*authenticate)(void *user_data, uint32_t id); |
void (*reference_buffer)(void *user_data, uint32_t name, int fd, |
struct wl_drm_buffer *buffer); |
void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer); |
}; |
enum { WAYLAND_DRM_PRIME = 0x01 }; |
struct wl_drm * |
wayland_drm_init(struct wl_display *display, char *device_name, |
struct wayland_drm_callbacks *callbacks, void *user_data, |
uint32_t flags); |
void |
wayland_drm_uninit(struct wl_drm *drm); |
int |
wayland_buffer_is_drm(struct wl_buffer *buffer); |
uint32_t |
wayland_drm_buffer_get_format(struct wl_buffer *buffer_base); |
void * |
wayland_drm_buffer_get_buffer(struct wl_buffer *buffer); |
#endif |
/contrib/sdk/sources/Mesa/src/egl/wayland/wayland-drm/wayland-drm.xml |
---|
0,0 → 1,182 |
<?xml version="1.0" encoding="UTF-8"?> |
<protocol name="drm"> |
<copyright> |
Copyright © 2008-2011 Kristian Høgsberg |
Copyright © 2010-2011 Intel Corporation |
Permission to use, copy, modify, distribute, and sell this |
software and its documentation for any purpose is hereby granted |
without fee, provided that\n the above copyright notice appear in |
all copies and that both that copyright notice and this permission |
notice appear in supporting documentation, and that the name of |
the copyright holders not be used in advertising or publicity |
pertaining to distribution of the software without specific, |
written prior permission. The copyright holders make no |
representations about the suitability of this software for any |
purpose. It is provided "as is" without express or implied |
warranty. |
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS |
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY |
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN |
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF |
THIS SOFTWARE. |
</copyright> |
<!-- drm support. This object is created by the server and published |
using the display's global event. --> |
<interface name="wl_drm" version="2"> |
<enum name="error"> |
<entry name="authenticate_fail" value="0"/> |
<entry name="invalid_format" value="1"/> |
<entry name="invalid_name" value="2"/> |
</enum> |
<enum name="format"> |
<!-- The drm format codes match the #defines in drm_fourcc.h. |
The formats actually supported by the compositor will be |
reported by the format event. --> |
<entry name="c8" value="0x20203843"/> |
<entry name="rgb332" value="0x38424752"/> |
<entry name="bgr233" value="0x38524742"/> |
<entry name="xrgb4444" value="0x32315258"/> |
<entry name="xbgr4444" value="0x32314258"/> |
<entry name="rgbx4444" value="0x32315852"/> |
<entry name="bgrx4444" value="0x32315842"/> |
<entry name="argb4444" value="0x32315241"/> |
<entry name="abgr4444" value="0x32314241"/> |
<entry name="rgba4444" value="0x32314152"/> |
<entry name="bgra4444" value="0x32314142"/> |
<entry name="xrgb1555" value="0x35315258"/> |
<entry name="xbgr1555" value="0x35314258"/> |
<entry name="rgbx5551" value="0x35315852"/> |
<entry name="bgrx5551" value="0x35315842"/> |
<entry name="argb1555" value="0x35315241"/> |
<entry name="abgr1555" value="0x35314241"/> |
<entry name="rgba5551" value="0x35314152"/> |
<entry name="bgra5551" value="0x35314142"/> |
<entry name="rgb565" value="0x36314752"/> |
<entry name="bgr565" value="0x36314742"/> |
<entry name="rgb888" value="0x34324752"/> |
<entry name="bgr888" value="0x34324742"/> |
<entry name="xrgb8888" value="0x34325258"/> |
<entry name="xbgr8888" value="0x34324258"/> |
<entry name="rgbx8888" value="0x34325852"/> |
<entry name="bgrx8888" value="0x34325842"/> |
<entry name="argb8888" value="0x34325241"/> |
<entry name="abgr8888" value="0x34324241"/> |
<entry name="rgba8888" value="0x34324152"/> |
<entry name="bgra8888" value="0x34324142"/> |
<entry name="xrgb2101010" value="0x30335258"/> |
<entry name="xbgr2101010" value="0x30334258"/> |
<entry name="rgbx1010102" value="0x30335852"/> |
<entry name="bgrx1010102" value="0x30335842"/> |
<entry name="argb2101010" value="0x30335241"/> |
<entry name="abgr2101010" value="0x30334241"/> |
<entry name="rgba1010102" value="0x30334152"/> |
<entry name="bgra1010102" value="0x30334142"/> |
<entry name="yuyv" value="0x56595559"/> |
<entry name="yvyu" value="0x55595659"/> |
<entry name="uyvy" value="0x59565955"/> |
<entry name="vyuy" value="0x59555956"/> |
<entry name="ayuv" value="0x56555941"/> |
<entry name="nv12" value="0x3231564e"/> |
<entry name="nv21" value="0x3132564e"/> |
<entry name="nv16" value="0x3631564e"/> |
<entry name="nv61" value="0x3136564e"/> |
<entry name="yuv410" value="0x39565559"/> |
<entry name="yvu410" value="0x39555659"/> |
<entry name="yuv411" value="0x31315559"/> |
<entry name="yvu411" value="0x31315659"/> |
<entry name="yuv420" value="0x32315559"/> |
<entry name="yvu420" value="0x32315659"/> |
<entry name="yuv422" value="0x36315559"/> |
<entry name="yvu422" value="0x36315659"/> |
<entry name="yuv444" value="0x34325559"/> |
<entry name="yvu444" value="0x34325659"/> |
</enum> |
<!-- Call this request with the magic received from drmGetMagic(). |
It will be passed on to the drmAuthMagic() or |
DRIAuthConnection() call. This authentication must be |
completed before create_buffer could be used. --> |
<request name="authenticate"> |
<arg name="id" type="uint"/> |
</request> |
<!-- Create a wayland buffer for the named DRM buffer. The DRM |
surface must have a name using the flink ioctl --> |
<request name="create_buffer"> |
<arg name="id" type="new_id" interface="wl_buffer"/> |
<arg name="name" type="uint"/> |
<arg name="width" type="int"/> |
<arg name="height" type="int"/> |
<arg name="stride" type="uint"/> |
<arg name="format" type="uint"/> |
</request> |
<!-- Create a wayland buffer for the named DRM buffer. The DRM |
surface must have a name using the flink ioctl --> |
<request name="create_planar_buffer"> |
<arg name="id" type="new_id" interface="wl_buffer"/> |
<arg name="name" type="uint"/> |
<arg name="width" type="int"/> |
<arg name="height" type="int"/> |
<arg name="format" type="uint"/> |
<arg name="offset0" type="int"/> |
<arg name="stride0" type="int"/> |
<arg name="offset1" type="int"/> |
<arg name="stride1" type="int"/> |
<arg name="offset2" type="int"/> |
<arg name="stride2" type="int"/> |
</request> |
<!-- Create a wayland buffer for the prime fd. Use for regular and planar |
buffers. Pass 0 for offset and stride for unused planes. --> |
<request name="create_prime_buffer" since="2"> |
<arg name="id" type="new_id" interface="wl_buffer"/> |
<arg name="name" type="fd"/> |
<arg name="width" type="int"/> |
<arg name="height" type="int"/> |
<arg name="format" type="uint"/> |
<arg name="offset0" type="int"/> |
<arg name="stride0" type="int"/> |
<arg name="offset1" type="int"/> |
<arg name="stride1" type="int"/> |
<arg name="offset2" type="int"/> |
<arg name="stride2" type="int"/> |
</request> |
<!-- Notification of the path of the drm device which is used by |
the server. The client should use this device for creating |
local buffers. Only buffers created from this device should |
be be passed to the server using this drm object's |
create_buffer request. --> |
<event name="device"> |
<arg name="name" type="string"/> |
</event> |
<event name="format"> |
<arg name="format" type="uint"/> |
</event> |
<!-- Raised if the authenticate request succeeded --> |
<event name="authenticated"/> |
<enum name="capability" since="2"> |
<description summary="wl_drm capability bitmask"> |
Bitmask of capabilities. |
</description> |
<entry name="prime" value="1" summary="wl_drm prime available"/> |
</enum> |
<event name="capabilities"> |
<arg name="value" type="uint"/> |
</event> |
</interface> |
</protocol> |
/contrib/sdk/sources/Mesa/src/egl/wayland/wayland-egl/Makefile.am |
---|
0,0 → 1,11 |
pkgconfigdir = $(libdir)/pkgconfig |
pkgconfig_DATA = wayland-egl.pc |
AM_CFLAGS = $(DEFINES) \ |
$(VISIBILITY_CFLAGS) \ |
$(WAYLAND_CFLAGS) |
lib_LTLIBRARIES = libwayland-egl.la |
noinst_HEADERS = wayland-egl-priv.h |
libwayland_egl_la_SOURCES = wayland-egl.c |
libwayland_egl_la_LDFLAGS = -version-info 1 |
/contrib/sdk/sources/Mesa/src/egl/wayland/wayland-egl/Makefile.in |
---|
0,0 → 1,839 |
# 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@ |
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/wayland/wayland-egl |
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ |
$(srcdir)/wayland-egl.pc.in $(top_srcdir)/bin/depcomp \ |
$(noinst_HEADERS) |
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 = wayland-egl.pc |
CONFIG_CLEAN_VPATH_FILES = |
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; |
am__vpath_adj = case $$p in \ |
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ |
*) f=$$p;; \ |
esac; |
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; |
am__install_max = 40 |
am__nobase_strip_setup = \ |
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` |
am__nobase_strip = \ |
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" |
am__nobase_list = $(am__nobase_strip_setup); \ |
for p in $$list; do echo "$$p $$p"; done | \ |
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ |
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ |
if (++n[$$2] == $(am__install_max)) \ |
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ |
END { for (dir in files) print dir, files[dir] }' |
am__base_list = \ |
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ |
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' |
am__uninstall_files_from_dir = { \ |
test -z "$$files" \ |
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ |
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \ |
$(am__cd) "$$dir" && rm -f $$files; }; \ |
} |
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" |
LTLIBRARIES = $(lib_LTLIBRARIES) |
libwayland_egl_la_LIBADD = |
am_libwayland_egl_la_OBJECTS = wayland-egl.lo |
libwayland_egl_la_OBJECTS = $(am_libwayland_egl_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 = |
libwayland_egl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ |
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ |
$(AM_CFLAGS) $(CFLAGS) $(libwayland_egl_la_LDFLAGS) $(LDFLAGS) \ |
-o $@ |
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 = $(libwayland_egl_la_SOURCES) |
DIST_SOURCES = $(libwayland_egl_la_SOURCES) |
am__can_run_installinfo = \ |
case $$AM_UPDATE_INFO_DIR in \ |
n|no|NO) false;; \ |
*) (install-info --version) >/dev/null 2>&1;; \ |
esac |
DATA = $(pkgconfig_DATA) |
HEADERS = $(noinst_HEADERS) |
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@ |
pkgconfigdir = $(libdir)/pkgconfig |
pkgconfig_DATA = wayland-egl.pc |
AM_CFLAGS = $(DEFINES) \ |
$(VISIBILITY_CFLAGS) \ |
$(WAYLAND_CFLAGS) |
lib_LTLIBRARIES = libwayland-egl.la |
noinst_HEADERS = wayland-egl-priv.h |
libwayland_egl_la_SOURCES = wayland-egl.c |
libwayland_egl_la_LDFLAGS = -version-info 1 |
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/wayland/wayland-egl/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/egl/wayland/wayland-egl/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): |
wayland-egl.pc: $(top_builddir)/config.status $(srcdir)/wayland-egl.pc.in |
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ |
install-libLTLIBRARIES: $(lib_LTLIBRARIES) |
@$(NORMAL_INSTALL) |
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ |
list2=; for p in $$list; do \ |
if test -f $$p; then \ |
list2="$$list2 $$p"; \ |
else :; fi; \ |
done; \ |
test -z "$$list2" || { \ |
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ |
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ |
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ |
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ |
} |
uninstall-libLTLIBRARIES: |
@$(NORMAL_UNINSTALL) |
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ |
for p in $$list; do \ |
$(am__strip_dir) \ |
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ |
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ |
done |
clean-libLTLIBRARIES: |
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) |
@list='$(lib_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}; \ |
} |
libwayland-egl.la: $(libwayland_egl_la_OBJECTS) $(libwayland_egl_la_DEPENDENCIES) $(EXTRA_libwayland_egl_la_DEPENDENCIES) |
$(AM_V_CCLD)$(libwayland_egl_la_LINK) -rpath $(libdir) $(libwayland_egl_la_OBJECTS) $(libwayland_egl_la_LIBADD) $(LIBS) |
mostlyclean-compile: |
-rm -f *.$(OBJEXT) |
distclean-compile: |
-rm -f *.tab.c |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wayland-egl.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 |
install-pkgconfigDATA: $(pkgconfig_DATA) |
@$(NORMAL_INSTALL) |
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ |
if test -n "$$list"; then \ |
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ |
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ |
fi; \ |
for p in $$list; do \ |
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ |
echo "$$d$$p"; \ |
done | $(am__base_list) | \ |
while read files; do \ |
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ |
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ |
done |
uninstall-pkgconfigDATA: |
@$(NORMAL_UNINSTALL) |
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ |
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ |
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) |
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) $(DATA) $(HEADERS) |
installdirs: |
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)"; do \ |
test -z "$$dir" || $(MKDIR_P) "$$dir"; \ |
done |
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-libLTLIBRARIES clean-libtool \ |
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-pkgconfigDATA |
install-dvi: install-dvi-am |
install-dvi-am: |
install-exec-am: install-libLTLIBRARIES |
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: uninstall-libLTLIBRARIES uninstall-pkgconfigDATA |
.MAKE: install-am install-strip |
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ |
clean-libLTLIBRARIES clean-libtool 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-libLTLIBRARIES install-man install-pdf \ |
install-pdf-am install-pkgconfigDATA 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 \ |
uninstall-libLTLIBRARIES uninstall-pkgconfigDATA |
# 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/wayland/wayland-egl/wayland-egl-priv.h |
---|
0,0 → 1,36 |
#ifndef _WAYLAND_EGL_PRIV_H |
#define _WAYLAND_EGL_PRIV_H |
#ifdef __cplusplus |
extern "C" { |
#endif |
/* GCC visibility */ |
#if defined(__GNUC__) && __GNUC__ >= 4 |
#define WL_EGL_EXPORT __attribute__ ((visibility("default"))) |
#else |
#define WL_EGL_EXPORT |
#endif |
#include <wayland-client.h> |
struct wl_egl_window { |
struct wl_surface *surface; |
int width; |
int height; |
int dx; |
int dy; |
int attached_width; |
int attached_height; |
void *private; |
void (*resize_callback)(struct wl_egl_window *, void *); |
}; |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/sdk/sources/Mesa/src/egl/wayland/wayland-egl/wayland-egl.c |
---|
0,0 → 1,55 |
#include <stdlib.h> |
#include <wayland-client.h> |
#include "wayland-egl.h" |
#include "wayland-egl-priv.h" |
WL_EGL_EXPORT void |
wl_egl_window_resize(struct wl_egl_window *egl_window, |
int width, int height, |
int dx, int dy) |
{ |
egl_window->width = width; |
egl_window->height = height; |
egl_window->dx = dx; |
egl_window->dy = dy; |
if (egl_window->resize_callback) |
egl_window->resize_callback(egl_window, egl_window->private); |
} |
WL_EGL_EXPORT struct wl_egl_window * |
wl_egl_window_create(struct wl_surface *surface, |
int width, int height) |
{ |
struct wl_egl_window *egl_window; |
egl_window = malloc(sizeof *egl_window); |
if (!egl_window) |
return NULL; |
egl_window->surface = surface; |
egl_window->private = NULL; |
egl_window->resize_callback = NULL; |
wl_egl_window_resize(egl_window, width, height, 0, 0); |
egl_window->attached_width = 0; |
egl_window->attached_height = 0; |
return egl_window; |
} |
WL_EGL_EXPORT void |
wl_egl_window_destroy(struct wl_egl_window *egl_window) |
{ |
free(egl_window); |
} |
WL_EGL_EXPORT void |
wl_egl_window_get_attached_size(struct wl_egl_window *egl_window, |
int *width, int *height) |
{ |
if (width) |
*width = egl_window->attached_width; |
if (height) |
*height = egl_window->attached_height; |
} |
/contrib/sdk/sources/Mesa/src/egl/wayland/wayland-egl/wayland-egl.pc.in |
---|
0,0 → 1,11 |
prefix=@prefix@ |
exec_prefix=@exec_prefix@ |
libdir=@libdir@ |
includedir=@includedir@ |
Name: wayland-egl |
Description: Mesa wayland-egl library |
Version: @VERSION@ |
Requires: wayland-client |
Libs: -L${libdir} -lwayland-egl |
Cflags: -I${includedir} |