summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Aguirre <aguirre.nicolas@gmail.com>2016-05-31 21:58:57 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2016-05-31 22:05:13 +0200
commit02ba99f2d6a19655392ec65604f197e461c86559 (patch)
tree91ae4f91e9809f1985a25f574c645c10f3ed0351
parentce93b27d5f3d84c82da992931a67e272acc1acb6 (diff)
eglfs: Remove specific code for libhybris/android portdevs/captainigloo/eglfs_rpi
-rw-r--r--src/modules/evas/engines/eglfs/evas_engine.c103
-rw-r--r--src/modules/evas/engines/eglfs/evas_engine.h3
-rw-r--r--src/modules/evas/engines/eglfs/evas_outbuf.c216
3 files changed, 81 insertions, 241 deletions
diff --git a/src/modules/evas/engines/eglfs/evas_engine.c b/src/modules/evas/engines/eglfs/evas_engine.c
index 648b54f89a..25446f39d2 100644
--- a/src/modules/evas/engines/eglfs/evas_engine.c
+++ b/src/modules/evas/engines/eglfs/evas_engine.c
@@ -1,5 +1,8 @@
1#include "config.h" 1#include "config.h"
2#include "evas_engine.h" 2#include "evas_engine.h"
3#include "../gl_common/evas_gl_define.h"
4#include "../software_generic/evas_native_common.h"
5
3#include <wayland-client.h> 6#include <wayland-client.h>
4 7
5#ifdef HAVE_DLSYM 8#ifdef HAVE_DLSYM
@@ -36,14 +39,6 @@ struct _Render_Engine
36 Render_Engine_GL_Generic generic; 39 Render_Engine_GL_Generic generic;
37}; 40};
38 41
39typedef struct _Native Native;
40struct _Native
41{
42 Evas_Native_Surface ns;
43 struct wl_buffer *wl_buf;
44 void *egl_surface;
45};
46
47/* local function prototype types */ 42/* local function prototype types */
48typedef void (*_eng_fn)(void); 43typedef void (*_eng_fn)(void);
49typedef _eng_fn (*glsym_func_eng_fn)(); 44typedef _eng_fn (*glsym_func_eng_fn)();
@@ -329,18 +324,12 @@ evgl_eng_make_current(void *data, void *surface, void *context, int flush)
329 return 1; 324 return 1;
330} 325}
331 326
332static void _hwc_present_cb(void *user_data, struct ANativeWindow *window,
333 struct ANativeWindowBuffer *buffer)
334{
335
336}
337 327
338static void * 328static void *
339evgl_eng_native_window_create(void *data) 329evgl_eng_native_window_create(void *data)
340{ 330{
341 Render_Engine *re; 331 Render_Engine *re;
342 Evas_Engine_Info_Eglfs *info; 332 Evas_Engine_Info_Eglfs *info;
343 struct ANativeWindow *native_window;
344 333
345 re = (Render_Engine *)data; 334 re = (Render_Engine *)data;
346 if (!re) 335 if (!re)
@@ -355,9 +344,8 @@ evgl_eng_native_window_create(void *data)
355 ERR("Invalid Evas Engine Eglfs Info!"); 344 ERR("Invalid Evas Engine Eglfs Info!");
356 return NULL; 345 return NULL;
357 } 346 }
358 EGLNativeWindowType win; 347 /* FIXME : eglfs has no native window ? */
359 win = create_hwcomposernativewindow(); 348 return NULL;
360 return (void *)win;
361} 349}
362 350
363static int 351static int
@@ -377,8 +365,6 @@ evgl_eng_native_window_destroy(void *data, void *native_window)
377 return 0; 365 return 0;
378 } 366 }
379 367
380 HWCNativeWindowDestroy(native_window);
381
382 return 1; 368 return 1;
383} 369}
384 370
@@ -398,7 +384,7 @@ evgl_eng_window_surface_create(void *data, void *native_window)
398 // Create resource surface for EGL 384 // Create resource surface for EGL
399 surface = eglCreateWindowSurface(eng_get_ob(re)->egl.disp, 385 surface = eglCreateWindowSurface(eng_get_ob(re)->egl.disp,
400 eng_get_ob(re)->egl.config, 386 eng_get_ob(re)->egl.config,
401 (EGLNativeWindowType)native_window, 387 NULL,
402 NULL); 388 NULL);
403 if (!surface) 389 if (!surface)
404 { 390 {
@@ -579,6 +565,8 @@ _re_winfree(Render_Engine *re)
579 evas_outbuf_unsurf(eng_get_ob(re)); 565 evas_outbuf_unsurf(eng_get_ob(re));
580} 566}
581 567
568
569
582static void 570static void
583_native_cb_bind(void *image) 571_native_cb_bind(void *image)
584{ 572{
@@ -590,13 +578,12 @@ _native_cb_bind(void *image)
590 578
591 if (n->ns.type == EVAS_NATIVE_SURFACE_WL) 579 if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
592 { 580 {
593 if (n->egl_surface) 581 if (n->ns_data.wl_surface.surface)
594 { 582 {
595 if (glsym_glEGLImageTargetTexture2DOES) 583 if (glsym_glEGLImageTargetTexture2DOES)
596 { 584 {
597 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); 585 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->ns_data.wl_surface.surface);
598 if (eglGetError() != EGL_SUCCESS) 586 GLERRV("glsym_glEGLImageTargetTexture2DOES");
599 ERR("glEGLImageTargetTexture2DOES() failed.");
600 } 587 }
601 else 588 else
602 ERR("Try glEGLImageTargetTexture2DOES on EGL with no support"); 589 ERR("Try glEGLImageTargetTexture2DOES on EGL with no support");
@@ -617,6 +604,16 @@ _native_cb_unbind(void *image)
617 if (!(img = image)) return; 604 if (!(img = image)) return;
618 if (!(n = img->native.data)) return; 605 if (!(n = img->native.data)) return;
619 606
607 if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
608 {
609 if (n->ns_data.wl_surface_dmabuf.image)
610 glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
611 n->ns_data.wl_surface_dmabuf.image = NULL;
612 }
613 else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
614 {
615 //glBindTexture(GL_TEXTURE_2D, 0); //really need?
616 }
620 else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) 617 else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
621 glBindTexture(GL_TEXTURE_2D, 0); 618 glBindTexture(GL_TEXTURE_2D, 0);
622 619
@@ -633,19 +630,31 @@ _native_cb_free(void *image)
633 630
634 if (!(img = image)) return; 631 if (!(img = image)) return;
635 if (!(n = img->native.data)) return; 632 if (!(n = img->native.data)) return;
636 if (!img->native.shared) return; 633 if (!(img->native.shared)) return;
637 634
638 if (n->ns.type == EVAS_NATIVE_SURFACE_WL) 635 if (n->ns.type == EVAS_NATIVE_SURFACE_WL_DMABUF)
639 { 636 {
640 wlid = n->wl_buf; 637 wlid = n->ns_data.wl_surface_dmabuf.resource;
641 eina_hash_del(img->native.shared->native_wl_hash, &wlid, img); 638 eina_hash_del(img->native.shared->native_wl_hash, &wlid, img);
642 if (n->egl_surface) 639 if (n->ns_data.wl_surface.surface)
640 {
641 if (glsym_eglDestroyImage && n->ns_data.wl_surface_dmabuf.image)
642 {
643 glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface_dmabuf.image);
644 GLERRV("eglDestroyImage() failed.");
645 }
646 }
647 }
648 else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
649 {
650 wlid = (void*)n->ns_data.wl_surface.wl_buf;
651 eina_hash_del(img->native.shared->native_wl_hash, &wlid, img);
652 if (n->ns_data.wl_surface.surface)
643 { 653 {
644 if (glsym_eglDestroyImage) 654 if (glsym_eglDestroyImage)
645 { 655 {
646 glsym_eglDestroyImage(img->native.disp, n->egl_surface); 656 glsym_eglDestroyImage(img->native.disp, n->ns_data.wl_surface.surface);
647 if (eglGetError() != EGL_SUCCESS) 657 GLERRV("eglDestroyImage() failed.");
648 ERR("eglDestroyImage() failed.");
649 } 658 }
650 else 659 else
651 ERR("Try eglDestroyImage on EGL with no support"); 660 ERR("Try eglDestroyImage on EGL with no support");
@@ -698,7 +707,7 @@ eng_setup(Evas *evas, void *in)
698 Render_Engine *re; 707 Render_Engine *re;
699 Render_Engine_Swap_Mode swap_mode = MODE_FULL; 708 Render_Engine_Swap_Mode swap_mode = MODE_FULL;
700 const char *s = NULL; 709 const char *s = NULL;
701 710 printf("eng_setup\n");
702 /* try to cast to our engine info structure */ 711 /* try to cast to our engine info structure */
703 if (!(info = (Evas_Engine_Info_Eglfs *)in)) return 0; 712 if (!(info = (Evas_Engine_Info_Eglfs *)in)) return 0;
704 713
@@ -776,6 +785,7 @@ eng_setup(Evas *evas, void *in)
776 ob = evas_outbuf_new(info, epd->output.w, epd->output.h, swap_mode); 785 ob = evas_outbuf_new(info, epd->output.w, epd->output.h, swap_mode);
777 if (!ob) 786 if (!ob)
778 { 787 {
788 printf("Can't create new outbuf\n");
779 free(re); 789 free(re);
780 return 0; 790 return 0;
781 } 791 }
@@ -817,6 +827,8 @@ eng_setup(Evas *evas, void *in)
817 merge_mode = MERGE_BOUNDING; 827 merge_mode = MERGE_BOUNDING;
818 else if ((!strcmp(s, "full")) || (!strcmp(s, "f"))) 828 else if ((!strcmp(s, "full")) || (!strcmp(s, "f")))
819 merge_mode = MERGE_FULL; 829 merge_mode = MERGE_FULL;
830 else if ((!strcmp(s, "smart")) || (!strcmp(s, "s")))
831 merge_mode = MERGE_SMART;
820 } 832 }
821 833
822 evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode); 834 evas_render_engine_software_generic_merge_mode_set(&re->generic.software, merge_mode);
@@ -1103,15 +1115,16 @@ eng_image_native_set(void *data, void *image, void *native)
1103 attribs[2] = EGL_NONE; 1115 attribs[2] = EGL_NONE;
1104 1116
1105 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); 1117 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
1106 glsym_eglQueryWaylandBufferWL(ob->egl.disp, wl_buf, 1118 if (glsym_eglQueryWaylandBufferWL(ob->egl.disp, wl_buf,
1107 EGL_WAYLAND_Y_INVERTED_WL, 1119 EGL_WAYLAND_Y_INVERTED_WL,
1108 &yinvert); 1120 &yinvert) == EGL_FALSE)
1121 yinvert = 1;
1109 eina_hash_add(ob->gl_context->shared->native_wl_hash, 1122 eina_hash_add(ob->gl_context->shared->native_wl_hash,
1110 &wlid, img); 1123 &wlid, img);
1111 1124
1112 n->wl_buf = wl_buf; 1125 n->ns_data.wl_surface.wl_buf = wl_buf;
1113 if (glsym_eglCreateImage) 1126 if (glsym_eglCreateImage)
1114 n->egl_surface = glsym_eglCreateImage(ob->egl.disp, 1127 n->ns_data.wl_surface.surface = glsym_eglCreateImage(ob->egl.disp,
1115 NULL, 1128 NULL,
1116 EGL_WAYLAND_BUFFER_WL, 1129 EGL_WAYLAND_BUFFER_WL,
1117 wl_buf, attribs); 1130 wl_buf, attribs);
@@ -1125,7 +1138,7 @@ eng_image_native_set(void *data, void *image, void *native)
1125 return NULL; 1138 return NULL;
1126 } 1139 }
1127 1140
1128 if (!n->egl_surface) 1141 if (!n->ns_data.wl_surface.surface)
1129 { 1142 {
1130 ERR("eglCreatePixmapSurface() for %p failed", wl_buf); 1143 ERR("eglCreatePixmapSurface() for %p failed", wl_buf);
1131 eina_hash_del(ob->gl_context->shared->native_wl_hash, 1144 eina_hash_del(ob->gl_context->shared->native_wl_hash,
@@ -1161,10 +1174,12 @@ eng_image_native_set(void *data, void *image, void *native)
1161 eina_hash_add(ob->gl_context->shared->native_tex_hash, 1174 eina_hash_add(ob->gl_context->shared->native_tex_hash,
1162 &texid, img); 1175 &texid, img);
1163 1176
1164 n->egl_surface = 0; 1177 n->ns_data.opengl.surface = 0;
1165 1178
1166 img->native.yinvert = 0; 1179 img->native.yinvert = 0;
1167 img->native.loose = 0; 1180 img->native.loose = 0;
1181 img->native.disp = ob->egl.disp;
1182 img->native.shared = ob->gl_context->shared;
1168 img->native.data = n; 1183 img->native.data = n;
1169 img->native.func.bind = _native_cb_bind; 1184 img->native.func.bind = _native_cb_bind;
1170 img->native.func.unbind = _native_cb_unbind; 1185 img->native.func.unbind = _native_cb_unbind;
@@ -1186,12 +1201,14 @@ eng_image_native_set(void *data, void *image, void *native)
1186static int 1201static int
1187module_open(Evas_Module *em) 1202module_open(Evas_Module *em)
1188{ 1203{
1204 printf("module eglfs open\n");
1189 /* check for valid evas module */ 1205 /* check for valid evas module */
1190 if (!em) return 0; 1206 if (!em) return 0;
1191 1207 printf("inherit gl_generic\n");
1192 /* get whatever engine module we inherit from */ 1208 /* get whatever engine module we inherit from */
1193 if (!_evas_module_engine_inherit(&pfunc, "gl_generic")) return 0; 1209 if (!_evas_module_engine_inherit(&pfunc, "gl_generic"))
1194 1210 return 0;
1211 printf("gl_generic loaded \n");
1195 /* try to create eina logging domain */ 1212 /* try to create eina logging domain */
1196 if (_evas_engine_eglfs_log_dom < 0) 1213 if (_evas_engine_eglfs_log_dom < 0)
1197 { 1214 {
@@ -1218,8 +1235,6 @@ module_open(Evas_Module *em)
1218 EVAS_API_OVERRIDE(output_dump, &func, eng_); 1235 EVAS_API_OVERRIDE(output_dump, &func, eng_);
1219 EVAS_API_OVERRIDE(image_native_set, &func, eng_); 1236 EVAS_API_OVERRIDE(image_native_set, &func, eng_);
1220 1237
1221 setenv("EGL_PLATFORM", "fbdev", 1);
1222
1223 gl_symbols(); 1238 gl_symbols();
1224 1239
1225 /* now advertise out own api */ 1240 /* now advertise out own api */
diff --git a/src/modules/evas/engines/eglfs/evas_engine.h b/src/modules/evas/engines/eglfs/evas_engine.h
index e02acb0d03..12aa07f810 100644
--- a/src/modules/evas/engines/eglfs/evas_engine.h
+++ b/src/modules/evas/engines/eglfs/evas_engine.h
@@ -15,9 +15,6 @@
15# include <EGL/eglmesaext.h> 15# include <EGL/eglmesaext.h>
16# include <GLES2/gl2.h> 16# include <GLES2/gl2.h>
17# include <GLES2/gl2ext.h> 17# include <GLES2/gl2ext.h>
18# include <hwcomposer.h>
19# include <hardware/hardware.h>
20# include <hardware/hwcomposer.h>
21# include "../gl_generic/Evas_Engine_GL_Generic.h" 18# include "../gl_generic/Evas_Engine_GL_Generic.h"
22 19
23extern int _evas_engine_eglfs_log_dom; 20extern int _evas_engine_eglfs_log_dom;
diff --git a/src/modules/evas/engines/eglfs/evas_outbuf.c b/src/modules/evas/engines/eglfs/evas_outbuf.c
index aa3cd8a1b2..9cc7834e42 100644
--- a/src/modules/evas/engines/eglfs/evas_outbuf.c
+++ b/src/modules/evas/engines/eglfs/evas_outbuf.c
@@ -1,113 +1,6 @@
1#include "evas_engine.h" 1#include "evas_engine.h"
2#include "../gl_common/evas_gl_define.h"
2 3
3#include <hybris/hwcomposerwindow/hwcomposer.h>
4#include <hardware/hwcomposer.h>
5#include <hardware/hardware.h>
6#include <android-config.h>
7
8static hwc_layer_1_t *fblayer;
9static hwc_composer_device_1_t *hwcDevicePtr;
10static hwc_display_contents_1_t **mList;
11
12void present(void *user_data, struct ANativeWindow *window,
13 struct ANativeWindowBuffer *buffer)
14{
15
16 int oldretire = mList[0]->retireFenceFd;
17 mList[0]->retireFenceFd = -1;
18 fblayer->handle = buffer->handle;
19 fblayer->acquireFenceFd = HWCNativeBufferGetFence(buffer);
20 fblayer->releaseFenceFd = -1;
21 int err = hwcDevicePtr->prepare(hwcDevicePtr, HWC_NUM_DISPLAY_TYPES, mList);
22 //assert(err == 0);
23
24 err = hwcDevicePtr->set(hwcDevicePtr, HWC_NUM_DISPLAY_TYPES, mList);
25 //assert(err == 0);
26 HWCNativeBufferSetFence(buffer, fblayer->releaseFenceFd);
27
28 if (oldretire != -1)
29 {
30 sync_wait(oldretire, -1);
31 close(oldretire);
32 }
33}
34
35
36EGLNativeWindowType create_hwcomposernativewindow(void)
37{
38 int err;
39 hw_module_t *hwcModule = 0;
40 hwcDevicePtr = 0;
41
42 err = hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **) &hwcModule);
43 //assert(err == 0);
44
45 err = hwc_open_1(hwcModule, &hwcDevicePtr);
46 //assert(err == 0);
47
48 hwcDevicePtr->blank(hwcDevicePtr, 0, 0);
49
50 uint32_t configs[5];
51 size_t numConfigs = 5;
52
53 err = hwcDevicePtr->getDisplayConfigs(hwcDevicePtr, 0, configs, &numConfigs);
54 //assert (err == 0);
55
56 int32_t attr_values[2];
57 uint32_t attributes[] = { HWC_DISPLAY_WIDTH, HWC_DISPLAY_HEIGHT, HWC_DISPLAY_NO_ATTRIBUTE };
58
59 hwcDevicePtr->getDisplayAttributes(hwcDevicePtr, 0,
60 configs[0], attributes, attr_values);
61
62 size_t size = sizeof(hwc_display_contents_1_t) + 2 * sizeof(hwc_layer_1_t);
63 hwc_display_contents_1_t *list = (hwc_display_contents_1_t *) malloc(size);
64 mList = (hwc_display_contents_1_t **) malloc(HWC_NUM_DISPLAY_TYPES * sizeof(hwc_display_contents_1_t *));
65 const hwc_rect_t r = { 0, 0, attr_values[0], attr_values[1] };
66
67 int counter = 0;
68 for (; counter < HWC_NUM_DISPLAY_TYPES; counter++)
69 mList[counter] = NULL;
70 // Assign buffer only to the first item, otherwise you get tearing
71 // if passed the same to multiple places
72 mList[0] = list;
73
74 fblayer = &list->hwLayers[0];
75 memset(fblayer, 0, sizeof(hwc_layer_1_t));
76 fblayer->compositionType = HWC_FRAMEBUFFER;
77 fblayer->hints = 0;
78 fblayer->flags = 0;
79 fblayer->handle = 0;
80 fblayer->transform = 0;
81 fblayer->blending = HWC_BLENDING_NONE;
82 fblayer->sourceCrop = r;
83 fblayer->displayFrame = r;
84 fblayer->visibleRegionScreen.numRects = 1;
85 fblayer->visibleRegionScreen.rects = &fblayer->displayFrame;
86 fblayer->acquireFenceFd = -1;
87 fblayer->releaseFenceFd = -1;
88 fblayer = &list->hwLayers[1];
89 memset(fblayer, 0, sizeof(hwc_layer_1_t));
90 fblayer->compositionType = HWC_FRAMEBUFFER_TARGET;
91 fblayer->hints = 0;
92 fblayer->flags = 0;
93 fblayer->handle = 0;
94 fblayer->transform = 0;
95 fblayer->blending = HWC_BLENDING_NONE;
96 fblayer->sourceCrop = r;
97 fblayer->displayFrame = r;
98 fblayer->visibleRegionScreen.numRects = 1;
99 fblayer->visibleRegionScreen.rects = &fblayer->displayFrame;
100 fblayer->acquireFenceFd = -1;
101 fblayer->releaseFenceFd = -1;
102
103 list->retireFenceFd = -1;
104 list->flags = HWC_GEOMETRY_CHANGED;
105 list->numHwLayers = 2;
106
107 EGLNativeWindowType win = NULL;
108 win = (EGLNativeWindowType)HWCNativeWindowCreate(attr_values[0], attr_values[1], HAL_PIXEL_FORMAT_RGBA_8888, present, NULL);
109 return win;
110}
111 4
112/* local variables */ 5/* local variables */
113static Outbuf *_evas_eglfs_window = NULL; 6static Outbuf *_evas_eglfs_window = NULL;
@@ -137,10 +30,6 @@ _evas_outbuf_make_current(void *data, void *doit)
137 return EINA_TRUE; 30 return EINA_TRUE;
138} 31}
139 32
140void _hwcomposer_present_cb(void *user_data, struct ANativeWindow *window, struct ANativeWindowBuffer *buffer)
141{
142}
143
144static Eina_Bool 33static Eina_Bool
145_evas_outbuf_egl_setup(Outbuf *ob) 34_evas_outbuf_egl_setup(Outbuf *ob)
146{ 35{
@@ -173,84 +62,6 @@ _evas_outbuf_egl_setup(Outbuf *ob)
173 else cfg_attr[n++] = 0; 62 else cfg_attr[n++] = 0;
174 cfg_attr[n++] = EGL_NONE; 63 cfg_attr[n++] = EGL_NONE;
175 64
176 int err;
177 hw_module_t *hwcModule = 0;
178 hwc_composer_device_1_t *hwcDevicePtr = 0;
179
180 err = hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **) &hwcModule);
181 if (err != 0)
182 {
183 ERR("hw_get_module() fail. code=%d", err);
184 return EINA_FALSE;
185 }
186 err = hwc_open_1(hwcModule, &hwcDevicePtr);
187 if (err != 0)
188 {
189 ERR("hwc_open_1 fail. code=%d", err);
190 return EINA_FALSE;
191 }
192 hwcDevicePtr->blank(hwcDevicePtr, 0, 0);
193
194 uint32_t configs[5];
195 size_t numConfigs = 5;
196
197 err = hwcDevicePtr->getDisplayConfigs(hwcDevicePtr, 0, configs, &numConfigs);
198 if (err != 0)
199 {
200 ERR("getDisplayConfig. code=%d", err);
201 return EINA_FALSE;
202 }
203
204 int32_t attr_values[2];
205 uint32_t attributes[] = { HWC_DISPLAY_WIDTH, HWC_DISPLAY_HEIGHT, HWC_DISPLAY_NO_ATTRIBUTE };
206
207 hwcDevicePtr->getDisplayAttributes(hwcDevicePtr, 0,
208 configs[0], attributes, attr_values);
209
210 DBG("width: %i height: %i\n", attr_values[0], attr_values[1]);
211
212 size_t size = sizeof(hwc_display_contents_1_t) + 2 * sizeof(hwc_layer_1_t);
213 hwc_display_contents_1_t *list = (hwc_display_contents_1_t *) malloc(size);
214 hwc_display_contents_1_t **mList = (hwc_display_contents_1_t **) malloc(HWC_NUM_DISPLAY_TYPES * sizeof(hwc_display_contents_1_t *));
215 const hwc_rect_t r = { 0, 0, attr_values[0], attr_values[1] };
216
217 int counter = 0;
218 for (; counter < HWC_NUM_DISPLAY_TYPES; counter++)
219 mList[counter] = NULL;
220 mList[0] = list;
221
222 hwc_layer_1_t *layer = &list->hwLayers[0];
223 memset(layer, 0, sizeof(hwc_layer_1_t));
224 layer->compositionType = HWC_FRAMEBUFFER;
225 layer->hints = 0;
226 layer->flags = 0;
227 layer->handle = 0;
228 layer->transform = 0;
229 layer->blending = HWC_BLENDING_NONE;
230 layer->sourceCrop = r;
231 layer->displayFrame = r;
232 layer->visibleRegionScreen.numRects = 1;
233 layer->visibleRegionScreen.rects = &layer->displayFrame;
234 layer->acquireFenceFd = -1;
235 layer->releaseFenceFd = -1;
236 layer = &list->hwLayers[1];
237 memset(layer, 0, sizeof(hwc_layer_1_t));
238 layer->compositionType = HWC_FRAMEBUFFER_TARGET;
239 layer->hints = 0;
240 layer->flags = 0;
241 layer->handle = 0;
242 layer->transform = 0;
243 layer->blending = HWC_BLENDING_NONE;
244 layer->sourceCrop = r;
245 layer->displayFrame = r;
246 layer->visibleRegionScreen.numRects = 1;
247 layer->visibleRegionScreen.rects = &layer->displayFrame;
248 layer->acquireFenceFd = -1;
249 layer->releaseFenceFd = -1;
250
251 list->retireFenceFd = -1;
252 list->flags = HWC_GEOMETRY_CHANGED;
253 list->numHwLayers = 2;
254 65
255 ob->egl.disp = eglGetDisplay(NULL); 66 ob->egl.disp = eglGetDisplay(NULL);
256 if (ob->egl.disp == EGL_NO_DISPLAY) 67 if (ob->egl.disp == EGL_NO_DISPLAY)
@@ -292,13 +103,30 @@ _evas_outbuf_egl_setup(Outbuf *ob)
292 return EINA_FALSE; 103 return EINA_FALSE;
293 } 104 }
294 105
295 // First is always best... 106 for (; i < ncfg; ++i)
296 ob->egl.config = cfgs[0]; 107 {
108 EGLint format;
109
110 if (!eglGetConfigAttrib(ob->egl.disp, cfgs[i], EGL_NATIVE_VISUAL_ID,
111 &format))
112 {
113 ERR("eglGetConfigAttrib() fail. code=%#x", eglGetError());
114 return EINA_FALSE;
115 }
116
117 DBG("Config Format: %d", format);
118 DBG("OB Format: %d", ob->info->info.format);
119
120 if (format == (int)ob->info->info.format)
121 {
122 ob->egl.config = cfgs[i];
123 break;
124 }
125 }
297 126
298 EGLNativeWindowType win = create_hwcomposernativewindow();
299 ob->egl.surface[0] = 127 ob->egl.surface[0] =
300 eglCreateWindowSurface(ob->egl.disp, ob->egl.config, 128 eglCreateWindowSurface(ob->egl.disp, ob->egl.config,
301 (EGLNativeWindowType)win, NULL); 129 NULL, NULL);
302 130
303 if (ob->egl.surface[0] == EGL_NO_SURFACE) 131 if (ob->egl.surface[0] == EGL_NO_SURFACE)
304 { 132 {