not using enviroment variable to get drm fd 18/150718/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: I9a3960df0bb23f79b0750a88ee2f7c949640170d

src/tdm_vc4.c

index 2972f2c..b111995 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "tdm_vc4.h"
 #include <tdm_helper.h>
+#include <tbm_drm_helper.h>
 
 #define ENABLE_PP
 
@@ -325,21 +326,22 @@ tdm_vc4_init(tdm_display *dpy, tdm_error *error)
 
        vc4_data->dpy = dpy;
 
-       /* The vc4 master fd can be opened by a tbm backend module in
-        * tbm_bufmgr_init() time. In this case, we just get it from
-        * TBM_vc4_MASTER_FD enviroment.
+       /* 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.
         */
-       vc4_data->drm_fd = tdm_helper_get_fd("TBM_DRM_MASTER_FD");
-       if (vc4_data->drm_fd < 0)
+       vc4_data->drm_fd = tbm_drm_helper_get_master_fd();
+       if (vc4_data->drm_fd < 0) {
                vc4_data->drm_fd = _tdm_vc4_open_drm();
 
-       if (vc4_data->drm_fd < 0) {
-               ret = TDM_ERROR_OPERATION_FAILED;
-               goto failed;
+               if (vc4_data->drm_fd < 0) {
+                       ret = TDM_ERROR_OPERATION_FAILED;
+                       goto failed;
+               }
+
+               tbm_drm_helper_set_tbm_master_fd(vc4_data->drm_fd);
        }
 
-       /* To share the drm master fd with other modules in display server side. */
-       tdm_helper_set_fd("TDM_DRM_MASTER_FD", vc4_data->drm_fd);
+       TDM_INFO("master fd(%d)", vc4_data->drm_fd);
 
 #ifdef HAVE_UDEV
        _tdm_vc4_udev_init(vc4_data);