summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2014-02-12 14:29:01 +0000
committerChris Michael <cp.michael@samsung.com>2014-02-28 13:12:51 +0000
commitc52d47ba36c6fac98ea61cf83eccff247c623832 (patch)
tree21e6f4ea4f3ad8ef665e6ff7b5b25afa499bd24c
parent62a6b32ed3d5a986f18602224f6db73c6726bf39 (diff)
evas-drm: Break out plane creation code into it's own function for cleaner code
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/drm/evas_drm.c96
1 files changed, 70 insertions, 26 deletions
diff --git a/src/modules/evas/engines/drm/evas_drm.c b/src/modules/evas/engines/drm/evas_drm.c
index 4b4343d10a..7e1134bc8a 100644
--- a/src/modules/evas/engines/drm/evas_drm.c
+++ b/src/modules/evas/engines/drm/evas_drm.c
@@ -320,6 +320,60 @@ _evas_drm_outbuf_page_flip(int fd EINA_UNUSED, unsigned int seq EINA_UNUSED, uns
320/* DBG("VBlank Event"); */ 320/* DBG("VBlank Event"); */
321/* } */ 321/* } */
322 322
323static Eina_Bool
324_evas_drm_outbuf_planes_setup(Outbuf *ob, drmModePlaneResPtr pres)
325{
326 drmModePlanePtr dplane;
327 Plane *oplane;
328 unsigned int p = 0;
329 unsigned int f = 0;
330
331 for (p = 0; p < pres->count_planes; p++)
332 {
333 /* try to get this plane */
334 if (!(dplane = drmModeGetPlane(ob->priv.fd, pres->planes[p])))
335 continue;
336
337 /* try to allocate space for our plane */
338 if (!(oplane =
339 malloc(sizeof(Plane) +
340 ((sizeof(unsigned int)) * dplane->count_formats))))
341 {
342 drmModeFreePlane(dplane);
343 continue;
344 }
345
346 oplane->crtcs = dplane->possible_crtcs;
347 oplane->id = dplane->plane_id;
348 oplane->num_formats = dplane->count_formats;
349 memcpy(oplane->formats, dplane->formats,
350 dplane->count_formats * sizeof(dplane->formats[0]));
351
352 DBG("Plane %d, %d %d", p, dplane->x, dplane->y);
353 DBG("\tFB: %d", dplane->fb_id);
354 DBG("\tCrtc: %d, %d %d", dplane->crtc_id,
355 dplane->crtc_x, dplane->crtc_y);
356
357 DBG("\tSupported Formats");
358 for (f = 0; f < dplane->count_formats; f++)
359 {
360 DBG("\t\t%C%C%C%C", (dplane->formats[f] & 0xFF),
361 ((dplane->formats[f] >> 8) & 0xFF),
362 ((dplane->formats[f] >> 16) & 0xFF),
363 ((dplane->formats[f] >> 24) & 0xFF));
364 }
365
366 /* free this plane */
367 drmModeFreePlane(dplane);
368
369 /* append this plane */
370 ob->priv.planes = eina_list_append(ob->priv.planes, oplane);
371 }
372
373 if (eina_list_count(ob->priv.planes) < 1) return EINA_FALSE;
374 return EINA_TRUE;
375}
376
323Eina_Bool 377Eina_Bool
324evas_drm_init(Evas_Engine_Info_Drm *info, int card) 378evas_drm_init(Evas_Engine_Info_Drm *info, int card)
325{ 379{
@@ -400,6 +454,7 @@ evas_drm_outbuf_setup(Outbuf *ob)
400{ 454{
401 drmModeRes *res; 455 drmModeRes *res;
402 drmModeConnector *conn; 456 drmModeConnector *conn;
457 drmModePlaneResPtr pres;
403 int i = 0; 458 int i = 0;
404 uint64_t dumb; 459 uint64_t dumb;
405 460
@@ -506,30 +561,18 @@ evas_drm_outbuf_setup(Outbuf *ob)
506 break; 561 break;
507 } 562 }
508 563
509 /* unsigned int p = 0; */ 564 /* get any plane resource from the card */
510 /* unsigned int f = 0; */ 565 pres = drmModeGetPlaneResources(ob->priv.fd);
511 /* drmModePlaneResPtr planes; */ 566
512 /* drmModePlanePtr plane; */ 567 /* if we have at least one plane, set it up */
513 /* planes = drmModeGetPlaneResources(ob->priv.fd); */ 568 if (pres->count_planes > 0)
514 /* for (p = 0; p < planes->count_planes; p++) */ 569 {
515 /* { */ 570 if (!_evas_drm_outbuf_planes_setup(ob, pres))
516 /* plane = drmModeGetPlane(ob->priv.fd, planes->planes[p]); */ 571 WRN("Could not setup hardware planes");
517 /* DBG("Plane %d, %d %d", p, plane->x, plane->y); */ 572 }
518 /* DBG("\tFB: %d", plane->fb_id); */
519 /* DBG("\tCrtc: %d, %d %d", plane->crtc_id, plane->crtc_x, plane->crtc_y); */
520 /* DBG("\tSupported Formats"); */
521 /* for (f = 0; f < plane->count_formats; f++) */
522 /* { */
523 /* DBG("\t\t%C%C%C%C", (plane->formats[f] & 0xFF), */
524 /* ((plane->formats[f] >> 8) & 0xFF), */
525 /* ((plane->formats[f] >> 16) & 0xFF), */
526 /* ((plane->formats[f] >> 24) & 0xFF)); */
527 /* } */
528
529 /* drmModeFreePlane(plane); */
530 /* } */
531 573
532 /* drmModeFreePlaneResources(planes); */ 574 /* free plane resources */
575 drmModeFreePlaneResources(pres);
533 576
534 /* free drm resources */ 577 /* free drm resources */
535 drmModeFreeResources(res); 578 drmModeFreeResources(res);
@@ -545,6 +588,7 @@ evas_drm_outbuf_framebuffer_set(Outbuf *ob, Buffer *buffer)
545 /* validate params */ 588 /* validate params */
546 if ((!ob) || (!buffer)) return; 589 if ((!ob) || (!buffer)) return;
547 590
591 buffer->valid = EINA_FALSE;
548 ret = drmModeSetCrtc(ob->priv.fd, ob->priv.crtc, buffer->fb, 0, 0, 592 ret = drmModeSetCrtc(ob->priv.fd, ob->priv.crtc, buffer->fb, 0, 0,
549 &ob->priv.conn, 1, &ob->priv.mode); 593 &ob->priv.conn, 1, &ob->priv.mode);
550 594
@@ -696,11 +740,11 @@ evas_drm_framebuffer_send(Outbuf *ob, Buffer *buffer, Eina_Rectangle *rects, uns
696 return EINA_FALSE; 740 return EINA_FALSE;
697 } 741 }
698 742
699 ob->priv.sent = buffer; 743 /* ob->priv.sent = buffer; */
700 ob->priv.pending_flip = EINA_TRUE; 744 ob->priv.pending_flip = EINA_TRUE;
701 745
702 while (ob->priv.pending_flip) 746 /* while (ob->priv.pending_flip) */
703 drmHandleEvent(ob->priv.fd, &ob->priv.ctx); 747 /* drmHandleEvent(ob->priv.fd, &ob->priv.ctx); */
704 748
705 return EINA_TRUE; 749 return EINA_TRUE;
706} 750}