check the master_fd
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 7 Apr 2022 09:45:25 +0000 (18:45 +0900)
committerXuelian Bai <xuelian.bai@samsung.com>
Thu, 18 Jan 2024 01:31:56 +0000 (09:31 +0800)
Display Server(Enlightenment) always use the master_fd, so if the process can get the
master_fd from tbm_drm_helper_get_master_fd(), there is no need to get
the authentication information.
If the process does not have the master_fd, it needs to get the
authentication from the master process which is the Display
Server(Enlightenment).

Change-Id: Ib18113468b133c5335f1f280760383e40977062a

src/egl/drivers/dri2/platform_tizen.c

index 9bf72a5..502906f 100755 (executable)
@@ -1633,28 +1633,21 @@ dri2_initialize_tizen(_EGLDisplay *disp)
          }
          dri2_dpy->fd = loader_open_device(tbm_bufmgr_device_name);
 
-      } else {
-         if (!tbm_drm_helper_get_auth_info(&dri2_dpy->fd, NULL, NULL)) {
-
-            /* FIXME: tbm_drm_helper_get_auth_info() does not support the case of
-             *        display server for now. this code is fallback routine for
-             *        that Enlightenment Server fails on tbm_drm_helper_get_auth_info.
-             *        When tbm_drm_helper_get_auth_info() supports display server
-             *        case, then remove below routine.
-             */
-#if 1
+      } else if (tbm_drm_helper_get_master_fd() >= 0) {
+            // display server always has master_fd,
+            // so tbm_bufmgr_fd is the master_fd if it can get the tbm_master_fd.
             tbm_bufmgr_device_name = loader_get_device_name_for_fd(tbm_bufmgr_fd);
             if (tbm_bufmgr_device_name == NULL) {
                err = "DRI2: failed to get tbm_bufmgr device name";
                goto cleanup_device;
             }
             dri2_dpy->fd = loader_open_device(tbm_bufmgr_device_name);
-#else
+      } else {
+         if (!tbm_drm_helper_get_auth_info(&dri2_dpy->fd, NULL, NULL)) {
             err = "DRI2: failed to get fd from tbm_drm_helper_get_auth_info()";
             goto cleanup_device;
-#endif
          }
-       }
+      }
 
       dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd);
       if (dri2_dpy->driver_name == NULL) {