Rémi Denis-Courmont
2018-12-09 19:46:07 UTC
vlc | branch: master | Rémi Denis-Courmont <***@remlab.net> | Sun Dec 9 20:38:53 2018 +0200| [fdc57213fc257892c0d92212d65c41223424d057] | committer: Rémi Denis-Courmont
xcb: require MIT-SHM extension version 1.2
configure.ac | 2 +-
modules/video_output/xcb/pictures.c | 28 ++++++++++++++++++----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index 42498eae13..d34c2e60c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3098,7 +3098,7 @@ AS_IF([test "${enable_xcb}" != "no"], [
xcb_err="$xcb_err ${XCB_COMPOSITE_PKG_ERRORS}."])
PKG_CHECK_MODULES([XCB_RANDR], [xcb-randr >= 1.3],, [
xcb_err="$xcb_err ${XCB_RANDR_PKG_ERRORS}."])
- PKG_CHECK_MODULES([XCB_SHM], [xcb-shm],, [
+ PKG_CHECK_MODULES([XCB_SHM], [xcb-shm >= 1.9.2],, [
xcb_err="$xcb_err ${XCB_SHM_PKG_ERRORS}."])
PKG_CHECK_MODULES([XCB_XKB], [xcb-xkb],, [
xcb_err="$xcb_err ${XCB_XKB_PKG_ERRORS}."])
diff --git a/modules/video_output/xcb/pictures.c b/modules/video_output/xcb/pictures.c
index 92ff76db93..2d43eee689 100644
--- a/modules/video_output/xcb/pictures.c
+++ b/modules/video_output/xcb/pictures.c
@@ -48,23 +48,31 @@
/** Check MIT-SHM shared memory support */
bool XCB_shm_Check (vlc_object_t *obj, xcb_connection_t *conn)
{
-#ifdef HAVE_SYS_SHM_H
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 != NULL)
+ if (r == NULL)
{
- free (r);
- return true;
+ msg_Err(obj, "MIT-SHM extension not available");
+ goto fail;
}
- 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;
-#endif
+
+ msg_Dbg(obj, "MIT-SHM extension version %"PRIu16".%"PRIu16,
+ r->major_version, r->minor_version);
+
+ if (r->major_version == 1 && r->minor_version < 2)
+ {
+ msg_Err(obj, "MIT-SHM extension too old");
+ free(r);
+ goto fail;
+ }
+
+ free (r);
+ return true;
+fail:
+ msg_Warn(obj, "display will be slow");
return false;
}
xcb: require MIT-SHM extension version 1.2
http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fdc57213fc257892c0d92212d65c41223424d057
---configure.ac | 2 +-
modules/video_output/xcb/pictures.c | 28 ++++++++++++++++++----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/configure.ac b/configure.ac
index 42498eae13..d34c2e60c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3098,7 +3098,7 @@ AS_IF([test "${enable_xcb}" != "no"], [
xcb_err="$xcb_err ${XCB_COMPOSITE_PKG_ERRORS}."])
PKG_CHECK_MODULES([XCB_RANDR], [xcb-randr >= 1.3],, [
xcb_err="$xcb_err ${XCB_RANDR_PKG_ERRORS}."])
- PKG_CHECK_MODULES([XCB_SHM], [xcb-shm],, [
+ PKG_CHECK_MODULES([XCB_SHM], [xcb-shm >= 1.9.2],, [
xcb_err="$xcb_err ${XCB_SHM_PKG_ERRORS}."])
PKG_CHECK_MODULES([XCB_XKB], [xcb-xkb],, [
xcb_err="$xcb_err ${XCB_XKB_PKG_ERRORS}."])
diff --git a/modules/video_output/xcb/pictures.c b/modules/video_output/xcb/pictures.c
index 92ff76db93..2d43eee689 100644
--- a/modules/video_output/xcb/pictures.c
+++ b/modules/video_output/xcb/pictures.c
@@ -48,23 +48,31 @@
/** Check MIT-SHM shared memory support */
bool XCB_shm_Check (vlc_object_t *obj, xcb_connection_t *conn)
{
-#ifdef HAVE_SYS_SHM_H
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 != NULL)
+ if (r == NULL)
{
- free (r);
- return true;
+ msg_Err(obj, "MIT-SHM extension not available");
+ goto fail;
}
- 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;
-#endif
+
+ msg_Dbg(obj, "MIT-SHM extension version %"PRIu16".%"PRIu16,
+ r->major_version, r->minor_version);
+
+ if (r->major_version == 1 && r->minor_version < 2)
+ {
+ msg_Err(obj, "MIT-SHM extension too old");
+ free(r);
+ goto fail;
+ }
+
+ free (r);
+ return true;
+fail:
+ msg_Warn(obj, "display will be slow");
return false;
}