forked from marfrit/libva-v4l2-request-fourier
iter38: multi-device probe — single libva session serves all 5 codecs
Probe BOTH rkvdec and hantro-vpu at VA_DRIVER_INIT and keep their
{video,media}_fd pairs in driver_data. RequestQueryConfigProfiles
enumerates the union of supported profiles from all open fds.
RequestCreateConfig retargets driver_data->{video,media}_fd to the
device that serves the requested profile; if a switch is needed
(active fd is wrong), tears down output_pool, capture_pool, video_format
cache, and fmt_valid so the next RequestCreateContext rebuilds them
on the new device.
Profile→device map (RK3399-shaped):
H264 / HEVC / VP9 → rkvdec
MPEG-2 / VP8 → hantro-vpu
Honours LIBVA_V4L2_REQUEST_VIDEO_PATH / MEDIA_PATH explicit overrides
(skips alt-probe when those are set).
Closes the 'libva multi-device probe' open item from iter36/iter37
campaign-close.
This commit is contained in:
@@ -56,6 +56,27 @@ struct request_data {
|
||||
int video_fd;
|
||||
int media_fd;
|
||||
|
||||
/*
|
||||
* iter38: multi-device probe. RK3399 has two V4L2 stateless decoders:
|
||||
* - rkvdec → H264 / HEVC / VP9
|
||||
* - hantro-vpu (rk3399-vpu-dec) → MPEG-2 / VP8
|
||||
* At VA_DRIVER_INIT we probe both, open their fds, and store them
|
||||
* here. driver_data->video_fd / media_fd above are the "active" fds
|
||||
* (point at one of the pairs below). RequestCreateConfig retargets
|
||||
* them based on the profile's required device. Pools and video_format
|
||||
* are torn down at retarget time so the next CreateContext rebuilds
|
||||
* them against the right device.
|
||||
*
|
||||
* -1 means that device kind isn't present on this kernel boot.
|
||||
* Honours LIBVA_V4L2_REQUEST_VIDEO_PATH / MEDIA_PATH explicit
|
||||
* overrides — when those are set, only the single requested device
|
||||
* is opened and the alt fds stay -1.
|
||||
*/
|
||||
int video_fd_rkvdec;
|
||||
int media_fd_rkvdec;
|
||||
int video_fd_hantro;
|
||||
int media_fd_hantro;
|
||||
|
||||
struct video_format *video_format;
|
||||
|
||||
/*
|
||||
@@ -117,4 +138,12 @@ struct request_data {
|
||||
VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context);
|
||||
VAStatus RequestTerminate(VADriverContextP context);
|
||||
|
||||
/*
|
||||
* iter38: retarget driver_data->{video,media}_fd to the device required by
|
||||
* `profile`. Returns 0 on success, -1 on profile not mappable to any kind.
|
||||
* Defined in request.c.
|
||||
*/
|
||||
int request_switch_device_for_profile(struct request_data *driver_data,
|
||||
VAProfile profile);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user