Skip to content

Commit

Permalink
Add: inex-glinfo. Rm dep mesa-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
eloaders committed Jan 27, 2014
1 parent 5a9a37b commit df2131d
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 9 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ make:
$(CC) -o inex-cpuid cpu.c -static $(CC_OPTS_LIBCPUID) $(additional_confflags)
$(CC) -o inex-usage free.c -static $(CC_OPTS_LIBPROCPS) $(additional_confflags)
$(CC) -o inex-cpusage cpusage.c $(additional_confflags)
$(CC) -o inex-glinfo glinfo.c -O2 -lX11 -lGL -lXext
@printf "\033[1;31mCompile src/i-nex stage 1 \033[0m$1\n"
$(GBC) $(GBCOPTS) src/i-nex
@printf "\033[1;31mCompile src/i-nex stage 2 \033[0m$1\n"
Expand Down Expand Up @@ -93,13 +94,15 @@ self:
chmod +x inex-cpuid
chmod +x inex-usage
chmod +x inex-cpusage
chmod +x inex-glinfo
chmod +x debian/check_kernel
chmod +x debian/i-nex-lspci
$(INSTALL) 0755 i-nex inex$(bindir)
$(INSTALL) 0755 inex-edid inex$(bindir)
$(INSTALL) 0755 inex-cpuid inex$(bindir)
$(INSTALL) 0755 inex-usage inex$(bindir)
$(INSTALL) 0755 inex-cpusage inex$(bindir)
$(INSTALL) 0755 inex-glinfo inex$(bindir)
$(INSTALL) 0755 src/i-nex/i-nex.gambas inex$(bindir)
$(INSTALL) 0755 pixmaps/pixmaps/i-nex.xpm inex/usr/share/pixmaps/
$(INSTALL) 0755 debian/i-nex.desktop inex/usr/share/applications/
Expand Down Expand Up @@ -159,6 +162,7 @@ clean:
$(RM_COM) $(RMFILE_OPT) inex-cpuid
$(RM_COM) $(RMFILE_OPT) inex-usage
$(RM_COM) $(RMFILE_OPT) inex-cpusage
$(RM_COM) $(RMFILE_OPT) inex-glinfo
$(RM_COM) $(RMDIR_OPT) `find . -name ".gambas"`
$(RM_COM) $(RMDIR_OPT) `find . -name "*.gambas"`
$(RM_COM) $(RMDIR_OPT) `find . -name ".directory"`
Expand Down Expand Up @@ -192,6 +196,7 @@ install:
chmod +x inex-cpuid
chmod +x inex-usage
chmod +x inex-cpusage
chmod +x inex-glinfo
chmod +x debian/check_kernel
chmod +x debian/i-nex-lspci
$(INSTALL) 0755 i-nex $(DESTDIR)$(bindir)
Expand Down Expand Up @@ -220,6 +225,7 @@ uninstall:
rm $(DESTDIR)$(bindir)/inex-cpuid
rm $(DESTDIR)$(bindir)/inex-usage
rm $(DESTDIR)$(bindir)/inex-cpusage
rm $(DESTDIR)$(bindir)/inex-glinfo
rm $(DESTDIR)$(bindir)/i-nex.gambas
rm $(DESTDIR)/usr/share/pixmaps/i-nex.xpm
rm $(DESTDIR)/usr/share/applications/i-nex.desktop
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Build-Depends: debhelper (>= 7),
debhelper (>= 5.0.0),
libcpuid11,
libprocps0-dev|libprocps3-dev|libproc-dev,
mesa-common-dev,
gambas3-dev (>= 3.0.90),
gambas3-dev (<< 3.99.0),
gambas3-gb-image (>= 3.0.90),
Expand Down Expand Up @@ -60,7 +61,6 @@ Depends: ${shlibs:Depends},
Replaces: i-nex
Recommends:
mount (>= 2.17),
mesa-utils (>= 7.6),
x11-utils (>= 7.5),
pciutils,
lsb-release (>= 4.0),
Expand Down
46 changes: 46 additions & 0 deletions glinfo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// g++ glxtest.cpp -o glxtest -O2 -lX11 -L /usr/lib/nvidia/ -lGL -lXext
// gcc glinfo.c -o glinfo -O2 -lX11 -lGL -lXext

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <GL/gl.h>
#include <GL/glx.h>


int attribs[] = {
GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
GLX_X_RENDERABLE, True,
0
};

int main()
{
/* Open a connection to the X server */
Display *dpy = XOpenDisplay(NULL);
if (!dpy) {
printf("Unable to open a connection to the X server\n");
exit(EXIT_FAILURE);
}
XSynchronize(dpy, True);

GLXFBConfig *fbConfigs;
int numReturned;
fbConfigs = glXChooseFBConfig(dpy, DefaultScreen(dpy), attribs, &numReturned );

XVisualInfo *vInfo = glXGetVisualFromFBConfig(dpy, fbConfigs[0]);
Pixmap pixmap = XCreatePixmap(dpy, RootWindow(dpy, vInfo->screen), 4, 4, 32);
GLXPixmap glxpixmap = glXCreatePixmap(dpy,
fbConfigs[0],
pixmap,
NULL);

GLXContext context = glXCreateNewContext(dpy, fbConfigs[0], GLX_RGBA_TYPE, NULL, True);
glXMakeCurrent(dpy, glxpixmap, context);
printf("{\n");
printf(" \"GL_VENDOR\": \"%s\",\n", glGetString(GL_VENDOR));
printf(" \"GL_RENDERER\": \"%s\",\n", glGetString(GL_RENDERER));
printf(" \"GL_VERSION\": \"%s\"\n", glGetString(GL_VERSION));
printf("}\n");
exit( EXIT_SUCCESS );
}
1 change: 1 addition & 0 deletions install-self-inex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ bindir="/usr/bin/"
install -m 0755 usr/bin/inex-cpuid $bindir
install -m 0755 usr/bin/inex-usage $bindir
install -m 0755 usr/bin/inex-cpusage $bindir
install -m 0755 usr/bin/inex-glinfo $bindir
install -m 0755 usr/bin/i-nex.gambas $bindir
install -m 0755 usr/share/pixmaps/i-nex.xpm /usr/share/pixmaps/
install -m 0755 usr/share/applications/i-nex.desktop /usr/share/applications/
Expand Down
4 changes: 2 additions & 2 deletions src/i-nex/.settings
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ File[22]="Data/report-ng.sh:5.3"
File[23]=".src/Distribution_Detect.module:13.1"
File[24]=".src/FFlags.module:2.19"
Active=25
File[25]=".src/Finfosys.class:548.39"
File[25]=".src/Finfosys.class:448.34"
File[26]=".src/FDF.form"
File[27]=".src/FDF.class:26.6"
File[28]=".src/FNET_R_T.form"
Expand All @@ -59,7 +59,7 @@ File[31]="logo/fb.png"
File[32]=".src/FCPU.module:2.19"
File[33]=".src/FUdisks.form"
File[34]=".src/FUdisks.class:26.6"
File[35]=".src/FCpudb.module:55.107"
File[35]=".src/FCpudb.module:41.32"
File[36]=".src/JSON.module:113.37"
File[37]=".src/Settings.class:2.19"
File[38]=".src/Main.module:2.19"
Expand Down
20 changes: 14 additions & 6 deletions src/i-nex/.src/Finfosys.class
Original file line number Diff line number Diff line change
Expand Up @@ -424,19 +424,30 @@ Public Sub grafika()
Dim available_resolutions, Kernel_driver_in_use As String
Dim rozdzielczosc, gpu, memory_prefetchable, memory_non_prefetchable As String
Dim opengl_vendor_string, opengl_renderer_string, opengl_version_string As String
Dim GLX_GFX As Collection

If ChkPrm.chkExec("glxinfo") = True Then
Shell "" & ChkPrm.ChkExecDir("lspci") & " | grep 'VGA' | cut -d ':' -f3 | cut -d '(' -f 1" Wait To gpu
'lspci -v -s `lspci | awk '/VGA/{print $1}'` | grep 'Kernel driver in use:' | cut -d ':' -f 2
Shell "" & ChkPrm.ChkExecDir("lspci") & " -v -s `lspci | awk '/VGA/{print $1}'` | grep 'Kernel driver in use:' | cut -d ':' -f 2" Wait To Kernel_driver_in_use
Shell "glxinfo | grep 'OpenGL vendor string:' | sed -n '1p' | cut -d ':' -f 2" Wait To opengl_vendor_string
Shell "glxinfo | grep 'OpenGL renderer string:' | sed -n '1p' | cut -d ':' -f 2" Wait To opengl_renderer_string
Shell "glxinfo | grep 'OpenGL version string:' | sed -n '1p' | cut -d ':' -f 2" Wait To opengl_version_string

Label105.Text = "OpenGL Vendor: " & Replace(opengl_vendor_string, "\n", "")
Label106.Text = "OpenGL Renderer: " & Replace(opengl_renderer_string, "\n", "")
Label107.Text = "OpenGL Version: " & Replace(opengl_version_string, "\n", "")

Else
Message.Warning("Not found glxinfo")
Try Exec ["/usr/bin/inex-glinfo"] Wait To opengl_vendor_string
Try GLX_GFX = JSON.Decode(opengl_vendor_string)
Try Label105.Text = "OpenGL Vendor: " & GLX_GFX["GL_VENDOR"]
Try Label106.Text = "OpenGL Renderer: " & GLX_GFX["GL_RENDERER"]
Try Label107.Text = "OpenGL Version: " & GLX_GFX["GL_VERSION"]
Endif

Shell "" & ChkPrm.ChkExecDir("lspci") & " -v -s `lspci | awk '/VGA/{print $1}'` | grep 'Kernel driver in use:' | cut -d ':' -f 2" Wait To Kernel_driver_in_use
Shell "" & ChkPrm.ChkExecDir("lspci") & " | grep 'VGA' | cut -d ':' -f3 | cut -d '(' -f 1" Wait To gpu
Shell "xdpyinfo | grep 'dimensions:' | cut -d ':' -f 2" Wait To rozdzielczosc

Exec ["/bin/bash", "/usr/bin/i-nex-lspci", "nonprefetchable"] Wait To memory_non_prefetchable
Exec ["/bin/bash", "/usr/bin/i-nex-lspci", "prefetchable"] Wait To memory_prefetchable

Expand All @@ -452,9 +463,6 @@ Public Sub grafika()
Label136.Text = "Kernel driver in use: " & Replace(Kernel_driver_in_use, "\n", "")
Label64.Text = "Total Memory prefetchable: " & Replace(memory_prefetchable, "\n", " - ")
Label146.Text = "Total Memory non-prefetchable: " & Replace(memory_non_prefetchable, "\n", " - ")
Label105.Text = "OpenGL Vendor: " & Replace(opengl_vendor_string, "\n", "")
Label106.Text = "OpenGL Renderer: " & Replace(opengl_renderer_string, "\n", "")
Label107.Text = "OpenGL Version: " & Replace(opengl_version_string, "\n", "")
Label108.Text = "Present resolution: " & Replace(rozdzielczosc, "\n", "")
TextBox1.Text = RTrim(Replace(gpu, "\n", ""))
Label109.Text = Replace(available_resolutions, "\n", "")
Expand Down

0 comments on commit df2131d

Please sign in to comment.