mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[common] added new sysinfo unit and multisample query support
Based on @rLink234's work in 4ac781b4516678b6c59d9ecf4a61df64a01ec8c1
This commit is contained in:
parent
3585e02993
commit
78a6af8dae
@ -5,16 +5,28 @@ include_directories(
|
|||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES
|
set(COMMON_SOURCES
|
||||||
src/stringutils.c
|
src/stringutils.c
|
||||||
src/stringlist.c
|
src/stringlist.c
|
||||||
src/option.c
|
src/option.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(LINUX_SOURCES
|
||||||
|
src/crash.linux.c
|
||||||
|
src/sysinfo.linux.c
|
||||||
|
)
|
||||||
|
|
||||||
|
set(WINOWS_SOURCES
|
||||||
|
src/crash.windows.c
|
||||||
|
src/sysinfo.windows.c
|
||||||
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_library(lg_common STATIC src/crash.windows.c ${SOURCES})
|
set(SOURCES ${COMMON_SOURCES} ${WINDOWS_SOURCES})
|
||||||
|
add_library(lg_common STATIC ${SOURCES})
|
||||||
else()
|
else()
|
||||||
add_library(lg_common STATIC src/crash.linux.c ${SOURCES})
|
set(SOURCES ${COMMON_SOURCES} ${LINUX_SOURCES})
|
||||||
|
add_library(lg_common STATIC ${SOURCES})
|
||||||
target_link_libraries(lg_common bfd)
|
target_link_libraries(lg_common bfd)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
21
common/include/common/sysinfo.h
Normal file
21
common/include/common/sysinfo.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
KVMGFX Client - A KVM Client for VGA Passthrough
|
||||||
|
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
https://looking-glass.hostfission.com
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
// returns the maximum number of multisamples supported by the system
|
||||||
|
int sysinfo_gfx_max_multisample();
|
64
common/src/sysinfo.linux.c
Normal file
64
common/src/sysinfo.linux.c
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
KVMGFX Client - A KVM Client for VGA Passthrough
|
||||||
|
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
https://looking-glass.hostfission.com
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <GL/glx.h>
|
||||||
|
|
||||||
|
int sysinfo_gfx_max_multisample()
|
||||||
|
{
|
||||||
|
Display * dpy = XOpenDisplay(NULL);
|
||||||
|
if (!dpy)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
XVisualInfo queryTemplate;
|
||||||
|
queryTemplate.screen = 0;
|
||||||
|
|
||||||
|
int visualCount;
|
||||||
|
int maxSamples = -1;
|
||||||
|
XVisualInfo * visuals = XGetVisualInfo(dpy, VisualScreenMask, &queryTemplate, &visualCount);
|
||||||
|
|
||||||
|
for (int i = 0; i < visualCount; i++)
|
||||||
|
{
|
||||||
|
XVisualInfo * visual = &visuals[i];
|
||||||
|
|
||||||
|
int res, supportsGL;
|
||||||
|
// Some GLX visuals do not use GL, and these must be ignored in our search.
|
||||||
|
if ((res = glXGetConfig(dpy, visual, GLX_USE_GL, &supportsGL)) != 0 || !supportsGL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int sampleBuffers, samples;
|
||||||
|
if ((res = glXGetConfig(dpy, visual, GLX_SAMPLE_BUFFERS, &sampleBuffers)) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Will be 1 if this visual supports multisampling
|
||||||
|
if (sampleBuffers != 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((res = glXGetConfig(dpy, visual, GLX_SAMPLES, &samples)) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Track the largest number of samples supported
|
||||||
|
if (samples > maxSamples)
|
||||||
|
maxSamples = samples;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
|
||||||
|
return maxSamples;
|
||||||
|
}
|
24
common/src/sysinfo.windows.c
Normal file
24
common/src/sysinfo.windows.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
KVMGFX Client - A KVM Client for VGA Passthrough
|
||||||
|
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
https://looking-glass.hostfission.com
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
int sysinfo_gfx_max_multisample()
|
||||||
|
{
|
||||||
|
//FIXME: Implement this
|
||||||
|
return 4;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user