xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 15 10:56:51 UTC 2024


 hw/xwayland/xwayland-glamor-gbm.c |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 005912d82f290aa2556a43ef86dd16b666644443
Author: Simon Ser <contact at emersion.fr>
Date:   Mon Jan 8 13:14:06 2024 +0100

    xwayland/glamor/gbm: simplify render node check
    
    No need to call is_device_path_render_node() on each node, the
    index is the node type. Saves a couple of open()/close()/IOCTLs.
    
    Signed-off-by: Simon Ser <contact at emersion.fr>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1237>

diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 30eb953d6..975733235 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -861,21 +861,17 @@ static const char *
 get_render_node_path_for_device(const drmDevicePtr drm_device,
                                 const char *device_path)
 {
-    char *render_node_path = NULL;
-    char device_found = 0;
+    const char *render_node_path;
     int i;
 
-    for (i = 0; i < DRM_NODE_MAX; i++) {
-        if ((drm_device->available_nodes & (1 << i)) == 0)
-           continue;
-
-        if (!strcmp (device_path, drm_device->nodes[i]))
-            device_found = 1;
-
-        if (is_device_path_render_node(drm_device->nodes[i]))
-            render_node_path = drm_device->nodes[i];
+    if (!(drm_device->available_nodes & (1 << DRM_NODE_RENDER)))
+        return NULL;
+    render_node_path = drm_device->nodes[DRM_NODE_RENDER];
 
-        if (device_found && render_node_path)
+    for (i = 0; i < DRM_NODE_MAX; i++) {
+        if (!(drm_device->available_nodes & (1 << i)))
+            continue;
+        if (strcmp(device_path, drm_device->nodes[i]) == 0)
             return render_node_path;
     }
 


More information about the xorg-commit mailing list