From e53e1cc924ab64dc9b3276c697935252af073507 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 22 Mar 2016 17:45:53 +0900 Subject: set TDM_DRM_MASTER_FD Change-Id: I1c0dd6d661bc176db372f1cd98e108821c1c62b0 --- src/tdm_drm.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/tdm_drm.c') diff --git a/src/tdm_drm.c b/src/tdm_drm.c index ab2ee53..c0059a6 100644 --- a/src/tdm_drm.c +++ b/src/tdm_drm.c @@ -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"); -- cgit v1.2.3