Steve Lhomme
54e045e4e1
modules/win32: remove unused vlc_codecs.h
2 years ago
Steve Lhomme
3588689553
va_surface: fix potential double use of a buffer
Substracting 1 to refcount first, means it goes back to unused state
temporarily. It may be picked by another thread as well before calling
atomic_fetch_sub().
In the end we don't need the -1,+1 it's already in the "used once" state (2)
after the atomic_compare_exchange() call.
4 years ago
Alexandre Janniaux
6b7a57f984
modules: fix typos
Typos found and reworked from codespell.
4 years ago
Steve Lhomme
481123a1b6
avcodec: va: use a vlc_sem_t to manage the available surfaces
This is cleaner than using a loop of vlc_tick_sleep(VOUT_OUTMEM_SLEEP);
We don't potentially wait 19.9999ms before giving a surface to the decoder.
6 years ago
Steve Lhomme
1fe351861a
avcodec: va: wait indefinitely until a surface is available
If there's no surface available the decoder should wait for one to be available,
not get an error and not try to decode anymore. When pictures (and thus
surfaces) were coming from the display a picture_pool_Wait() was used, so in
the normal case we should do something similar.
The infinite looping shouldn't be an issue as on Flush or Close the decoder
will release all the past pictures/surfaces. So there will be new surfaces
available for past calls.
We could improve the code by using a conditional variable or semaphore to
unlock the pending requests rather than using vlc_tick_sleep().
6 years ago
Steve Lhomme
a6392963dd
avcodec: rename va_surface_internal.h to va_surface.h
It's not internal code anymore.
6 years ago
Steve Lhomme
7d4028f587
va_surface: emit an error if the amount of pictures in the pool is too large
The way the pool works, it cannot handle more than MAX_SURFACE_COUNT surfaces.
6 years ago
Steve Lhomme
c8cd126f6c
va_surface: fix printing of size_t in logs
After c0162d6dd7
7 years ago
Steve Lhomme
99c9656cdd
va_surface: set the AVCodecContext hwaccel_context in the final setup callback
7 years ago
Steve Lhomme
c0162d6dd7
va_surface: use size_t for the surface index
and read it using a const pointer
7 years ago
Steve Lhomme
bb5fc95242
va_surface: remove unused va_pool_Close parameter
7 years ago
Steve Lhomme
8a823165b1
va_surface: release all the resources when the va_pool is finally released
7 years ago
Steve Lhomme
f6da761f7c
va_surface: fix reusing a pool already setup
+ simplify the va_pool_SetupDecoder() code
7 years ago
Steve Lhomme
96cabf22cb
va_surface: hold a reference on the va_pool for each surface in flight
7 years ago
Steve Lhomme
5249defb68
va_surface: refcount the va_pool so it can be released with the last picture
The original creator is the one holding the first reference and release it via
va_pool_Close().
Fixes a leak of va_pool after va_pool_Close() is called.
7 years ago
Steve Lhomme
d7971ee0a6
va_surface: allocate all the surfaces in the array with the pool structure
No need for all the mallocs
7 years ago
Steve Lhomme
c23810953a
va_surface: remove unused parameter
7 years ago
Steve Lhomme
8f6e850294
va_surface: call NewSurfacePicContext internally
7 years ago
Steve Lhomme
3d4f30925b
va_surface: create the picture context each time
Rather than doing a copy each time. In other words we don't have one by laying
aroung by default.
7 years ago
Steve Lhomme
2b1761f53b
va_surface: pass the opaque to the picture context creation callback
7 years ago
Steve Lhomme
96f66f06b8
va_surface: don't pass the surface index to allocate a picture context
We get it from the va_surface directly.
7 years ago
Steve Lhomme
6f50851498
va_surface: store the va_pool in each surface
7 years ago
Steve Lhomme
fac459a554
va_surface: add a function to get the surface index in the array
7 years ago
Steve Lhomme
00aaa32d67
va_surface: pass an opaque pointer to use with callbacks
We need to keep a local copy of the pool configuration now.
+ rename DestroyVideoDecoder to ReleasePoolSurfaces
7 years ago
Steve Lhomme
8c18fe2201
va_surface: make the va_pool structure private
7 years ago
Steve Lhomme
ff4e03dd0c
va_surface: remove the external pool API
Only D3D11 was using it and it doesn't make sense in push.
7 years ago
Steve Lhomme
dbf64bd9f8
dxva: remove redundant hw.surface_count
It's already read when we setup the decoder.
7 years ago
Steve Lhomme
81fe02a5d1
va_surface: fix return value when device creation fails
7 years ago
Steve Lhomme
a8fb25e68b
va_surface: use a define to count the retries to get a free surface
7 years ago
Steve Lhomme
5fcbf23a34
dxva: allocate the va_pool separately
It might still live with pictures after the va module is deactivated.
7 years ago
Steve Lhomme
fc8b0c8d0b
dxva: balance the surface API and avoid dirty casts
d3d11va/dxva2 only get a va_surface from the API and deal with the references.
They need to create a copy of the internal picture context so it's not released
when the picture is finished in the display. A copy also increments the surface
refcount, so we need to release one after the copy.
7 years ago
Steve Lhomme
9f25d132ac
dxva: change surface context allocation to allow local types for each variant
We don't use a custom/fake VA_PICSYS in the va_surface API. Each type is
responsible for storing the picture_sys_t where they want (if any).
The va_surface API only deals with picture_context_t now.
7 years ago
Steve Lhomme
245d76e608
va_surface: allow closing uninitialized pools
It makes closing partically initialized VA's easier
7 years ago
Martin Storsjö
b8e08bd832
directx_va: Fix fallback from d3d11va to d3d9va/dxva2 after the recent refactorings
7 years ago
Steve Lhomme
e4cc2f846b
directx_va: move the decoder setup out of the generic directx surface setup
7 years ago
Steve Lhomme
377d00bb98
direct_va: store the va_surface in the picture context
So that every clone can get/release a reference to the original surface.
7 years ago
Steve Lhomme
03c4b4f79a
dxva: setup the surface directly in va_pool_SetupDecoder()
7 years ago
Steve Lhomme
b06db75717
dxva: don't store the external pool flag in the dxva helper
It's only used with D3D11VA and will go away with push.
7 years ago
Steve Lhomme
ec672df041
dxva: merge the video service handling in the device creation callbacks
7 years ago
Steve Lhomme
1d0bca7fea
dxva: merge the device manager in the device creation callback
7 years ago
Steve Lhomme
6e82ec2fa0
dxva: pass the va object to the device destroy callback
7 years ago
Steve Lhomme
bbcd07ff21
directx_va: group the pool/device callbacks in a const structure
7 years ago
Steve Lhomme
9e5570a7e0
directx_va: don't use the va when we only need the sys
7 years ago
Steve Lhomme
f4d47b28a5
dxva: remove the video format from the device init
7 years ago
Steve Lhomme
4cd31c8384
directx_va: get the picture_context_t from the va_pool
We can fill the picture outside of this call.
7 years ago
Steve Lhomme
77df17ab89
dxva: pass the actual video_format_t to create the device
In DVXA2 we should check the max decoding resolution.
7 years ago
Steve Lhomme
3de3d37a87
va_surface: make the picture_sys type a define
So it can be renamed
7 years ago
Steve Lhomme
b60d0a5715
d3d11/d3d9: only include va_surface.h when necessary
7 years ago
Steve Lhomme
d3227abbdc
va: compute the retries as the upper amount needed for a second
8 years ago
Steve Lhomme
8b0c6bb9fa
rename msleep() to vlc_tick_sleep()
8 years ago