summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-09-19 11:55:29 -0400
committerChris Michael <cp.michael@samsung.com>2017-09-19 13:10:33 -0400
commit7198fe568b837cea62a82f17165086785147da08 (patch)
treeed6a2153f44749fef172c0d3a73402475ed46316
parent8a516c4d4fabf2e0f04acbe3f79a09c3eca174a3 (diff)
evas-drm: Support rotations other than 0
This patch adds support for software rotation in the evas drm engine. This is a fallback codepath in case hardware rotation is not supported for a given rotation amount. This patch also fixes a leak of and pending updates during output buffer free. ref T5999 Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/modules/evas/engines/drm/evas_outbuf.c131
1 files changed, 87 insertions, 44 deletions
diff --git a/src/modules/evas/engines/drm/evas_outbuf.c b/src/modules/evas/engines/drm/evas_outbuf.c
index 4029275712..f78d8e1658 100644
--- a/src/modules/evas/engines/drm/evas_outbuf.c
+++ b/src/modules/evas/engines/drm/evas_outbuf.c
@@ -29,12 +29,16 @@ _outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count)
29} 29}
30 30
31static Eina_Bool 31static Eina_Bool
32_outbuf_fb_create(Outbuf *ob, Outbuf_Fb *ofb) 32_outbuf_fb_create(Outbuf *ob, Outbuf_Fb *ofb, int w, int h)
33{ 33{
34 ofb->fb = 34 ofb->fb =
35 ecore_drm2_fb_create(ob->dev, ob->w, ob->h, 35 ecore_drm2_fb_create(ob->dev, w, 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)
38 {
39 WRN("Failed To Create FB: %d %d", w, h);
40 return EINA_FALSE;
41 }
38 42
39 ofb->age = 0; 43 ofb->age = 0;
40 ofb->drawn = EINA_FALSE; 44 ofb->drawn = EINA_FALSE;
@@ -59,7 +63,7 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
59{ 63{
60 Outbuf *ob; 64 Outbuf *ob;
61 char *num; 65 char *num;
62 int i = 0; 66 int i = 0, fw, fh;
63 67
64 ob = calloc(1, sizeof(Outbuf)); 68 ob = calloc(1, sizeof(Outbuf));
65 if (!ob) return NULL; 69 if (!ob) return NULL;
@@ -86,10 +90,21 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
86 else if (ob->priv.num > 4) ob->priv.num = 4; 90 else if (ob->priv.num > 4) ob->priv.num = 4;
87 } 91 }
88 92
93 if ((ob->rotation == 0) || (ob->rotation == 180))
94 {
95 fw = w;
96 fh = h;
97 }
98 else if ((ob->rotation == 90) || (ob->rotation == 270))
99 {
100 fw = h;
101 fh = w;
102 }
103
89 if ((!w) || (!h)) return ob; 104 if ((!w) || (!h)) return ob;
90 for (i = 0; i < ob->priv.num; i++) 105 for (i = 0; i < ob->priv.num; i++)
91 { 106 {
92 if (!_outbuf_fb_create(ob, &(ob->priv.ofb[i]))) 107 if (!_outbuf_fb_create(ob, &(ob->priv.ofb[i]), fw, fh))
93 { 108 {
94 WRN("Failed to create framebuffer %d", i); 109 WRN("Failed to create framebuffer %d", i);
95 continue; 110 continue;
@@ -104,6 +119,31 @@ _outbuf_free(Outbuf *ob)
104{ 119{
105 int i = 0; 120 int i = 0;
106 121
122 while (ob->priv.pending)
123 {
124 RGBA_Image *img;
125 Eina_Rectangle *rect;
126
127 img = ob->priv.pending->data;
128 ob->priv.pending =
129 eina_list_remove_list(ob->priv.pending, ob->priv.pending);
130
131 rect = img->extended_info;
132
133#ifdef EVAS_CSERVE2
134 if (evas_cserve2_use_get())
135 evas_cache2_image_close(&img->cache_entry);
136 else
137#endif
138 evas_cache_image_drop(&img->cache_entry);
139
140 eina_rectangle_free(rect);
141 }
142
143 /* TODO: idle flush */
144
145 _outbuf_flush(ob, NULL, NULL, EVAS_RENDER_MODE_UNDEF);
146
107 for (i = 0; i < ob->priv.num; i++) 147 for (i = 0; i < ob->priv.num; i++)
108 _outbuf_fb_destroy(&ob->priv.ofb[i]); 148 _outbuf_fb_destroy(&ob->priv.ofb[i]);
109 149
@@ -119,7 +159,7 @@ _outbuf_rotation_get(Outbuf *ob)
119void 159void
120_outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth) 160_outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
121{ 161{
122 int i = 0; 162 int i = 0, fw, fh;
123 unsigned int format = DRM_FORMAT_ARGB8888; 163 unsigned int format = DRM_FORMAT_ARGB8888;
124 164
125 switch (depth) 165 switch (depth)
@@ -165,30 +205,37 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
165 (ob->depth == depth) && (ob->format == format)) 205 (ob->depth == depth) && (ob->format == format))
166 return; 206 return;
167 207
208 ob->w = w;
209 ob->h = h;
168 ob->depth = depth; 210 ob->depth = depth;
169 ob->format = format; 211 ob->format = format;
170 ob->rotation = rotation; 212 ob->rotation = rotation;
171 213
172 ob->w = w;
173 ob->h = h;
174 if ((ob->rotation == 90) || (ob->rotation == 270))
175 {
176 ob->w = h;
177 ob->h = w;
178 }
179
180 for (i = 0; i < ob->priv.num; i++) 214 for (i = 0; i < ob->priv.num; i++)
181 _outbuf_fb_destroy(&ob->priv.ofb[i]); 215 _outbuf_fb_destroy(&ob->priv.ofb[i]);
182 216
217 if ((ob->rotation == 0) || (ob->rotation == 180))
218 {
219 fw = w;
220 fh = h;
221 }
222 else if ((ob->rotation == 90) || (ob->rotation == 270))
223 {
224 fw = h;
225 fh = w;
226 }
227
183 if ((!w) || (!h)) return; 228 if ((!w) || (!h)) return;
184 for (i = 0; i < ob->priv.num; i++) 229 for (i = 0; i < ob->priv.num; i++)
185 { 230 {
186 if (!_outbuf_fb_create(ob, &(ob->priv.ofb[i]))) 231 if (!_outbuf_fb_create(ob, &(ob->priv.ofb[i]), fw, fh))
187 { 232 {
188 WRN("Failed to create framebuffer %d", i); 233 WRN("Failed to create framebuffer %d", i);
189 continue; 234 continue;
190 } 235 }
191 } 236 }
237
238 /* TODO: idle flush */
192} 239}
193 240
194static Outbuf_Fb * 241static Outbuf_Fb *
@@ -262,51 +309,47 @@ void *
262_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) 309_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch)
263{ 310{
264 RGBA_Image *img = NULL; 311 RGBA_Image *img = NULL;
312 Eina_Rectangle *rect;
265 313
266 if ((w <= 0) || (h <= 0)) return NULL; 314 if ((w <= 0) || (h <= 0)) return NULL;
267 315
268 RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, ob->w, ob->h); 316 RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, ob->w, ob->h);
269 317
270 if (ob->rotation == 0) // && (ob->depth == 32)) 318 if (!(rect = eina_rectangle_new(x, y, w, h)))
271 { 319 return NULL;
272 Eina_Rectangle *rect;
273
274 if (!(rect = eina_rectangle_new(x, y, w, h)))
275 return NULL;
276 320
277#ifdef EVAS_CSERVE2 321#ifdef EVAS_CSERVE2
278 if (evas_cserve2_use_get()) 322 if (evas_cserve2_use_get())
279 img = (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get()); 323 img = (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
280 else 324 else
281#endif 325#endif
282 img = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); 326 img = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
283 327
284 if (!img) 328 if (!img)
285 { 329 {
286 eina_rectangle_free(rect); 330 eina_rectangle_free(rect);
287 return NULL; 331 return NULL;
288 } 332 }
289 333
290 img->cache_entry.flags.alpha = ob->alpha; 334 img->cache_entry.flags.alpha = ob->alpha;
291 335
292#ifdef EVAS_CSERVE2 336#ifdef EVAS_CSERVE2
293 if (evas_cserve2_use_get()) 337 if (evas_cserve2_use_get())
294 evas_cache2_image_surface_alloc(&img->cache_entry, w, h); 338 evas_cache2_image_surface_alloc(&img->cache_entry, w, h);
295 else 339 else
296#endif 340#endif
297 evas_cache_image_surface_alloc(&img->cache_entry, w, h); 341 evas_cache_image_surface_alloc(&img->cache_entry, w, h);
298 342
299 img->extended_info = rect; 343 img->extended_info = rect;
300 344
301 if (cx) *cx = 0; 345 if (cx) *cx = 0;
302 if (cy) *cy = 0; 346 if (cy) *cy = 0;
303 if (cw) *cw = w; 347 if (cw) *cw = w;
304 if (ch) *ch = h; 348 if (ch) *ch = h;
305 349
306 /* add this cached image data to pending writes */ 350 /* add this cached image data to pending writes */
307 ob->priv.pending = 351 ob->priv.pending =
308 eina_list_append(ob->priv.pending, img); 352 eina_list_append(ob->priv.pending, img);
309 }
310 353
311 return img; 354 return img;
312} 355}