[vlc-commits] commit: XCB: remove -x11-shm option ( =?UTF-8?Q?R=C3=A9mi=20Denis=2DCourmont=20?=)

git at videolan.org git at videolan.org
Sat Dec 4 19:27:41 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec  4 20:16:32 2010 +0200| [5984bb6aa1b9ddad1efc37295d1a2f26a46708b7] | committer: Rémi Denis-Courmont 

XCB: remove -x11-shm option

We have reliable error detection with XCB, so this option has become
mostly useless. For testing/debugging, the developer can hack the
CheckSHM() function to return false if really needed.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5984bb6aa1b9ddad1efc37295d1a2f26a46708b7
---

 modules/video_output/xcb/common.c  |   27 +++++++++++----------------
 modules/video_output/xcb/x11.c     |    8 ++------
 modules/video_output/xcb/xcb_vlc.h |    2 +-
 modules/video_output/xcb/xvideo.c  |    9 ++-------
 4 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/modules/video_output/xcb/common.c b/modules/video_output/xcb/common.c
index fc89cc6..cc44a4d 100644
--- a/modules/video_output/xcb/common.c
+++ b/modules/video_output/xcb/common.c
@@ -160,31 +160,26 @@ error:
 }
 
 /** Check MIT-SHM shared memory support */
-void CheckSHM (vlc_object_t *obj, xcb_connection_t *conn, bool *restrict pshm)
+bool CheckSHM (vlc_object_t *obj, xcb_connection_t *conn)
 {
 #ifdef HAVE_SYS_SHM_H
-    bool shm = var_InheritBool (obj, "x11-shm") > 0;
-    if (shm)
-    {
-        xcb_shm_query_version_cookie_t ck;
-        xcb_shm_query_version_reply_t *r;
+    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;
-        }
+    ck = xcb_shm_query_version (conn);
+    r = xcb_shm_query_version_reply (conn, ck, NULL);
+    if (r != NULL)
+    {
         free (r);
+        return true;
     }
-    *pshm = shm;
+    msg_Err (obj, "shared memory (MIT-SHM) not available");
+    msg_Warn (obj, "display will be slow");
 #else
     msg_Warn (obj, "shared memory (MIT-SHM) not implemented");
     (void) conn;
-    *pshm = false;
 #endif
+    return false;
 }
 
 /**
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index acd99c7..d9d8629 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -37,10 +37,6 @@
 
 #include "xcb_vlc.h"
 
-#define SHM_TEXT N_("Use shared memory")
-#define SHM_LONGTEXT N_( \
-    "Use shared memory to communicate between VLC and the X server.")
-
 static int  Open (vlc_object_t *);
 static void Close (vlc_object_t *);
 
@@ -56,7 +52,7 @@ vlc_module_begin ()
     set_callbacks (Open, Close)
     add_shortcut ("xcb-x11", "x11", "xid")
 
-    add_bool ("x11-shm", true, SHM_TEXT, SHM_LONGTEXT, true)
+    add_obsolete_bool ("x11-shm") /* obsoleted since 1.2.0 */
 vlc_module_end ()
 
 /* It must be large enough to absorb the server display jitter but it is
@@ -310,7 +306,7 @@ static int Open (vlc_object_t *obj)
 
     p_sys->visible = false;
 
-    CheckSHM (obj, p_sys->conn, &p_sys->shm);
+    p_sys->shm = CheckSHM (obj, p_sys->conn);
 
     /* */
     vout_display_info_t info = vd->info;
diff --git a/modules/video_output/xcb/xcb_vlc.h b/modules/video_output/xcb/xcb_vlc.h
index 0928f3e..f17c532 100644
--- a/modules/video_output/xcb/xcb_vlc.h
+++ b/modules/video_output/xcb/xcb_vlc.h
@@ -48,7 +48,7 @@ struct vout_window_t *GetWindow (vout_display_t *obj,
                                  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);
+bool CheckSHM (vlc_object_t *obj, xcb_connection_t *conn);
 xcb_cursor_t CreateBlankCursor (xcb_connection_t *, const xcb_screen_t *);
 void RegisterMouseEvents (vlc_object_t *, xcb_connection_t *, xcb_window_t);
 
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 69e6311..d812f36 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -49,10 +49,6 @@
     "XVideo image format id to use. By default, VLC will " \
     "try to use the best match for the video being played.")
 
-#define SHM_TEXT N_("Use shared memory")
-#define SHM_LONGTEXT N_( \
-    "Use shared memory to communicate between VLC and the X server.")
-
 static int  Open (vlc_object_t *);
 static void Close (vlc_object_t *);
 
@@ -71,8 +67,7 @@ vlc_module_begin ()
                  ADAPTOR_TEXT, ADAPTOR_LONGTEXT, true)
     add_integer ("xvideo-format-id", 0,
                  FORMAT_TEXT, FORMAT_LONGTEXT, true)
-    add_bool ("x11-shm", true, SHM_TEXT, SHM_LONGTEXT, true)
-        add_deprecated_alias ("xvideo-shm")
+    add_obsolete_bool ("xvideo-shm") /* removed in 1.2.0 */
     add_shortcut ("xcb-xv", "xv", "xvideo", "xid")
 vlc_module_end ()
 
@@ -542,7 +537,7 @@ static int Open (vlc_object_t *obj)
     /* Create cursor */
     p_sys->cursor = CreateBlankCursor (conn, screen);
 
-    CheckSHM (obj, conn, &p_sys->shm);
+    p_sys->shm = CheckSHM (obj, conn);
 
     /* */
     vout_display_info_t info = vd->info;



More information about the vlc-commits mailing list