Skip to content

Commit

Permalink
Build: Always require EGL
Browse files Browse the repository at this point in the history
All supported platforms now include sufficiently new EGL libraries to
build both the EGL back end and the EGL/X11 front end, and the ability
to build VirtualGL without those features is not well-tested and is
tricky to maintain.  The ability to build VirtualGL without EGL will
continue to be maintained in the 3.0.x branch on a break/fix basis.

Note that this eliminates the ability to build VirtualGL on Solaris.
However, we have not officially supported Solaris for quite some time
(https://virtualgl.org/Documentation/OSSupport), and the only reason why
I have even bothered to test VirtualGL on Solaris is because nVidia
continues to release drivers for it.  Since the VirtualGL 3.0.x branch
is still in the Maintenance support category, all non-disruptive fixes
have been back-ported to it from the main (3.1.x) branch (and will
continue to be back-ported until VirtualGL 3.2 is released), so the only
functional differences between the tip of 3.0.x and the tip of main
relate to EGL features that aren't relevant for Solaris.
  • Loading branch information
dcommander committed Feb 18, 2024
1 parent a7d6371 commit 817d8c6
Show file tree
Hide file tree
Showing 32 changed files with 55 additions and 383 deletions.
2 changes: 1 addition & 1 deletion BUILDING-win.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ called "VirtualGL-Utils".
Build Requirements
------------------

- [CMake](http://www.cmake.org) v2.8.12 or later
- [CMake](http://www.cmake.org) v3.10 or later

- Microsoft Visual C++ 2005 or later

Expand Down
5 changes: 1 addition & 4 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ Building VirtualGL
Build Requirements
------------------

- [CMake](http://www.cmake.org) v2.8.12 or later
* CMake v3.1 or later is required if building the VirtualGL Faker with the
OpenCL interposer enabled (this is the default on Linux and FreeBSD but can
be changed using the `VGL_FAKEOPENCL` CMake variable.)
- [CMake](http://www.cmake.org) v3.10 or later

- libjpeg-turbo SDK v1.2 or later
* The libjpeg-turbo SDK binary packages can be downloaded from
Expand Down
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
# SETUP
###############################################################################

cmake_minimum_required(VERSION 2.8.12)
# Shut up CMake 3.1 and later
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif()
cmake_minimum_required(VERSION 3.10)

if(WIN32)
project(VirtualGL-Utils)
Expand Down
4 changes: 0 additions & 4 deletions cmakescripts/BuildPackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ add_custom_target(srpm pkgscripts/makesrpm
SOURCES pkgscripts/makesrpm
DEPENDS dist)

set(EGLDEPENDS "")
if(VGL_EGLBACKEND)
set(EGLDEPENDS ", libegl1:${DEBARCH}")
endif()
configure_file(release/makedpkg.in pkgscripts/makedpkg)
configure_file(release/deb-control.in pkgscripts/deb-control)

Expand Down
2 changes: 0 additions & 2 deletions common/rr.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,8 @@ typedef struct _FakerConfig
char defaultfbconfig[MAXSTR];
char dlsymloader;
char egl;
#ifdef EGLBACKEND
char egllib[MAXSTR];
char eglxIgnorePixmapBit;
#endif
double flushdelay;
int forcealpha;
double fps;
Expand Down
34 changes: 15 additions & 19 deletions demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
endif()
install(TARGETS glxinfo DESTINATION ${CMAKE_INSTALL_BINDIR})

if(VGL_EGLBACKEND)
add_executable(eglinfo eglinfo.c glinfo_common.c)
target_link_libraries(eglinfo ${OPENGL_gl_LIBRARY} ${OPENGL_egl_LIBRARY})
install(TARGETS eglinfo DESTINATION ${CMAKE_INSTALL_BINDIR})
add_executable(eglinfo eglinfo.c glinfo_common.c)
target_link_libraries(eglinfo ${OPENGL_gl_LIBRARY} ${OPENGL_egl_LIBRARY})
install(TARGETS eglinfo DESTINATION ${CMAKE_INSTALL_BINDIR})

add_executable(eglxinfo eglinfo.c glinfo_common.c)
target_compile_definitions(eglxinfo PUBLIC -DEGLX)
target_link_libraries(eglxinfo ${OPENGL_gl_LIBRARY} ${OPENGL_egl_LIBRARY}
${X11_X11_LIB})
install(TARGETS eglxinfo DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
add_executable(eglxinfo eglinfo.c glinfo_common.c)
target_compile_definitions(eglxinfo PUBLIC -DEGLX)
target_link_libraries(eglxinfo ${OPENGL_gl_LIBRARY} ${OPENGL_egl_LIBRARY}
${X11_X11_LIB})
install(TARGETS eglxinfo DESTINATION ${CMAKE_INSTALL_BINDIR})

set(GLXSPHERES glxspheres)
if(BITS EQUAL 64)
Expand All @@ -40,16 +38,14 @@ target_link_libraries(${GLXSPHERES} ${OPENGL_gl_LIBRARY} ${X11_X11_LIB}
${OPENGL_glu_LIBRARY} m)
install(TARGETS ${GLXSPHERES} DESTINATION ${CMAKE_INSTALL_BINDIR})

if(VGL_EGLBACKEND)
set(EGLXSPHERES eglxspheres)
if(BITS EQUAL 64)
set(EGLXSPHERES eglxspheres64)
endif()
add_executable(${EGLXSPHERES} eglxspheres.c xfonts.c)
target_link_libraries(${EGLXSPHERES} ${OPENGL_gl_LIBRARY} ${OPENGL_egl_LIBRARY}
${X11_X11_LIB} ${OPENGL_glu_LIBRARY} m)
install(TARGETS ${EGLXSPHERES} DESTINATION ${CMAKE_INSTALL_BINDIR})
set(EGLXSPHERES eglxspheres)
if(BITS EQUAL 64)
set(EGLXSPHERES eglxspheres64)
endif()
add_executable(${EGLXSPHERES} eglxspheres.c xfonts.c)
target_link_libraries(${EGLXSPHERES} ${OPENGL_gl_LIBRARY} ${OPENGL_egl_LIBRARY}
${X11_X11_LIB} ${OPENGL_glu_LIBRARY} m)
install(TARGETS ${EGLXSPHERES} DESTINATION ${CMAKE_INSTALL_BINDIR})

foreach(program pbdemo)
add_executable(${program} ${program}.c pbutil.c)
Expand Down
2 changes: 1 addition & 1 deletion release/deb-control.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Essential: no
Maintainer: @PKGVENDOR@ <@PKGEMAIL@>
Homepage: @PKGURL@
Installed-Size: {__SIZE}
Depends: libxtst6:@DEBARCH@, libxv1:@DEBARCH@, libglu1-mesa:@DEBARCH@@EGLDEPENDS@
Depends: libxtst6:@DEBARCH@, libxv1:@DEBARCH@, libglu1-mesa:@DEBARCH@, libegl1:@DEBARCH@
Description: A toolkit for displaying OpenGL applications to thin clients
VirtualGL is a toolkit that allows most Linux/Unix OpenGL applications to be
remotely displayed with 3D hardware acceleration to thin clients, regardless
Expand Down
16 changes: 4 additions & 12 deletions release/rpm.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
# Path under which docs should be installed
%define docdir %{_defaultdocdir}/%{name}-%{version}

%define eglbackend @VGL_EGLBACKEND@
%define fakeopencl @VGL_FAKEOPENCL@

Summary: A toolkit for displaying OpenGL applications to thin clients
Expand Down Expand Up @@ -206,10 +205,8 @@ rm %{_tmppath}/%{name}-%{version}-%{release}-find-requires
%{bindir}/tcbench
%{bindir}/nettest
%{bindir}/cpustat
%if %{eglbackend}
%{bindir}/eglinfo
%{bindir}/eglxinfo
%endif
%{bindir}/eglinfo
%{bindir}/eglxinfo
%{bindir}/glxinfo
%{bindir}/vglclient
%{bindir}/vglconfig
Expand All @@ -220,15 +217,10 @@ rm %{_tmppath}/%{name}-%{version}-%{release}-find-requires
%{bindir}/vglrun
%if "%{_bits}" == "64"
%{bindir}/glxspheres64
%{bindir}/eglxspheres64
%else
%{bindir}/glxspheres
%endif
%if %{eglbackend}
%if "%{_bits}" == "64"
%{bindir}/eglxspheres64
%else
%{bindir}/eglxspheres
%endif
%{bindir}/eglxspheres
%endif
%if "%{bindir}" != "%{_bindir}" && %{binsymlinks}
%{_bindir}/vglclient
Expand Down
54 changes: 18 additions & 36 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,7 @@ boolean_number(VGL_FAKEOPENCL)
boolean_number(VGL_FAKEOPENCL PARENT_SCOPE)
report_option(VGL_FAKEOPENCL "OpenCL interposer")
if(VGL_FAKEOPENCL)
cmake_minimum_required(VERSION 3.1)
include(FindOpenCL)
include_directories(${OpenCL_INCLUDE_DIRS})
endif()

set(DEFAULT_VGL_EGLBACKEND 0)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(DEFAULT_VGL_EGLBACKEND 1)
endif()
option(VGL_EGLBACKEND "Include the EGL back end, which allows the VirtualGL Faker to be used without a 3D X server"
${DEFAULT_VGL_EGLBACKEND})
boolean_number(VGL_EGLBACKEND)
boolean_number(VGL_EGLBACKEND PARENT_SCOPE)
report_option(VGL_EGLBACKEND "EGL back end")
if(VGL_EGLBACKEND)
cmake_minimum_required(VERSION 3.10)
set(EGL_LIBRARY ${OPENGL_egl_LIBRARY})
add_definitions(-DEGLBACKEND)
endif()

get_directory_property(DEFS_PROP COMPILE_DEFINITIONS)
Expand Down Expand Up @@ -104,7 +87,13 @@ endif()
set(FAKER_SOURCES
backend.cpp
ContextHash.cpp
ContextHashEGL.cpp
EGLXDisplayHash.cpp
EGLXVirtualWin.cpp
EGLXWindowHash.cpp
FakePbuffer.cpp
faker.cpp
faker-egl.cpp
faker-gl.cpp
faker-glx.cpp
faker-sym.cpp
Expand All @@ -114,7 +103,9 @@ set(FAKER_SOURCES
GlobalCriticalSection.cpp
GLXDrawableHash.cpp
glxvisual.cpp
PbufferHashEGL.cpp
PixmapHash.cpp
RBOContext.cpp
TransPlugin.cpp
VirtualDrawable.cpp
VirtualPixmap.cpp
Expand All @@ -127,15 +118,6 @@ set(FAKER_SOURCES
if(VGL_USEXV)
set(FAKER_SOURCES ${FAKER_SOURCES};XVTrans.cpp)
endif()
if(VGL_EGLBACKEND)
# EGL back end
set(FAKER_SOURCES
${FAKER_SOURCES};ContextHashEGL.cpp;FakePbuffer.cpp;PbufferHashEGL.cpp;RBOContext.cpp)
# EGL front end
set(FAKER_SOURCES
${FAKER_SOURCES};faker-egl.cpp;EGLXDisplayHash.cpp;EGLXVirtualWin.cpp;
EGLXWindowHash.cpp)
endif()

set(FAKERLIBS ${VGL_FAKER_NAME};${VGL_FAKER_NAME}-nodl)
if(VGL_FAKEOPENCL)
Expand Down Expand Up @@ -170,10 +152,12 @@ foreach(fakerlib ${FAKERLIBS})
target_link_libraries(${fakerlib} vglcommon ${FBXFAKERLIB} vglsocket m
${LIBDL})
if(${fakerlib} STREQUAL ${VGL_FAKER_NAME})
target_link_libraries(${fakerlib} ${OPENGL_gl_LIBRARY} ${EGL_LIBRARY})
target_link_libraries(${fakerlib} ${OPENGL_gl_LIBRARY}
${OPENGL_egl_LIBRARY})
endif()
if(${fakerlib} STREQUAL ${VGL_FAKER_NAME}-opencl)
target_link_libraries(${fakerlib} ${OPENGL_gl_LIBRARY} ${EGL_LIBRARY} ${OpenCL_LIBRARIES})
target_link_libraries(${fakerlib} ${OPENGL_gl_LIBRARY}
${OPENGL_egl_LIBRARY} OpenCL::OpenCL)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND GNUCXX)
# For some reason, on SunOS/GCC CMake tries to use the C compiler to link
Expand Down Expand Up @@ -249,10 +233,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_library(deepbindtest SHARED libdeepbindtest.c)
if(VGL_FAKEOPENCL)
target_compile_definitions(deepbindtest PUBLIC -DFAKEOPENCL)
target_link_libraries(deepbindtest ${OpenCL_LIBRARIES})
target_link_libraries(deepbindtest OpenCL::OpenCL)
endif()
target_link_libraries(deepbindtest ${X11_X11_LIB} ${OPENGL_gl_LIBRARY}
${EGL_LIBRARY} ${LIBDL})
${OPENGL_egl_LIBRARY} ${LIBDL})
set_target_properties(deepbindtest PROPERTIES LINK_FLAGS "${MINUSZ}defs")
endif()

Expand All @@ -266,12 +250,10 @@ target_link_libraries(fakerut "${MINUSZ}now ${OPENGL_gl_LIBRARY}"
${OPENGL_glu_LIBRARY} "${MINUSZ}now ${X11_X11_LIB}" ${LIBDL} vglutil
${XCB_XCB_LIB} ${XCB_GLX_LIB} ${X11_XCB_LIB})

if(VGL_EGLBACKEND)
add_executable(eglxfakerut eglxfakerut.cpp)
target_link_libraries(eglxfakerut "${MINUSZ}now ${OPENGL_gl_LIBRARY}"
"${MINUSZ}now ${X11_X11_LIB}" "${MINUSZ}now ${EGL_LIBRARY}" ${LIBDL}
vglutil)
endif()
add_executable(eglxfakerut eglxfakerut.cpp)
target_link_libraries(eglxfakerut "${MINUSZ}now ${OPENGL_gl_LIBRARY}"
"${MINUSZ}now ${X11_X11_LIB}" "${MINUSZ}now ${OPENGL_egl_LIBRARY}" ${LIBDL}
vglutil)

add_library(vgltrans_test SHARED testplugin.cpp VGLTrans.cpp)
unset(VGLTRANS_TEST_LINK_FLAGS)
Expand Down
8 changes: 0 additions & 8 deletions server/TempContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ namespace faker
GLXContext ctx, bool eglx_ = false) : dpy(dpy_), ctxChanged(false),
eglx(eglx_)
{
#ifdef EGLBACKEND
if(eglx)
{
oldctx = (GLXContext)_eglGetCurrentContext();
Expand All @@ -42,7 +41,6 @@ namespace faker
oldapi = _eglQueryAPI();
}
else
#endif
{
oldctx = backend::getCurrentContext();
oldread = backend::getCurrentReadDrawable();
Expand All @@ -53,7 +51,6 @@ namespace faker
if((read || draw)
&& (oldread != read || olddraw != draw || oldctx != ctx))
{
#ifdef EGLBACKEND
if(eglx)
{
_eglBindAPI(EGL_OPENGL_API);
Expand All @@ -62,7 +59,6 @@ namespace faker
THROW("Could not bind OpenGL context to window (window may have disappeared)");
}
else
#endif
{
if(!backend::makeCurrent(dpy, draw, read, ctx))
THROW("Could not bind OpenGL context to window (window may have disappeared)");
Expand All @@ -81,15 +77,13 @@ namespace faker
{
if(ctxChanged)
{
#ifdef EGLBACKEND
if(eglx)
{
_eglMakeCurrent((EGLDisplay)dpy, (EGLSurface)olddraw,
(EGLSurface)oldread, (EGLContext)oldctx);
if(oldapi != EGL_NONE) _eglBindAPI(oldapi);
}
else
#endif
backend::makeCurrent(dpy, olddraw, oldread, oldctx);
ctxChanged = false;
}
Expand All @@ -100,9 +94,7 @@ namespace faker
Display *dpy;
GLXContext oldctx;
GLXDrawable oldread, olddraw;
#ifdef EGLBACKEND
EGLenum oldapi;
#endif
bool ctxChanged;
bool eglx;
};
Expand Down
Loading

0 comments on commit 817d8c6

Please sign in to comment.