[vlc-devel] [PATCH 2/2] direct3d11: use FLIP_DISCARD instead of FLIP_SEQUENTIAL when possible

Steve Lhomme robux4 at gmail.com
Thu Sep 14 16:19:06 CEST 2017


On Thu, Sep 14, 2017 at 3:53 PM, Jean-Baptiste Kempf <jb at videolan.org> wrote:
> I'm not OK with this, tbh...

It doesn't make any visible difference. But from the doc the
sequential is designed so that you can update just a part of the
swapchain. Something we never do. The discard seems more like what we
want and hopefully is a bit faster.

> On Thu, 14 Sep 2017, at 15:03, Steve Lhomme wrote:
>> ---
>>  modules/video_output/win32/direct3d11.c | 19 ++++++++++++-------
>>  1 file changed, 12 insertions(+), 7 deletions(-)
>>
>> diff --git a/modules/video_output/win32/direct3d11.c
>> b/modules/video_output/win32/direct3d11.c
>> index 2d36519325..900cf29bdb 100644
>> --- a/modules/video_output/win32/direct3d11.c
>> +++ b/modules/video_output/win32/direct3d11.c
>> @@ -1662,8 +1662,6 @@ static int Direct3D11Open(vout_display_t *vd,
>> video_format_t *fmt)
>>          scd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; /* TODO: use
>>          DXGI_FORMAT_NV12 */
>>          break;
>>      }
>> -    //scd.Flags = 512; // DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO;
>> -    scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
>>
>>      static const D3D_DRIVER_TYPE driverAttempts[] = {
>>          D3D_DRIVER_TYPE_HARDWARE,
>> @@ -1710,11 +1708,18 @@ static int Direct3D11Open(vout_display_t *vd,
>> video_format_t *fmt)
>>         return VLC_EGENERIC;
>>      }
>>
>> -    hr = IDXGIAdapter_GetParent(dxgiadapter, &IID_IDXGIFactory2, (void
>> **)&dxgifactory);
>> -    IDXGIAdapter_Release(dxgiadapter);
>> -    if (FAILED(hr)) {
>> -       msg_Err(vd, "Could not get the DXGI Factory. (hr=0x%lX)", hr);
>> -       return VLC_EGENERIC;
>> +    hr = IDXGIAdapter_GetParent(dxgiadapter, &IID_IDXGIFactory4, (void
>> **)&dxgifactory);
>> +    if (SUCCEEDED(hr)) {
>> +        IDXGIAdapter_Release(dxgiadapter);
>> +        scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
>> +    } else {
>> +        hr = IDXGIAdapter_GetParent(dxgiadapter, &IID_IDXGIFactory2,
>> (void **)&dxgifactory);
>> +        IDXGIAdapter_Release(dxgiadapter);
>> +        if (FAILED(hr)) {
>> +           msg_Err(vd, "Could not get the DXGI Factory. (hr=0x%lX)",
>> hr);
>> +           return VLC_EGENERIC;
>> +        }
>> +        scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
>>      }
>>
>>      hr = IDXGIFactory2_CreateSwapChainForHwnd(dxgifactory, (IUnknown
>>      *)sys->d3ddevice,
>> --
>> 2.12.1
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
>
> --
> Jean-Baptiste Kempf -  President
> +33 672 704 734


More information about the vlc-devel mailing list