Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
05f8b2ca
Commit
05f8b2ca
authored
Sep 12, 2023
by
Roman Arzumanyan
Committed by
Timo Rothenpieler
Sep 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/hwcontext_cuda: add option to use current device context
Signed-off-by:
Timo Rothenpieler
<
timo@rothenpieler.org
>
parent
48fc414c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
6 deletions
+41
-6
configure
configure
+5
-4
APIchanges
doc/APIchanges
+3
-0
hwcontext_cuda.c
libavutil/hwcontext_cuda.c
+27
-1
hwcontext_cuda.h
libavutil/hwcontext_cuda.h
+5
-0
version.h
libavutil/version.h
+1
-1
No files found.
configure
View file @
05f8b2ca
...
...
@@ -6577,10 +6577,11 @@ fi
if
!
disabled ffnvcodec
;
then
ffnv_hdr_list
=
"ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h"
check_pkg_config ffnvcodec
"ffnvcodec >= 12.0.16.0"
"
$ffnv_hdr_list
"
""
||
\
check_pkg_config ffnvcodec
"ffnvcodec >= 11.1.5.2 ffnvcodec < 12.0"
"
$ffnv_hdr_list
"
""
||
\
check_pkg_config ffnvcodec
"ffnvcodec >= 11.0.10.2 ffnvcodec < 11.1"
"
$ffnv_hdr_list
"
""
||
\
check_pkg_config ffnvcodec
"ffnvcodec >= 8.1.24.14 ffnvcodec < 8.2"
"
$ffnv_hdr_list
"
""
check_pkg_config ffnvcodec
"ffnvcodec >= 12.1.14.0"
"
$ffnv_hdr_list
"
""
||
\
check_pkg_config ffnvcodec
"ffnvcodec >= 12.0.16.1 ffnvcodec < 12.1"
"
$ffnv_hdr_list
"
""
||
\
check_pkg_config ffnvcodec
"ffnvcodec >= 11.1.5.3 ffnvcodec < 12.0"
"
$ffnv_hdr_list
"
""
||
\
check_pkg_config ffnvcodec
"ffnvcodec >= 11.0.10.3 ffnvcodec < 11.1"
"
$ffnv_hdr_list
"
""
||
\
check_pkg_config ffnvcodec
"ffnvcodec >= 8.1.24.15 ffnvcodec < 8.2"
"
$ffnv_hdr_list
"
""
fi
if
enabled_all libglslang libshaderc
;
then
...
...
doc/APIchanges
View file @
05f8b2ca
...
...
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
API changes, most recent first:
2023-09-28 - xxxxxxxxxx - lavu 58.26.100 - hwcontext_cuda.h
Add AV_CUDA_USE_CURRENT_CONTEXT.
2023-09-19 - xxxxxxxxxx - lavu 58.25.100 - avutil.h
Make AV_TIME_BASE_Q compatible with C++.
...
...
libavutil/hwcontext_cuda.c
View file @
05f8b2ca
...
...
@@ -361,6 +361,11 @@ static int cuda_context_init(AVHWDeviceContext *device_ctx, int flags) {
hwctx
->
internal
->
cuda_device
));
if
(
ret
<
0
)
return
ret
;
}
else
if
(
flags
&
AV_CUDA_USE_CURRENT_CONTEXT
)
{
ret
=
CHECK_CU
(
cu
->
cuCtxGetCurrent
(
&
hwctx
->
cuda_ctx
));
if
(
ret
<
0
)
return
ret
;
av_log
(
device_ctx
,
AV_LOG_INFO
,
"Using current CUDA context.
\n
"
);
}
else
{
ret
=
CHECK_CU
(
cu
->
cuCtxCreate
(
&
hwctx
->
cuda_ctx
,
desired_flags
,
hwctx
->
internal
->
cuda_device
));
...
...
@@ -382,8 +387,21 @@ static int cuda_flags_from_opts(AVHWDeviceContext *device_ctx,
AVDictionary
*
opts
,
int
*
flags
)
{
AVDictionaryEntry
*
primary_ctx_opt
=
av_dict_get
(
opts
,
"primary_ctx"
,
NULL
,
0
);
AVDictionaryEntry
*
current_ctx_opt
=
av_dict_get
(
opts
,
"current_ctx"
,
NULL
,
0
);
int
use_primary_ctx
=
0
,
use_current_ctx
=
0
;
if
(
primary_ctx_opt
)
use_primary_ctx
=
strtol
(
primary_ctx_opt
->
value
,
NULL
,
10
);
if
(
current_ctx_opt
)
use_current_ctx
=
strtol
(
current_ctx_opt
->
value
,
NULL
,
10
);
if
(
primary_ctx_opt
&&
strtol
(
primary_ctx_opt
->
value
,
NULL
,
10
))
{
if
(
use_primary_ctx
&&
use_current_ctx
)
{
av_log
(
device_ctx
,
AV_LOG_ERROR
,
"Requested both primary and current CUDA context simultaneously.
\n
"
);
return
AVERROR
(
EINVAL
);
}
if
(
primary_ctx_opt
&&
use_primary_ctx
)
{
av_log
(
device_ctx
,
AV_LOG_VERBOSE
,
"Using CUDA primary device context
\n
"
);
*
flags
|=
AV_CUDA_USE_PRIMARY_CONTEXT
;
}
else
if
(
primary_ctx_opt
)
{
...
...
@@ -391,6 +409,14 @@ static int cuda_flags_from_opts(AVHWDeviceContext *device_ctx,
*
flags
&=
~
AV_CUDA_USE_PRIMARY_CONTEXT
;
}
if
(
current_ctx_opt
&&
use_current_ctx
)
{
av_log
(
device_ctx
,
AV_LOG_VERBOSE
,
"Using CUDA current device context
\n
"
);
*
flags
|=
AV_CUDA_USE_CURRENT_CONTEXT
;
}
else
if
(
current_ctx_opt
)
{
av_log
(
device_ctx
,
AV_LOG_VERBOSE
,
"Disabling use of CUDA current device context
\n
"
);
*
flags
&=
~
AV_CUDA_USE_CURRENT_CONTEXT
;
}
return
0
;
}
...
...
libavutil/hwcontext_cuda.h
View file @
05f8b2ca
...
...
@@ -62,6 +62,11 @@ typedef struct AVCUDADeviceContext {
*/
#define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0)
/**
* Use current device context instead of creating a new one.
*/
#define AV_CUDA_USE_CURRENT_CONTEXT (1 << 1)
/**
* @}
*/
...
...
libavutil/version.h
View file @
05f8b2ca
...
...
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 58
#define LIBAVUTIL_VERSION_MINOR 2
5
#define LIBAVUTIL_VERSION_MINOR 2
6
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment