Commit 792f9eb5 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

XCB: pass shared memory segment XID as parameter of picture allocation

parent 6922be48
......@@ -71,7 +71,8 @@ bool XCB_shm_Check (vlc_object_t *obj, xcb_connection_t *conn)
* the X server (MIT-SHM extension).
*/
int XCB_pictures_Alloc (vout_display_t *vd, picture_resource_t *res,
size_t size, xcb_connection_t *conn, bool attach)
size_t size, xcb_connection_t *conn,
xcb_shm_seg_t segment)
{
res->p_sys = malloc (sizeof(*res->p_sys));
if (!res->p_sys)
......@@ -97,15 +98,9 @@ int XCB_pictures_Alloc (vout_display_t *vd, picture_resource_t *res,
return VLC_EGENERIC;
}
xcb_shm_seg_t segment;
if (attach)
{
/* Attach the segment to X */
xcb_void_cookie_t ck;
segment = xcb_generate_id (conn);
ck = xcb_shm_attach_checked (conn, segment, id, 1);
if (segment != 0)
{ /* Attach the segment to X */
xcb_void_cookie_t ck = xcb_shm_attach_checked (conn, segment, id, 1);
switch (XCB_error_Check (vd, conn, "shared memory server-side error",
ck))
{
......@@ -130,8 +125,6 @@ int XCB_pictures_Alloc (vout_display_t *vd, picture_resource_t *res,
segment = 0;
}
}
else
segment = 0;
shmctl (id, IPC_RMID, NULL);
res->p_sys->segment = segment;
......
......@@ -37,5 +37,5 @@ struct picture_sys_t
xcb_shm_seg_t segment;
};
int XCB_pictures_Alloc (vout_display_t *, picture_resource_t *, size_t size,
xcb_connection_t *, bool attach);
xcb_connection_t *, xcb_shm_seg_t);
void XCB_pictures_Free (picture_resource_t *, xcb_connection_t *);
......@@ -384,7 +384,8 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
res->p->i_lines = pic->p->i_lines;
res->p->i_pitch = pic->p->i_pitch;
if (XCB_pictures_Alloc (vd, res, res->p->i_pitch * res->p->i_lines,
sys->conn, sys->shm))
sys->conn,
sys->shm ? xcb_generate_id(sys->conn) : 0))
break;
pic_array[count] = picture_NewFromResource (&vd->fmt, res);
if (!pic_array[count])
......
......@@ -640,6 +640,7 @@ static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
for (count = 0; count < requested_count; count++)
{
picture_resource_t *res = &p_sys->resource[count];
xcb_shm_seg_t seg = p_sys->shm ? xcb_generate_id (p_sys->conn) : 0;
for (unsigned i = 0; i < num_planes; i++)
{
......@@ -651,7 +652,7 @@ static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
}
if (XCB_pictures_Alloc (vd, res, p_sys->att->data_size,
p_sys->conn, p_sys->shm))
p_sys->conn, seg))
break;
/* Allocate further planes as specified by XVideo */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment