Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
5b07bd99
Commit
5b07bd99
authored
Apr 24, 2015
by
Rémi Denis-Courmont
Browse files
vaapi: advance and simplify context allocation
parent
4b01d3cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/codec/avcodec/vaapi.c
View file @
5b07bd99
...
...
@@ -93,12 +93,8 @@ static void DestroySurfaces( vlc_va_sys_t *sys )
CopyCleanCache
(
&
sys
->
image_cache
);
}
if
(
sys
->
hw_ctx
.
context_id
!=
VA_INVALID_ID
)
vaDestroyContext
(
sys
->
hw_ctx
.
display
,
sys
->
hw_ctx
.
context_id
);
/* */
sys
->
image
.
image_id
=
VA_INVALID_ID
;
sys
->
hw_ctx
.
context_id
=
VA_INVALID_ID
;
sys
->
i_surface_width
=
0
;
sys
->
i_surface_height
=
0
;
vlc_mutex_destroy
(
&
sys
->
lock
);
...
...
@@ -111,16 +107,6 @@ static int CreateSurfaces( vlc_va_sys_t *sys, void **pp_hw_ctx, vlc_fourcc_t *pi
/* */
sys
->
image
.
image_id
=
VA_INVALID_ID
;
sys
->
hw_ctx
.
context_id
=
VA_INVALID_ID
;
/* Create a context */
if
(
vaCreateContext
(
sys
->
hw_ctx
.
display
,
sys
->
hw_ctx
.
config_id
,
i_width
,
i_height
,
VA_PROGRESSIVE
,
sys
->
surfaces
,
sys
->
count
,
&
sys
->
hw_ctx
.
context_id
))
{
sys
->
hw_ctx
.
context_id
=
VA_INVALID_ID
;
goto
error
;
}
/* Find and create a supported image chroma */
int
i_fmt_count
=
vaMaxNumImageFormats
(
sys
->
hw_ctx
.
display
);
...
...
@@ -369,6 +355,7 @@ static void Delete( vlc_va_t *va, AVCodecContext *avctx )
(
void
)
avctx
;
vaDestroyContext
(
sys
->
hw_ctx
.
display
,
sys
->
hw_ctx
.
context_id
);
vaDestroySurfaces
(
sys
->
hw_ctx
.
display
,
sys
->
surfaces
,
sys
->
count
);
vaDestroyConfig
(
sys
->
hw_ctx
.
display
,
sys
->
hw_ctx
.
config_id
);
vaTerminate
(
sys
->
hw_ctx
.
display
);
...
...
@@ -534,6 +521,16 @@ static int Create( vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
goto
error
;
}
/* Create a context */
if
(
vaCreateContext
(
sys
->
hw_ctx
.
display
,
sys
->
hw_ctx
.
config_id
,
ctx
->
coded_width
,
ctx
->
coded_height
,
VA_PROGRESSIVE
,
sys
->
surfaces
,
sys
->
count
,
&
sys
->
hw_ctx
.
context_id
))
{
sys
->
hw_ctx
.
context_id
=
VA_INVALID_ID
;
vaDestroySurfaces
(
sys
->
hw_ctx
.
display
,
sys
->
surfaces
,
sys
->
count
);
goto
error
;
}
vlc_mutex_init
(
&
sys
->
lock
);
va
->
sys
=
sys
;
...
...
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