summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-07-10 16:13:18 -0400
committerChris Michael <cp.michael@samsung.com>2018-07-10 16:13:18 -0400
commitf783163ca5a47a13797fff96eb4dc3beefd49c4f (patch)
tree0794498ce313a792ea92fdc411c3b20afa940e9e /src/modules/evas/engines
parent9028fb5ac26e95a9a5dbd88b72f22f78f5edd39b (diff)
evas_drm: Make the fbs an array of pointers
Summary: Use pointers instead of an array of structures, since we're going to replace the array with a list shortly. ref T7099 Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #committers, zmike Tags: #efl Maniphest Tasks: T7099 Differential Revision: https://phab.enlightenment.org/D6562
Diffstat (limited to 'src/modules/evas/engines')
-rw-r--r--src/modules/evas/engines/drm/evas_engine.h2
-rw-r--r--src/modules/evas/engines/drm/evas_outbuf.c57
2 files changed, 36 insertions, 23 deletions
diff --git a/src/modules/evas/engines/drm/evas_engine.h b/src/modules/evas/engines/drm/evas_engine.h
index af9cc4da3d..d200f42463 100644
--- a/src/modules/evas/engines/drm/evas_engine.h
+++ b/src/modules/evas/engines/drm/evas_engine.h
@@ -63,7 +63,7 @@ struct _Outbuf
63 struct 63 struct
64 { 64 {
65 int num; 65 int num;
66 Outbuf_Fb ofb[MAX_BUFFERS], *draw; 66 Outbuf_Fb *ofb[MAX_BUFFERS], *draw;
67 Ecore_Drm2_Output *output; 67 Ecore_Drm2_Output *output;
68 Ecore_Drm2_Plane *plane; 68 Ecore_Drm2_Plane *plane;
69 Eina_List *pending; 69 Eina_List *pending;
diff --git a/src/modules/evas/engines/drm/evas_outbuf.c b/src/modules/evas/engines/drm/evas_outbuf.c
index 0e525d566b..d205723505 100644
--- a/src/modules/evas/engines/drm/evas_outbuf.c
+++ b/src/modules/evas/engines/drm/evas_outbuf.c
@@ -28,23 +28,29 @@ _outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count)
28 ofb->age = 0; 28 ofb->age = 0;
29} 29}
30 30
31static Eina_Bool 31static Outbuf_Fb *
32_outbuf_fb_create(Outbuf *ob, Outbuf_Fb *ofb, int w, int h) 32_outbuf_fb_create(Outbuf *ob, int w, int h)
33{ 33{
34 ofb->fb = 34 Outbuf_Fb *out;
35
36 out = calloc(1, sizeof(Outbuf_Fb));
37 if (!out) return NULL;
38
39 out->fb =
35 ecore_drm2_fb_create(ob->dev, w, h, 40 ecore_drm2_fb_create(ob->dev, w, h,
36 ob->depth, ob->bpp, ob->format); 41 ob->depth, ob->bpp, ob->format);
37 if (!ofb->fb) 42 if (!out->fb)
38 { 43 {
39 WRN("Failed To Create FB: %d %d", w, h); 44 WRN("Failed To Create FB: %d %d", w, h);
40 return EINA_FALSE; 45 free(out);
46 return NULL;
41 } 47 }
42 48
43 ofb->age = 0; 49 out->age = 0;
44 ofb->drawn = EINA_FALSE; 50 out->drawn = EINA_FALSE;
45 ofb->valid = EINA_TRUE; 51 out->valid = EINA_TRUE;
46 52
47 return EINA_TRUE; 53 return out;
48} 54}
49 55
50static void 56static void
@@ -56,12 +62,14 @@ _outbuf_fb_destroy(Outbuf_Fb *ofb)
56 ofb->valid = EINA_FALSE; 62 ofb->valid = EINA_FALSE;
57 ofb->drawn = EINA_FALSE; 63 ofb->drawn = EINA_FALSE;
58 ofb->age = 0; 64 ofb->age = 0;
65 free(ofb);
59} 66}
60 67
61Outbuf * 68Outbuf *
62_outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h) 69_outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
63{ 70{
64 Outbuf *ob; 71 Outbuf *ob;
72 Outbuf_Fb *ofb;
65 char *num; 73 char *num;
66 int i = 0, fw = 0, fh = 0; 74 int i = 0, fw = 0, fh = 0;
67 75
@@ -104,11 +112,13 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
104 if ((!w) || (!h)) return ob; 112 if ((!w) || (!h)) return ob;
105 for (i = 0; i < ob->priv.num; i++) 113 for (i = 0; i < ob->priv.num; i++)
106 { 114 {
107 if (!_outbuf_fb_create(ob, &(ob->priv.ofb[i]), fw, fh)) 115 ofb = _outbuf_fb_create(ob, fw, fh);
116 if (!ofb)
108 { 117 {
109 WRN("Failed to create framebuffer %d", i); 118 WRN("Failed to create framebuffer %d", i);
110 continue; 119 continue;
111 } 120 }
121 ob->priv.ofb[i] = ofb;
112 } 122 }
113 123
114 return ob; 124 return ob;
@@ -145,7 +155,7 @@ _outbuf_free(Outbuf *ob)
145 _outbuf_flush(ob, NULL, NULL, EVAS_RENDER_MODE_UNDEF); 155 _outbuf_flush(ob, NULL, NULL, EVAS_RENDER_MODE_UNDEF);
146 156
147 for (i = 0; i < ob->priv.num; i++) 157 for (i = 0; i < ob->priv.num; i++)
148 _outbuf_fb_destroy(&ob->priv.ofb[i]); 158 _outbuf_fb_destroy(ob->priv.ofb[i]);
149 159
150 free(ob); 160 free(ob);
151} 161}
@@ -159,6 +169,7 @@ _outbuf_rotation_get(Outbuf *ob)
159void 169void
160_outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth) 170_outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
161{ 171{
172 Outbuf_Fb *ofb;
162 int i = 0, fw = 0, fh = 0; 173 int i = 0, fw = 0, fh = 0;
163 unsigned int format = DRM_FORMAT_ARGB8888; 174 unsigned int format = DRM_FORMAT_ARGB8888;
164 175
@@ -212,7 +223,7 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
212 ob->rotation = rotation; 223 ob->rotation = rotation;
213 224
214 for (i = 0; i < ob->priv.num; i++) 225 for (i = 0; i < ob->priv.num; i++)
215 _outbuf_fb_destroy(&ob->priv.ofb[i]); 226 _outbuf_fb_destroy(ob->priv.ofb[i]);
216 227
217 if ((ob->rotation == 0) || (ob->rotation == 180)) 228 if ((ob->rotation == 0) || (ob->rotation == 180))
218 { 229 {
@@ -228,11 +239,13 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
228 if ((!w) || (!h)) return; 239 if ((!w) || (!h)) return;
229 for (i = 0; i < ob->priv.num; i++) 240 for (i = 0; i < ob->priv.num; i++)
230 { 241 {
231 if (!_outbuf_fb_create(ob, &(ob->priv.ofb[i]), fw, fh)) 242 ofb = _outbuf_fb_create(ob, fw, fh);
243 if (!ofb)
232 { 244 {
233 WRN("Failed to create framebuffer %d", i); 245 WRN("Failed to create framebuffer %d", i);
234 continue; 246 continue;
235 } 247 }
248 ob->priv.ofb[i] = ofb;
236 } 249 }
237 250
238 /* TODO: idle flush */ 251 /* TODO: idle flush */
@@ -248,15 +261,15 @@ _outbuf_fb_wait(Outbuf *ob)
248 */ 261 */
249 for (i = 0; i < ob->priv.num; i++) 262 for (i = 0; i < ob->priv.num; i++)
250 { 263 {
251 if (ecore_drm2_fb_busy_get(ob->priv.ofb[i].fb)) continue; 264 if (ecore_drm2_fb_busy_get(ob->priv.ofb[i]->fb)) continue;
252 if (ob->priv.ofb[i].valid && (ob->priv.ofb[i].age > best_age)) 265 if (ob->priv.ofb[i]->valid && (ob->priv.ofb[i]->age > best_age))
253 { 266 {
254 best = i; 267 best = i;
255 best_age = ob->priv.ofb[i].age; 268 best_age = ob->priv.ofb[i]->age;
256 } 269 }
257 } 270 }
258 271
259 if (best >= 0) return &(ob->priv.ofb[best]); 272 if (best >= 0) return ob->priv.ofb[best];
260 return NULL; 273 return NULL;
261} 274}
262 275
@@ -274,13 +287,13 @@ _outbuf_fb_assign(Outbuf *ob)
274 287
275 for (i = 0; i < ob->priv.num; i++) 288 for (i = 0; i < ob->priv.num; i++)
276 { 289 {
277 if ((ob->priv.ofb[i].valid) && (ob->priv.ofb[i].drawn)) 290 if ((ob->priv.ofb[i]->valid) && (ob->priv.ofb[i]->drawn))
278 { 291 {
279 ob->priv.ofb[i].age++; 292 ob->priv.ofb[i]->age++;
280 if (ob->priv.ofb[i].age > 4) 293 if (ob->priv.ofb[i]->age > 4)
281 { 294 {
282 ob->priv.ofb[i].age = 0; 295 ob->priv.ofb[i]->age = 0;
283 ob->priv.ofb[i].drawn = EINA_FALSE; 296 ob->priv.ofb[i]->drawn = EINA_FALSE;
284 } 297 }
285 } 298 }
286 } 299 }