[vlc-devel] [PATCH] nVidia affinity

David R Robison drrobison at openroadsconsulting.com
Thu Aug 29 13:21:56 CEST 2013


Thanks for your comments.

I will remove the .po changes. For some reason the build is modifying 
them and the got included in my "git commit" and my patch.

The reason for specifying nVidia each time is because these are nVidia 
specific OpenGL extensions. There are also extensions for other card 
brands. For example, this page http://glew.sourceforge.net/glew.html 
shows the extensions for other card manufacturers. I didn't want to make 
it so generic that things got confused in the future. I guess the 
question is, do we want one command line switch for GPU affinity and 
then have to determine what kind of graphics card is available before we 
can set the affinity or have a command line argument for each 
manufacturer that supports GPU affinity? If it is generic then, when 
adding affinities for other card manufacturers, we would have to search 
though the supported cards and detect which card is installed and then 
flag the type of affinity we are doing. I hope I am clear in my 
explanation. Any thoughts on how you want to handle this?

I will move the defines to right above the include that uses them. This 
is the <GL/wglew.h> file.

To get the OpenGL function pointers you have to have an active OpenGL 
context. However, you have to call the affinity routines outside an 
OpenGL context. So I create a "dummy" context and fetch the function 
pointers and then throw away the dummy context. I was hoping to cache 
these function pointer so I did not have to fetch them each time I 
needed them by creating another OpenGL context. They are used in the 
open and the close functions. I could either 1) fetch them each time 
they are needed or 2) attach them to some structure like vd->sys. Which 
would you prefer.

For the debug messages, I wanted some way to positively tell the user if 
the GPU selection was successful or failed because the nVidia affinity 
extensions did not exist. Without this there is no real way to know if 
the selection worked. However I set them to debug so they would normally 
be silent. Also, they would only be displayed if the user actually 
selected a GPU affinity. But I can remove them if you wish.



David

David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: drrobison at openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/bookstore/bookdetail.php?PB_ISBN=9781597816526

On 8/29/2013 7:06 AM, Jean-Baptiste Kempf wrote:
> On 28 Aug, David R Robison wrote :
>>    modules/video_output/Modules.am    |    2 +-
>>    modules/video_output/msw/common.h  |    3 ++
>>    modules/video_output/msw/glwin32.c |   87
>> +++++++++++++++++++++++++++++++++++-
>>    po/nb.po                           |    2 +-
>>    po/or.po                           |    2 +-
>>    5 files changed, 91 insertions(+), 5 deletions(-)
> No .po changes in this patch.
>
>> +    // nVidia GPU affinity
>> +    HDC affinityHDC
> "GPU affinity" is enough and can be done inline.
>
>
>> +#define GLEW_NO_GLU
>> +#define GLEW_STATIC
> Where is the include?
>
>> +#define HW_NVIDIA_AFFINITY_TEXT N_("nVidia affinity of adapter")
>> +#define HW_NVIDIA_AFFINITY_LONGTEXT N_(\
>> +    "nVidia affinity of adapter indexed from 0.")
> No. Remove nVidia from there. It will get implemented at some point with
> ATI and we do not want to ask translators to redo it.
>
>> +    add_integer("nvidia-affinity", -1, HW_NVIDIA_AFFINITY_TEXT,
>> HW_NVIDIA_AFFINITY_LONGTEXT, true)
> idem --gpu-affinity
>
>> +#undef wglEnumGpusNV
>> +#undef wglCreateAffinityDCNV
>> +#undef wglDeleteDCNV
>> +static PFNWGLENUMGPUSNVPROC wglEnumGpusNV;
>> +static PFNWGLCREATEAFFINITYDCNVPROC wglCreateAffinityDCNV;
>> +static PFNWGLDELETEDCNVPROC wglDeleteDCNV;
> Why?
>
>> +static void AssignNVidiaAffinity(vout_display_t *vd, UINT nVidiaAffinity) {
> Here, this is fine to call it nVidia.
>
>> +    /* see if we have the extensions */
>> +    if (!wglEnumGpusNV || !wglCreateAffinityDCNV) {
>> +        msg_Dbg(vd, "OpenGL nVidia extensions do not seem to be present" );
>> +        return;
>> +    }
> You are going to spam the messages for all GPU not-nVidia and the old
> nVidia ones? Why not doing it only if requested?
>
>> +    /* 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);
>> +    }
> See above.
>
> 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.




More information about the vlc-devel mailing list