Re: Trying to use AssignNVidiaAffinity to assign OpenGL a specific graphics card
David R Robison <[email protected]> Wed, 21 Aug 2013 07:29:49 -0400
| Newsgroups | gmane.comp.video.videolan.vlc.general |
|---|---|
| Message-ID | <[email protected]> |
I've come close. Here is the code I used to assign the nVidia affinity
#undef wglEnumGpusNV
#undef wglCreateAffinityDCNV
static PFNWGLENUMGPUSNVPROC wglEnumGpusNV;
static PFNWGLCREATEAFFINITYDCNVPROC wglCreateAffinityDCNV;
static void AssignNVidiaAffinity(vout_display_t *vd, UINT nVidiaAffinity) {
// initialize the wgl context
if (wglEnumGpusNV == NULL) {
msg_Dbg(vd, "Initialize wgl context" );
HDC winDC = GetDC(vd->sys->hvideownd);
PIXELFORMATDESCRIPTOR pfd;
memset(&pfd, 0, sizeof(pfd));
pfd.nSize = sizeof(pfd);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
SetPixelFormat(winDC, ChoosePixelFormat(winDC, &pfd), &pfd);
HGLRC hGLRC = wglCreateContext(winDC);
wglMakeCurrent(winDC, hGLRC);
wglEnumGpusNV =
(PFNWGLENUMGPUSNVPROC)wglGetProcAddress("wglEnumGpusNV");
wglCreateAffinityDCNV =
(PFNWGLCREATEAFFINITYDCNVPROC)wglGetProcAddress("wglCreateAffinityDCNV");
wglDeleteContext(hGLRC);
}
// see if we have the extensions
if (!wglEnumGpusNV || !wglCreateAffinityDCNV) {
msg_Dbg(vd, "OpenGL nVidia extensions do not seem to be present" );
return;
}
// find the graphics card
HGPUNV GpuMask[2];
GpuMask[0] = NULL;
GpuMask[1] = NULL;
HGPUNV hGPU;
if (!wglEnumGpusNV(nVidiaAffinity, &hGPU)) {
msg_Warn(vd, "Could not enumerate nVidia adapter %d",
nVidiaAffinity );
return;
}
// make the new context
GpuMask[0] = hGPU;
vd->sys->hGLDC = wglCreateAffinityDCNV(GpuMask);
}
This is called in the glwin32.c program as
// process card specific affinities
int nVidiaAffinity = var_InheritInteger(vd, "nvidia-affinity");
if (nVidiaAffinity >= 0) {
msg_Dbg(vd, "nVidia affinity using adapter %d", nVidiaAffinity );
AssignNVidiaAffinity(vd, nVidiaAffinity);
}
/*
* use default card affinity
*/
if (sys->hGLDC == NULL) sys->hGLDC = GetDC(sys->hvideownd);
It works, in the since that I can select the card and see the card's
memory and activity increase, but it plays no video. I'm not sure what
I'm doing wrong, but I guess there is more investigation on my part that
is needed. Any thoughts?
David
David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: [email protected]
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/bookstore/bookdetail.php?PB_ISBN=9781597816526
On 8/21/2013 4:51 AM, Jean-Baptiste Kempf wrote:
> On 13 Aug, David R Robison wrote :
>> Has anyone attempted this before? Any thoughts on what I may be doing
>> wrong? We are running under Windows 7.
> Did you fix it, in the end?
>
> Best regards,
>
This email communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.
If you are not the intended recipient, please delete this email immediately.
______________________________________________________
vlc mailing list
To unsubscribe or modify your subscription options:
https://mailman.videolan.org/listinfo/vlc