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

XCB: get rid of -lxcb_image

It made things more complicated for MIT-SHM.
parent c8b8cca4
...@@ -4202,7 +4202,6 @@ AS_IF([test "${enable_xcb}" != "no"], [ ...@@ -4202,7 +4202,6 @@ AS_IF([test "${enable_xcb}" != "no"], [
dnl xcb-utils dnl xcb-utils
PKG_CHECK_MODULES(XCB_AUX, [xcb-aux]) PKG_CHECK_MODULES(XCB_AUX, [xcb-aux])
PKG_CHECK_MODULES(XCB_IMAGE, [xcb-image])
PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms]) PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms])
VLC_ADD_PLUGIN([xcb]) VLC_ADD_PLUGIN([xcb])
......
...@@ -26,12 +26,10 @@ libxcb_plugin_la_SOURCES = \ ...@@ -26,12 +26,10 @@ libxcb_plugin_la_SOURCES = \
xcb/events.c xcb/events.c
libxcb_plugin_la_CFLAGS = $(AM_CFLAGS) \ libxcb_plugin_la_CFLAGS = $(AM_CFLAGS) \
$(XCB_CFLAGS) $(XCB_SHM_CFLAGS) \ $(XCB_CFLAGS) $(XCB_SHM_CFLAGS) \
$(XPROTO_CFLAGS) \ $(XPROTO_CFLAGS)
$(XCB_IMAGE_CFLAGS)
libxcb_plugin_la_LIBADD = $(AM_LIBADD) \ libxcb_plugin_la_LIBADD = $(AM_LIBADD) \
$(XCB_LIBS) $(XCB_SHM_LIBS) \ $(XCB_LIBS) $(XCB_SHM_LIBS) \
$(XPROTO_LIBS) \ $(XPROTO_LIBS)
$(XCB_IMAGE_LIBS)
libxcb_plugin_la_DEPENDENCIES = libxcb_plugin_la_DEPENDENCIES =
libxcb_window_plugin_la_SOURCES = xcb/window.c xcb/keys.c libxcb_window_plugin_la_SOURCES = xcb/window.c xcb/keys.c
......
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include <xcb/shm.h> #include <xcb/shm.h>
#include <xcb/xcb_image.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_vout.h> #include <vlc_vout.h>
...@@ -377,7 +375,6 @@ static void Close (vlc_object_t *obj) ...@@ -377,7 +375,6 @@ static void Close (vlc_object_t *obj)
struct picture_sys_t struct picture_sys_t
{ {
xcb_connection_t *conn; /* Shared connection to X server */ xcb_connection_t *conn; /* Shared connection to X server */
xcb_image_t *image; /* Picture buffer */
xcb_shm_seg_t segment; /* Shared memory segment X ID */ xcb_shm_seg_t segment; /* Shared memory segment X ID */
}; };
...@@ -399,10 +396,8 @@ static int PictureInit (vout_thread_t *vout, picture_t *pic) ...@@ -399,10 +396,8 @@ static int PictureInit (vout_thread_t *vout, picture_t *pic)
void *shm = SHM_ERR; void *shm = SHM_ERR;
const size_t size = pic->p->i_pitch * pic->p->i_lines; const size_t size = pic->p->i_pitch * pic->p->i_lines;
if (p_sys->shm) /* Allocate shared memory segment */
{ /* Allocate shared memory segment */
int id = shmget (IPC_PRIVATE, size, IPC_CREAT | 0700); int id = shmget (IPC_PRIVATE, size, IPC_CREAT | 0700);
if (id == -1) if (id == -1)
{ {
msg_Err (vout, "shared memory allocation error: %m"); msg_Err (vout, "shared memory allocation error: %m");
...@@ -418,53 +413,31 @@ static int PictureInit (vout_thread_t *vout, picture_t *pic) ...@@ -418,53 +413,31 @@ static int PictureInit (vout_thread_t *vout, picture_t *pic)
goto error; goto error;
} }
if (p_sys->shm)
{
/* Attach the segment to X */ /* Attach the segment to X */
xcb_void_cookie_t ck; xcb_void_cookie_t ck;
priv->segment = xcb_generate_id (p_sys->conn); priv->segment = xcb_generate_id (p_sys->conn);
ck = xcb_shm_attach_checked (p_sys->conn, priv->segment, id, 1); ck = xcb_shm_attach_checked (p_sys->conn, priv->segment, id, 1);
shmctl (id, IPC_RMID, 0);
if (CheckError (vout, "shared memory server-side error", ck)) if (CheckError (vout, "shared memory server-side error", ck))
{ {
msg_Info (vout, "using buggy X (remote) server? SSH?"); msg_Info (vout, "using buggy X11 server - SSH proxying?");
shmdt (shm); priv->segment = 0;
shm = SHM_ERR;
} }
} }
else else
priv->segment = 0; priv->segment = 0;
const unsigned real_width = pic->p->i_pitch / (p_sys->bpp >> 3); shmctl (id, IPC_RMID, 0);
/* FIXME: anyway to getthing more intuitive than that?? */
xcb_image_t *img;
img = xcb_image_create (real_width, pic->p->i_lines,
XCB_IMAGE_FORMAT_Z_PIXMAP, p_sys->pad,
p_sys->depth, p_sys->bpp, p_sys->bpp,
p_sys->byte_order, XCB_IMAGE_ORDER_MSB_FIRST,
NULL,
(shm != SHM_ERR) ? size : 0,
(shm != SHM_ERR) ? shm : NULL);
if (img == NULL)
{
if (shm != SHM_ERR)
xcb_shm_detach (p_sys->conn, priv->segment);
goto error;
}
priv->conn = p_sys->conn; priv->conn = p_sys->conn;
priv->image = img;
pic->p_sys = priv; pic->p_sys = priv;
pic->p->p_pixels = img->data; pic->p->p_pixels = shm;
pic->i_status = DESTROYED_PICTURE; pic->i_status = DESTROYED_PICTURE;
pic->i_type = DIRECT_PICTURE; pic->i_type = DIRECT_PICTURE;
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
if (shm != SHM_ERR)
shmdt (shm);
free (priv); free (priv);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -480,9 +453,8 @@ static void PictureDeinit (picture_t *pic) ...@@ -480,9 +453,8 @@ static void PictureDeinit (picture_t *pic)
if (p_sys->segment != 0) if (p_sys->segment != 0)
{ {
xcb_shm_detach (p_sys->conn, p_sys->segment); xcb_shm_detach (p_sys->conn, p_sys->segment);
shmdt (p_sys->image->data); shmdt (pic->p->p_pixels);
} }
xcb_image_destroy (p_sys->image);
free (p_sys); free (p_sys);
} }
...@@ -571,21 +543,21 @@ static void Display (vout_thread_t *vout, picture_t *pic) ...@@ -571,21 +543,21 @@ static void Display (vout_thread_t *vout, picture_t *pic)
{ {
vout_sys_t *p_sys = vout->p_sys; vout_sys_t *p_sys = vout->p_sys;
picture_sys_t *priv = pic->p_sys; picture_sys_t *priv = pic->p_sys;
xcb_image_t *img = priv->image;
if (img->base == NULL) if (priv->segment)
{ xcb_shm_put_image (p_sys->conn, p_sys->window, p_sys->gc,
xcb_shm_segment_info_t info = { /* real width */ pic->p->i_pitch / pic->p->i_pixel_pitch,
.shmseg = priv->segment, /* real height */ pic->p->i_lines, /* x */ 0, /* y */ 0,
.shmid = -1, /* lost track of it, unimportant */ /* width */ pic->p->i_visible_pitch / pic->p->i_pixel_pitch,
.shmaddr = img->data, /* height */ pic->p->i_visible_lines, /* x */ 0, /* y */ 0,
}; p_sys->depth, XCB_IMAGE_FORMAT_Z_PIXMAP,
0, priv->segment, 0);
xcb_image_shm_put (p_sys->conn, p_sys->window, p_sys->gc, img, info,
0, 0, 0, 0, img->width, img->height, 0);
}
else else
xcb_image_put (p_sys->conn, p_sys->window, p_sys->gc, img, 0, 0, 0); xcb_put_image (p_sys->conn, XCB_IMAGE_FORMAT_Z_PIXMAP,
p_sys->window, p_sys->gc,
pic->p->i_pitch / pic->p->i_pixel_pitch,
pic->p->i_lines, 0, 0, 0, p_sys->depth,
pic->p->i_pitch * pic->p->i_lines, pic->p->p_pixels);
xcb_flush (p_sys->conn); xcb_flush (p_sys->conn);
} }
......
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