Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
bf697698
Commit
bf697698
authored
Jul 14, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vdpau: use custom picture destroy callback
parent
1a5c86d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
41 deletions
+52
-41
modules/hw/vdpau/display.c
modules/hw/vdpau/display.c
+52
-41
No files found.
modules/hw/vdpau/display.c
View file @
bf697698
...
...
@@ -52,8 +52,6 @@ vlc_module_begin()
add_shortcut
(
"vdpau"
,
"xid"
)
vlc_module_end
()
#define MAX_PICTURES (32)
struct
vout_display_sys_t
{
xcb_connection_t
*
conn
;
/**< XCB connection */
...
...
@@ -69,47 +67,73 @@ struct vout_display_sys_t
VdpRGBAFormat
rgb_fmt
;
/**< Output surface format */
picture_pool_t
*
pool
;
/**< pictures pool */
picture_sys_t
*
pics
[
MAX_PICTURES
];
};
static
void
pictureSys_DestroyVDPAU
(
picture_sys_t
*
psys
)
{
vdp_output_surface_destroy
(
psys
->
vdp
,
psys
->
surface
);
vdp_release_x11
(
psys
->
vdp
);
free
(
psys
);
}
static
void
PictureDestroyVDPAU
(
picture_t
*
pic
)
{
pictureSys_DestroyVDPAU
(
pic
->
p_sys
);
free
(
pic
);
}
static
VdpStatus
picture_NewVDPAU
(
vdp_t
*
vdp
,
VdpRGBAFormat
rgb_fmt
,
const
video_format_t
*
restrict
fmt
,
picture_t
**
restrict
picp
)
{
picture_sys_t
*
psys
=
malloc
(
sizeof
(
*
psys
));
if
(
unlikely
(
psys
==
NULL
))
return
VDP_STATUS_RESOURCES
;
psys
->
vdp
=
vdp_hold_x11
(
vdp
,
&
psys
->
device
);
VdpStatus
err
=
vdp_output_surface_create
(
psys
->
vdp
,
psys
->
device
,
rgb_fmt
,
fmt
->
i_visible_width
,
fmt
->
i_visible_height
,
&
psys
->
surface
);
if
(
err
!=
VDP_STATUS_OK
)
{
vdp_release_x11
(
psys
->
vdp
);
free
(
psys
);
return
err
;
}
picture_resource_t
res
=
{
.
p_sys
=
psys
,
.
pf_destroy
=
PictureDestroyVDPAU
,
};
picture_t
*
pic
=
picture_NewFromResource
(
fmt
,
&
res
);
if
(
unlikely
(
pic
==
NULL
))
{
pictureSys_DestroyVDPAU
(
psys
);
return
VDP_STATUS_RESOURCES
;
}
*
picp
=
pic
;
return
VDP_STATUS_OK
;
}
static
picture_pool_t
*
PoolAlloc
(
vout_display_t
*
vd
,
unsigned
requested_count
)
{
vout_display_sys_t
*
sys
=
vd
->
sys
;
const
video_format_t
*
fmt
=
&
vd
->
fmt
;
picture_t
*
pics
[
MAX_PICTURES
];
picture_resource_t
res
=
{
.
p_sys
=
NULL
};
if
(
requested_count
>
MAX_PICTURES
)
requested_count
=
MAX_PICTURES
;
picture_t
*
pics
[
requested_count
];
unsigned
count
=
0
;
while
(
count
<
requested_count
)
{
picture_sys_t
*
psys
=
malloc
(
sizeof
(
*
psys
));
if
(
unlikely
(
psys
==
NULL
))
break
;
VdpStatus
err
=
vdp_output_surface_create
(
sys
->
vdp
,
sys
->
device
,
sys
->
rgb_fmt
,
fmt
->
i_visible_width
,
fmt
->
i_visible_height
,
&
psys
->
surface
);
VdpStatus
err
=
picture_NewVDPAU
(
sys
->
vdp
,
sys
->
rgb_fmt
,
&
vd
->
fmt
,
pics
+
count
);
if
(
err
!=
VDP_STATUS_OK
)
{
free
(
psys
);
msg_Err
(
vd
,
"%s creation failure: %s"
,
"output surface"
,
vdp_get_error_string
(
sys
->
vdp
,
err
));
break
;
}
psys
->
device
=
sys
->
device
;
psys
->
vdp
=
sys
->
vdp
;
res
.
p_sys
=
psys
;
pics
[
count
]
=
picture_NewFromResource
(
&
vd
->
fmt
,
&
res
);
if
(
pics
[
count
]
==
NULL
)
{
free
(
psys
);
break
;
}
sys
->
pics
[
count
++
]
=
res
.
p_sys
;
count
++
;
}
sys
->
current
=
NULL
;
return
count
?
picture_pool_New
(
count
,
pics
)
:
NULL
;
...
...
@@ -119,17 +143,6 @@ static void PoolFree(vout_display_t *vd, picture_pool_t *pool)
{
vout_display_sys_t
*
sys
=
vd
->
sys
;
for
(
unsigned
count
=
0
;
count
<
MAX_PICTURES
;
count
++
)
{
picture_sys_t
*
psys
=
sys
->
pics
[
count
];
if
(
psys
==
NULL
)
continue
;
VdpStatus
err
=
vdp_output_surface_destroy
(
sys
->
vdp
,
psys
->
surface
);
if
(
err
!=
VDP_STATUS_OK
)
msg_Err
(
vd
,
"%s destruction failure: %s"
,
"output surface"
,
vdp_get_error_string
(
sys
->
vdp
,
err
));
}
if
(
sys
->
current
!=
NULL
)
picture_Release
(
sys
->
current
);
picture_pool_Delete
(
pool
);
...
...
@@ -626,8 +639,6 @@ static int Open(vlc_object_t *obj)
sys
->
cursor
=
XCB_cursor_Create
(
sys
->
conn
,
screen
);
sys
->
pool
=
NULL
;
for
(
unsigned
count
=
0
;
count
<
MAX_PICTURES
;
count
++
)
sys
->
pics
[
count
]
=
NULL
;
/* */
vd
->
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