[vlc-devel] [PATCH 2/4] qsv: keep the incoming decoder device

Steve Lhomme robux4 at ycbcr.xyz
Thu Jul 2 16:50:42 CEST 2020


By the way,

vlc_encoder_GetDecoderDevice() is probably not needed anymore. It was 
useful in pull mode to create a decoder device that upstream could see. 
Now we push a decoder device so we don't need to create one anymore. We 
don't want to switch to D3D11 encoding (and upload the textures to the 
GPU) with software sources. So I'll remove it.

Not sure there is still a case where vlc_encoder_GetDecoderDevice() 
would be useful. It's already possible for any encoder that needs a GPU 
context to call vlc_decoder_device_Create(). Even then it doesn't even 
need to be through a decoder device, unless it's using filters internally.

On 2020-07-02 16:34, Steve Lhomme wrote:
> On 2020-07-02 16:26, Alexandre Janniaux wrote:
>> Hi,
>>
>> Can you detail a bit what this patch means?
>>
>> What are the downside of not using the decoder device from the
>> input video context or forcing the use of vlc_encoder_GetDecoderDevice
>> and in which use case does it applies ?
> 
> What do you mean "not using the decoder device from the input video 
> context" ? It is an input video context.
> It's needed by the next patch. I can merge the 2 patches if needed. It's 
> certainly not needed in software encoding, although it should not hurt.
> 
>> Regards,
>> -- 
>> Alexandre Janniaux
>> Videolabs
>>
>> On Thu, Jul 02, 2020 at 04:18:58PM +0200, Steve Lhomme wrote:
>>> ---
>>>   modules/codec/qsv.c | 10 ++++++++++
>>>   1 file changed, 10 insertions(+)
>>>
>>> diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
>>> index 727f09e11cd..b04c1dcb899 100644
>>> --- a/modules/codec/qsv.c
>>> +++ b/modules/codec/qsv.c
>>> @@ -294,6 +294,7 @@ typedef struct
>>>
>>>       picture_pool_t   *input_pool;         // pool of pictures to 
>>> feed the decoder
>>>                                             //  as it doesn't like 
>>> constantly changing buffers
>>> +    vlc_decoder_device *dec_device;
>>>   } encoder_sys_t;
>>>
>>>   static block_t *Encode(encoder_t *, picture_t *);
>>> @@ -425,6 +426,11 @@ static int Open(vlc_object_t *this)
>>>       if (unlikely(!sys))
>>>           return VLC_ENOMEM;
>>>
>>> +    if (enc->vctx_in)
>>> +        sys->dec_device = vlc_video_context_HoldDevice(enc->vctx_in);
>>> +    else
>>> +        sys->dec_device = vlc_encoder_GetDecoderDevice(enc);
>>> +
>>>       /* Initialize dispatcher, it will loads the actual SW/HW 
>>> Implementation */
>>>       sts = MFXInit(MFX_IMPL_AUTO_ANY, &ver, &sys->session);
>>>
>>> @@ -433,6 +439,8 @@ static int Open(vlc_object_t *this)
>>>               msg_Err(enc, "Intel Media SDK implementation not 
>>> supported, is your card plugged?");
>>>           else
>>>               msg_Err(enc, "Unable to find an Intel Media SDK 
>>> implementation (%d).", sts);
>>> +        if (sys->dec_device)
>>> +            vlc_decoder_device_Release(sys->dec_device);
>>>           free(sys);
>>>           return VLC_EGENERIC;
>>>       }
>>> @@ -650,6 +658,8 @@ static void Close(vlc_object_t *this)
>>>       async_task_t_fifo_Release(&sys->packets);
>>>       if (sys->input_pool)
>>>           picture_pool_Release(sys->input_pool);
>>> +    if (sys->dec_device)
>>> +        vlc_decoder_device_Release(sys->dec_device);
>>>       free(sys);
>>>   }
>>>
>>> -- 
>>> 2.26.2
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list