[vlc-commits] [Git][videolan/vlc][master] 5 commits: xcb/window: missing #include

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Wed Apr 13 16:31:35 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
857a8f9c by Rémi Denis-Courmont at 2022-04-13T16:16:02+00:00
xcb/window: missing #include

- - - - -
90793652 by Rémi Denis-Courmont at 2022-04-13T16:16:02+00:00
xcb/window: remove stray #include

- - - - -
c6b1580f by Rémi Denis-Courmont at 2022-04-13T16:16:02+00:00
xcb/events: use logger internally

This uses a vout_display_t for historical reasons. We need to reuse this
code with another type of object now.

- - - - -
10963981 by Rémi Denis-Courmont at 2022-04-13T16:16:02+00:00
xcb/events: do not require a vout display

- - - - -
6d8cccee by Rémi Denis-Courmont at 2022-04-13T16:16:02+00:00
vdpau/display: drain the event queue

This adds the vlc_xcb_Manage() call to match the behaviour of the other
XCB-based displays.

- - - - -


6 changed files:

- modules/hw/vdpau/display.c
- modules/video_output/xcb/events.c
- modules/video_output/xcb/events.h
- modules/video_output/xcb/render.c
- modules/video_output/xcb/window.c
- modules/video_output/xcb/x11.c


Changes:

=====================================
modules/hw/vdpau/display.c
=====================================
@@ -148,6 +148,8 @@ static void Queue(vout_display_t *vd, picture_t *pic, subpicture_t *subpic,
     VdpOutputSurface surface = p_sys->surface;
     VdpStatus err;
 
+    vlc_xcb_Manage(vd->obj.logger, sys->conn);
+
     VdpPresentationQueueStatus status;
     VdpTime ts;
     err = vdp_presentation_queue_query_surface_status(sys->vdp, sys->queue,
@@ -298,11 +300,13 @@ static int Open(vout_display_t *vd,
     if (unlikely(sys == NULL))
         return VLC_ENOMEM;
 
+    struct vlc_logger *log = vd->obj.logger;
     const xcb_screen_t *screen;
-    if (vlc_xcb_parent_Create(vd, vd->cfg->window, &sys->conn, &screen) != VLC_SUCCESS)
+    int ret = vlc_xcb_parent_Create(log, vd->cfg->window, &sys->conn, &screen);
+    if (ret != VLC_SUCCESS)
     {
         free(sys);
-        return VLC_EGENERIC;
+        return ret;
     }
 
     vlc_decoder_device *dec_device = context ? vlc_video_context_HoldDevice(context) : NULL;
@@ -437,7 +441,7 @@ static int Open(vout_display_t *vd,
                 sys->window, vd->cfg->window->handle.xid, place.x, place.y,
                 place.width, place.height, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT,
                 screen->root_visual, mask, values);
-        if (vlc_xcb_error_Check(vd, sys->conn, "window creation failure", c))
+        if (vlc_xcb_error_Check(log, sys->conn, "window creation failure", c))
             goto error;
         msg_Dbg(vd, "using X11 window 0x%08"PRIx32, sys->window);
         xcb_map_window(sys->conn, sys->window);


=====================================
modules/video_output/xcb/events.c
=====================================
@@ -38,7 +38,7 @@ const char vlc_module_name[] = "xcb";
 
 #pragma GCC visibility push(default)
 
-int vlc_xcb_error_Check(vout_display_t *vd, xcb_connection_t *conn,
+int vlc_xcb_error_Check(struct vlc_logger *log, xcb_connection_t *conn,
                         const char *str, xcb_void_cookie_t ck)
 {
     xcb_generic_error_t *err;
@@ -49,7 +49,7 @@ int vlc_xcb_error_Check(vout_display_t *vd, xcb_connection_t *conn,
         int code = err->error_code;
 
         free (err);
-        msg_Err (vd, "%s: X11 error %d", str, code);
+        vlc_error(log, "%s: X11 error %d", str, code);
         assert (code != 0);
         return code;
     }
@@ -59,32 +59,32 @@ int vlc_xcb_error_Check(vout_display_t *vd, xcb_connection_t *conn,
 /**
  * Connect to the X server.
  */
-static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
+static xcb_connection_t *Connect(struct vlc_logger *log, const char *display)
 {
     xcb_connection_t *conn = xcb_connect (display, NULL);
     if (xcb_connection_has_error (conn) /*== NULL*/)
     {
-        msg_Err (obj, "cannot connect to X server (%s)",
-                 (display != NULL) ? display : "default");
+        vlc_error(log, "cannot connect to X server (%s)",
+                  (display != NULL) ? display : "default");
         xcb_disconnect (conn);
         return NULL;
     }
 
     const xcb_setup_t *setup = xcb_get_setup (conn);
-    msg_Dbg (obj, "connected to X%"PRIu16".%"PRIu16" server",
-             setup->protocol_major_version, setup->protocol_minor_version);
-    msg_Dbg (obj, " vendor : %.*s", (int)setup->vendor_len,
-             xcb_setup_vendor (setup));
-    msg_Dbg (obj, " version: %"PRIu32, setup->release_number);
+    vlc_debug(log, "connected to X%"PRIu16".%"PRIu16" server",
+              setup->protocol_major_version, setup->protocol_minor_version);
+    vlc_debug(log, " vendor : %.*s", (int)setup->vendor_len,
+              xcb_setup_vendor(setup));
+    vlc_debug(log, " version: %"PRIu32, setup->release_number);
     return conn;
 }
 
 /**
  * Find screen matching a given root window.
  */
-static const xcb_screen_t *FindScreen (vlc_object_t *obj,
-                                       xcb_connection_t *conn,
-                                       xcb_window_t root)
+static const xcb_screen_t *FindScreen(struct vlc_logger *log,
+                                      xcb_connection_t *conn,
+                                      xcb_window_t root)
 {
     /* Find the selected screen */
     const xcb_setup_t *setup = xcb_get_setup (conn);
@@ -93,25 +93,25 @@ static const xcb_screen_t *FindScreen (vlc_object_t *obj,
     {
         if (i.data->root == root)
         {
-            msg_Dbg (obj, "using screen 0x%"PRIx32, root);
+            vlc_debug(log, "using screen 0x%"PRIx32, root);
             return i.data;
         }
     }
-    msg_Err (obj, "window screen not found");
+    vlc_error(log, "window screen not found");
     return NULL;
 }
 
-int vlc_xcb_parent_Create(vout_display_t *vd, const vout_window_t *wnd,
+int vlc_xcb_parent_Create(struct vlc_logger *log, const vout_window_t *wnd,
                           xcb_connection_t **restrict pconn,
                           const xcb_screen_t **restrict pscreen)
 {
     if (wnd->type != VOUT_WINDOW_TYPE_XID)
     {
-        msg_Err (vd, "window not available");
+        vlc_error(log, "window not available");
         return VLC_ENOTSUP;
     }
 
-    xcb_connection_t *conn = Connect (VLC_OBJECT(vd), wnd->display.x11);
+    xcb_connection_t *conn = Connect(log, wnd->display.x11);
     if (conn == NULL)
         goto error;
     *pconn = conn;
@@ -121,11 +121,11 @@ int vlc_xcb_parent_Create(vout_display_t *vd, const vout_window_t *wnd,
                                 NULL);
     if (geo == NULL)
     {
-        msg_Err (vd, "window not valid");
+        vlc_error(log, "window not valid");
         goto error;
     }
 
-    const xcb_screen_t *screen = FindScreen (VLC_OBJECT(vd), conn, geo->root);
+    const xcb_screen_t *screen = FindScreen(log, conn, geo->root);
     free (geo);
     if (screen == NULL)
         goto error;
@@ -141,7 +141,7 @@ error:
 /**
  * Process an X11 event.
  */
-static int ProcessEvent(vout_display_t *vd, xcb_generic_event_t *ev)
+static int ProcessEvent(struct vlc_logger *log, xcb_generic_event_t *ev)
 {
     switch (ev->response_type & 0x7f)
     {
@@ -149,23 +149,23 @@ static int ProcessEvent(vout_display_t *vd, xcb_generic_event_t *ev)
             break;
 
         default:
-            msg_Dbg (vd, "unhandled event %"PRIu8, ev->response_type);
+            vlc_debug(log, "unhandled event %"PRIu8, ev->response_type);
     }
 
     free (ev);
     return VLC_SUCCESS;
 }
 
-int vlc_xcb_Manage(vout_display_t *vd, xcb_connection_t *conn)
+int vlc_xcb_Manage(struct vlc_logger *log, xcb_connection_t *conn)
 {
     xcb_generic_event_t *ev;
 
     while ((ev = xcb_poll_for_event (conn)) != NULL)
-        ProcessEvent(vd, ev);
+        ProcessEvent(log, ev);
 
     if (xcb_connection_has_error (conn))
     {
-        msg_Err (vd, "X server failure");
+        vlc_error(log, "X server failure");
         return VLC_EGENERIC;
     }
 


=====================================
modules/video_output/xcb/events.h
=====================================
@@ -24,14 +24,14 @@
 # define XCB_CURSOR_NONE ((xcb_cursor_t) 0U)
 #endif
 
-#include <vlc_vout_display.h>
+struct vlc_logger;
 
 /* events.c */
 
 /**
  * Checks for an XCB error.
  */
-int vlc_xcb_error_Check(vout_display_t *, xcb_connection_t *conn,
+int vlc_xcb_error_Check(struct vlc_logger *, xcb_connection_t *conn,
                         const char *str, xcb_void_cookie_t);
 
 /**
@@ -40,10 +40,10 @@ int vlc_xcb_error_Check(vout_display_t *, xcb_connection_t *conn,
  * Creates a VLC video X window object, connects to the corresponding X server,
  * finds the corresponding X server screen.
  */
-int vlc_xcb_parent_Create(vout_display_t *obj, const vout_window_t *wnd,
+int vlc_xcb_parent_Create(struct vlc_logger *, const vout_window_t *wnd,
                           xcb_connection_t **connp,
                           const xcb_screen_t **screenp);
 /**
  * Processes XCB events.
  */
-int vlc_xcb_Manage(vout_display_t *vd, xcb_connection_t *conn);
+int vlc_xcb_Manage(struct vlc_logger *, xcb_connection_t *conn);


=====================================
modules/video_output/xcb/render.c
=====================================
@@ -244,7 +244,7 @@ static void Display(vout_display_t *vd, picture_t *pic)
     xcb_connection_t *conn = sys->conn;
     xcb_void_cookie_t ck;
 
-    vlc_xcb_Manage(vd, conn);
+    vlc_xcb_Manage(vd->obj.logger, conn);
 
     /* Copy the scaled picture into the target picture, in other words
      * copy the rendered pixmap into the window.
@@ -554,6 +554,7 @@ static int Open(vout_display_t *vd,
                 video_format_t *fmtp, vlc_video_context *ctx)
 {
     vlc_object_t *obj = VLC_OBJECT(vd);
+    struct vlc_logger *log = obj->logger;
 
     vout_display_sys_t *sys = vlc_obj_malloc(obj, sizeof (*sys));
     if (unlikely(sys == NULL))
@@ -565,8 +566,9 @@ static int Open(vout_display_t *vd,
     xcb_connection_t *conn;
     const xcb_screen_t *screen;
 
-    if (vlc_xcb_parent_Create(vd, vd->cfg->window, &conn, &screen) != VLC_SUCCESS)
-        return VLC_EGENERIC;
+    int ret = vlc_xcb_parent_Create(log, vd->cfg->window, &conn, &screen);
+    if (ret != VLC_SUCCESS)
+        return ret;
 
     sys->conn = conn;
     sys->root = screen->root;


=====================================
modules/video_output/xcb/window.c
=====================================
@@ -46,10 +46,9 @@ typedef xcb_atom_t Atom;
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
+#include <vlc_actions.h>
 #include <vlc_vout_window.h>
 
-#include "events.h"
-
 typedef struct
 {
     xcb_connection_t *conn;


=====================================
modules/video_output/xcb/x11.c
=====================================
@@ -92,7 +92,7 @@ static void Display (vout_display_t *vd, picture_t *pic)
     xcb_shm_seg_t segment = sys->segment;
     xcb_void_cookie_t ck;
 
-    vlc_xcb_Manage(vd, sys->conn);
+    vlc_xcb_Manage(vd->obj.logger, sys->conn);
 
     /* Black out the borders */
     xcb_rectangle_t rectv[4], *rect;
@@ -321,12 +321,14 @@ static int Open (vout_display_t *vd,
     vd->sys = sys;
 
     /* Get window, connect to X server */
+    struct vlc_logger *log = vd->obj.logger;
     xcb_connection_t *conn;
     const xcb_screen_t *scr;
-    if (vlc_xcb_parent_Create(vd, vd->cfg->window, &conn, &scr) != VLC_SUCCESS)
+    int ret = vlc_xcb_parent_Create(log, vd->cfg->window, &conn, &scr);
+    if (ret != VLC_SUCCESS)
     {
         free (sys);
-        return VLC_EGENERIC;
+        return ret;
     }
     sys->conn = conn;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6d8a6416ae0c7a01690214362ee126573d2fcc79...6d8cccee3c269838d54e1fb6dc3f7bb356739f6f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6d8a6416ae0c7a01690214362ee126573d2fcc79...6d8cccee3c269838d54e1fb6dc3f7bb356739f6f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list