/contrib/sdk/sources/Mesa/src/gbm/Makefile.am |
---|
0,0 → 1,47 |
pkgconfigdir = $(libdir)/pkgconfig |
pkgconfig_DATA = main/gbm.pc |
AM_CFLAGS = \ |
-D_OS_UNIX=1 \ |
-DMODULEDIR='"$(libdir)/gbm"' \ |
-I$(top_srcdir)/include \ |
-I$(top_srcdir)/src/gbm/main \ |
$(LIBUDEV_CFLAGS) \ |
$(LIBKMS_CFLAGS) \ |
$(DLOPEN_CFLAGS) \ |
$(DEFINES) |
lib_LTLIBRARIES = libgbm.la |
include_HEADERS = main/gbm.h |
libgbm_la_SOURCES = \ |
main/gbm.c \ |
main/backend.c \ |
main/common.c |
libgbm_la_LDFLAGS = -version-info 1:0 |
libgbm_la_LIBADD = $(LIBUDEV_LIBS) $(LIBKMS_LIBS) $(DLOPEN_LIBS) |
if HAVE_EGL_PLATFORM_WAYLAND |
AM_CPPFLAGS = -DHAVE_WAYLAND_PLATFORM |
AM_CFLAGS += $(WAYLAND_CFLAGS) |
libgbm_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la $(WAYLAND_LIBS) |
endif |
if HAVE_DRI |
noinst_LTLIBRARIES = libgbm_dri.la |
libgbm_dri_la_SOURCES = \ |
backends/dri/gbm_dri.c \ |
backends/dri/driver_name.c |
libgbm_dri_la_CFLAGS = \ |
$(AM_CFLAGS) \ |
-DDEFAULT_DRIVER_DIR='"$(DRI_DRIVER_SEARCH_DIR)"' \ |
$(LIBDRM_CFLAGS) |
libgbm_la_LIBADD += \ |
libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la $(LIBDRM_LIBS) |
endif |
all-local: libgbm.la |
$(MKDIR_P) $(top_builddir)/$(LIB_DIR); |
ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so |
/contrib/sdk/sources/Mesa/src/gbm/Makefile.in |
---|
0,0 → 1,956 |
# 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@ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__append_1 = $(WAYLAND_CFLAGS) |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__append_2 = $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la $(WAYLAND_LIBS) |
@HAVE_DRI_TRUE@am__append_3 = \ |
@HAVE_DRI_TRUE@ libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la $(LIBDRM_LIBS) |
subdir = src/gbm |
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ |
$(top_srcdir)/bin/depcomp $(include_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 = |
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)$(includedir)" |
LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) |
am__DEPENDENCIES_1 = |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la \ |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@ $(am__DEPENDENCIES_1) |
@HAVE_DRI_TRUE@am__DEPENDENCIES_3 = libgbm_dri.la \ |
@HAVE_DRI_TRUE@ $(top_builddir)/src/mapi/shared-glapi/libglapi.la \ |
@HAVE_DRI_TRUE@ $(am__DEPENDENCIES_1) |
libgbm_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ |
$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) |
am_libgbm_la_OBJECTS = gbm.lo backend.lo common.lo |
libgbm_la_OBJECTS = $(am_libgbm_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 = |
libgbm_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ |
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ |
$(libgbm_la_LDFLAGS) $(LDFLAGS) -o $@ |
libgbm_dri_la_LIBADD = |
am__libgbm_dri_la_SOURCES_DIST = backends/dri/gbm_dri.c \ |
backends/dri/driver_name.c |
@HAVE_DRI_TRUE@am_libgbm_dri_la_OBJECTS = libgbm_dri_la-gbm_dri.lo \ |
@HAVE_DRI_TRUE@ libgbm_dri_la-driver_name.lo |
libgbm_dri_la_OBJECTS = $(am_libgbm_dri_la_OBJECTS) |
libgbm_dri_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ |
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libgbm_dri_la_CFLAGS) \ |
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ |
@HAVE_DRI_TRUE@am_libgbm_dri_la_rpath = |
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 = $(libgbm_la_SOURCES) $(libgbm_dri_la_SOURCES) |
DIST_SOURCES = $(libgbm_la_SOURCES) $(am__libgbm_dri_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 |
DATA = $(pkgconfig_DATA) |
HEADERS = $(include_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 = main/gbm.pc |
AM_CFLAGS = -D_OS_UNIX=1 -DMODULEDIR='"$(libdir)/gbm"' \ |
-I$(top_srcdir)/include -I$(top_srcdir)/src/gbm/main \ |
$(LIBUDEV_CFLAGS) $(LIBKMS_CFLAGS) $(DLOPEN_CFLAGS) $(DEFINES) \ |
$(am__append_1) |
lib_LTLIBRARIES = libgbm.la |
include_HEADERS = main/gbm.h |
libgbm_la_SOURCES = \ |
main/gbm.c \ |
main/backend.c \ |
main/common.c |
libgbm_la_LDFLAGS = -version-info 1:0 |
libgbm_la_LIBADD = $(LIBUDEV_LIBS) $(LIBKMS_LIBS) $(DLOPEN_LIBS) \ |
$(am__append_2) $(am__append_3) |
@HAVE_EGL_PLATFORM_WAYLAND_TRUE@AM_CPPFLAGS = -DHAVE_WAYLAND_PLATFORM |
@HAVE_DRI_TRUE@noinst_LTLIBRARIES = libgbm_dri.la |
@HAVE_DRI_TRUE@libgbm_dri_la_SOURCES = \ |
@HAVE_DRI_TRUE@ backends/dri/gbm_dri.c \ |
@HAVE_DRI_TRUE@ backends/dri/driver_name.c |
@HAVE_DRI_TRUE@libgbm_dri_la_CFLAGS = \ |
@HAVE_DRI_TRUE@ $(AM_CFLAGS) \ |
@HAVE_DRI_TRUE@ -DDEFAULT_DRIVER_DIR='"$(DRI_DRIVER_SEARCH_DIR)"' \ |
@HAVE_DRI_TRUE@ $(LIBDRM_CFLAGS) |
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/gbm/Makefile'; \ |
$(am__cd) $(top_srcdir) && \ |
$(AUTOMAKE) --foreign src/gbm/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): |
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}; \ |
} |
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}; \ |
} |
libgbm.la: $(libgbm_la_OBJECTS) $(libgbm_la_DEPENDENCIES) $(EXTRA_libgbm_la_DEPENDENCIES) |
$(AM_V_CCLD)$(libgbm_la_LINK) -rpath $(libdir) $(libgbm_la_OBJECTS) $(libgbm_la_LIBADD) $(LIBS) |
libgbm_dri.la: $(libgbm_dri_la_OBJECTS) $(libgbm_dri_la_DEPENDENCIES) $(EXTRA_libgbm_dri_la_DEPENDENCIES) |
$(AM_V_CCLD)$(libgbm_dri_la_LINK) $(am_libgbm_dri_la_rpath) $(libgbm_dri_la_OBJECTS) $(libgbm_dri_la_LIBADD) $(LIBS) |
mostlyclean-compile: |
-rm -f *.$(OBJEXT) |
distclean-compile: |
-rm -f *.tab.c |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backend.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbm.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgbm_dri_la-driver_name.Plo@am__quote@ |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgbm_dri_la-gbm_dri.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 $@ $< |
gbm.lo: main/gbm.c |
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gbm.lo -MD -MP -MF $(DEPDIR)/gbm.Tpo -c -o gbm.lo `test -f 'main/gbm.c' || echo '$(srcdir)/'`main/gbm.c |
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/gbm.Tpo $(DEPDIR)/gbm.Plo |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main/gbm.c' object='gbm.lo' libtool=yes @AMDEPBACKSLASH@ |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gbm.lo `test -f 'main/gbm.c' || echo '$(srcdir)/'`main/gbm.c |
backend.lo: main/backend.c |
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT backend.lo -MD -MP -MF $(DEPDIR)/backend.Tpo -c -o backend.lo `test -f 'main/backend.c' || echo '$(srcdir)/'`main/backend.c |
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/backend.Tpo $(DEPDIR)/backend.Plo |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main/backend.c' object='backend.lo' libtool=yes @AMDEPBACKSLASH@ |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o backend.lo `test -f 'main/backend.c' || echo '$(srcdir)/'`main/backend.c |
common.lo: main/common.c |
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common.lo -MD -MP -MF $(DEPDIR)/common.Tpo -c -o common.lo `test -f 'main/common.c' || echo '$(srcdir)/'`main/common.c |
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/common.Tpo $(DEPDIR)/common.Plo |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main/common.c' object='common.lo' libtool=yes @AMDEPBACKSLASH@ |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common.lo `test -f 'main/common.c' || echo '$(srcdir)/'`main/common.c |
libgbm_dri_la-gbm_dri.lo: backends/dri/gbm_dri.c |
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgbm_dri_la_CFLAGS) $(CFLAGS) -MT libgbm_dri_la-gbm_dri.lo -MD -MP -MF $(DEPDIR)/libgbm_dri_la-gbm_dri.Tpo -c -o libgbm_dri_la-gbm_dri.lo `test -f 'backends/dri/gbm_dri.c' || echo '$(srcdir)/'`backends/dri/gbm_dri.c |
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgbm_dri_la-gbm_dri.Tpo $(DEPDIR)/libgbm_dri_la-gbm_dri.Plo |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backends/dri/gbm_dri.c' object='libgbm_dri_la-gbm_dri.lo' libtool=yes @AMDEPBACKSLASH@ |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgbm_dri_la_CFLAGS) $(CFLAGS) -c -o libgbm_dri_la-gbm_dri.lo `test -f 'backends/dri/gbm_dri.c' || echo '$(srcdir)/'`backends/dri/gbm_dri.c |
libgbm_dri_la-driver_name.lo: backends/dri/driver_name.c |
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgbm_dri_la_CFLAGS) $(CFLAGS) -MT libgbm_dri_la-driver_name.lo -MD -MP -MF $(DEPDIR)/libgbm_dri_la-driver_name.Tpo -c -o libgbm_dri_la-driver_name.lo `test -f 'backends/dri/driver_name.c' || echo '$(srcdir)/'`backends/dri/driver_name.c |
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgbm_dri_la-driver_name.Tpo $(DEPDIR)/libgbm_dri_la-driver_name.Plo |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='backends/dri/driver_name.c' object='libgbm_dri_la-driver_name.lo' libtool=yes @AMDEPBACKSLASH@ |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgbm_dri_la_CFLAGS) $(CFLAGS) -c -o libgbm_dri_la-driver_name.lo `test -f 'backends/dri/driver_name.c' || echo '$(srcdir)/'`backends/dri/driver_name.c |
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-includeHEADERS: $(include_HEADERS) |
@$(NORMAL_INSTALL) |
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ |
if test -n "$$list"; then \ |
echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ |
$(MKDIR_P) "$(DESTDIR)$(includedir)" || 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)$(includedir)'"; \ |
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ |
done |
uninstall-includeHEADERS: |
@$(NORMAL_UNINSTALL) |
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ |
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ |
dir='$(DESTDIR)$(includedir)'; $(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)$(includedir)"; 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 \ |
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-includeHEADERS 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-includeHEADERS 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 \ |
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-includeHEADERS 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-includeHEADERS uninstall-libLTLIBRARIES \ |
uninstall-pkgconfigDATA |
all-local: libgbm.la |
$(MKDIR_P) $(top_builddir)/$(LIB_DIR); |
ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.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/gbm/backends/dri/driver_name.c |
---|
0,0 → 1,89 |
/* |
* 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 <libudev.h> |
#include "gbm_driint.h" |
#define DRIVER_MAP_DRI2_ONLY |
#include "pci_ids/pci_id_driver_map.h" |
char * |
dri_fd_get_driver_name(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 = _gbm_udev_device_new_from_fd(udev, fd); |
if (device == NULL) |
return NULL; |
parent = udev_device_get_parent(device); |
if (parent == NULL) { |
fprintf(stderr, "gbm: 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) { |
fprintf(stderr, "gbm: 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); |
_gbm_log("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); |
_gbm_log("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; |
} |
/contrib/sdk/sources/Mesa/src/gbm/backends/dri/gbm_dri.c |
---|
0,0 → 1,671 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <stddef.h> |
#include <stdint.h> |
#include <string.h> |
#include <limits.h> |
#include <sys/types.h> |
//#include <sys/mman.h> |
#include <unistd.h> |
//#include <dlfcn.h> |
#include <xf86drm.h> |
#include <GL/gl.h> /* dri_interface needs GL types */ |
#include <GL/internal/dri_interface.h> |
#include "gbm_driint.h" |
#include "gbmint.h" |
/* For importing wl_buffer */ |
#if HAVE_WAYLAND_PLATFORM |
#include "../../../egl/wayland/wayland-drm/wayland-drm.h" |
#endif |
void *load_library(const char *name); |
void *get_proc_address(void *lib, char *proc_name); |
static __DRIimage * |
dri_lookup_egl_image(__DRIscreen *screen, void *image, void *data) |
{ |
struct gbm_dri_device *dri = data; |
if (dri->lookup_image == NULL) |
return NULL; |
return dri->lookup_image(screen, image, dri->lookup_user_data); |
} |
static __DRIbuffer * |
dri_get_buffers(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *data) |
{ |
struct gbm_dri_surface *surf = data; |
struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm); |
if (dri->get_buffers == NULL) |
return NULL; |
return dri->get_buffers(driDrawable, width, height, attachments, |
count, out_count, surf->dri_private); |
} |
static void |
dri_flush_front_buffer(__DRIdrawable * driDrawable, void *data) |
{ |
struct gbm_dri_surface *surf = data; |
struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm); |
if (dri->flush_front_buffer != NULL) |
dri->flush_front_buffer(driDrawable, surf->dri_private); |
} |
static __DRIbuffer * |
dri_get_buffers_with_format(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *data) |
{ |
struct gbm_dri_surface *surf = data; |
struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm); |
if (dri->get_buffers_with_format == NULL) |
return NULL; |
return |
dri->get_buffers_with_format(driDrawable, width, height, attachments, |
count, out_count, surf->dri_private); |
} |
static const __DRIuseInvalidateExtension use_invalidate = { |
{ __DRI_USE_INVALIDATE, 1 } |
}; |
static const __DRIimageLookupExtension image_lookup_extension = { |
{ __DRI_IMAGE_LOOKUP, 1 }, |
dri_lookup_egl_image |
}; |
const __DRIdri2LoaderExtension dri2_loader_extension = { |
{ __DRI_DRI2_LOADER, 3 }, |
dri_get_buffers, |
dri_flush_front_buffer, |
dri_get_buffers_with_format, |
}; |
struct dri_extension_match { |
const char *name; |
int version; |
int offset; |
}; |
static struct dri_extension_match dri_core_extensions[] = { |
{ __DRI2_FLUSH, 1, offsetof(struct gbm_dri_device, flush) }, |
{ __DRI_IMAGE, 1, offsetof(struct gbm_dri_device, image) }, |
{ NULL, 0, 0 } |
}; |
static struct dri_extension_match gbm_dri_device_extensions[] = { |
{ __DRI_CORE, 1, offsetof(struct gbm_dri_device, core) }, |
{ __DRI_DRI2, 1, offsetof(struct gbm_dri_device, dri2) }, |
{ NULL, 0, 0 } |
}; |
static int |
dri_bind_extensions(struct gbm_dri_device *dri, |
struct dri_extension_match *matches, |
const __DRIextension **extensions) |
{ |
int i, j, ret = 0; |
void *field; |
for (i = 0; extensions[i]; i++) { |
for (j = 0; matches[j].name; j++) { |
if (strcmp(extensions[i]->name, matches[j].name) == 0 && |
extensions[i]->version >= matches[j].version) { |
field = ((char *) dri + matches[j].offset); |
*(const __DRIextension **) field = extensions[i]; |
} |
} |
} |
for (j = 0; matches[j].name; j++) { |
field = ((char *) dri + matches[j].offset); |
if (*(const __DRIextension **) field == NULL) { |
ret = -1; |
} |
} |
return ret; |
} |
static int |
dri_load_driver(struct gbm_dri_device *dri) |
{ |
const __DRIextension **extensions; |
// char path[PATH_MAX], *search_paths, *p, *next, *end; |
char *search_paths; |
search_paths = NULL; |
#if 0 |
if (geteuid() == getuid()) { |
/* don't allow setuid apps to use GBM_DRIVERS_PATH */ |
search_paths = getenv("GBM_DRIVERS_PATH"); |
} |
if (search_paths == NULL) |
search_paths = DEFAULT_DRIVER_DIR; |
dri->driver = NULL; |
end = search_paths + strlen(search_paths); |
for (p = search_paths; p < end && dri->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, dri->base.driver_name); |
dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
#endif |
if (dri->driver == NULL) { |
snprintf(path, sizeof path, |
"%.*s/%s_dri.so", len, p, dri->base.driver_name); |
dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
if (dri->driver == NULL) |
fprintf(stderr, "failed to open %s: %s\n", path, dlerror()); |
} |
} |
#endif |
dri->driver = load_library("libGL.dll"); |
if (dri->driver == NULL) { |
fprintf(stderr, "gbm: failed to open any driver (search paths %s)", |
search_paths); |
return -1; |
} |
extensions = get_proc_address(dri->driver, __DRI_DRIVER_EXTENSIONS); |
if (extensions == NULL) { |
fprintf(stderr, "gbm: driver exports no extensions\n"); |
// dlclose(dri->driver); |
return -1; |
} |
if (dri_bind_extensions(dri, gbm_dri_device_extensions, extensions) < 0) { |
// dlclose(dri->driver); |
fprintf(stderr, "failed to bind extensions\n"); |
return -1; |
} |
return 0; |
} |
static int |
dri_screen_create(struct gbm_dri_device *dri) |
{ |
const __DRIextension **extensions; |
int ret = 0; |
dri->base.driver_name = strdup("drm"); //dri_fd_get_driver_name(dri->base.base.fd); |
if (dri->base.driver_name == NULL) |
return -1; |
ret = dri_load_driver(dri); |
if (ret) { |
fprintf(stderr, "failed to load driver: %s\n", dri->base.driver_name); |
return ret; |
}; |
dri->extensions[0] = &image_lookup_extension.base; |
dri->extensions[1] = &use_invalidate.base; |
dri->extensions[2] = &dri2_loader_extension.base; |
dri->extensions[3] = NULL; |
if (dri->dri2 == NULL) |
return -1; |
dri->screen = dri->dri2->createNewScreen(0, dri->base.base.fd, |
dri->extensions, |
&dri->driver_configs, dri); |
if (dri->screen == NULL) |
return -1; |
extensions = dri->core->getExtensions(dri->screen); |
if (dri_bind_extensions(dri, dri_core_extensions, extensions) < 0) { |
ret = -1; |
goto free_screen; |
} |
dri->lookup_image = NULL; |
dri->lookup_user_data = NULL; |
return 0; |
free_screen: |
dri->core->destroyScreen(dri->screen); |
return ret; |
} |
static int |
gbm_dri_is_format_supported(struct gbm_device *gbm, |
uint32_t format, |
uint32_t usage) |
{ |
switch (format) { |
case GBM_BO_FORMAT_XRGB8888: |
case GBM_FORMAT_XRGB8888: |
break; |
case GBM_BO_FORMAT_ARGB8888: |
case GBM_FORMAT_ARGB8888: |
if (usage & GBM_BO_USE_SCANOUT) |
return 0; |
break; |
default: |
return 0; |
} |
if (usage & GBM_BO_USE_CURSOR_64X64 && |
usage & GBM_BO_USE_RENDERING) |
return 0; |
return 1; |
} |
static int |
gbm_dri_bo_write(struct gbm_bo *_bo, const void *buf, size_t count) |
{ |
struct gbm_dri_bo *bo = gbm_dri_bo(_bo); |
if (bo->image != NULL) |
return -1; |
memcpy(bo->map, buf, count); |
return 0; |
} |
static void |
gbm_dri_bo_destroy(struct gbm_bo *_bo) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm); |
struct gbm_dri_bo *bo = gbm_dri_bo(_bo); |
// struct drm_mode_destroy_dumb arg; |
if (bo->image != NULL) { |
dri->image->destroyImage(bo->image); |
} else { |
// munmap(bo->map, bo->size); |
// memset(&arg, 0, sizeof(arg)); |
// arg.handle = bo->handle; |
// drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg); |
} |
free(bo); |
} |
static uint32_t |
gbm_dri_to_gbm_format(uint32_t dri_format) |
{ |
uint32_t ret = 0; |
switch (dri_format) { |
case __DRI_IMAGE_FORMAT_RGB565: |
ret = GBM_FORMAT_RGB565; |
break; |
case __DRI_IMAGE_FORMAT_XRGB8888: |
ret = GBM_FORMAT_XRGB8888; |
break; |
case __DRI_IMAGE_FORMAT_ARGB8888: |
ret = GBM_FORMAT_ARGB8888; |
break; |
case __DRI_IMAGE_FORMAT_ABGR8888: |
ret = GBM_FORMAT_ABGR8888; |
break; |
default: |
ret = 0; |
break; |
} |
return ret; |
} |
static struct gbm_bo * |
gbm_dri_bo_import(struct gbm_device *gbm, |
uint32_t type, void *buffer, uint32_t usage) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(gbm); |
struct gbm_dri_bo *bo; |
__DRIimage *image; |
unsigned dri_use = 0; |
int gbm_format; |
/* Required for query image WIDTH & HEIGHT */ |
if (dri->image->base.version < 4) |
return NULL; |
switch (type) { |
#if HAVE_WAYLAND_PLATFORM |
case GBM_BO_IMPORT_WL_BUFFER: |
{ |
struct wl_drm_buffer *wb = (struct wl_drm_buffer *) buffer; |
if (!wayland_buffer_is_drm(buffer)) |
return NULL; |
image = wb->driver_buffer; |
switch (wb->format) { |
case WL_DRM_FORMAT_XRGB8888: |
gbm_format = GBM_FORMAT_XRGB8888; |
break; |
case WL_DRM_FORMAT_ARGB8888: |
gbm_format = GBM_FORMAT_ARGB8888; |
break; |
case WL_DRM_FORMAT_YUYV: |
gbm_format = GBM_FORMAT_YUYV; |
break; |
default: |
return NULL; |
} |
break; |
} |
#endif |
case GBM_BO_IMPORT_EGL_IMAGE: |
{ |
int dri_format; |
if (dri->lookup_image == NULL) |
return NULL; |
image = dri->lookup_image(dri->screen, buffer, dri->lookup_user_data); |
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_FORMAT, &dri_format); |
gbm_format = gbm_dri_to_gbm_format(dri_format); |
if (gbm_format == 0) |
return NULL; |
break; |
} |
default: |
return NULL; |
} |
bo = calloc(1, sizeof *bo); |
if (bo == NULL) |
return NULL; |
bo->image = dri->image->dupImage(image, NULL); |
if (usage & GBM_BO_USE_SCANOUT) |
dri_use |= __DRI_IMAGE_USE_SCANOUT; |
if (usage & GBM_BO_USE_CURSOR_64X64) |
dri_use |= __DRI_IMAGE_USE_CURSOR; |
if (dri->image->base.version >= 2 && |
!dri->image->validateUsage(bo->image, dri_use)) { |
free(bo); |
return NULL; |
} |
bo->base.base.gbm = gbm; |
bo->base.base.format = gbm_format; |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_WIDTH, |
(int*)&bo->base.base.width); |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HEIGHT, |
(int*)&bo->base.base.height); |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE, |
(int*)&bo->base.base.stride); |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE, |
&bo->base.base.handle.s32); |
return &bo->base.base; |
} |
#if 0 |
static struct gbm_bo * |
create_dumb(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t usage) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(gbm); |
struct drm_mode_create_dumb create_arg; |
struct drm_mode_map_dumb map_arg; |
struct gbm_dri_bo *bo; |
struct drm_mode_destroy_dumb destroy_arg; |
int ret; |
if (!(usage & GBM_BO_USE_CURSOR_64X64)) |
return NULL; |
if (format != GBM_FORMAT_ARGB8888) |
return NULL; |
bo = calloc(1, sizeof *bo); |
if (bo == NULL) |
return NULL; |
create_arg.bpp = 32; |
create_arg.width = width; |
create_arg.height = height; |
ret = drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_arg); |
if (ret) |
goto free_bo; |
bo->base.base.gbm = gbm; |
bo->base.base.width = width; |
bo->base.base.height = height; |
bo->base.base.stride = create_arg.pitch; |
bo->base.base.format = format; |
bo->base.base.handle.u32 = create_arg.handle; |
bo->handle = create_arg.handle; |
bo->size = create_arg.size; |
memset(&map_arg, 0, sizeof(map_arg)); |
map_arg.handle = bo->handle; |
ret = drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_MAP_DUMB, &map_arg); |
if (ret) |
goto destroy_dumb; |
bo->map = mmap(0, bo->size, PROT_WRITE, |
MAP_SHARED, dri->base.base.fd, map_arg.offset); |
if (bo->map == MAP_FAILED) |
goto destroy_dumb; |
return &bo->base.base; |
destroy_dumb: |
memset(&destroy_arg, 0, sizeof destroy_arg); |
destroy_arg.handle = create_arg.handle; |
drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg); |
free_bo: |
free(bo); |
return NULL; |
} |
#endif |
static struct gbm_bo * |
gbm_dri_bo_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t usage) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(gbm); |
struct gbm_dri_bo *bo; |
int dri_format; |
unsigned dri_use = 0; |
// if (usage & GBM_BO_USE_WRITE) |
// return create_dumb(gbm, width, height, format, usage); |
bo = calloc(1, sizeof *bo); |
if (bo == NULL) |
return NULL; |
bo->base.base.gbm = gbm; |
bo->base.base.width = width; |
bo->base.base.height = height; |
bo->base.base.format = format; |
switch (format) { |
case GBM_FORMAT_RGB565: |
dri_format =__DRI_IMAGE_FORMAT_RGB565; |
break; |
case GBM_FORMAT_XRGB8888: |
case GBM_BO_FORMAT_XRGB8888: |
dri_format = __DRI_IMAGE_FORMAT_XRGB8888; |
break; |
case GBM_FORMAT_ARGB8888: |
case GBM_BO_FORMAT_ARGB8888: |
dri_format = __DRI_IMAGE_FORMAT_ARGB8888; |
break; |
case GBM_FORMAT_ABGR8888: |
dri_format = __DRI_IMAGE_FORMAT_ABGR8888; |
break; |
default: |
return NULL; |
} |
if (usage & GBM_BO_USE_SCANOUT) |
dri_use |= __DRI_IMAGE_USE_SCANOUT; |
if (usage & GBM_BO_USE_CURSOR_64X64) |
dri_use |= __DRI_IMAGE_USE_CURSOR; |
/* Gallium drivers requires shared in order to get the handle/stride */ |
dri_use |= __DRI_IMAGE_USE_SHARE; |
bo->image = |
dri->image->createImage(dri->screen, |
width, height, |
dri_format, dri_use, |
bo); |
if (bo->image == NULL) |
return NULL; |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE, |
&bo->base.base.handle.s32); |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE, |
(int *) &bo->base.base.stride); |
printf("%s handle %d w %d h%d\n",__FUNCTION__, bo->base.base.handle.s32, |
width, height); |
return &bo->base.base; |
} |
static struct gbm_surface * |
gbm_dri_surface_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t flags) |
{ |
struct gbm_dri_surface *surf; |
surf = calloc(1, sizeof *surf); |
if (surf == NULL) |
return NULL; |
surf->base.gbm = gbm; |
surf->base.width = width; |
surf->base.height = height; |
surf->base.format = format; |
surf->base.flags = flags; |
return &surf->base; |
} |
static void |
gbm_dri_surface_destroy(struct gbm_surface *_surf) |
{ |
struct gbm_dri_surface *surf = gbm_dri_surface(_surf); |
free(surf); |
} |
static void |
dri_destroy(struct gbm_device *gbm) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(gbm); |
dri->core->destroyScreen(dri->screen); |
free(dri->driver_configs); |
// dlclose(dri->driver); |
free(dri->base.driver_name); |
free(dri); |
} |
static struct gbm_device * |
dri_device_create(int fd) |
{ |
struct gbm_dri_device *dri; |
int ret; |
dri = calloc(1, sizeof *dri); |
dri->base.base.fd = fd; |
dri->base.base.bo_create = gbm_dri_bo_create; |
dri->base.base.bo_import = gbm_dri_bo_import; |
dri->base.base.is_format_supported = gbm_dri_is_format_supported; |
dri->base.base.bo_write = gbm_dri_bo_write; |
dri->base.base.bo_destroy = gbm_dri_bo_destroy; |
dri->base.base.destroy = dri_destroy; |
dri->base.base.surface_create = gbm_dri_surface_create; |
dri->base.base.surface_destroy = gbm_dri_surface_destroy; |
dri->base.type = GBM_DRM_DRIVER_TYPE_DRI; |
dri->base.base.name = "drm"; |
ret = dri_screen_create(dri); |
if (ret) |
goto err_dri; |
return &dri->base.base; |
err_dri: |
free(dri); |
return NULL; |
} |
struct gbm_backend gbm_dri_backend = { |
.backend_name = "dri", |
.create_device = dri_device_create, |
}; |
/contrib/sdk/sources/Mesa/src/gbm/backends/dri/gbm_dri.c.bak |
---|
0,0 → 1,673 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#include <stdio.h> |
#include <stdlib.h> |
#include <stddef.h> |
#include <stdint.h> |
#include <string.h> |
#include <limits.h> |
#include <sys/types.h> |
//#include <sys/mman.h> |
#include <unistd.h> |
//#include <dlfcn.h> |
#include <xf86drm.h> |
#include <GL/gl.h> /* dri_interface needs GL types */ |
#include <GL/internal/dri_interface.h> |
#include "gbm_driint.h" |
#include "gbmint.h" |
/* For importing wl_buffer */ |
#if HAVE_WAYLAND_PLATFORM |
#include "../../../egl/wayland/wayland-drm/wayland-drm.h" |
#endif |
void *load_library(const char *name); |
void *get_proc_address(void *lib, char *proc_name); |
static __DRIimage * |
dri_lookup_egl_image(__DRIscreen *screen, void *image, void *data) |
{ |
struct gbm_dri_device *dri = data; |
if (dri->lookup_image == NULL) |
return NULL; |
return dri->lookup_image(screen, image, dri->lookup_user_data); |
} |
static __DRIbuffer * |
dri_get_buffers(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *data) |
{ |
struct gbm_dri_surface *surf = data; |
struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm); |
if (dri->get_buffers == NULL) |
return NULL; |
return dri->get_buffers(driDrawable, width, height, attachments, |
count, out_count, surf->dri_private); |
} |
static void |
dri_flush_front_buffer(__DRIdrawable * driDrawable, void *data) |
{ |
struct gbm_dri_surface *surf = data; |
struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm); |
if (dri->flush_front_buffer != NULL) |
dri->flush_front_buffer(driDrawable, surf->dri_private); |
} |
static __DRIbuffer * |
dri_get_buffers_with_format(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *data) |
{ |
struct gbm_dri_surface *surf = data; |
struct gbm_dri_device *dri = gbm_dri_device(surf->base.gbm); |
if (dri->get_buffers_with_format == NULL) |
return NULL; |
return |
dri->get_buffers_with_format(driDrawable, width, height, attachments, |
count, out_count, surf->dri_private); |
} |
static const __DRIuseInvalidateExtension use_invalidate = { |
{ __DRI_USE_INVALIDATE, 1 } |
}; |
static const __DRIimageLookupExtension image_lookup_extension = { |
{ __DRI_IMAGE_LOOKUP, 1 }, |
dri_lookup_egl_image |
}; |
const __DRIdri2LoaderExtension dri2_loader_extension = { |
{ __DRI_DRI2_LOADER, 3 }, |
dri_get_buffers, |
dri_flush_front_buffer, |
dri_get_buffers_with_format, |
}; |
struct dri_extension_match { |
const char *name; |
int version; |
int offset; |
}; |
static struct dri_extension_match dri_core_extensions[] = { |
{ __DRI2_FLUSH, 1, offsetof(struct gbm_dri_device, flush) }, |
{ __DRI_IMAGE, 1, offsetof(struct gbm_dri_device, image) }, |
{ NULL, 0, 0 } |
}; |
static struct dri_extension_match gbm_dri_device_extensions[] = { |
{ __DRI_CORE, 1, offsetof(struct gbm_dri_device, core) }, |
{ __DRI_DRI2, 1, offsetof(struct gbm_dri_device, dri2) }, |
{ NULL, 0, 0 } |
}; |
static int |
dri_bind_extensions(struct gbm_dri_device *dri, |
struct dri_extension_match *matches, |
const __DRIextension **extensions) |
{ |
int i, j, ret = 0; |
void *field; |
for (i = 0; extensions[i]; i++) { |
for (j = 0; matches[j].name; j++) { |
if (strcmp(extensions[i]->name, matches[j].name) == 0 && |
extensions[i]->version >= matches[j].version) { |
field = ((char *) dri + matches[j].offset); |
*(const __DRIextension **) field = extensions[i]; |
} |
} |
} |
for (j = 0; matches[j].name; j++) { |
field = ((char *) dri + matches[j].offset); |
if (*(const __DRIextension **) field == NULL) { |
ret = -1; |
} |
} |
return ret; |
} |
static int |
dri_load_driver(struct gbm_dri_device *dri) |
{ |
const __DRIextension **extensions; |
// char path[PATH_MAX], *search_paths, *p, *next, *end; |
char *search_paths; |
search_paths = NULL; |
#if 0 |
if (geteuid() == getuid()) { |
/* don't allow setuid apps to use GBM_DRIVERS_PATH */ |
search_paths = getenv("GBM_DRIVERS_PATH"); |
} |
if (search_paths == NULL) |
search_paths = DEFAULT_DRIVER_DIR; |
dri->driver = NULL; |
end = search_paths + strlen(search_paths); |
for (p = search_paths; p < end && dri->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, dri->base.driver_name); |
dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
#endif |
if (dri->driver == NULL) { |
snprintf(path, sizeof path, |
"%.*s/%s_dri.so", len, p, dri->base.driver_name); |
dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
if (dri->driver == NULL) |
fprintf(stderr, "failed to open %s: %s\n", path, dlerror()); |
} |
} |
#endif |
dri->driver = load_library("libGL.dll"); |
if (dri->driver == NULL) { |
fprintf(stderr, "gbm: failed to open any driver (search paths %s)", |
search_paths); |
return -1; |
} |
extensions = get_proc_address(dri->driver, __DRI_DRIVER_EXTENSIONS); |
if (extensions == NULL) { |
fprintf(stderr, "gbm: driver exports no extensions\n"); |
// dlclose(dri->driver); |
return -1; |
} |
if (dri_bind_extensions(dri, gbm_dri_device_extensions, extensions) < 0) { |
// dlclose(dri->driver); |
fprintf(stderr, "failed to bind extensions\n"); |
return -1; |
} |
return 0; |
} |
static int |
dri_screen_create(struct gbm_dri_device *dri) |
{ |
const __DRIextension **extensions; |
int ret = 0; |
dri->base.driver_name = strdup("drm"); //dri_fd_get_driver_name(dri->base.base.fd); |
if (dri->base.driver_name == NULL) |
return -1; |
ret = dri_load_driver(dri); |
if (ret) { |
fprintf(stderr, "failed to load driver: %s\n", dri->base.driver_name); |
return ret; |
}; |
dri->extensions[0] = &image_lookup_extension.base; |
dri->extensions[1] = &use_invalidate.base; |
dri->extensions[2] = &dri2_loader_extension.base; |
dri->extensions[3] = NULL; |
if (dri->dri2 == NULL) |
return -1; |
dri->screen = dri->dri2->createNewScreen(0, dri->base.base.fd, |
dri->extensions, |
&dri->driver_configs, dri); |
if (dri->screen == NULL) |
return -1; |
extensions = dri->core->getExtensions(dri->screen); |
if (dri_bind_extensions(dri, dri_core_extensions, extensions) < 0) { |
ret = -1; |
goto free_screen; |
} |
dri->lookup_image = NULL; |
dri->lookup_user_data = NULL; |
return 0; |
free_screen: |
dri->core->destroyScreen(dri->screen); |
return ret; |
} |
static int |
gbm_dri_is_format_supported(struct gbm_device *gbm, |
uint32_t format, |
uint32_t usage) |
{ |
switch (format) { |
case GBM_BO_FORMAT_XRGB8888: |
case GBM_FORMAT_XRGB8888: |
break; |
case GBM_BO_FORMAT_ARGB8888: |
case GBM_FORMAT_ARGB8888: |
if (usage & GBM_BO_USE_SCANOUT) |
return 0; |
break; |
default: |
return 0; |
} |
if (usage & GBM_BO_USE_CURSOR_64X64 && |
usage & GBM_BO_USE_RENDERING) |
return 0; |
return 1; |
} |
static int |
gbm_dri_bo_write(struct gbm_bo *_bo, const void *buf, size_t count) |
{ |
struct gbm_dri_bo *bo = gbm_dri_bo(_bo); |
if (bo->image != NULL) |
return -1; |
memcpy(bo->map, buf, count); |
return 0; |
} |
static void |
gbm_dri_bo_destroy(struct gbm_bo *_bo) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm); |
struct gbm_dri_bo *bo = gbm_dri_bo(_bo); |
// struct drm_mode_destroy_dumb arg; |
if (bo->image != NULL) { |
dri->image->destroyImage(bo->image); |
} else { |
// munmap(bo->map, bo->size); |
// memset(&arg, 0, sizeof(arg)); |
// arg.handle = bo->handle; |
// drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg); |
} |
free(bo); |
} |
static uint32_t |
gbm_dri_to_gbm_format(uint32_t dri_format) |
{ |
uint32_t ret = 0; |
switch (dri_format) { |
case __DRI_IMAGE_FORMAT_RGB565: |
ret = GBM_FORMAT_RGB565; |
break; |
case __DRI_IMAGE_FORMAT_XRGB8888: |
ret = GBM_FORMAT_XRGB8888; |
break; |
case __DRI_IMAGE_FORMAT_ARGB8888: |
ret = GBM_FORMAT_ARGB8888; |
break; |
case __DRI_IMAGE_FORMAT_ABGR8888: |
ret = GBM_FORMAT_ABGR8888; |
break; |
default: |
ret = 0; |
break; |
} |
return ret; |
} |
static struct gbm_bo * |
gbm_dri_bo_import(struct gbm_device *gbm, |
uint32_t type, void *buffer, uint32_t usage) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(gbm); |
struct gbm_dri_bo *bo; |
__DRIimage *image; |
unsigned dri_use = 0; |
int gbm_format; |
/* Required for query image WIDTH & HEIGHT */ |
if (dri->image->base.version < 4) |
return NULL; |
switch (type) { |
#if HAVE_WAYLAND_PLATFORM |
case GBM_BO_IMPORT_WL_BUFFER: |
{ |
struct wl_drm_buffer *wb = (struct wl_drm_buffer *) buffer; |
if (!wayland_buffer_is_drm(buffer)) |
return NULL; |
image = wb->driver_buffer; |
switch (wb->format) { |
case WL_DRM_FORMAT_XRGB8888: |
gbm_format = GBM_FORMAT_XRGB8888; |
break; |
case WL_DRM_FORMAT_ARGB8888: |
gbm_format = GBM_FORMAT_ARGB8888; |
break; |
case WL_DRM_FORMAT_YUYV: |
gbm_format = GBM_FORMAT_YUYV; |
break; |
default: |
return NULL; |
} |
break; |
} |
#endif |
case GBM_BO_IMPORT_EGL_IMAGE: |
{ |
int dri_format; |
if (dri->lookup_image == NULL) |
return NULL; |
image = dri->lookup_image(dri->screen, buffer, dri->lookup_user_data); |
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_FORMAT, &dri_format); |
gbm_format = gbm_dri_to_gbm_format(dri_format); |
if (gbm_format == 0) |
return NULL; |
break; |
} |
default: |
return NULL; |
} |
bo = calloc(1, sizeof *bo); |
if (bo == NULL) |
return NULL; |
bo->image = dri->image->dupImage(image, NULL); |
if (usage & GBM_BO_USE_SCANOUT) |
dri_use |= __DRI_IMAGE_USE_SCANOUT; |
if (usage & GBM_BO_USE_CURSOR_64X64) |
dri_use |= __DRI_IMAGE_USE_CURSOR; |
if (dri->image->base.version >= 2 && |
!dri->image->validateUsage(bo->image, dri_use)) { |
free(bo); |
return NULL; |
} |
bo->base.base.gbm = gbm; |
bo->base.base.format = gbm_format; |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_WIDTH, |
(int*)&bo->base.base.width); |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HEIGHT, |
(int*)&bo->base.base.height); |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE, |
(int*)&bo->base.base.stride); |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE, |
&bo->base.base.handle.s32); |
return &bo->base.base; |
} |
#if 0 |
static struct gbm_bo * |
create_dumb(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t usage) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(gbm); |
struct drm_mode_create_dumb create_arg; |
struct drm_mode_map_dumb map_arg; |
struct gbm_dri_bo *bo; |
struct drm_mode_destroy_dumb destroy_arg; |
int ret; |
if (!(usage & GBM_BO_USE_CURSOR_64X64)) |
return NULL; |
if (format != GBM_FORMAT_ARGB8888) |
return NULL; |
bo = calloc(1, sizeof *bo); |
if (bo == NULL) |
return NULL; |
create_arg.bpp = 32; |
create_arg.width = width; |
create_arg.height = height; |
ret = drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_arg); |
if (ret) |
goto free_bo; |
bo->base.base.gbm = gbm; |
bo->base.base.width = width; |
bo->base.base.height = height; |
bo->base.base.stride = create_arg.pitch; |
bo->base.base.format = format; |
bo->base.base.handle.u32 = create_arg.handle; |
bo->handle = create_arg.handle; |
bo->size = create_arg.size; |
memset(&map_arg, 0, sizeof(map_arg)); |
map_arg.handle = bo->handle; |
ret = drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_MAP_DUMB, &map_arg); |
if (ret) |
goto destroy_dumb; |
bo->map = mmap(0, bo->size, PROT_WRITE, |
MAP_SHARED, dri->base.base.fd, map_arg.offset); |
if (bo->map == MAP_FAILED) |
goto destroy_dumb; |
return &bo->base.base; |
destroy_dumb: |
memset(&destroy_arg, 0, sizeof destroy_arg); |
destroy_arg.handle = create_arg.handle; |
drmIoctl(dri->base.base.fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_arg); |
free_bo: |
free(bo); |
return NULL; |
} |
#endif |
static struct gbm_bo * |
gbm_dri_bo_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t usage) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(gbm); |
struct gbm_dri_bo *bo; |
int dri_format; |
unsigned dri_use = 0; |
// if (usage & GBM_BO_USE_WRITE) |
// return create_dumb(gbm, width, height, format, usage); |
bo = calloc(1, sizeof *bo); |
if (bo == NULL) |
return NULL; |
bo->base.base.gbm = gbm; |
bo->base.base.width = width; |
bo->base.base.height = height; |
bo->base.base.format = format; |
switch (format) { |
case GBM_FORMAT_RGB565: |
dri_format =__DRI_IMAGE_FORMAT_RGB565; |
break; |
case GBM_FORMAT_XRGB8888: |
case GBM_BO_FORMAT_XRGB8888: |
dri_format = __DRI_IMAGE_FORMAT_XRGB8888; |
break; |
case GBM_FORMAT_ARGB8888: |
case GBM_BO_FORMAT_ARGB8888: |
dri_format = __DRI_IMAGE_FORMAT_ARGB8888; |
break; |
case GBM_FORMAT_ABGR8888: |
dri_format = __DRI_IMAGE_FORMAT_ABGR8888; |
break; |
default: |
return NULL; |
} |
if (usage & GBM_BO_USE_SCANOUT) |
dri_use |= __DRI_IMAGE_USE_SCANOUT; |
if (usage & GBM_BO_USE_CURSOR_64X64) |
dri_use |= __DRI_IMAGE_USE_CURSOR; |
/* Gallium drivers requires shared in order to get the handle/stride */ |
dri_use |= __DRI_IMAGE_USE_SHARE; |
bo->image = |
dri->image->createImage(dri->screen, |
width, height, |
dri_format, dri_use, |
bo); |
if (bo->image == NULL) |
return NULL; |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE, |
&bo->base.base.handle.s32); |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE, |
(int *) &bo->base.base.stride); |
printf("gbm_dri_bo_create bo: %p handle %d" |
" width: %d height: %d pitch: %d format %d\n",bo, bo->base.base.handle.s32, |
bo->base.base.width, bo->base.base.height, |
(int)bo->base.base.stride,bo->base.base.format); |
return &bo->base.base; |
} |
static struct gbm_surface * |
gbm_dri_surface_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t flags) |
{ |
struct gbm_dri_surface *surf; |
surf = calloc(1, sizeof *surf); |
if (surf == NULL) |
return NULL; |
surf->base.gbm = gbm; |
surf->base.width = width; |
surf->base.height = height; |
surf->base.format = format; |
surf->base.flags = flags; |
return &surf->base; |
} |
static void |
gbm_dri_surface_destroy(struct gbm_surface *_surf) |
{ |
struct gbm_dri_surface *surf = gbm_dri_surface(_surf); |
free(surf); |
} |
static void |
dri_destroy(struct gbm_device *gbm) |
{ |
struct gbm_dri_device *dri = gbm_dri_device(gbm); |
dri->core->destroyScreen(dri->screen); |
free(dri->driver_configs); |
// dlclose(dri->driver); |
free(dri->base.driver_name); |
free(dri); |
} |
static struct gbm_device * |
dri_device_create(int fd) |
{ |
struct gbm_dri_device *dri; |
int ret; |
dri = calloc(1, sizeof *dri); |
dri->base.base.fd = fd; |
dri->base.base.bo_create = gbm_dri_bo_create; |
dri->base.base.bo_import = gbm_dri_bo_import; |
dri->base.base.is_format_supported = gbm_dri_is_format_supported; |
dri->base.base.bo_write = gbm_dri_bo_write; |
dri->base.base.bo_destroy = gbm_dri_bo_destroy; |
dri->base.base.destroy = dri_destroy; |
dri->base.base.surface_create = gbm_dri_surface_create; |
dri->base.base.surface_destroy = gbm_dri_surface_destroy; |
dri->base.type = GBM_DRM_DRIVER_TYPE_DRI; |
dri->base.base.name = "drm"; |
ret = dri_screen_create(dri); |
if (ret) |
goto err_dri; |
return &dri->base.base; |
err_dri: |
free(dri); |
return NULL; |
} |
struct gbm_backend gbm_dri_backend = { |
.backend_name = "dri", |
.create_device = dri_device_create, |
}; |
/contrib/sdk/sources/Mesa/src/gbm/backends/dri/gbm_driint.h |
---|
0,0 → 1,108 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#ifndef _GBM_DRI_INTERNAL_H_ |
#define _GBM_DRI_INTERNAL_H_ |
#include "gbmint.h" |
#include "common.h" |
#include "common_drm.h" |
#include <GL/gl.h> /* dri_interface needs GL types */ |
#include "GL/internal/dri_interface.h" |
struct gbm_dri_surface; |
struct gbm_dri_device { |
struct gbm_drm_device base; |
void *driver; |
__DRIscreen *screen; |
__DRIcoreExtension *core; |
__DRIdri2Extension *dri2; |
__DRIimageExtension *image; |
__DRI2flushExtension *flush; |
__DRIdri2LoaderExtension *loader; |
const __DRIconfig **driver_configs; |
const __DRIextension *extensions[4]; |
__DRIimage *(*lookup_image)(__DRIscreen *screen, void *image, void *data); |
void *lookup_user_data; |
__DRIbuffer *(*get_buffers)(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *data); |
void (*flush_front_buffer)(__DRIdrawable * driDrawable, void *data); |
__DRIbuffer *(*get_buffers_with_format)(__DRIdrawable * driDrawable, |
int *width, int *height, |
unsigned int *attachments, int count, |
int *out_count, void *data); |
}; |
struct gbm_dri_bo { |
struct gbm_drm_bo base; |
__DRIimage *image; |
/* Only used for cursors */ |
uint32_t handle, size; |
void *map; |
}; |
struct gbm_dri_surface { |
struct gbm_surface base; |
void *dri_private; |
}; |
static inline struct gbm_dri_device * |
gbm_dri_device(struct gbm_device *gbm) |
{ |
return (struct gbm_dri_device *) gbm; |
} |
static inline struct gbm_dri_bo * |
gbm_dri_bo(struct gbm_bo *bo) |
{ |
return (struct gbm_dri_bo *) bo; |
} |
static inline struct gbm_dri_surface * |
gbm_dri_surface(struct gbm_surface *surface) |
{ |
return (struct gbm_dri_surface *) surface; |
} |
char * |
dri_fd_get_driver_name(int fd); |
#endif |
/contrib/sdk/sources/Mesa/src/gbm/main/backend.c |
---|
0,0 → 1,138 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#include <stdio.h> |
#include <stddef.h> |
#include <stdlib.h> |
#include <string.h> |
#include <limits.h> |
//#include <dlfcn.h> |
#include "backend.h" |
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) |
extern const struct gbm_backend gbm_dri_backend; |
struct backend_desc { |
const char *name; |
const struct gbm_backend *builtin; |
}; |
static const struct backend_desc backends[] = { |
{ "gbm_dri.so", &gbm_dri_backend } |
// { "gbm_gallium_drm.so", NULL }, |
}; |
#if 0 |
static const void * |
load_backend(const struct backend_desc *backend) |
{ |
char path[PATH_MAX]; |
const void *init = NULL; |
void *module; |
const char *name; |
const char *entrypoint = "gbm_backend"; |
if (backend == NULL) |
return NULL; |
name = backend->name; |
if (backend->builtin) { |
init = backend->builtin; |
} else { |
#if 0 |
if (name[0] != '/') |
snprintf(path, sizeof path, MODULEDIR "/%s", name); |
else |
snprintf(path, sizeof path, "%s", name); |
module = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
if (!module) { |
fprintf(stderr, |
"failed to load module: %s\n", dlerror()); |
return NULL; |
} |
init = dlsym(module, entrypoint); |
if (!init) |
#endif |
return NULL; |
} |
return init; |
} |
static const struct backend_desc * |
find_backend(const char *name) |
{ |
const struct backend_desc *backend = NULL; |
int i; |
for (i = 0; i < ARRAY_SIZE(backends); ++i) { |
if (strcmp(backends[i].name, name) == 0) { |
backend = &backends[i]; |
break; |
} |
} |
return backend; |
} |
#endif |
struct gbm_device * |
_gbm_create_device(int fd) |
{ |
const struct gbm_backend *backend = NULL; |
struct gbm_device *dev = NULL; |
#if 0 |
int i; |
const char *b; |
b = getenv("GBM_BACKEND"); |
if (b) |
backend = load_backend(find_backend(b)); |
if (backend) |
dev = backend->create_device(fd); |
for (i = 0; i < ARRAY_SIZE(backends) && dev == NULL; ++i) { |
backend = load_backend(&backends[i]); |
if (backend == NULL) |
continue; |
dev = backend->create_device(fd); |
} |
#endif |
backend = &gbm_dri_backend; |
dev = backend->create_device(fd); |
return dev; |
} |
/contrib/sdk/sources/Mesa/src/gbm/main/backend.h |
---|
0,0 → 1,36 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#ifndef MODULE_H_ |
#define MODULE_H_ |
#include "gbmint.h" |
struct gbm_device * |
_gbm_create_device(int fd); |
#endif |
/contrib/sdk/sources/Mesa/src/gbm/main/common.c |
---|
0,0 → 1,88 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#include <stdio.h> |
#include <string.h> |
#include <libudev.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <unistd.h> |
#include "common.h" |
#include "gbmint.h" |
GBM_EXPORT struct udev_device * |
_gbm_udev_device_new_from_fd(struct udev *udev, int fd) |
{ |
struct udev_device *device; |
struct stat buf; |
if (fstat(fd, &buf) < 0) { |
fprintf(stderr, "gbm: failed to stat fd %d", fd); |
return NULL; |
} |
device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev); |
if (device == NULL) { |
fprintf(stderr, |
"gbm: could not create udev device for fd %d", fd); |
return NULL; |
} |
return device; |
} |
GBM_EXPORT char * |
_gbm_fd_get_device_name(int fd) |
{ |
struct udev *udev; |
struct udev_device *device; |
const char *const_device_name; |
char *device_name = NULL; |
udev = udev_new(); |
device = _gbm_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; |
} |
GBM_EXPORT void |
_gbm_log(const char *fmt_str, ...) |
{ |
} |
/contrib/sdk/sources/Mesa/src/gbm/main/common.h |
---|
0,0 → 1,42 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#ifndef _COMMON_H_ |
#define _COMMON_H_ |
//#include <libudev.h> |
//struct udev_device * |
//_gbm_udev_device_new_from_fd(struct udev *udev, int fd); |
char * |
_gbm_fd_get_device_name(int fd); |
void |
_gbm_log(const char *fmt_str, ...); |
#endif |
/contrib/sdk/sources/Mesa/src/gbm/main/common_drm.h |
---|
0,0 → 1,48 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#ifndef _COMMON_DRM_H_ |
#define _COMMON_DRM_H_ |
#include "gbmint.h" |
enum gbm_drm_driver_type { |
GBM_DRM_DRIVER_TYPE_DRI, |
GBM_DRM_DRIVER_TYPE_GALLIUM, |
}; |
struct gbm_drm_device { |
struct gbm_device base; |
enum gbm_drm_driver_type type; |
char *driver_name; |
}; |
struct gbm_drm_bo { |
struct gbm_bo base; |
}; |
#endif |
/contrib/sdk/sources/Mesa/src/gbm/main/gbm.c |
---|
0,0 → 1,469 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#define _BSD_SOURCE |
#include <stddef.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <stdint.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <unistd.h> |
#include "gbm.h" |
#include "gbmint.h" |
#include "common.h" |
#include "backend.h" |
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) |
struct gbm_device *devices[16]; |
static int device_num = 0; |
/** Returns the file description for the gbm device |
* |
* \return The fd that the struct gbm_device was created with |
*/ |
GBM_EXPORT int |
gbm_device_get_fd(struct gbm_device *gbm) |
{ |
return gbm->fd; |
} |
/* FIXME: maybe superfluous, use udev subclass from the fd? */ |
/** Get the backend name for the given gbm device |
* |
* \return The backend name string - this belongs to the device and must not |
* be freed |
*/ |
GBM_EXPORT const char * |
gbm_device_get_backend_name(struct gbm_device *gbm) |
{ |
return gbm->name; |
} |
/** Test if a format is supported for a given set of usage flags. |
* |
* \param gbm The created buffer manager |
* \param format The format to test |
* \param usage A bitmask of the usages to test the format against |
* \return 1 if the format is supported otherwise 0 |
* |
* \sa enum gbm_bo_flags for the list of flags that the format can be |
* tested against |
* |
* \sa enum gbm_bo_format for the list of formats |
*/ |
int |
gbm_device_is_format_supported(struct gbm_device *gbm, |
uint32_t format, uint32_t usage) |
{ |
return gbm->is_format_supported(gbm, format, usage); |
} |
/** Destroy the gbm device and free all resources associated with it. |
* |
* \param gbm The device created using gbm_create_device() |
*/ |
GBM_EXPORT void |
gbm_device_destroy(struct gbm_device *gbm) |
{ |
gbm->refcount--; |
if (gbm->refcount == 0) |
gbm->destroy(gbm); |
} |
#if 0 |
GBM_EXPORT struct gbm_device * |
_gbm_mesa_get_device(int fd) |
{ |
struct gbm_device *gbm = NULL; |
struct stat buf; |
dev_t dev; |
int i; |
for (i = 0; i < device_num; ++i) { |
dev = devices[i]->stat.st_rdev; |
if (major(dev) == major(buf.st_rdev) && |
minor(dev) == minor(buf.st_rdev)) { |
gbm = devices[i]; |
gbm->refcount++; |
break; |
} |
} |
return gbm; |
} |
#endif |
/** Create a gbm device for allocating buffers |
* |
* The file descriptor passed in is used by the backend to communicate with |
* platform for allocating the memory. For allocations using DRI this would be |
* the file descriptor returned when opening a device such as \c |
* /dev/dri/card0 |
* |
* \param fd The file descriptor for an backend specific device |
* \return The newly created struct gbm_device. The resources associated with |
* the device should be freed with gbm_device_destroy() when it is no longer |
* needed. If the creation of the device failed NULL will be returned. |
*/ |
GBM_EXPORT struct gbm_device * |
gbm_create_device(int fd) |
{ |
struct gbm_device *gbm = NULL; |
struct stat buf; |
if (fd == 0) { |
fprintf(stderr, "gbm_create_device: invalid fd: %d\n", fd); |
return NULL; |
} |
if (device_num == 0) |
memset(devices, 0, sizeof devices); |
gbm = _gbm_create_device(fd); |
if (gbm == NULL) |
return NULL; |
gbm->dummy = gbm_create_device; |
gbm->stat = buf; |
gbm->refcount = 1; |
if (device_num < ARRAY_SIZE(devices)-1) |
devices[device_num++] = gbm; |
return gbm; |
} |
/** Get the width of the buffer object |
* |
* \param bo The buffer object |
* \return The width of the allocated buffer object |
* |
*/ |
GBM_EXPORT unsigned int |
gbm_bo_get_width(struct gbm_bo *bo) |
{ |
return bo->width; |
} |
/** Get the height of the buffer object |
* |
* \param bo The buffer object |
* \return The height of the allocated buffer object |
*/ |
GBM_EXPORT unsigned int |
gbm_bo_get_height(struct gbm_bo *bo) |
{ |
return bo->height; |
} |
/** Get the stride of the buffer object |
* |
* This is calculated by the backend when it does the allocation in |
* gbm_bo_create() |
* |
* \param bo The buffer object |
* \return The stride of the allocated buffer object in bytes |
*/ |
GBM_EXPORT uint32_t |
gbm_bo_get_stride(struct gbm_bo *bo) |
{ |
return bo->stride; |
} |
/** Get the format of the buffer object |
* |
* The format of the pixels in the buffer. |
* |
* \param bo The buffer object |
* \return The format of buffer object, on of the GBM_FORMAT_* codes |
*/ |
GBM_EXPORT uint32_t |
gbm_bo_get_format(struct gbm_bo *bo) |
{ |
return bo->format; |
} |
/** Get the handle of the buffer object |
* |
* This is stored in the platform generic union gbm_bo_handle type. However |
* the format of this handle is platform specific. |
* |
* \param bo The buffer object |
* \return Returns the handle of the allocated buffer object |
*/ |
GBM_EXPORT union gbm_bo_handle |
gbm_bo_get_handle(struct gbm_bo *bo) |
{ |
return bo->handle; |
} |
/** Write data into the buffer object |
* |
* If the buffer object was created with the GBM_BO_USE_WRITE flag, |
* this function can used to write data into the buffer object. The |
* data is copied directly into the object and it's the responsiblity |
* of the caller to make sure the data represents valid pixel data, |
* according to the width, height, stride and format of the buffer object. |
* |
* \param bo The buffer object |
* \param buf The data to write |
* \param count The number of bytes to write |
* \return Returns -1 on error, 0 otherwise |
*/ |
GBM_EXPORT int |
gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count) |
{ |
return bo->gbm->bo_write(bo, buf, count); |
} |
/** Get the gbm device used to create the buffer object |
* |
* \param bo The buffer object |
* \return Returns the gbm device with which the buffer object was created |
*/ |
GBM_EXPORT struct gbm_device * |
gbm_bo_get_device(struct gbm_bo *bo) |
{ |
return bo->gbm; |
} |
/** Set the user data associated with a buffer object |
* |
* \param bo The buffer object |
* \param data The data to associate to the buffer object |
* \param destroy_user_data A callback (which may be %NULL) that will be |
* called prior to the buffer destruction |
*/ |
GBM_EXPORT void |
gbm_bo_set_user_data(struct gbm_bo *bo, void *data, |
void (*destroy_user_data)(struct gbm_bo *, void *)) |
{ |
bo->user_data = data; |
bo->destroy_user_data = destroy_user_data; |
} |
/** Get the user data associated with a buffer object |
* |
* \param bo The buffer object |
* \return Returns the user data associated with the buffer object or %NULL |
* if no data was associated with it |
* |
* \sa gbm_bo_set_user_data() |
*/ |
GBM_EXPORT void * |
gbm_bo_get_user_data(struct gbm_bo *bo) |
{ |
return bo->user_data; |
} |
/** |
* Destroys the given buffer object and frees all resources associated with |
* it. |
* |
* \param bo The buffer object |
*/ |
GBM_EXPORT void |
gbm_bo_destroy(struct gbm_bo *bo) |
{ |
if (bo->destroy_user_data) |
bo->destroy_user_data(bo, bo->user_data); |
bo->gbm->bo_destroy(bo); |
} |
/** |
* Allocate a buffer object for the given dimensions |
* |
* \param gbm The gbm device returned from gbm_create_device() |
* \param width The width for the buffer |
* \param height The height for the buffer |
* \param format The format to use for the buffer |
* \param usage The union of the usage flags for this buffer |
* |
* \return A newly allocated buffer that should be freed with gbm_bo_destroy() |
* when no longer needed. If an error occurs during allocation %NULL will be |
* returned. |
* |
* \sa enum gbm_bo_format for the list of formats |
* \sa enum gbm_bo_flags for the list of usage flags |
*/ |
GBM_EXPORT struct gbm_bo * |
gbm_bo_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t usage) |
{ |
if (width == 0 || height == 0) |
return NULL; |
if (usage & GBM_BO_USE_CURSOR_64X64 && |
(width != 64 || height != 64)) |
return NULL; |
return gbm->bo_create(gbm, width, height, format, usage); |
} |
/** |
* Create a gbm buffer object from an foreign object |
* |
* This function imports a foreign object and creates a new gbm bo for it. |
* This enabled using the foreign object with a display API such as KMS. |
* Currently two types of foreign objects are supported, indicated by the type |
* argument: |
* |
* GBM_BO_IMPORT_WL_BUFFER |
* GBM_BO_IMPORT_EGL_IMAGE |
* |
* The the gbm bo shares the underlying pixels but its life-time is |
* independent of the foreign object. |
* |
* \param gbm The gbm device returned from gbm_create_device() |
* \param gbm The type of object we're importing |
* \param gbm Pointer to the external object |
* \param usage The union of the usage flags for this buffer |
* |
* \return A newly allocated buffer object that should be freed with |
* gbm_bo_destroy() when no longer needed. |
* |
* \sa enum gbm_bo_flags for the list of usage flags |
*/ |
GBM_EXPORT struct gbm_bo * |
gbm_bo_import(struct gbm_device *gbm, |
uint32_t type, void *buffer, uint32_t usage) |
{ |
return gbm->bo_import(gbm, type, buffer, usage); |
} |
/** |
* Allocate a surface object |
* |
* \param gbm The gbm device returned from gbm_create_device() |
* \param width The width for the surface |
* \param height The height for the surface |
* \param format The format to use for the surface |
* |
* \return A newly allocated surface that should be freed with |
* gbm_surface_destroy() when no longer needed. If an error occurs |
* during allocation %NULL will be returned. |
* |
* \sa enum gbm_bo_format for the list of formats |
*/ |
GBM_EXPORT struct gbm_surface * |
gbm_surface_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t flags) |
{ |
return gbm->surface_create(gbm, width, height, format, flags); |
} |
/** |
* Destroys the given surface and frees all resources associated with |
* it. |
* |
* All buffers locked with gbm_surface_lock_front_buffer() should be |
* released prior to calling this function. |
* |
* \param surf The surface |
*/ |
GBM_EXPORT void |
gbm_surface_destroy(struct gbm_surface *surf) |
{ |
surf->gbm->surface_destroy(surf); |
} |
/** |
* Lock the surface's current front buffer |
* |
* Lock rendering to the surface's current front buffer until it is |
* released with gbm_surface_release_buffer(). |
* |
* This function must be called exactly once after calling |
* eglSwapBuffers. Calling it before any eglSwapBuffer has happened |
* on the surface or two or more times after eglSwapBuffers is an |
* error. A new bo representing the new front buffer is returned. On |
* multiple invocations, all the returned bos must be released in |
* order to release the actual surface buffer. |
* |
* \param surf The surface |
* |
* \return A buffer object that should be released with |
* gbm_surface_release_buffer() when no longer needed. The implementation |
* is free to reuse buffers released with gbm_surface_release_buffer() so |
* this bo should not be destroyed using gbm_bo_destroy(). If an error |
* occurs this function returns %NULL. |
*/ |
GBM_EXPORT struct gbm_bo * |
gbm_surface_lock_front_buffer(struct gbm_surface *surf) |
{ |
return surf->gbm->surface_lock_front_buffer(surf); |
} |
/** |
* Release a locked buffer obtained with gbm_surface_lock_front_buffer() |
* |
* Returns the underlying buffer to the gbm surface. Releasing a bo |
* will typically make gbm_surface_has_free_buffer() return 1 and thus |
* allow rendering the next frame, but not always. The implementation |
* may choose to destroy the bo immediately or reuse it, in which case |
* the user data associated with it is unchanged. |
* |
* \param surf The surface |
* \param bo The buffer object |
*/ |
GBM_EXPORT void |
gbm_surface_release_buffer(struct gbm_surface *surf, struct gbm_bo *bo) |
{ |
surf->gbm->surface_release_buffer(surf, bo); |
} |
/** |
* Return whether or not a surface has free (non-locked) buffers |
* |
* Before starting a new frame, the surface must have a buffer |
* available for rendering. Initially, a gbm surface will have a free |
* buffer, but after one of more buffers have been locked (\sa |
* gbm_surface_lock_front_buffer()), the application must check for a |
* free buffer before rendering. |
* |
* If a surface doesn't have a free buffer, the application must |
* return a buffer to the surface using gbm_surface_release_buffer() |
* and after that, the application can query for free buffers again. |
* |
* \param surf The surface |
* \return 1 if the surface has free buffers, 0 otherwise |
*/ |
GBM_EXPORT int |
gbm_surface_has_free_buffers(struct gbm_surface *surf) |
{ |
return surf->gbm->surface_has_free_buffers(surf); |
} |
/contrib/sdk/sources/Mesa/src/gbm/main/gbm.c.bak |
---|
0,0 → 1,472 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#define _BSD_SOURCE |
#include <stddef.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <stdint.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <unistd.h> |
#include "gbm.h" |
#include "gbmint.h" |
#include "common.h" |
#include "backend.h" |
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) |
struct gbm_device *devices[16]; |
static int device_num = 0; |
/** Returns the file description for the gbm device |
* |
* \return The fd that the struct gbm_device was created with |
*/ |
GBM_EXPORT int |
gbm_device_get_fd(struct gbm_device *gbm) |
{ |
return gbm->fd; |
} |
/* FIXME: maybe superfluous, use udev subclass from the fd? */ |
/** Get the backend name for the given gbm device |
* |
* \return The backend name string - this belongs to the device and must not |
* be freed |
*/ |
GBM_EXPORT const char * |
gbm_device_get_backend_name(struct gbm_device *gbm) |
{ |
return gbm->name; |
} |
/** Test if a format is supported for a given set of usage flags. |
* |
* \param gbm The created buffer manager |
* \param format The format to test |
* \param usage A bitmask of the usages to test the format against |
* \return 1 if the format is supported otherwise 0 |
* |
* \sa enum gbm_bo_flags for the list of flags that the format can be |
* tested against |
* |
* \sa enum gbm_bo_format for the list of formats |
*/ |
int |
gbm_device_is_format_supported(struct gbm_device *gbm, |
uint32_t format, uint32_t usage) |
{ |
return gbm->is_format_supported(gbm, format, usage); |
} |
/** Destroy the gbm device and free all resources associated with it. |
* |
* \param gbm The device created using gbm_create_device() |
*/ |
GBM_EXPORT void |
gbm_device_destroy(struct gbm_device *gbm) |
{ |
gbm->refcount--; |
if (gbm->refcount == 0) |
gbm->destroy(gbm); |
} |
#if 0 |
GBM_EXPORT struct gbm_device * |
_gbm_mesa_get_device(int fd) |
{ |
struct gbm_device *gbm = NULL; |
struct stat buf; |
dev_t dev; |
int i; |
for (i = 0; i < device_num; ++i) { |
dev = devices[i]->stat.st_rdev; |
if (major(dev) == major(buf.st_rdev) && |
minor(dev) == minor(buf.st_rdev)) { |
gbm = devices[i]; |
gbm->refcount++; |
break; |
} |
} |
return gbm; |
} |
#endif |
/** Create a gbm device for allocating buffers |
* |
* The file descriptor passed in is used by the backend to communicate with |
* platform for allocating the memory. For allocations using DRI this would be |
* the file descriptor returned when opening a device such as \c |
* /dev/dri/card0 |
* |
* \param fd The file descriptor for an backend specific device |
* \return The newly created struct gbm_device. The resources associated with |
* the device should be freed with gbm_device_destroy() when it is no longer |
* needed. If the creation of the device failed NULL will be returned. |
*/ |
GBM_EXPORT struct gbm_device * |
gbm_create_device(int fd) |
{ |
struct gbm_device *gbm = NULL; |
struct stat buf; |
if (fd == 0) { |
fprintf(stderr, "gbm_create_device: invalid fd: %d\n", fd); |
return NULL; |
} |
if (device_num == 0) |
memset(devices, 0, sizeof devices); |
gbm = _gbm_create_device(fd); |
if (gbm == NULL) |
return NULL; |
gbm->dummy = gbm_create_device; |
gbm->stat = buf; |
gbm->refcount = 1; |
if (device_num < ARRAY_SIZE(devices)-1) |
devices[device_num++] = gbm; |
return gbm; |
} |
/** Get the width of the buffer object |
* |
* \param bo The buffer object |
* \return The width of the allocated buffer object |
* |
*/ |
GBM_EXPORT unsigned int |
gbm_bo_get_width(struct gbm_bo *bo) |
{ |
return bo->width; |
} |
/** Get the height of the buffer object |
* |
* \param bo The buffer object |
* \return The height of the allocated buffer object |
*/ |
GBM_EXPORT unsigned int |
gbm_bo_get_height(struct gbm_bo *bo) |
{ |
return bo->height; |
} |
/** Get the stride of the buffer object |
* |
* This is calculated by the backend when it does the allocation in |
* gbm_bo_create() |
* |
* \param bo The buffer object |
* \return The stride of the allocated buffer object in bytes |
*/ |
GBM_EXPORT uint32_t |
gbm_bo_get_stride(struct gbm_bo *bo) |
{ |
return bo->stride; |
} |
/** Get the format of the buffer object |
* |
* The format of the pixels in the buffer. |
* |
* \param bo The buffer object |
* \return The format of buffer object, on of the GBM_FORMAT_* codes |
*/ |
GBM_EXPORT uint32_t |
gbm_bo_get_format(struct gbm_bo *bo) |
{ |
return bo->format; |
} |
/** Get the handle of the buffer object |
* |
* This is stored in the platform generic union gbm_bo_handle type. However |
* the format of this handle is platform specific. |
* |
* \param bo The buffer object |
* \return Returns the handle of the allocated buffer object |
*/ |
GBM_EXPORT union gbm_bo_handle |
gbm_bo_get_handle(struct gbm_bo *bo) |
{ |
return bo->handle; |
} |
/** Write data into the buffer object |
* |
* If the buffer object was created with the GBM_BO_USE_WRITE flag, |
* this function can used to write data into the buffer object. The |
* data is copied directly into the object and it's the responsiblity |
* of the caller to make sure the data represents valid pixel data, |
* according to the width, height, stride and format of the buffer object. |
* |
* \param bo The buffer object |
* \param buf The data to write |
* \param count The number of bytes to write |
* \return Returns -1 on error, 0 otherwise |
*/ |
GBM_EXPORT int |
gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count) |
{ |
return bo->gbm->bo_write(bo, buf, count); |
} |
/** Get the gbm device used to create the buffer object |
* |
* \param bo The buffer object |
* \return Returns the gbm device with which the buffer object was created |
*/ |
GBM_EXPORT struct gbm_device * |
gbm_bo_get_device(struct gbm_bo *bo) |
{ |
return bo->gbm; |
} |
/** Set the user data associated with a buffer object |
* |
* \param bo The buffer object |
* \param data The data to associate to the buffer object |
* \param destroy_user_data A callback (which may be %NULL) that will be |
* called prior to the buffer destruction |
*/ |
GBM_EXPORT void |
gbm_bo_set_user_data(struct gbm_bo *bo, void *data, |
void (*destroy_user_data)(struct gbm_bo *, void *)) |
{ |
bo->user_data = data; |
bo->destroy_user_data = destroy_user_data; |
} |
/** Get the user data associated with a buffer object |
* |
* \param bo The buffer object |
* \return Returns the user data associated with the buffer object or %NULL |
* if no data was associated with it |
* |
* \sa gbm_bo_set_user_data() |
*/ |
GBM_EXPORT void * |
gbm_bo_get_user_data(struct gbm_bo *bo) |
{ |
return bo->user_data; |
} |
/** |
* Destroys the given buffer object and frees all resources associated with |
* it. |
* |
* \param bo The buffer object |
*/ |
GBM_EXPORT void |
gbm_bo_destroy(struct gbm_bo *bo) |
{ |
if (bo->destroy_user_data) |
bo->destroy_user_data(bo, bo->user_data); |
bo->gbm->bo_destroy(bo); |
} |
/** |
* Allocate a buffer object for the given dimensions |
* |
* \param gbm The gbm device returned from gbm_create_device() |
* \param width The width for the buffer |
* \param height The height for the buffer |
* \param format The format to use for the buffer |
* \param usage The union of the usage flags for this buffer |
* |
* \return A newly allocated buffer that should be freed with gbm_bo_destroy() |
* when no longer needed. If an error occurs during allocation %NULL will be |
* returned. |
* |
* \sa enum gbm_bo_format for the list of formats |
* \sa enum gbm_bo_flags for the list of usage flags |
*/ |
GBM_EXPORT struct gbm_bo * |
gbm_bo_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t usage) |
{ |
printf("gbm_bo_create w: %d h: %d format %d usage %x\n", |
width, height, format, usage); |
if (width == 0 || height == 0) |
return NULL; |
if (usage & GBM_BO_USE_CURSOR_64X64 && |
(width != 64 || height != 64)) |
return NULL; |
return gbm->bo_create(gbm, width, height, format, usage); |
} |
/** |
* Create a gbm buffer object from an foreign object |
* |
* This function imports a foreign object and creates a new gbm bo for it. |
* This enabled using the foreign object with a display API such as KMS. |
* Currently two types of foreign objects are supported, indicated by the type |
* argument: |
* |
* GBM_BO_IMPORT_WL_BUFFER |
* GBM_BO_IMPORT_EGL_IMAGE |
* |
* The the gbm bo shares the underlying pixels but its life-time is |
* independent of the foreign object. |
* |
* \param gbm The gbm device returned from gbm_create_device() |
* \param gbm The type of object we're importing |
* \param gbm Pointer to the external object |
* \param usage The union of the usage flags for this buffer |
* |
* \return A newly allocated buffer object that should be freed with |
* gbm_bo_destroy() when no longer needed. |
* |
* \sa enum gbm_bo_flags for the list of usage flags |
*/ |
GBM_EXPORT struct gbm_bo * |
gbm_bo_import(struct gbm_device *gbm, |
uint32_t type, void *buffer, uint32_t usage) |
{ |
return gbm->bo_import(gbm, type, buffer, usage); |
} |
/** |
* Allocate a surface object |
* |
* \param gbm The gbm device returned from gbm_create_device() |
* \param width The width for the surface |
* \param height The height for the surface |
* \param format The format to use for the surface |
* |
* \return A newly allocated surface that should be freed with |
* gbm_surface_destroy() when no longer needed. If an error occurs |
* during allocation %NULL will be returned. |
* |
* \sa enum gbm_bo_format for the list of formats |
*/ |
GBM_EXPORT struct gbm_surface * |
gbm_surface_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t flags) |
{ |
return gbm->surface_create(gbm, width, height, format, flags); |
} |
/** |
* Destroys the given surface and frees all resources associated with |
* it. |
* |
* All buffers locked with gbm_surface_lock_front_buffer() should be |
* released prior to calling this function. |
* |
* \param surf The surface |
*/ |
GBM_EXPORT void |
gbm_surface_destroy(struct gbm_surface *surf) |
{ |
surf->gbm->surface_destroy(surf); |
} |
/** |
* Lock the surface's current front buffer |
* |
* Lock rendering to the surface's current front buffer until it is |
* released with gbm_surface_release_buffer(). |
* |
* This function must be called exactly once after calling |
* eglSwapBuffers. Calling it before any eglSwapBuffer has happened |
* on the surface or two or more times after eglSwapBuffers is an |
* error. A new bo representing the new front buffer is returned. On |
* multiple invocations, all the returned bos must be released in |
* order to release the actual surface buffer. |
* |
* \param surf The surface |
* |
* \return A buffer object that should be released with |
* gbm_surface_release_buffer() when no longer needed. The implementation |
* is free to reuse buffers released with gbm_surface_release_buffer() so |
* this bo should not be destroyed using gbm_bo_destroy(). If an error |
* occurs this function returns %NULL. |
*/ |
GBM_EXPORT struct gbm_bo * |
gbm_surface_lock_front_buffer(struct gbm_surface *surf) |
{ |
return surf->gbm->surface_lock_front_buffer(surf); |
} |
/** |
* Release a locked buffer obtained with gbm_surface_lock_front_buffer() |
* |
* Returns the underlying buffer to the gbm surface. Releasing a bo |
* will typically make gbm_surface_has_free_buffer() return 1 and thus |
* allow rendering the next frame, but not always. The implementation |
* may choose to destroy the bo immediately or reuse it, in which case |
* the user data associated with it is unchanged. |
* |
* \param surf The surface |
* \param bo The buffer object |
*/ |
GBM_EXPORT void |
gbm_surface_release_buffer(struct gbm_surface *surf, struct gbm_bo *bo) |
{ |
surf->gbm->surface_release_buffer(surf, bo); |
} |
/** |
* Return whether or not a surface has free (non-locked) buffers |
* |
* Before starting a new frame, the surface must have a buffer |
* available for rendering. Initially, a gbm surface will have a free |
* buffer, but after one of more buffers have been locked (\sa |
* gbm_surface_lock_front_buffer()), the application must check for a |
* free buffer before rendering. |
* |
* If a surface doesn't have a free buffer, the application must |
* return a buffer to the surface using gbm_surface_release_buffer() |
* and after that, the application can query for free buffers again. |
* |
* \param surf The surface |
* \return 1 if the surface has free buffers, 0 otherwise |
*/ |
GBM_EXPORT int |
gbm_surface_has_free_buffers(struct gbm_surface *surf) |
{ |
return surf->gbm->surface_has_free_buffers(surf); |
} |
/contrib/sdk/sources/Mesa/src/gbm/main/gbm.h |
---|
0,0 → 1,292 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#ifndef _GBM_H_ |
#define _GBM_H_ |
#ifdef __cplusplus |
extern "C" { |
#endif |
#define __GBM__ 1 |
#include <stdint.h> |
/** |
* \file gbm.h |
* \brief Generic Buffer Manager |
*/ |
struct gbm_device; |
struct gbm_bo; |
struct gbm_surface; |
/** |
* \mainpage The Generic Buffer Manager |
* |
* This module provides an abstraction that the caller can use to request a |
* buffer from the underlying memory management system for the platform. |
* |
* This allows the creation of portable code whilst still allowing access to |
* the underlying memory manager. |
*/ |
/** |
* Abstraction representing the handle to a buffer allocated by the |
* manager |
*/ |
union gbm_bo_handle { |
void *ptr; |
int32_t s32; |
uint32_t u32; |
int64_t s64; |
uint64_t u64; |
}; |
/** Format of the allocated buffer */ |
enum gbm_bo_format { |
/** RGB with 8 bits per channel in a 32 bit value */ |
GBM_BO_FORMAT_XRGB8888, |
/** ARGB with 8 bits per channel in a 32 bit value */ |
GBM_BO_FORMAT_ARGB8888 |
}; |
#define __gbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ |
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) |
#define GBM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */ |
/* color index */ |
#define GBM_FORMAT_C8 __gbm_fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ |
/* 8 bpp RGB */ |
#define GBM_FORMAT_RGB332 __gbm_fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */ |
#define GBM_FORMAT_BGR233 __gbm_fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */ |
/* 16 bpp RGB */ |
#define GBM_FORMAT_XRGB4444 __gbm_fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */ |
#define GBM_FORMAT_XBGR4444 __gbm_fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */ |
#define GBM_FORMAT_RGBX4444 __gbm_fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */ |
#define GBM_FORMAT_BGRX4444 __gbm_fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */ |
#define GBM_FORMAT_ARGB4444 __gbm_fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */ |
#define GBM_FORMAT_ABGR4444 __gbm_fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */ |
#define GBM_FORMAT_RGBA4444 __gbm_fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */ |
#define GBM_FORMAT_BGRA4444 __gbm_fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */ |
#define GBM_FORMAT_XRGB1555 __gbm_fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */ |
#define GBM_FORMAT_XBGR1555 __gbm_fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */ |
#define GBM_FORMAT_RGBX5551 __gbm_fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */ |
#define GBM_FORMAT_BGRX5551 __gbm_fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */ |
#define GBM_FORMAT_ARGB1555 __gbm_fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */ |
#define GBM_FORMAT_ABGR1555 __gbm_fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */ |
#define GBM_FORMAT_RGBA5551 __gbm_fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */ |
#define GBM_FORMAT_BGRA5551 __gbm_fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */ |
#define GBM_FORMAT_RGB565 __gbm_fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */ |
#define GBM_FORMAT_BGR565 __gbm_fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */ |
/* 24 bpp RGB */ |
#define GBM_FORMAT_RGB888 __gbm_fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */ |
#define GBM_FORMAT_BGR888 __gbm_fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */ |
/* 32 bpp RGB */ |
#define GBM_FORMAT_XRGB8888 __gbm_fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */ |
#define GBM_FORMAT_XBGR8888 __gbm_fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */ |
#define GBM_FORMAT_RGBX8888 __gbm_fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ |
#define GBM_FORMAT_BGRX8888 __gbm_fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */ |
#define GBM_FORMAT_ARGB8888 __gbm_fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */ |
#define GBM_FORMAT_ABGR8888 __gbm_fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */ |
#define GBM_FORMAT_RGBA8888 __gbm_fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ |
#define GBM_FORMAT_BGRA8888 __gbm_fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ |
#define GBM_FORMAT_XRGB2101010 __gbm_fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */ |
#define GBM_FORMAT_XBGR2101010 __gbm_fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */ |
#define GBM_FORMAT_RGBX1010102 __gbm_fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */ |
#define GBM_FORMAT_BGRX1010102 __gbm_fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */ |
#define GBM_FORMAT_ARGB2101010 __gbm_fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */ |
#define GBM_FORMAT_ABGR2101010 __gbm_fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */ |
#define GBM_FORMAT_RGBA1010102 __gbm_fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */ |
#define GBM_FORMAT_BGRA1010102 __gbm_fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */ |
/* packed YCbCr */ |
#define GBM_FORMAT_YUYV __gbm_fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */ |
#define GBM_FORMAT_YVYU __gbm_fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */ |
#define GBM_FORMAT_UYVY __gbm_fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */ |
#define GBM_FORMAT_VYUY __gbm_fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */ |
#define GBM_FORMAT_AYUV __gbm_fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */ |
/* |
* 2 plane YCbCr |
* index 0 = Y plane, [7:0] Y |
* index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian |
* or |
* index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian |
*/ |
#define GBM_FORMAT_NV12 __gbm_fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */ |
#define GBM_FORMAT_NV21 __gbm_fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ |
#define GBM_FORMAT_NV16 __gbm_fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ |
#define GBM_FORMAT_NV61 __gbm_fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ |
/* |
* 3 plane YCbCr |
* index 0: Y plane, [7:0] Y |
* index 1: Cb plane, [7:0] Cb |
* index 2: Cr plane, [7:0] Cr |
* or |
* index 1: Cr plane, [7:0] Cr |
* index 2: Cb plane, [7:0] Cb |
*/ |
#define GBM_FORMAT_YUV410 __gbm_fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */ |
#define GBM_FORMAT_YVU410 __gbm_fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */ |
#define GBM_FORMAT_YUV411 __gbm_fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */ |
#define GBM_FORMAT_YVU411 __gbm_fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */ |
#define GBM_FORMAT_YUV420 __gbm_fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */ |
#define GBM_FORMAT_YVU420 __gbm_fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */ |
#define GBM_FORMAT_YUV422 __gbm_fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */ |
#define GBM_FORMAT_YVU422 __gbm_fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */ |
#define GBM_FORMAT_YUV444 __gbm_fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ |
#define GBM_FORMAT_YVU444 __gbm_fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ |
/** |
* Flags to indicate the intended use for the buffer - these are passed into |
* gbm_bo_create(). The caller must set the union of all the flags that are |
* appropriate |
* |
* \sa Use gbm_device_is_format_supported() to check if the combination of format |
* and use flags are supported |
*/ |
enum gbm_bo_flags { |
/** |
* Buffer is going to be presented to the screen using an API such as KMS |
*/ |
GBM_BO_USE_SCANOUT = (1 << 0), |
/** |
* Buffer is going to be used as cursor - the dimensions for the buffer |
* must be 64x64 if this flag is passed. |
*/ |
GBM_BO_USE_CURSOR_64X64 = (1 << 1), |
/** |
* Buffer is to be used for rendering - for example it is going to be used |
* as the storage for a color buffer |
*/ |
GBM_BO_USE_RENDERING = (1 << 2), |
/** |
* Buffer can be used for gbm_bo_write. This is guaranteed to work |
* with GBM_BO_USE_CURSOR_64X64. but may not work for other |
* combinations. |
*/ |
GBM_BO_USE_WRITE = (1 << 3), |
}; |
int |
gbm_device_get_fd(struct gbm_device *gbm); |
const char * |
gbm_device_get_backend_name(struct gbm_device *gbm); |
int |
gbm_device_is_format_supported(struct gbm_device *gbm, |
uint32_t format, uint32_t usage); |
void |
gbm_device_destroy(struct gbm_device *gbm); |
struct gbm_device * |
gbm_create_device(int fd); |
struct gbm_bo * |
gbm_bo_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t flags); |
#define GBM_BO_IMPORT_WL_BUFFER 0x5501 |
#define GBM_BO_IMPORT_EGL_IMAGE 0x5502 |
struct gbm_bo * |
gbm_bo_import(struct gbm_device *gbm, uint32_t type, |
void *buffer, uint32_t usage); |
uint32_t |
gbm_bo_get_width(struct gbm_bo *bo); |
uint32_t |
gbm_bo_get_height(struct gbm_bo *bo); |
uint32_t |
gbm_bo_get_stride(struct gbm_bo *bo); |
uint32_t |
gbm_bo_get_format(struct gbm_bo *bo); |
struct gbm_device * |
gbm_bo_get_device(struct gbm_bo *bo); |
union gbm_bo_handle |
gbm_bo_get_handle(struct gbm_bo *bo); |
int |
gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count); |
void |
gbm_bo_set_user_data(struct gbm_bo *bo, void *data, |
void (*destroy_user_data)(struct gbm_bo *, void *)); |
void * |
gbm_bo_get_user_data(struct gbm_bo *bo); |
void |
gbm_bo_destroy(struct gbm_bo *bo); |
struct gbm_surface * |
gbm_surface_create(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t flags); |
struct gbm_bo * |
gbm_surface_lock_front_buffer(struct gbm_surface *surface); |
void |
gbm_surface_release_buffer(struct gbm_surface *surface, struct gbm_bo *bo); |
int |
gbm_surface_has_free_buffers(struct gbm_surface *surface); |
void |
gbm_surface_destroy(struct gbm_surface *surface); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/sdk/sources/Mesa/src/gbm/main/gbm.pc.in |
---|
0,0 → 1,12 |
prefix=@prefix@ |
exec_prefix=@exec_prefix@ |
libdir=@libdir@ |
includedir=@includedir@ |
Name: gbm |
Description: Mesa gbm library |
Requires.private: @GBM_PC_REQ_PRIV@ |
Version: @VERSION@ |
Libs: -L${libdir} -lgbm |
Libs.private: @GBM_PC_LIB_PRIV@ |
Cflags: -I${includedir} |
/contrib/sdk/sources/Mesa/src/gbm/main/gbmint.h |
---|
0,0 → 1,116 |
/* |
* 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: |
* Benjamin Franzke <benjaminfranzke@googlemail.com> |
*/ |
#ifndef INTERNAL_H_ |
#define INTERNAL_H_ |
#include "gbm.h" |
#include <sys/stat.h> |
/* GCC visibility */ |
#if defined(__GNUC__) && __GNUC__ >= 4 |
#define GBM_EXPORT __attribute__ ((visibility("default"))) |
#else |
#define GBM_EXPORT |
#endif |
/** |
* \file gbmint.h |
* \brief Internal implementation details of gbm |
*/ |
/** |
* The device used for the memory allocation. |
* |
* The members of this structure should be not accessed directly |
*/ |
struct gbm_device { |
/* Hack to make a gbm_device detectable by its first element. */ |
struct gbm_device *(*dummy)(int); |
int fd; |
const char *name; |
unsigned int refcount; |
struct stat stat; |
void (*destroy)(struct gbm_device *gbm); |
int (*is_format_supported)(struct gbm_device *gbm, |
uint32_t format, |
uint32_t usage); |
struct gbm_bo *(*bo_create)(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, |
uint32_t usage); |
struct gbm_bo *(*bo_import)(struct gbm_device *gbm, uint32_t type, |
void *buffer, uint32_t usage); |
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data); |
void (*bo_destroy)(struct gbm_bo *bo); |
struct gbm_surface *(*surface_create)(struct gbm_device *gbm, |
uint32_t width, uint32_t height, |
uint32_t format, uint32_t flags); |
struct gbm_bo *(*surface_lock_front_buffer)(struct gbm_surface *surface); |
void (*surface_release_buffer)(struct gbm_surface *surface, |
struct gbm_bo *bo); |
int (*surface_has_free_buffers)(struct gbm_surface *surface); |
void (*surface_destroy)(struct gbm_surface *surface); |
}; |
/** |
* The allocated buffer object. |
* |
* The members in this structure should not be accessed directly. |
*/ |
struct gbm_bo { |
struct gbm_device *gbm; |
uint32_t width; |
uint32_t height; |
uint32_t stride; |
uint32_t format; |
union gbm_bo_handle handle; |
void *user_data; |
void (*destroy_user_data)(struct gbm_bo *, void *); |
}; |
struct gbm_surface { |
struct gbm_device *gbm; |
uint32_t width; |
uint32_t height; |
uint32_t format; |
uint32_t flags; |
}; |
struct gbm_backend { |
const char *backend_name; |
struct gbm_device *(*create_device)(int fd); |
}; |
GBM_EXPORT struct gbm_device * |
_gbm_mesa_get_device(int fd); |
#endif |