forked from mia/Aegisub
Split up video into vendor/renderer/version and acquire video
adapter info via OpenGL/GLX on Unix. Originally committed to SVN as r3589.
This commit is contained in:
parent
eaf3353982
commit
d64f10faa9
9 changed files with 101 additions and 13 deletions
|
@ -179,9 +179,24 @@ public:
|
||||||
virtual wxString Memory()=0;
|
virtual wxString Memory()=0;
|
||||||
|
|
||||||
/// Video card
|
/// Video card
|
||||||
/// @return Video card
|
/// @return Video card description
|
||||||
/// @retval Any
|
/// @retval Any
|
||||||
virtual wxString Video()=0;
|
virtual wxString Video()=0;
|
||||||
|
|
||||||
|
/// Video card
|
||||||
|
/// @return Video card vendor
|
||||||
|
/// @retval Any
|
||||||
|
virtual wxString VideoVendor()=0;
|
||||||
|
|
||||||
|
/// Video card renderer
|
||||||
|
/// @return Video card renderer name
|
||||||
|
/// @retval Any
|
||||||
|
virtual wxString VideoRenderer()=0;
|
||||||
|
|
||||||
|
/// Video card version
|
||||||
|
/// @return Video card renderer version
|
||||||
|
/// @retval Any
|
||||||
|
virtual wxString VideoVersion()=0;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// @name Windows
|
/// @name Windows
|
||||||
|
|
|
@ -80,6 +80,9 @@ const Report::nameMap Report::HumanNames() {
|
||||||
nMap.insert(nPair("thesauruslang", _TT("Thesaurus Language")));
|
nMap.insert(nPair("thesauruslang", _TT("Thesaurus Language")));
|
||||||
nMap.insert(nPair("unix", _TT("Unix")));
|
nMap.insert(nPair("unix", _TT("Unix")));
|
||||||
nMap.insert(nPair("video", _TT("Video")));
|
nMap.insert(nPair("video", _TT("Video")));
|
||||||
|
nMap.insert(nPair("videovendor", _TT("Video Vendor")));
|
||||||
|
nMap.insert(nPair("videorenderer", _TT("Video Renderer")));
|
||||||
|
nMap.insert(nPair("videoversion", _TT("Video Version")));
|
||||||
nMap.insert(nPair("videoprovider", _TT("Video Provider")));
|
nMap.insert(nPair("videoprovider", _TT("Video Provider")));
|
||||||
nMap.insert(nPair("windows", _TT("Windows")));
|
nMap.insert(nPair("windows", _TT("Windows")));
|
||||||
nMap.insert(nPair("wxversion", _TT("wx Version")));
|
nMap.insert(nPair("wxversion", _TT("wx Version")));
|
||||||
|
|
|
@ -29,6 +29,62 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
#include "GL/glx.h"
|
||||||
|
#include "GL/gl.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
PlatformUnix::PlatformUnix() {
|
||||||
|
GetVideoInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gather video adapter information via OpenGL/GLX.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void PlatformUnix::GetVideoInfo() {
|
||||||
|
Display *dpy;
|
||||||
|
XVisualInfo *vi;
|
||||||
|
GLXContext cx;
|
||||||
|
Window root, win;
|
||||||
|
XSetWindowAttributes attr;
|
||||||
|
unsigned long mask;
|
||||||
|
int attList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
|
||||||
|
|
||||||
|
vendor = wxString();
|
||||||
|
renderer = wxString();
|
||||||
|
version = wxString();
|
||||||
|
|
||||||
|
// Like in glxinfo.c, but somewhat simpler and shorter.
|
||||||
|
dpy = XOpenDisplay(0);
|
||||||
|
if (!dpy) return;
|
||||||
|
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attList);
|
||||||
|
if (!vi) return;
|
||||||
|
cx = glXCreateContext(dpy, vi, 0, GL_TRUE);
|
||||||
|
if (!cx) return;
|
||||||
|
|
||||||
|
root = RootWindow(dpy, DefaultScreen(dpy));
|
||||||
|
attr.background_pixel = 0;
|
||||||
|
attr.border_pixel = 0;
|
||||||
|
attr.colormap = XCreateColormap(dpy, root, vi->visual, AllocNone);
|
||||||
|
attr.event_mask = StructureNotifyMask | ExposureMask;
|
||||||
|
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||||
|
win = XCreateWindow(dpy, root, 0, 0, 100, 100, 0, vi->depth,
|
||||||
|
InputOutput, vi->visual, mask, &attr);
|
||||||
|
|
||||||
|
if (!glXMakeCurrent(dpy, win, cx)) {
|
||||||
|
glXDestroyContext(dpy, cx);
|
||||||
|
XDestroyWindow(dpy, win);
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vendor = wxString(glGetString(GL_VENDOR));
|
||||||
|
renderer = wxString(glGetString(GL_RENDERER));
|
||||||
|
version = wxString(glGetString(GL_VERSION));
|
||||||
|
|
||||||
|
glXDestroyContext(dpy, cx);
|
||||||
|
XDestroyWindow(dpy, win);
|
||||||
|
XCloseDisplay(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString PlatformUnix::OSVersion() {
|
wxString PlatformUnix::OSVersion() {
|
||||||
|
@ -72,7 +128,19 @@ wxString PlatformUnix::Memory() {
|
||||||
};
|
};
|
||||||
|
|
||||||
wxString PlatformUnix::Video() {
|
wxString PlatformUnix::Video() {
|
||||||
return "";
|
return wxString::Format("%s %s (%s)", vendor, renderer, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString PlatformUnix::VideoVendor() {
|
||||||
|
return vendor;
|
||||||
|
};
|
||||||
|
|
||||||
|
wxString PlatformUnix::VideoRenderer() {
|
||||||
|
return renderer;
|
||||||
|
};
|
||||||
|
|
||||||
|
wxString PlatformUnix::VideoVersion() {
|
||||||
|
return version;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxString PlatformUnix::UnixLibraries() {
|
wxString PlatformUnix::UnixLibraries() {
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Platform;
|
||||||
/// @brief General Unix functions.
|
/// @brief General Unix functions.
|
||||||
class PlatformUnix : public Platform {
|
class PlatformUnix : public Platform {
|
||||||
public:
|
public:
|
||||||
PlatformUnix() {};
|
PlatformUnix();
|
||||||
virtual ~PlatformUnix() {};
|
virtual ~PlatformUnix() {};
|
||||||
wxString OSVersion();
|
wxString OSVersion();
|
||||||
wxString DesktopEnvironment();
|
wxString DesktopEnvironment();
|
||||||
|
@ -37,7 +37,16 @@ public:
|
||||||
virtual wxString CPUFeatures2();
|
virtual wxString CPUFeatures2();
|
||||||
virtual wxString Memory();
|
virtual wxString Memory();
|
||||||
virtual wxString Video();
|
virtual wxString Video();
|
||||||
|
virtual wxString VideoVendor();
|
||||||
|
virtual wxString VideoRenderer();
|
||||||
|
virtual wxString VideoVersion();
|
||||||
|
|
||||||
// Unix Specific
|
// Unix Specific
|
||||||
virtual wxString UnixLibraries();
|
virtual wxString UnixLibraries();
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void GetVideoInfo();
|
||||||
|
wxString vendor;
|
||||||
|
wxString renderer;
|
||||||
|
wxString version;
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,10 +70,6 @@ wxString PlatformUnixBSD::Memory() {
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
wxString PlatformUnixBSD::Video() {
|
|
||||||
return "";
|
|
||||||
};
|
|
||||||
|
|
||||||
wxString PlatformUnixBSD::UnixLibraries() {
|
wxString PlatformUnixBSD::UnixLibraries() {
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,6 @@ public:
|
||||||
virtual wxString CPUFeatures();
|
virtual wxString CPUFeatures();
|
||||||
virtual wxString CPUFeatures2();
|
virtual wxString CPUFeatures2();
|
||||||
virtual wxString Memory();
|
virtual wxString Memory();
|
||||||
virtual wxString Video();
|
|
||||||
|
|
||||||
// Unix Specific
|
// Unix Specific
|
||||||
virtual wxString UnixLibraries();
|
virtual wxString UnixLibraries();
|
||||||
|
|
|
@ -80,10 +80,6 @@ wxString PlatformUnixLinux::Memory() {
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
wxString PlatformUnixLinux::Video() {
|
|
||||||
return "";
|
|
||||||
};
|
|
||||||
|
|
||||||
wxString PlatformUnixLinux::UnixLibraries() {
|
wxString PlatformUnixLinux::UnixLibraries() {
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,6 @@ public:
|
||||||
virtual wxString CPUFeatures();
|
virtual wxString CPUFeatures();
|
||||||
virtual wxString CPUFeatures2();
|
virtual wxString CPUFeatures2();
|
||||||
virtual wxString Memory();
|
virtual wxString Memory();
|
||||||
virtual wxString Video();
|
|
||||||
|
|
||||||
// Unix Specific
|
// Unix Specific
|
||||||
virtual wxString UnixLibraries();
|
virtual wxString UnixLibraries();
|
||||||
|
|
|
@ -97,6 +97,9 @@ Report::XMLReport Report::ReportCreate() {
|
||||||
Add(display, "colour", p->DisplayColour());
|
Add(display, "colour", p->DisplayColour());
|
||||||
Add(display, "size", p->DisplaySize());
|
Add(display, "size", p->DisplaySize());
|
||||||
Add(display, "ppi", p->DisplayPPI());
|
Add(display, "ppi", p->DisplayPPI());
|
||||||
|
Add(doc.hardware, "videovendor", p->VideoVendor());
|
||||||
|
Add(doc.hardware, "videorenderer", p->VideoRenderer());
|
||||||
|
Add(doc.hardware, "videoversion", p->VideoVersion());
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
doc.windows = new wxXmlNode(wxXML_ELEMENT_NODE, "windows");
|
doc.windows = new wxXmlNode(wxXML_ELEMENT_NODE, "windows");
|
||||||
|
|
Loading…
Reference in a new issue