ecore-drm2: Pass output as data to drmModePageFlip and drmModeAtomicCommit
authorChristopher Michael <cp.michael@samsung.com>
Wed, 2 Jan 2019 16:05:07 +0000 (11:05 -0500)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 24 Jan 2019 05:20:18 +0000 (14:20 +0900)
In order to support per-output ticking, the drmModePageFlip and
drmModeAtomicCommit functions need to pass the actual Output as data
to the pageflip callback so that the pageflip callback function can
pass the proper rectangle to ecore_evas_animator_tick

Differential Revision: https://phab.enlightenment.org/D7678

src/lib/ecore_drm2/ecore_drm2_fb.c
src/lib/ecore_drm2/ecore_drm2_outputs.c
src/modules/ecore_evas/engines/drm/ecore_evas_drm.c

index 4e26fd7..33c0e27 100644 (file)
@@ -411,7 +411,7 @@ _fb_atomic_flip_test(Ecore_Drm2_Output *output)
      }
 
    ret =
-     sym_drmModeAtomicCommit(output->fd, req, flags, NULL);
+     sym_drmModeAtomicCommit(output->fd, req, flags, output);
    if (ret < 0) goto err;
 
    /* clear any previous request */
@@ -447,7 +447,7 @@ _fb_atomic_flip(Ecore_Drm2_Output *output)
 
    res =
      sym_drmModeAtomicCommit(output->fd, output->prep.atomic_req, flags,
-                             output->user_data);
+                             output);
    if (res < 0)
      {
         ERR("Failed Atomic Commit: %m");
@@ -499,7 +499,7 @@ _fb_flip(Ecore_Drm2_Output *output)
         static Eina_Bool bugged_about_bug = EINA_FALSE;
         repeat = EINA_FALSE;
         ret = sym_drmModePageFlip(fb->fd, output->crtc_id, fb->id,
-                                  DRM_MODE_PAGE_FLIP_EVENT, output->user_data);
+                                  DRM_MODE_PAGE_FLIP_EVENT, output);
         /* Some drivers (RPI - looking at you) are broken and produce
          * flip events before they are ready for another flip, so be
          * a little robust in the face of badness and try a few times
index e39f26a..928a16c 100644 (file)
@@ -1291,7 +1291,7 @@ _output_mode_atomic_set(Ecore_Drm2_Output *output, Ecore_Drm2_Output_Mode *mode)
      }
 
    ret = sym_drmModeAtomicCommit(output->fd, req, DRM_MODE_ATOMIC_ALLOW_MODESET,
-                                 output->user_data);
+                                 output);
    if (ret < 0)
      {
         ERR("Failed to commit atomic Mode: %m");
@@ -1538,7 +1538,7 @@ ecore_drm2_output_rotation_set(Ecore_Drm2_Output *output, int rotation)
              if (res < 0) goto err;
 
              res = sym_drmModeAtomicCommit(output->fd, req, flags,
-                                           output->user_data);
+                                           output);
              if (res < 0)
                goto err;
              else
index d300484..2c3909b 100644 (file)
@@ -718,27 +718,32 @@ static void
 _cb_pageflip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int sec, unsigned int usec, void *data)
 {
    Ecore_Evas *ee;
+   Ecore_Drm2_Output *output;
    Ecore_Evas_Engine_Drm_Data *edata;
    int ret;
 
-   ee = data;
+   output = data;
+
+   ee = ecore_drm2_output_user_data_get(output);
+   if (!ee) return;
+
    edata = ee->engine.data;
 
-   ret = ecore_drm2_fb_flip_complete(edata->output);
+   ret = ecore_drm2_fb_flip_complete(output);
 
    if (edata->ticking)
      {
         int x, y, w, h;
         double t = (double)sec + ((double)usec / 1000000);
 
-        ecore_drm2_output_info_get(edata->output, &x, &y, &w, &h, NULL);
+        ecore_drm2_output_info_get(output, &x, &y, &w, &h, NULL);
 
         if (!edata->once) t = ecore_time_get();
         ecore_evas_animator_tick(ee, &(Eina_Rectangle){x, y, w, h},
                                  t - edata->offset);
      }
    else if (ret)
-     ecore_drm2_fb_flip(NULL, edata->output);
+     ecore_drm2_fb_flip(NULL, output);
 }
 
 static void