On Sun, 24 Jan 2016 23:16:03 +0100
Schaich Alonso <alonsoscha...@fastmail.fm> wrote:

> [...]
> I've attached [...]

Erm... Another try...

Alonso

#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

#include <GL/glx.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>

static int xvisual_attribs[] = { GLX_RGBA, None };

int main (int argc, char **argv)
{
    Display *display;
    Window   window;
    XSetWindowAttributes win_attribs;
    XVisualInfo *info;
    Colormap map;
    GLXContext context;
    
    display = XOpenDisplay(NULL);
    assert (display != NULL);
    
    info = glXChooseVisual (display, DefaultScreen(display), xvisual_attribs);
    assert (info != NULL);

    context = glXCreateContext (display, info, NULL, GL_TRUE);
    assert (context != NULL);
    
    map = XCreateColormap (display, 
                           RootWindow(display, info->screen), 
                           info->visual, 
                           AllocNone);

    win_attribs.colormap = map;
    
    window = XCreateWindow (display, 
                            RootWindow(display, info->screen), 
                            0, 0,
                            320, 240,
                            0,
                            info->depth,
                            InputOutput,
                            info->visual,
                            CWColormap,
                            &win_attribs);

    XSetStandardProperties (display,
                            window,
                            "NVX_gpu_memory_info",
                            "NVX_gpu_memory_info",
                            None,
                            argv,
                            argc,
                            NULL);

    glXMakeCurrent (display, window, context);

    XMapWindow (display, window);
    
    int total, current, evict_cnt, evicted;
    
    glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &total);
    glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &current);
    glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX, &evict_cnt);
    glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, &evicted);
    
    printf ("GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX=%d\n", total);
    printf ("GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX=%d\n", current);
    printf ("GPU_MEMORY_INFO_EVICTION_COUNT_NVX=%d\n", evict_cnt);
    printf ("GPU_MEMORY_INFO_EVICTED_MEMORY_NVX=%d\n", evicted);
    
    return (EXIT_SUCCESS);
}

Attachment: pgpCGq0IUZXjl.pgp
Description: PGP signature

_______________________________________________
kde-freebsd mailing list
kde-freebsd@kde.org
https://mail.kde.org/mailman/listinfo/kde-freebsd
See also http://freebsd.kde.org/ for latest information

Reply via email to