2 Replies Latest reply on Jan 20, 2012 5:21 PM by plohrmann

    "GPA_OpenContext()" is returning "GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED"

    sandytelxsi02
      AMD A6-3410MX APU

      Hello,

      I am trying to get GPU utilization using "GPUPerf" library.

      I  modified the sample application "fgl_glxgears" , such that after opengl context is created I call api "GPA_OpenContext" . But this api always returns "GPA_STATUS_ERROR_HARDWARE_NOT_SUPPORTED".

      GPA_Initialize is called before the opengl context is created and this returns success.

      Attaching the part of sample application for reference "fgl_glxgears.c".(Plz search for GPU in the sample code)

      PS:

      OS : Fedora Core 15 64bit

      Kernel : 2.6.38

      Driver : ATI catalyst driver version 11.11

      Platform : AMD A6-3410MX APU

      /* * Create an RGBA, double-buffered window. */ static void make_window(const char *name, int x, int y, int width, int height) { #ifdef _WIN32 static const PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), /* size */ 1, /* version */ PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER, /* support double-buffering */ PFD_TYPE_RGBA, /* color type */ 16, /* prefered color depth */ 0, 0, 0, 0, 0, 0, /* color bits (ignored) */ 0, /* no alpha buffer */ 0, /* alpha bits (ignored) */ 0, /* no accumulation buffer */ 0, 0, 0, 0, /* accum bits (ignored) */ 16, /* depth buffer */ 1, /* no stencil buffer */ 0, /* no auxiliary buffers */ PFD_MAIN_PLANE, /* main layer */ 0, /* reserved */ 0, 0, 0, /* no layer, visible, damage masks */ }; int pixelFormat; static char szAppName[] = "FGL glxgears"; HINSTANCE hInstance = GetModuleHandle(NULL); WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = NULL; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName = NULL; wc.lpszClassName = szAppName; RegisterClass(&wc); /* create window */ hWnd = CreateWindow( szAppName, name, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, x, y, width, height, NULL, NULL, hInstance, NULL); /* display window */ ShowWindow(hWnd, SW_SHOWNORMAL); UpdateWindow(hWnd); /* initialize OpenGL rendering */ hDC = GetDC(hWnd); pixelFormat = ChoosePixelFormat(hDC, &pfd); if (pixelFormat == 0) { printf("Error: couldn't get an RGBA, Double-buffered pixel format\n"); exit(1); } if (SetPixelFormat(hDC, pixelFormat, &pfd) != TRUE) { printf("Error: SetPixelFormat failed\n"); exit(1); } hGLRC = wglCreateContext(hDC); if (!hGLRC) { printf("Error: wglCreateContext failed\n"); exit(1); } wglMakeCurrent(hDC, hGLRC); #else // _WIN32 int attrib[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 1, None }; int scrnum; XSetWindowAttributes attr; unsigned long mask; Window root; XVisualInfo *visinfo; GPA_Status enGPAStatus = 0; void *lib_handle; /*GPU : Load GPUPerf library and initialize it. */ lib_handle = dlopen("libGPUPerfAPIGL.so" , RTLD_LAZY ); GPA_Initialize( ); scrnum = DefaultScreen( dpy ); root = RootWindow( dpy, scrnum ); visinfo = glXChooseVisual( dpy, scrnum, attrib ); if (!visinfo) { printf("Error: couldn't get an RGBA, Double-buffered visual\n"); exit(1); } /* window attributes */ attr.border_pixel = 0; attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; #if 1 // Andy: if the desktop is in the overlay planes (stereo enabled), having the // xserver clear the background is preventing the 3D content to show through. // A fox for this is a 2D driver issue attr.background_pixel = 0; mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; #else mask = CWBorderPixel | CWColormap | CWEventMask; #endif win = XCreateWindow( dpy, root, 0, 0, width, height, 0, visinfo->depth, InputOutput, visinfo->visual, mask, &attr ); /* set hints and properties */ { XSizeHints sizehints; sizehints.x = x; sizehints.y = y; sizehints.width = width; sizehints.height = height; sizehints.flags = USSize | USPosition; XSetNormalHints(dpy, win, &sizehints); XSetStandardProperties(dpy, win, name, name, None, (char **)NULL, 0, &sizehints); } ctx_win = glXCreateContext( dpy, visinfo, NULL, GL_TRUE ); if (!ctx_win) { printf("Error: glXCreateContext failed\n"); exit(1); } XFree(visinfo); glXMakeCurrent(dpy, win, ctx_win); /*GPU : Send the context created above to this api. */ enGPAStatus = GPA_OpenContext (ctx_win); if(0 != enGPAStatus) { printf("%d\n", enGPAStatus); return; } GPA_EnableAllCounters(); #endif // _WIN32 }