summaryrefslogtreecommitdiff
path: root/src/modules
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 /src/modules
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.
Diffstat (limited to '')
-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
9 files changed, 33 insertions, 26 deletions
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;