summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-07-21 15:48:40 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-08-09 14:56:58 -0500
commit8ff59b2c55a58331625b6d997918e64eddc84b10 (patch)
tree85a9d9398281b1aad159517e8e9bdee2c0adc3b8
parentbe0af0ed00148c55e1eb519444ea48201677badb (diff)
ecore_drm2: Pass Ecore_Drm2_Device instead of fd to most functions
Intended to simplify the upcoming commit that merges device find and device open into a single function that returns a device. The fd is something callers shouldn't really need to get their hands on, right now there are still a few places where it's needed, but those will be gone soon too.
-rw-r--r--src/lib/ecore_drm2/Ecore_Drm2.h26
-rw-r--r--src/lib/ecore_drm2/ecore_drm2.c6
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_device.c8
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c34
-rw-r--r--src/modules/ecore_evas/engines/drm/ecore_evas_drm.c13
-rw-r--r--src/modules/evas/engines/drm/Evas_Engine_Drm.h4
-rw-r--r--src/modules/evas/engines/drm/evas_engine.c10
-rw-r--r--src/modules/evas/engines/drm/evas_engine.h3
-rw-r--r--src/modules/evas/engines/drm/evas_outbuf.c4
-rw-r--r--src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h3
-rw-r--r--src/modules/evas/engines/gl_drm/evas_engine.c12
-rw-r--r--src/modules/evas/engines/gl_drm/evas_engine.h6
-rw-r--r--src/modules/evas/engines/gl_drm/evas_outbuf.c4
13 files changed, 81 insertions, 52 deletions
diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 450f1faa0c..81c3ace6a8 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -144,7 +144,7 @@ EAPI int ecore_drm2_shutdown(void);
144/** 144/**
145 * Read and process pending Drm events 145 * Read and process pending Drm events
146 * 146 *
147 * @param fd drm file descriptor 147 * @param dev drm device
148 * @param ctx 148 * @param ctx
149 * 149 *
150 * @return 0 on success, -1 otherwise 150 * @return 0 on success, -1 otherwise
@@ -156,7 +156,7 @@ EAPI int ecore_drm2_shutdown(void);
156 * @ingroup Ecore_Drm_Init_Group 156 * @ingroup Ecore_Drm_Init_Group
157 * @since 1.19 157 * @since 1.19
158 */ 158 */
159EAPI int ecore_drm2_event_handle(int fd, Ecore_Drm2_Context *drmctx); 159EAPI int ecore_drm2_event_handle(Ecore_Drm2_Device *dev, Ecore_Drm2_Context *drmctx);
160 160
161/** 161/**
162 * @defgroup Ecore_Drm2_Device_Group Drm device functions 162 * @defgroup Ecore_Drm2_Device_Group Drm device functions
@@ -832,7 +832,7 @@ EAPI unsigned int ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output
832/** 832/**
833 * Create a new framebuffer object 833 * Create a new framebuffer object
834 * 834 *
835 * @param fd 835 * @param dev
836 * @param width 836 * @param width
837 * @param height 837 * @param height
838 * @param depth 838 * @param depth
@@ -844,9 +844,9 @@ EAPI unsigned int ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output
844 * @ingroup Ecore_Drm2_Fb_Group 844 * @ingroup Ecore_Drm2_Fb_Group
845 * @since 1.18 845 * @since 1.18
846 */ 846 */
847EAPI Ecore_Drm2_Fb *ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned int format); 847EAPI Ecore_Drm2_Fb *ecore_drm2_fb_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format);
848 848
849EAPI Ecore_Drm2_Fb *ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int handle, unsigned int stride, void *bo); 849EAPI Ecore_Drm2_Fb *ecore_drm2_fb_gbm_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, unsigned int handle, unsigned int stride, void *bo);
850 850
851/** 851/**
852 * Get a framebuffer's mmap'd data 852 * Get a framebuffer's mmap'd data
@@ -971,7 +971,7 @@ EAPI void *ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb);
971/** 971/**
972 * Import a dmabuf object as a Framebuffer 972 * Import a dmabuf object as a Framebuffer
973 * 973 *
974 * @param fd 974 * @param dev
975 * @param width 975 * @param width
976 * @param height 976 * @param height
977 * @param depth 977 * @param depth
@@ -987,7 +987,7 @@ EAPI void *ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb);
987 * @since 1.20 987 * @since 1.20
988 * 988 *
989 */ 989 */
990EAPI Ecore_Drm2_Fb *ecore_drm2_fb_dmabuf_import(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count); 990EAPI Ecore_Drm2_Fb *ecore_drm2_fb_dmabuf_import(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count);
991 991
992/** 992/**
993 * Discard a framebuffer object 993 * Discard a framebuffer object
@@ -1094,6 +1094,18 @@ EAPI void ecore_drm2_fb_status_handler_set(Ecore_Drm2_Fb *fb, Ecore_Drm2_Fb_Stat
1094 */ 1094 */
1095EAPI Eina_Bool ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, int sequence, long *sec, long *usec); 1095EAPI Eina_Bool ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, int sequence, long *sec, long *usec);
1096 1096
1097/**
1098 * Get the fd of an Ecore_Drm2_Device
1099 *
1100 * Query the fd of the device.
1101 *
1102 * @param device
1103 *
1104 * @since 1.20
1105 */
1106
1107EAPI int ecore_drm2_device_fd_get(Ecore_Drm2_Device *device);
1108
1097# endif 1109# endif
1098 1110
1099#endif 1111#endif
diff --git a/src/lib/ecore_drm2/ecore_drm2.c b/src/lib/ecore_drm2/ecore_drm2.c
index 526ea4a523..a4ab72042d 100644
--- a/src/lib/ecore_drm2/ecore_drm2.c
+++ b/src/lib/ecore_drm2/ecore_drm2.c
@@ -219,16 +219,16 @@ ecore_drm2_shutdown(void)
219} 219}
220 220
221EAPI int 221EAPI int
222ecore_drm2_event_handle(int fd, Ecore_Drm2_Context *drmctx) 222ecore_drm2_event_handle(Ecore_Drm2_Device *dev, Ecore_Drm2_Context *drmctx)
223{ 223{
224 drmEventContext ctx; 224 drmEventContext ctx;
225 225
226 EINA_SAFETY_ON_TRUE_RETURN_VAL((fd < 0), -1); 226 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, -1);
227 227
228 memset(&ctx, 0, sizeof(ctx)); 228 memset(&ctx, 0, sizeof(ctx));
229 ctx.version = 2; 229 ctx.version = 2;
230 ctx.page_flip_handler = drmctx->page_flip_handler; 230 ctx.page_flip_handler = drmctx->page_flip_handler;
231 ctx.vblank_handler = drmctx->vblank_handler; 231 ctx.vblank_handler = drmctx->vblank_handler;
232 232
233 return sym_drmHandleEvent(fd, &ctx); 233 return sym_drmHandleEvent(dev->fd, &ctx);
234} 234}
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index 3545d1a299..aa8917ce4e 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -885,6 +885,14 @@ ecore_drm2_device_prefer_shadow(Ecore_Drm2_Device *device)
885 return EINA_FALSE; 885 return EINA_FALSE;
886} 886}
887 887
888EAPI int
889ecore_drm2_device_fd_get(Ecore_Drm2_Device *device)
890{
891 EINA_SAFETY_ON_NULL_RETURN_VAL(device, -1);
892
893 return device->fd;
894}
895
888/* prevent crashing with old apps compiled against these functions */ 896/* prevent crashing with old apps compiled against these functions */
889EAPI void ecore_drm2_device_keyboard_cached_context_set(){}; 897EAPI void ecore_drm2_device_keyboard_cached_context_set(){};
890EAPI void ecore_drm2_device_keyboard_cached_keymap_set(){}; 898EAPI void ecore_drm2_device_keyboard_cached_keymap_set(){};
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c
index 3a13c3dbbb..85331aeaa2 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -16,7 +16,7 @@ _fb2_create(Ecore_Drm2_Fb *fb)
16} 16}
17 17
18EAPI Ecore_Drm2_Fb * 18EAPI Ecore_Drm2_Fb *
19ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned int format) 19ecore_drm2_fb_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format)
20{ 20{
21 Ecore_Drm2_Fb *fb; 21 Ecore_Drm2_Fb *fb;
22 struct drm_mode_create_dumb carg; 22 struct drm_mode_create_dumb carg;
@@ -24,12 +24,12 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
24 struct drm_mode_map_dumb marg; 24 struct drm_mode_map_dumb marg;
25 int ret; 25 int ret;
26 26
27 EINA_SAFETY_ON_TRUE_RETURN_VAL((fd < 0), NULL); 27 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
28 28
29 fb = calloc(1, sizeof(Ecore_Drm2_Fb)); 29 fb = calloc(1, sizeof(Ecore_Drm2_Fb));
30 if (!fb) return NULL; 30 if (!fb) return NULL;
31 31
32 fb->fd = fd; 32 fb->fd = dev->fd;
33 fb->w = width; 33 fb->w = width;
34 fb->h = height; 34 fb->h = height;
35 fb->bpp = bpp; 35 fb->bpp = bpp;
@@ -42,7 +42,7 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
42 carg.width = width; 42 carg.width = width;
43 carg.height = height; 43 carg.height = height;
44 44
45 ret = sym_drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &carg); 45 ret = sym_drmIoctl(dev->fd, DRM_IOCTL_MODE_CREATE_DUMB, &carg);
46 if (ret) goto err; 46 if (ret) goto err;
47 47
48 fb->handles[0] = carg.handle; 48 fb->handles[0] = carg.handle;
@@ -52,7 +52,7 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
52 if (!_fb2_create(fb)) 52 if (!_fb2_create(fb))
53 { 53 {
54 ret = 54 ret =
55 sym_drmModeAddFB(fd, width, height, depth, bpp, 55 sym_drmModeAddFB(dev->fd, width, height, depth, bpp,
56 fb->strides[0], fb->handles[0], &fb->id); 56 fb->strides[0], fb->handles[0], &fb->id);
57 if (ret) 57 if (ret)
58 { 58 {
@@ -63,14 +63,14 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
63 63
64 memset(&marg, 0, sizeof(struct drm_mode_map_dumb)); 64 memset(&marg, 0, sizeof(struct drm_mode_map_dumb));
65 marg.handle = fb->handles[0]; 65 marg.handle = fb->handles[0];
66 ret = sym_drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &marg); 66 ret = sym_drmIoctl(dev->fd, DRM_IOCTL_MODE_MAP_DUMB, &marg);
67 if (ret) 67 if (ret)
68 { 68 {
69 ERR("Could not map framebuffer: %m"); 69 ERR("Could not map framebuffer: %m");
70 goto map_err; 70 goto map_err;
71 } 71 }
72 72
73 fb->mmap = mmap(NULL, fb->sizes[0], PROT_WRITE, MAP_SHARED, fd, marg.offset); 73 fb->mmap = mmap(NULL, fb->sizes[0], PROT_WRITE, MAP_SHARED, dev->fd, marg.offset);
74 if (fb->mmap == MAP_FAILED) 74 if (fb->mmap == MAP_FAILED)
75 { 75 {
76 ERR("Could not mmap framebuffer memory: %m"); 76 ERR("Could not mmap framebuffer memory: %m");
@@ -80,22 +80,22 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
80 return fb; 80 return fb;
81 81
82map_err: 82map_err:
83 sym_drmModeRmFB(fd, fb->id); 83 sym_drmModeRmFB(dev->fd, fb->id);
84add_err: 84add_err:
85 memset(&darg, 0, sizeof(struct drm_mode_destroy_dumb)); 85 memset(&darg, 0, sizeof(struct drm_mode_destroy_dumb));
86 darg.handle = fb->handles[0]; 86 darg.handle = fb->handles[0];
87 sym_drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg); 87 sym_drmIoctl(dev->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg);
88err: 88err:
89 free(fb); 89 free(fb);
90 return NULL; 90 return NULL;
91} 91}
92 92
93EAPI Ecore_Drm2_Fb * 93EAPI Ecore_Drm2_Fb *
94ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int handle, unsigned int stride, void *bo) 94ecore_drm2_fb_gbm_create(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, unsigned int handle, unsigned int stride, void *bo)
95{ 95{
96 Ecore_Drm2_Fb *fb; 96 Ecore_Drm2_Fb *fb;
97 97
98 EINA_SAFETY_ON_TRUE_RETURN_VAL((fd < 0), NULL); 98 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
99 99
100 fb = calloc(1, sizeof(Ecore_Drm2_Fb)); 100 fb = calloc(1, sizeof(Ecore_Drm2_Fb));
101 if (!fb) return NULL; 101 if (!fb) return NULL;
@@ -103,7 +103,7 @@ ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsi
103 fb->gbm = EINA_TRUE; 103 fb->gbm = EINA_TRUE;
104 fb->gbm_bo = bo; 104 fb->gbm_bo = bo;
105 105
106 fb->fd = fd; 106 fb->fd = dev->fd;
107 fb->w = width; 107 fb->w = width;
108 fb->h = height; 108 fb->h = height;
109 fb->bpp = bpp; 109 fb->bpp = bpp;
@@ -116,7 +116,7 @@ ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsi
116 116
117 if (!_fb2_create(fb)) 117 if (!_fb2_create(fb))
118 { 118 {
119 if (sym_drmModeAddFB(fd, width, height, depth, bpp, 119 if (sym_drmModeAddFB(dev->fd, width, height, depth, bpp,
120 fb->strides[0], fb->handles[0], &fb->id)) 120 fb->strides[0], fb->handles[0], &fb->id))
121 { 121 {
122 ERR("Could not add framebuffer: %m"); 122 ERR("Could not add framebuffer: %m");
@@ -664,20 +664,22 @@ ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb)
664} 664}
665 665
666EAPI Ecore_Drm2_Fb * 666EAPI Ecore_Drm2_Fb *
667ecore_drm2_fb_dmabuf_import(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count) 667ecore_drm2_fb_dmabuf_import(Ecore_Drm2_Device *dev, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count)
668{ 668{
669 int i; 669 int i;
670 Ecore_Drm2_Fb *fb; 670 Ecore_Drm2_Fb *fb;
671 671
672 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
673
672 fb = calloc(1, sizeof(Ecore_Drm2_Fb)); 674 fb = calloc(1, sizeof(Ecore_Drm2_Fb));
673 if (!fb) return NULL; 675 if (!fb) return NULL;
674 676
675 for (i = 0; i < dmabuf_fd_count; i++) 677 for (i = 0; i < dmabuf_fd_count; i++)
676 if (sym_drmPrimeFDToHandle(fd, dmabuf_fd[i], &fb->handles[i])) 678 if (sym_drmPrimeFDToHandle(dev->fd, dmabuf_fd[i], &fb->handles[i]))
677 goto fail; 679 goto fail;
678 680
679 fb->dmabuf = EINA_TRUE; 681 fb->dmabuf = EINA_TRUE;
680 fb->fd = fd; 682 fb->fd = dev->fd;
681 fb->w = width; 683 fb->w = width;
682 fb->h = height; 684 fb->h = height;
683 fb->bpp = bpp; 685 fb->bpp = bpp;
diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
index 35cd8d83a1..a801445492 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -48,7 +48,6 @@
48 48
49typedef struct _Ecore_Evas_Engine_Drm_Data 49typedef struct _Ecore_Evas_Engine_Drm_Data
50{ 50{
51 int fd;
52 int cw, ch; 51 int cw, ch;
53 int clockid; 52 int clockid;
54 int x, y, w, h; 53 int x, y, w, h;
@@ -156,8 +155,7 @@ _ecore_evas_drm_init(Ecore_Evas *ee, Ecore_Evas_Engine_Drm_Data *edata, const ch
156 goto dev_err; 155 goto dev_err;
157 } 156 }
158 157
159 edata->fd = ecore_drm2_device_open(edata->dev); 158 if (ecore_drm2_device_open(edata->dev) < 0)
160 if (edata->fd < 0)
161 { 159 {
162 ERR("Failed to open device"); 160 ERR("Failed to open device");
163 goto open_err; 161 goto open_err;
@@ -597,7 +595,7 @@ _cb_drm_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
597 595
598 ee = data; 596 ee = data;
599 edata = ee->engine.data; 597 edata = ee->engine.data;
600 ret = ecore_drm2_event_handle(edata->fd, &edata->ctx); 598 ret = ecore_drm2_event_handle(edata->dev, &edata->ctx);
601 if (ret) 599 if (ret)
602 { 600 {
603 WRN("drmHandleEvent failed to read an event"); 601 WRN("drmHandleEvent failed to read an event");
@@ -907,7 +905,7 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
907 if ((num) && (!atoi(num))) 905 if ((num) && (!atoi(num)))
908 einfo->info.vsync = EINA_FALSE; 906 einfo->info.vsync = EINA_FALSE;
909 907
910 einfo->info.fd = edata->fd; 908 einfo->info.dev = edata->dev;
911 einfo->info.bpp = edata->bpp; 909 einfo->info.bpp = edata->bpp;
912 einfo->info.depth = edata->depth; 910 einfo->info.depth = edata->depth;
913 einfo->info.format = edata->format; 911 einfo->info.format = edata->format;
@@ -925,7 +923,7 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
925 { 923 {
926 Evas_Engine_Info_Drm *einfo = tinfo; 924 Evas_Engine_Info_Drm *einfo = tinfo;
927 925
928 einfo->info.fd = edata->fd; 926 einfo->info.dev = edata->dev;
929 einfo->info.bpp = edata->bpp; 927 einfo->info.bpp = edata->bpp;
930 einfo->info.depth = edata->depth; 928 einfo->info.depth = edata->depth;
931 einfo->info.format = edata->format; 929 einfo->info.format = edata->format;
@@ -962,7 +960,8 @@ _ecore_evas_new_internal(const char *device, int x, int y, int w, int h, Eina_Bo
962 edata->ctx.page_flip_handler = _cb_pageflip; 960 edata->ctx.page_flip_handler = _cb_pageflip;
963 961
964 edata->hdlr = 962 edata->hdlr =
965 ecore_main_fd_handler_add(edata->fd, ECORE_FD_READ, _cb_drm_event, ee, 963 ecore_main_fd_handler_add(ecore_drm2_device_fd_get(edata->dev),
964 ECORE_FD_READ, _cb_drm_event, ee,
966 NULL, NULL); 965 NULL, NULL);
967 966
968 canvases = eina_list_append(canvases, ee); 967 canvases = eina_list_append(canvases, ee);
diff --git a/src/modules/evas/engines/drm/Evas_Engine_Drm.h b/src/modules/evas/engines/drm/Evas_Engine_Drm.h
index 457db625e7..2fcbc466f1 100644
--- a/src/modules/evas/engines/drm/Evas_Engine_Drm.h
+++ b/src/modules/evas/engines/drm/Evas_Engine_Drm.h
@@ -1,6 +1,8 @@
1#ifndef _EVAS_ENGINE_DRM_H 1#ifndef _EVAS_ENGINE_DRM_H
2# define _EVAS_ENGINE_DRM_H 2# define _EVAS_ENGINE_DRM_H
3 3
4# include <Ecore_Drm2.h>
5
4typedef struct _Evas_Engine_Info_Drm 6typedef struct _Evas_Engine_Info_Drm
5{ 7{
6 /* PRIVATE - don't mess with this baby or evas will poke its tongue out */ 8 /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
@@ -9,7 +11,7 @@ typedef struct _Evas_Engine_Info_Drm
9 11
10 struct 12 struct
11 { 13 {
12 int fd; 14 Ecore_Drm2_Device *dev;
13 int depth, bpp; 15 int depth, bpp;
14 unsigned int format, rotation; 16 unsigned int format, rotation;
15 17
diff --git a/src/modules/evas/engines/drm/evas_engine.c b/src/modules/evas/engines/drm/evas_engine.c
index e54b809b5a..7d01407c8f 100644
--- a/src/modules/evas/engines/drm/evas_engine.c
+++ b/src/modules/evas/engines/drm/evas_engine.c
@@ -5,7 +5,7 @@ typedef struct _Render_Engine
5{ 5{
6 Render_Engine_Software_Generic generic; 6 Render_Engine_Software_Generic generic;
7 7
8 int fd; 8 Ecore_Drm2_Device *dev;
9} Render_Engine; 9} Render_Engine;
10 10
11struct scanout_handle 11struct scanout_handle
@@ -30,7 +30,7 @@ _render_engine_setup(Evas_Engine_Info_Drm *info, int w, int h)
30 ob = _outbuf_setup(info, w, h); 30 ob = _outbuf_setup(info, w, h);
31 if (!ob) goto err; 31 if (!ob) goto err;
32 32
33 re->fd = info->info.fd; 33 re->dev = info->info.dev;
34 34
35 if (!evas_render_engine_software_generic_init(&re->generic, ob, 35 if (!evas_render_engine_software_generic_init(&re->generic, ob,
36 _outbuf_state_get, 36 _outbuf_state_get,
@@ -120,7 +120,7 @@ eng_output_free(void *engine EINA_UNUSED, void *data)
120} 120}
121 121
122static Ecore_Drm2_Fb * 122static Ecore_Drm2_Fb *
123drm_import_simple_dmabuf(int fd, struct dmabuf_attributes *attributes) 123drm_import_simple_dmabuf(Ecore_Drm2_Device *dev, struct dmabuf_attributes *attributes)
124{ 124{
125 unsigned int stride[4] = { 0 }; 125 unsigned int stride[4] = { 0 };
126 int dmabuf_fd[4] = { 0 }; 126 int dmabuf_fd[4] = { 0 };
@@ -132,7 +132,7 @@ drm_import_simple_dmabuf(int fd, struct dmabuf_attributes *attributes)
132 dmabuf_fd[i] = attributes->fd[i]; 132 dmabuf_fd[i] = attributes->fd[i];
133 } 133 }
134 134
135 return ecore_drm2_fb_dmabuf_import(fd, attributes->width, 135 return ecore_drm2_fb_dmabuf_import(dev, attributes->width,
136 attributes->height, 32, 32, 136 attributes->height, 32, 32,
137 attributes->format, stride, 137 attributes->format, stride,
138 dmabuf_fd, attributes->n_planes); 138 dmabuf_fd, attributes->n_planes);
@@ -197,7 +197,7 @@ eng_image_plane_assign(void *data, void *image, int x, int y)
197 * sticking to this one for now */ 197 * sticking to this one for now */
198 if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL; 198 if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL;
199 199
200 fb = drm_import_simple_dmabuf(re->fd, &n->ns_data.wl_surface_dmabuf.attr); 200 fb = drm_import_simple_dmabuf(re->dev, &n->ns_data.wl_surface_dmabuf.attr);
201 if (!fb) return NULL; 201 if (!fb) return NULL;
202 202
203 g = calloc(1, sizeof(struct scanout_handle)); 203 g = calloc(1, sizeof(struct scanout_handle));
diff --git a/src/modules/evas/engines/drm/evas_engine.h b/src/modules/evas/engines/drm/evas_engine.h
index 09f23f9650..a14ce15b07 100644
--- a/src/modules/evas/engines/drm/evas_engine.h
+++ b/src/modules/evas/engines/drm/evas_engine.h
@@ -52,7 +52,8 @@ typedef struct _Outbuf_Fb
52 52
53struct _Outbuf 53struct _Outbuf
54{ 54{
55 int fd, w, h, bpp, rotation; 55 Ecore_Drm2_Device *dev;
56 int w, h, bpp, rotation;
56 unsigned int depth, format; 57 unsigned int depth, format;
57 58
58 struct 59 struct
diff --git a/src/modules/evas/engines/drm/evas_outbuf.c b/src/modules/evas/engines/drm/evas_outbuf.c
index d65b92107d..79f8f6f12c 100644
--- a/src/modules/evas/engines/drm/evas_outbuf.c
+++ b/src/modules/evas/engines/drm/evas_outbuf.c
@@ -32,7 +32,7 @@ static Eina_Bool
32_outbuf_fb_create(Outbuf *ob, Outbuf_Fb *ofb) 32_outbuf_fb_create(Outbuf *ob, Outbuf_Fb *ofb)
33{ 33{
34 ofb->fb = 34 ofb->fb =
35 ecore_drm2_fb_create(ob->fd, ob->w, ob->h, 35 ecore_drm2_fb_create(ob->dev, ob->w, ob->h,
36 ob->depth, ob->bpp, ob->format); 36 ob->depth, ob->bpp, ob->format);
37 if (!ofb->fb) return EINA_FALSE; 37 if (!ofb->fb) return EINA_FALSE;
38 38
@@ -66,7 +66,7 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
66 66
67 ob->w = w; 67 ob->w = w;
68 ob->h = h; 68 ob->h = h;
69 ob->fd = info->info.fd; 69 ob->dev = info->info.dev;
70 ob->alpha = info->info.alpha; 70 ob->alpha = info->info.alpha;
71 ob->rotation = info->info.rotation; 71 ob->rotation = info->info.rotation;
72 72
diff --git a/src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h b/src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h
index 9fd4b3c0e9..5dd18545a7 100644
--- a/src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h
+++ b/src/modules/evas/engines/gl_drm/Evas_Engine_GL_Drm.h
@@ -18,7 +18,8 @@ struct _Evas_Engine_Info_GL_Drm
18 { 18 {
19 struct gbm_device *gbm; 19 struct gbm_device *gbm;
20 20
21 int fd, bpp; 21 Ecore_Drm2_Device *dev;
22 int bpp;
22 unsigned int rotation, depth; 23 unsigned int rotation, depth;
23 unsigned int format, flags; 24 unsigned int format, flags;
24 25
diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c
index f5109a3875..f4dbed8494 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.c
+++ b/src/modules/evas/engines/gl_drm/evas_engine.c
@@ -122,9 +122,11 @@ static const EVGL_Interface evgl_funcs =
122Eina_Bool 122Eina_Bool
123eng_gbm_init(Evas_Engine_Info_GL_Drm *info) 123eng_gbm_init(Evas_Engine_Info_GL_Drm *info)
124{ 124{
125 int fd;
125 if (!info) return EINA_FALSE; 126 if (!info) return EINA_FALSE;
126 127
127 if (!(info->info.gbm = gbm_create_device(info->info.fd))) 128 fd = ecore_drm2_device_fd_get(info->info.dev);
129 if (!(info->info.gbm = gbm_create_device(fd)))
128 { 130 {
129 ERR("Coult not create gbm device"); 131 ERR("Coult not create gbm device");
130 return EINA_FALSE; 132 return EINA_FALSE;
@@ -600,7 +602,7 @@ _re_winfree(Render_Engine *re)
600} 602}
601 603
602static Ecore_Drm2_Fb * 604static Ecore_Drm2_Fb *
603drm_import_simple_dmabuf(int fd, struct dmabuf_attributes *attributes) 605drm_import_simple_dmabuf(Ecore_Drm2_Device *dev, struct dmabuf_attributes *attributes)
604{ 606{
605 unsigned int stride[4] = { 0 }; 607 unsigned int stride[4] = { 0 };
606 int dmabuf_fd[4] = { 0 }; 608 int dmabuf_fd[4] = { 0 };
@@ -612,7 +614,7 @@ drm_import_simple_dmabuf(int fd, struct dmabuf_attributes *attributes)
612 dmabuf_fd[i] = attributes->fd[i]; 614 dmabuf_fd[i] = attributes->fd[i];
613 } 615 }
614 616
615 return ecore_drm2_fb_dmabuf_import(fd, attributes->width, 617 return ecore_drm2_fb_dmabuf_import(dev, attributes->width,
616 attributes->height, 32, 32, 618 attributes->height, 32, 32,
617 attributes->format, stride, 619 attributes->format, stride,
618 dmabuf_fd, attributes->n_planes); 620 dmabuf_fd, attributes->n_planes);
@@ -805,7 +807,7 @@ eng_image_plane_assign(void *data, void *image, int x, int y)
805 * sticking to this one for now */ 807 * sticking to this one for now */
806 if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL; 808 if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL;
807 809
808 fb = drm_import_simple_dmabuf(re->fd, &n->ns_data.wl_surface_dmabuf.attr); 810 fb = drm_import_simple_dmabuf(re->dev, &n->ns_data.wl_surface_dmabuf.attr);
809 811
810 if (!fb) return NULL; 812 if (!fb) return NULL;
811 813
@@ -958,7 +960,7 @@ eng_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
958 return NULL; 960 return NULL;
959 } 961 }
960 962
961 re->fd = info->info.fd; 963 re->dev = info->info.dev;
962 964
963 /* try to create new outbuf */ 965 /* try to create new outbuf */
964 ob = evas_outbuf_new(info, w, h, swap_mode); 966 ob = evas_outbuf_new(info, w, h, swap_mode);
diff --git a/src/modules/evas/engines/gl_drm/evas_engine.h b/src/modules/evas/engines/gl_drm/evas_engine.h
index 107c9387b1..1a888d2e8e 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.h
+++ b/src/modules/evas/engines/gl_drm/evas_engine.h
@@ -70,7 +70,7 @@ struct _Render_Engine
70{ 70{
71 Render_Engine_GL_Generic generic; 71 Render_Engine_GL_Generic generic;
72 72
73 int fd; 73 Ecore_Drm2_Device *dev;
74}; 74};
75 75
76struct _Context_3D 76struct _Context_3D
@@ -85,7 +85,9 @@ struct _Outbuf
85 Evas_Engine_Info_GL_Drm *info; 85 Evas_Engine_Info_GL_Drm *info;
86 Evas_Engine_GL_Context *gl_context; 86 Evas_Engine_GL_Context *gl_context;
87 87
88 int fd, w, h, bpp; 88 Ecore_Drm2_Device *dev;
89
90 int w, h, bpp;
89 unsigned int rotation, depth, format; 91 unsigned int rotation, depth, format;
90 int prev_age; 92 int prev_age;
91 Render_Engine_Swap_Mode swap_mode; 93 Render_Engine_Swap_Mode swap_mode;
diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c b/src/modules/evas/engines/gl_drm/evas_outbuf.c
index f51444ccb1..0f3ea45e2f 100644
--- a/src/modules/evas/engines/gl_drm/evas_outbuf.c
+++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c
@@ -75,7 +75,7 @@ _evas_outbuf_fb_get(Outbuf *ob, struct gbm_bo *bo)
75 /* fb->size = fb->stride * fb->h; */ 75 /* fb->size = fb->stride * fb->h; */
76 76
77 fb = 77 fb =
78 ecore_drm2_fb_gbm_create(ob->fd, w, h, ob->depth, ob->bpp, 78 ecore_drm2_fb_gbm_create(ob->dev, w, h, ob->depth, ob->bpp,
79 format, hdl, stride, bo); 79 format, hdl, stride, bo);
80 if (!fb) 80 if (!fb)
81 { 81 {
@@ -407,7 +407,7 @@ evas_outbuf_new(Evas_Engine_Info_GL_Drm *info, int w, int h, Render_Engine_Swap_
407 /* ob->vsync = info->info.vsync; */ 407 /* ob->vsync = info->info.vsync; */
408 ob->swap_mode = swap_mode; 408 ob->swap_mode = swap_mode;
409 409
410 ob->fd = info->info.fd; 410 ob->dev = info->info.dev;
411 ob->bpp = info->info.bpp; 411 ob->bpp = info->info.bpp;
412 ob->format = info->info.format; 412 ob->format = info->info.format;
413 ob->priv.output = info->info.output; 413 ob->priv.output = info->info.output;