     MIN(COALESCE(mtf.ts_next_frame_start, frame.ts_end), frame.ts_end)
       - MAX(COALESCE(mtf.ts_prev_frame_end, 0), frame.ts))
     AS INTEGER) AS dur_frame,
-  gcs.gcs_ts,
-  gcs.gcs_ts_end,
-  gcs.gcs_dur,
+  gcs.ts AS gcs_ts,
+  gcs.ts_end AS gcs_ts_end,
+  gcs.dur AS gcs_dur,
   CAST(1 AS INTEGER) AS app_missed
 FROM android_sysui_cuj_sf_actual_frame_timeline_slice frame
 JOIN android_sysui_cuj_surfaceflinger_main_thread_frames mtf ON frame.name = mtf.vsync
-LEFT JOIN android_sysui_cuj_gcs_to_mt_match gcs ON gcs.vsync = frame.name
+LEFT JOIN android_sysui_cuj_surfaceflinger_gpu_completion_slices gcs ON gcs.idx = gcs_idx
 WHERE frame.jank_type != 'None';

    on_msg.dur,
    on_msg.expected_vsync_ts,
    lag(on_msg.ts_end) OVER (ORDER BY on_msg.ts_end ASC) AS ts_prev_frame_end,
    lead(on_msg.ts) OVER (ORDER BY on_msg.ts ASC) AS ts_next_frame_start
FROM on_msg
JOIN android_sysui_cuj_sf_vsync_boundaries cuj_boundaries
WHERE on_msg.vsync >= cuj_boundaries.vsync_min AND on_msg.vsync <= cuj_boundaries.vsync_max;

-- Find just the composite slices
DROP TABLE IF EXISTS android_sysui_cuj_surfaceflinger_composite_slices;

    slice.name,
    slice.ts,
    slice.dur,
    slice.ts + slice.dur AS ts_end,
    gcs.gcs_idx
  FROM slice
  JOIN android_sysui_cuj_sf_main_thread_track main_track ON slice.track_id = main_track.id
  LEFT JOIN android_sysui_cuj_sf_mts_to_gcs gcs ON slice.ts = gcs.ts
  WHERE slice.dur > 0 AND slice.name GLOB 'composite*';

DROP VIEW IF EXISTS android_sysui_cuj_surfaceflinger_commit_composite_frames_in_cuj;
