/**
* 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;
}
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:
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
/* 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);
p_sys->visible = false;
+ CheckSHM (obj, p_sys->conn, &p_sys->shm);
+
/* */
vout_display_info_t info = vd->info;
info.has_pictures_invalid = true;
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,
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);
/* Create cursor */
p_sys->cursor = CreateBlankCursor (conn, screen);
- /* */
+ CheckSHM (obj, conn, &p_sys->shm);
/* */
vout_display_info_t info = vd->info;