summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext_internal.h
Commit message (Collapse)AuthorAge
* avutil/hwcontext: Allocate AVHWFramesCtx jointly with its internalsAndreas Rheinhardt2024-03-07
| | | | | | | | | | | This is possible because the lifetime of these structures coincide. It has the advantage of allowing to remove AVHWFramesInternal from the public header; given that AVHWFramesInternal.priv is no more, most accesses to AVHWFramesInternal are no more; indeed, the only field accessed of it outside of hwcontext.c is the internal frame pool, making this commit very simple. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_internal: Remove unused AVHWFramesInternal.privAndreas Rheinhardt2024-03-07
| | | | | | | | It is no longer used by any hwcontext, as they all allocate their private data together with their public data and access it via AVHWFramesContext.hwctx. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext: Allocate AVHWDevCtx jointly with its internalsAndreas Rheinhardt2024-03-07
| | | | | | | | | | This is possible because the lifetime of these structures coincide. It has the advantage of allowing to remove the AVHWDeviceInternal from the public header; given that AVHWDeviceInternal.priv is no more, all accesses to it happen in hwcontext.c, so that this commit moves the joint structure there. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext: Remove unused AVHWDeviceInternal.privAndreas Rheinhardt2024-03-07
| | | | | | | | It is no longer used by any hwcontext, as they all allocate their private data together with their public data and access it via AVHWDeviceContext.hwctx. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavutil: add hwcontext_d3d12va and AV_PIX_FMT_D3D12Wu Jianhua2023-12-21
| | | | | Signed-off-by: Wu Jianhua <toqsxw@outlook.com> Signed-off-by: Tong Wu <tong1.wu@intel.com>
* Revert "avutils/hwcontext: When deriving a hwdevice, search for existing ↵Haihao Xiang2022-01-05
| | | | | | | | | | device in both directions" This reverts commit a4289497755386435783774a4f520eb7fc23cbc9. There were objections on ML (see https://ffmpeg.org/pipermail/ffmpeg-devel/2021-December/290530.html) Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avutils/hwcontext: When deriving a hwdevice, search for existing device in ↵Soft Works2022-01-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | both directions The test /libavutil/tests/hwdevice checks that when deriving a device from a source device and then deriving back to the type of the source device, the result is matching the original source device, i.e. the derivation mechanism doesn't create a new device in this case. Previously, this test was usually passed, but only due to two different kind of flaws: 1. The test covers only a single level of derivation (and back) It derives device Y from device X and then Y back to the type of X and checks whether the result matches X. What it doesn't check for, are longer chains of derivation like: CUDA1 > OpenCL2 > CUDA3 and then back to OpenCL4 In that case, the second derivation returns the first device (CUDA3 == CUDA1), but when deriving OpenCL4, hwcontext.c was creating a new OpenCL4 context instead of returning OpenCL2, because there was no link from CUDA1 to OpenCL2 (only backwards from OpenCL2 to CUDA1) If the test would check for two levels of derivation, it would have failed. This patch fixes those (yet untested) cases by introducing forward references (derived_device) in addition to the existing back references (source_device). 2. hwcontext_qsv didn't properly set the source_device In case of QSV, hwcontext_qsv creates a source context internally (vaapi, dxva2 or d3d11va) without calling av_hwdevice_ctx_create_derived and without setting source_device. This way, the hwcontext test ran successful, but what practically happened, was that - for example - deriving vaapi from qsv didn't return the original underlying vaapi device and a new one was created instead: Exactly what the test is intended to detect and prevent. It just couldn't do so, because the original device was hidden (= not set as the source_device of the QSV device). This patch properly makes these setting and fixes all derivation scenarios. (at a later stage, /libavutil/tests/hwdevice should be extended to check longer derivation chains as well) Reviewed-by: Lynne <dev@lynne.ee> Reviewed-by: Anton Khirnov <anton@khirnov.net> Tested-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* hwcontext: add av_hwdevice_ctx_create_derived_optsLynne2020-05-23
| | | | | | | | | | | | | This allows for users who derive devices to set options for the new device context they derive. The main use case of this is to allow users to enable extensions (such as surface drawing extensions) in Vulkan while deriving from the device their frames are on. That way, users don't need to write any initialization code themselves, since the Vulkan spec invalidates mixing instances, physical devices and active devices. Apart from Vulkan, other hwcontexts ignore the opts argument since they don't support options at all (or in VAAPI and OpenCL's case, options are currently only used for device selection, which device_derive overrides).
* lavu: add Vulkan hwcontext codeLynne2020-02-04
| | | | | | | | | | This commit adds the necessary code to initialize and use a Vulkan device within the hwcontext libavutil framework. Currently direct mapping to VAAPI and DRM frames is functional, and transfers to CUDA and native frames are supported. Lets hope the future Vulkan video decode extension fits well within this framework.
* hwcontext_internal: add ff_hwframe_map_replaceRostislav Pehlivanov2018-06-21
| | | | | | Used to fix unmapping when no direct interop exists between APIs. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* lavu/hwcontext: add AV_HWDEVICE_TYPE_MEDIACODECAman Gupta2017-12-16
| | | | Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
* lavu: OpenCL hwcontext implementationMark Thompson2017-11-22
|
* lavu: Add DRM hwcontextMark Thompson2017-09-13
|
* lavu: add new D3D11 pixfmt and hwcontextwm42017-06-27
| | | | | | | | | | | | | | | | | | | | | | To be used with the new d3d11 hwaccel decode API. With the new hwaccel API, we don't want surfaces to depend on the decoder (other than the required dimension and format). The old D3D11VA pixfmt uses ID3D11VideoDecoderOutputView pointers, which include the decoder configuration, and thus is incompatible with the new hwaccel API. This patch introduces AV_PIX_FMT_D3D11, which uses ID3D11Texture2D and an index. It's simpler and compatible with the new hwaccel API. The introduced hwcontext supports only the new pixfmt. Frame upload code untested. Significantly based on work by Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites. Merges Libav commit fff90422d181744cd75dbf011687ee7095f02875. Signed-off-by: Diego Biurrun <diego@biurrun.de>
* hwcontext: Improve allocation in derived contextsMark Thompson2017-06-14
| | | | | | | | | Use the flags argument of av_hwframe_ctx_create_derived() to pass the mapping flags which will be used on allocation. Also, set the format and hardware context on the allocated frame automatically - the user should not be required to do this themselves. (cherry picked from commit c5714b51aad41fef56dddac1d542e7fc6b984627)
* hwcontext: Add frame context mapping for nontrivial contextsMark Thompson2017-06-14
| | | | | | | | | Some frames contexts are not usable without additional format-specific state in hwctx. This change adds new functions frames_derive_from and frames_derive_to to initialise this state appropriately when deriving a frames context which will require it to be set. (cherry picked from commit 27978155bc661eec9f22bcf82c9cfc099cff4365)
* hwcontext: Add device derivationMark Thompson2017-06-14
| | | | | | | Creates a new device context from another of a different type which refers to the same underlying hardware. (cherry picked from commit b266ad56fe0e4ce5bb70118ba2e2b1dabfaf76ce)
* videotoolbox: add hwcontext supportwm42017-05-15
| | | | | | | | | | | | | | | | | | This adds tons of code for no other benefit than making VideoToolbox support conform with the new hwaccel API (using hw_device_ctx and hw_frames_ctx). Since VideoToolbox decoding does not actually require the user to allocate frames, the new code does mostly nothing. One benefit is that ffmpeg_videotoolbox.c can be dropped once generic hwaccel support for ffmpeg.c is merged from Libav. Does not consider VDA or VideoToolbox encoding. Fun fact: the frame transfer functions are copied from vaapi, as the mapping makes copying generic boilerplate. Mapping itself is not exported by the VT code, because I don't know how to test.
* Merge commit 'd06aa24ba583ad08025da9e1b29afcd8218ff9b0'Clément Bœsch2017-03-30
|\ | | | | | | | | | | | | * commit 'd06aa24ba583ad08025da9e1b29afcd8218ff9b0': hwcontext: Hardware frame mapping Merged-by: Clément Bœsch <cboesch@gopro.com>
| * hwcontext: Hardware frame mappingMark Thompson2016-11-03
| | | | | | | | | | | | | | | | | | | | Adds the new av_hwframe_map() function, which allows mapping between hardware frames and normal memory, along with internal support for implementing it. Also adds av_hwframe_ctx_create_derived(), for creating a hardware frames context associated with one device using frames mapped from another by some hardware-specific means.
* | Merge commit '59e7361cc791e5103be1712dc59a2055f118d0da'James Almer2016-09-28
|\| | | | | | | | | | | | | | | | | | | | | * commit '59e7361cc791e5103be1712dc59a2055f118d0da': hwcontext: add a QSV implementation Conflicts: doc/APIchanges libavutil/version.h Merged-by: James Almer <jamrial@gmail.com>
| * hwcontext: add a QSV implementationAnton Khirnov2016-06-21
| |
* | Merge commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d'Hendrik Leppkes2016-06-26
|\| | | | | | | | | | | | | * commit '1c9e8616c535ef496e7ee8a5cbc5e9e972a6977d': hwcontext: add a function for opening devices Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * hwcontext: add a function for opening devicesAnton Khirnov2016-05-26
| |
* | Merge commit 'c46db38cde8e8fd8ecb1c6602f10ec0e002f29a8'Hendrik Leppkes2016-06-22
|\| | | | | | | | | | | | | * commit 'c46db38cde8e8fd8ecb1c6602f10ec0e002f29a8': hwcontext: add a dxva2 implementation Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * hwcontext: add a dxva2 implementationAnton Khirnov2016-05-17
| |
* | Merge commit '551c6775abb5e0ad34c26d7e23bc6fbbe8ccc9d4'Derek Buitenhuis2016-04-14
|\| | | | | | | | | | | | | * commit '551c6775abb5e0ad34c26d7e23bc6fbbe8ccc9d4': lavu: VAAPI hwcontext implementation Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavu: VAAPI hwcontext implementationMark Thompson2016-03-19
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | Merge commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09'Derek Buitenhuis2016-04-14
|\| | | | | | | | | | | | | * commit 'b1f01e85a92d401a9b29c79f23db36b7685e8c09': lavu: add a way to query hwcontext frame constraints Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavu: add a way to query hwcontext frame constraintsMark Thompson2016-03-19
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | Merge commit 'ad884d100259e55cb51a4239cd8a4fd5154c2073'Derek Buitenhuis2016-02-24
|\| | | | | | | | | | | | | * commit 'ad884d100259e55cb51a4239cd8a4fd5154c2073': hwcontext: add a CUDA implementation Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * hwcontext: add a CUDA implementationAnton Khirnov2016-02-14
| |
* | Merge commit 'a001ce31bc2bcf875a39b5fb22dae49120293b42'Derek Buitenhuis2016-02-17
|\| | | | | | | | | | | | | * commit 'a001ce31bc2bcf875a39b5fb22dae49120293b42': hwcontext: add a VDPAU implementation Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * hwcontext: add a VDPAU implementationAnton Khirnov2016-02-14
| |
* | Merge commit '89923e418b494e337683442ab896d754bc07341a'Derek Buitenhuis2016-02-17
|/ | | | | | | * commit '89923e418b494e337683442ab896d754bc07341a': lavu: add a framework for handling hwaccel frames Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavu: add a framework for handling hwaccel framesAnton Khirnov2016-02-14