not using enviroment variable to get drm fd 19/150719/1
authorBoram Park <boram1288.park@samsung.com>
Fri, 15 Sep 2017 07:40:31 +0000 (16:40 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 18 Sep 2017 09:41:56 +0000 (18:41 +0900)
Change-Id: I40dd51f782371a8f1667e75288e58e437889dd53

src/tdm_sprd.c

index 75e9222..040441c 100755 (executable)
@@ -8,6 +8,7 @@
 
 #include "tdm_sprd.h"
 #include <tdm_helper.h>
+#include <tbm_drm_helper.h>
 
 #define SET_DRM_IRQ
 
@@ -215,21 +216,21 @@ tdm_sprd_init(tdm_display *dpy, tdm_error *error)
        sprd_data->drm_fd = -1;
 
        /* 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.
-        *
+        * tbm_bufmgr_init() time. In this case, we just get it from tbm.
         */
-       sprd_data->drm_fd = tdm_helper_get_fd("TBM_DRM_MASTER_FD");
-       if (sprd_data->drm_fd < 0)
+       sprd_data->drm_fd = tbm_drm_helper_get_master_fd();
+       if (sprd_data->drm_fd < 0) {
                sprd_data->drm_fd = _tdm_sprd_open_drm();
 
-       if (sprd_data->drm_fd < 0) {
-               ret = TDM_ERROR_OPERATION_FAILED;
-               goto failed_l;
+               if (sprd_data->drm_fd < 0) {
+                       ret = TDM_ERROR_OPERATION_FAILED;
+                       goto failed_l;
+               }
+
+               tbm_drm_helper_set_tbm_master_fd(sprd_data->drm_fd);
        }
 
-       /* To share the drm master fd with other modules in display server side. */
-       tdm_helper_set_fd("TDM_DRM_MASTER_FD", sprd_data->drm_fd);
+       TDM_INFO("master fd(%d)", sprd_data->drm_fd);
 
 #if 0
        if (drmSetClientCap(sprd_data->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0)