Commit Graph

34 Commits

Author SHA1 Message Date
Timo Rothenpieler
2de6cd4ba4 avutil/hwcontext_cuda: return more useful error codes from init functions 2021-11-22 23:03:21 +01:00
Timo Rothenpieler
b1f1de0844 avutil/hwcontext_cuda: add option to use primary device context 2021-11-22 23:03:21 +01:00
Lynne
4a6581e968 hwcontext_vulkan: dynamically load functions
This patch allows for alternative loader implementations.
2021-04-30 00:08:37 +02:00
Andreas Rheinhardt
ef6a9e5e31 avutil/buffer: Switch AVBuffer API to size_t
Announced in 14040a1d91.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
James Almer
e36eb94048 avutil: use the buffer_size_t typedef where required
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-10 20:26:37 -03:00
Timo Rothenpieler
98d3f23598 avutil/hwcontext_cuda: fix edge case with non-even frame heights 2020-11-04 01:36:48 +01:00
Timo Rothenpieler
2f3cb5ccca avutil/hwcontext_cuda: query correct alignment from device 2020-11-04 01:36:39 +01:00
Timo Rothenpieler
d5763edab2 avutil/hwcontext_cuda: increase CUDA frame alignment to 512
At least on Turing, a frame without 512 byte alignment cannot be passed
to cuTexObjectCreate.
2020-11-03 18:17:35 +01:00
Lynne
2e08b39444
hwcontext: add av_hwdevice_ctx_create_derived_opts
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).
2020-05-23 19:07:26 +01:00
Timo Rothenpieler
30b28f9a83 avutil/hwcontext_cuda: Only handle CUDA hardware frames 2020-04-06 19:33:01 +02:00
Timo Rothenpieler
d9a37af070 avutil/hwcontext_cuda: combine transfer functions
Gets rid of some mostly duplicated code and adds the ability to do
hardware to hardware transfers.
2020-03-19 17:38:36 +01:00
Yaroslav Pogrebnyak
08d46cb586 avutil/hwcontext_cuda: add YUVA420P pixel format
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-03-19 16:38:08 +01:00
Philip Langdale
7f149b0452 lavu/hwcontext_cuda: refactor context initialisation
There's enough going on here now that it should not be duplicated
between cuda_device_create and cuda_device_derive.
2020-02-04 23:19:48 +00:00
Lynne
a88449ffb2 lavu: add Vulkan hwcontext code
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.
2020-02-04 23:19:48 +00:00
Oleg Dobkin
32ba563cfc avutil/hwcontext_cuda: allow using primary CUDA device context
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-11-26 16:24:40 +01:00
Philip Langdale
52d8f35b14 avutil/hcontext_cuda: Remove unnecessary stream synchronisation
Similarly to the previous changes, we don't need to synchronise
after a memcpy to device memory. On the other hand, we need to
keep synchronising after a copy to host memory, otherwise there's
no guarantee that subsequent host reads will return valid data.
2019-03-30 10:56:49 -07:00
Philip Langdale
19d3d0c057 avutil/hwcontext_cuda: Define and use common CHECK_CU()
We have a pattern of wrapping CUDA calls to print errors and
normalise return values that is used in a couple of places. To
avoid duplication and increase consistency, let's put the wrapper
implementation in a shared place and use it everywhere.

Affects:

* avcodec/cuviddec
* avcodec/nvdec
* avcodec/nvenc
* avfilter/vf_scale_cuda
* avfilter/vf_scale_npp
* avfilter/vf_thumbnail_cuda
* avfilter/vf_transpose_npp
* avfilter/vf_yadif_cuda
2018-11-14 17:39:42 -08:00
Marton Balint
1b2471039b avutil/hwcontext_cuda: fix YUV420P cuda_get_buffer
Regression since ece068a771.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-05-15 22:18:58 +02:00
Timo Rothenpieler
ece068a771 avutil/hwcontext_cuda: use generic size and pointer assignment functions 2018-05-10 00:34:22 +02:00
Timo Rothenpieler
41a18982d0 avutil/hwcontext_cuda: add support for nvenc rgb formats 2018-05-10 00:34:22 +02:00
Timo Rothenpieler
9b82e333b7 avutil/hwcontext_cuda: explicitly synchronize cuMemcpy calls 2018-05-10 00:34:22 +02:00
Timo Rothenpieler
c855683427 avutil/hwcontext_cuda: add CUstream in cuda hwctx 2018-05-10 00:34:22 +02:00
Mark Thompson
1dc483a6f2 compat/cuda: Pass a logging context to load functions
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-11-20 15:47:05 +00:00
Yogender Gupta
3407d8118c hwcontext_cuda : Support YUV444P16 format
Signed-off-by: Philip Langdale <philipl@overt.org>
2017-08-03 15:25:35 -07:00
wm4
c16fe1432d hwcontext_cuda: implement frames_get_constraints
Copied and modified from hwcontext_qsv.c.
2017-01-23 16:21:18 +01:00
Timo Rothenpieler
52773a2c68 avutil/hwcontext_cuda: check for missing pixel format 2016-11-30 12:36:23 +01:00
Philip Langdale
8d6c358ea8 libavutil/hwcontext_cuda: Support P010 and P016 formats
CUVID is now capable of returning 10bit and 12bit decoded content
in P010/P016. Let's support transfering those formats.
2016-11-22 10:09:14 -08:00
Timo Rothenpieler
e6464a44ed avutil/hwcontext_cuda: use dynamically loaded CUDA 2016-11-22 10:34:27 +01:00
Timo Rothenpieler
a0d7ce1406 avutil/hwcontext_cuda: align allocated frames 2016-10-03 15:49:22 +02:00
Timo Rothenpieler
97e7f03d35 avutil/hwcontext_cuda: use proper synchronization flag 2016-09-29 22:58:34 +02:00
Hendrik Leppkes
c5a0c16850 Merge commit '2e219b491bcc0845248345fdad31231b081e06d1'
* commit '2e219b491bcc0845248345fdad31231b081e06d1':
  hwcontext_cuda: implement device creation

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-26 15:25:12 +02:00
Anton Khirnov
2e219b491b hwcontext_cuda: implement device creation 2016-05-26 15:40:33 +02:00
Derek Buitenhuis
6992276aca Merge commit 'ad884d100259e55cb51a4239cd8a4fd5154c2073'
* commit 'ad884d100259e55cb51a4239cd8a4fd5154c2073':
  hwcontext: add a CUDA implementation

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-24 15:23:16 +00:00
Anton Khirnov
ad884d1002 hwcontext: add a CUDA implementation 2016-02-14 22:08:33 +01:00