[vlc-devel] commit: Split MIT-SHM check out of GetWindow ( Rémi Denis-Courmont )
git version control
git at videolan.org
Thu Dec 10 22:31:37 CET 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Dec 10 23:11:51 2009 +0200| [ffe7e8d131425cf7a9f71f0dd1e9c5e16dcb7160] | committer: Rémi Denis-Courmont
Split MIT-SHM check out of GetWindow
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ffe7e8d131425cf7a9f71f0dd1e9c5e16dcb7160
---
modules/video_output/xcb/common.c | 47 ++++++++++++++++++-----------------
modules/video_output/xcb/x11.c | 5 ++-
modules/video_output/xcb/xcb_vlc.h | 4 +-
modules/video_output/xcb/xvideo.c | 4 +-
4 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/modules/video_output/xcb/common.c b/modules/video_output/xcb/common.c
index e538e65..c4ab50d 100644
--- a/modules/video_output/xcb/common.c
+++ b/modules/video_output/xcb/common.c
@@ -86,14 +86,12 @@ static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
/**
* Create a VLC video X window object, connect to the corresponding X server,
- * find the corresponding X server screen,
- * and probe the MIT-SHM extension.
+ * find the corresponding X server screen.
*/
vout_window_t *GetWindow (vout_display_t *vd,
xcb_connection_t **restrict pconn,
const xcb_screen_t **restrict pscreen,
- uint8_t *restrict pdepth,
- bool *restrict pshm)
+ uint8_t *restrict pdepth)
{
/* Get window */
xcb_window_t root;
@@ -166,27 +164,8 @@ vout_window_t *GetWindow (vout_display_t *vd,
}
msg_Dbg (vd, "using screen 0x%"PRIx32, root);
- /* Check MIT-SHM shared memory support */
- bool shm = var_CreateGetBool (vd, "x11-shm") > 0;
- if (shm)
- {
- xcb_shm_query_version_cookie_t ck;
- xcb_shm_query_version_reply_t *r;
-
- ck = xcb_shm_query_version (conn);
- r = xcb_shm_query_version_reply (conn, ck, NULL);
- if (!r)
- {
- msg_Err (vd, "shared memory (MIT-SHM) not available");
- msg_Warn (vd, "display will be slow");
- shm = false;
- }
- free (r);
- }
-
*pconn = conn;
*pscreen = screen;
- *pshm = shm;
return wnd;
error:
@@ -213,6 +192,28 @@ int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
return 0;
}
+/** Check MIT-SHM shared memory support */
+void CheckSHM (vlc_object_t *obj, xcb_connection_t *conn, bool *restrict pshm)
+{
+ bool shm = var_CreateGetBool (obj, "x11-shm") > 0;
+ if (shm)
+ {
+ xcb_shm_query_version_cookie_t ck;
+ xcb_shm_query_version_reply_t *r;
+
+ ck = xcb_shm_query_version (conn);
+ r = xcb_shm_query_version_reply (conn, ck, NULL);
+ if (!r)
+ {
+ msg_Err (obj, "shared memory (MIT-SHM) not available");
+ msg_Warn (obj, "display will be slow");
+ shm = false;
+ }
+ free (r);
+ }
+ *pshm = shm;
+}
+
/**
* Create a blank cursor.
* Note that the pixmaps are leaked (until the X disconnection). Hence, this
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index d1b3e3b..13b9c0b 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -105,8 +105,7 @@ static int Open (vlc_object_t *obj)
/* Get window, connect to X server */
const xcb_screen_t *scr;
- p_sys->embed = GetWindow (vd, &p_sys->conn, &scr, &p_sys->depth,
- &p_sys->shm);
+ p_sys->embed = GetWindow (vd, &p_sys->conn, &scr, &p_sys->depth);
if (p_sys->embed == NULL)
{
free (p_sys);
@@ -272,6 +271,8 @@ static int Open (vlc_object_t *obj)
p_sys->visible = false;
+ CheckSHM (obj, p_sys->conn, &p_sys->shm);
+
/* */
vout_display_info_t info = vd->info;
info.has_pictures_invalid = true;
diff --git a/modules/video_output/xcb/xcb_vlc.h b/modules/video_output/xcb/xcb_vlc.h
index 96babf7..f744738 100644
--- a/modules/video_output/xcb/xcb_vlc.h
+++ b/modules/video_output/xcb/xcb_vlc.h
@@ -41,10 +41,10 @@ int ProcessKeyEvent (key_handler_t *, xcb_generic_event_t *);
struct vout_window_t *GetWindow (vout_display_t *obj,
xcb_connection_t **restrict pconn,
const xcb_screen_t **restrict pscreen,
- uint8_t *restrict pdepth,
- bool *restrict pshm);
+ uint8_t *restrict pdepth);
int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
unsigned *restrict width, unsigned *restrict height);
+void CheckSHM (vlc_object_t *obj, xcb_connection_t *conn, bool *restrict pshm);
xcb_cursor_t CreateBlankCursor (xcb_connection_t *, const xcb_screen_t *);
int CheckError (vout_display_t *, xcb_connection_t *conn,
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 6bb8873..e8798d5 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -301,7 +301,7 @@ static int Open (vlc_object_t *obj)
xcb_connection_t *conn;
const xcb_screen_t *screen;
uint8_t depth;
- p_sys->embed = GetWindow (vd, &conn, &screen, &depth, &p_sys->shm);
+ p_sys->embed = GetWindow (vd, &conn, &screen, &depth);
if (p_sys->embed == NULL)
{
free (p_sys);
@@ -501,7 +501,7 @@ static int Open (vlc_object_t *obj)
/* Create cursor */
p_sys->cursor = CreateBlankCursor (conn, screen);
- /* */
+ CheckSHM (obj, conn, &p_sys->shm);
/* */
vout_display_info_t info = vd->info;
More information about the vlc-devel
mailing list