set TDM_DRM_MASTER_FD 42/65542/1
authorBoram Park <boram1288.park@samsung.com>
Tue, 22 Mar 2016 08:45:53 +0000 (17:45 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 11 Apr 2016 10:39:48 +0000 (19:39 +0900)
Change-Id: I1c0dd6d661bc176db372f1cd98e108821c1c62b0

src/tdm_drm.c

index ab2ee53..c0059a6 100644 (file)
@@ -223,12 +223,23 @@ tdm_drm_init(tdm_display *dpy, tdm_error *error)
 
        drm_data->dpy = dpy;
 
-       drm_data->drm_fd = _tdm_drm_open_drm();
+       /* The drm master fd can be opened by a tbm backend module in
+        * tbm_bufmgr_init() time. In this case, we just get it from
+        * TBM_DRM_MASTER_FD enviroment.
+        * 
+        */
+       drm_data->drm_fd = tdm_helper_get_fd("TBM_DRM_MASTER_FD");
+       if (drm_data->drm_fd < 0)
+               drm_data->drm_fd = _tdm_drm_open_drm();
+
        if (drm_data->drm_fd < 0) {
                ret = TDM_ERROR_OPERATION_FAILED;
                goto failed;
        }
 
+       /* To share the drm master fd with other modules in display server side. */
+       tdm_helper_set_fd("TDM_DRM_MASTER_FD", drm_data->drm_fd);
+
 #if LIBDRM_MAJOR_VERSION >= 2 && LIBDRM_MINOR_VERSION >= 4  && LIBDRM_MICRO_VERSION >= 47
        if (drmSetClientCap(drm_data->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0) {
                TDM_WRN("Set DRM_CLIENT_CAP_UNIVERSAL_PLANES failed");