View | Details | Raw Unified | Return to bug 761312 | Differences between
and this patch

Collapse All | Expand All

(-)a/gdk/wayland/gdkdisplay-wayland.c (+3 lines)
 Lines 1020-1073   _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display, Link Here 
1020
                                            width*scale, height*scale,
1020
                                            width*scale, height*scale,
1021
                                            stride, WL_SHM_FORMAT_ARGB8888);
1021
                                            stride, WL_SHM_FORMAT_ARGB8888);
1022
  wl_buffer_add_listener (data->buffer, &buffer_listener, surface);
1022
  wl_buffer_add_listener (data->buffer, &buffer_listener, surface);
1023
1023
1024
  cairo_surface_set_user_data (surface, &gdk_wayland_cairo_key,
1024
  cairo_surface_set_user_data (surface, &gdk_wayland_cairo_key,
1025
                               data, gdk_wayland_cairo_surface_destroy);
1025
                               data, gdk_wayland_cairo_surface_destroy);
1026
1026
1027
  cairo_surface_set_device_scale (surface, scale, scale);
1027
  cairo_surface_set_device_scale (surface, scale, scale);
1028
1028
1029
  status = cairo_surface_status (surface);
1029
  status = cairo_surface_status (surface);
1030
  if (status != CAIRO_STATUS_SUCCESS)
1030
  if (status != CAIRO_STATUS_SUCCESS)
1031
    {
1031
    {
1032
      g_critical (G_STRLOC ": Unable to create Cairo image surface: %s",
1032
      g_critical (G_STRLOC ": Unable to create Cairo image surface: %s",
1033
                  cairo_status_to_string (status));
1033
                  cairo_status_to_string (status));
1034
    }
1034
    }
1035
1035
1036
  return surface;
1036
  return surface;
1037
}
1037
}
1038
1038
1039
struct wl_buffer *
1039
struct wl_buffer *
1040
_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface)
1040
_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface)
1041
{
1041
{
1042
  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
1042
  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
1043
  return data->buffer;
1043
  return data->buffer;
1044
}
1044
}
1045
1045
1046
void
1046
void
1047
_gdk_wayland_shm_surface_set_busy (cairo_surface_t *surface)
1047
_gdk_wayland_shm_surface_set_busy (cairo_surface_t *surface)
1048
{
1048
{
1049
  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
1049
  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
1050
1051
  g_assert (!data->busy);
1052
1050
  data->busy = TRUE;
1053
  data->busy = TRUE;
1051
  cairo_surface_reference (surface);
1054
  cairo_surface_reference (surface);
1052
}
1055
}
1053
1056
1054
gboolean
1057
gboolean
1055
_gdk_wayland_shm_surface_get_busy (cairo_surface_t *surface)
1058
_gdk_wayland_shm_surface_get_busy (cairo_surface_t *surface)
1056
{
1059
{
1057
  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
1060
  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
1058
  return data->busy;
1061
  return data->busy;
1059
}
1062
}
1060
1063
1061
gboolean
1064
gboolean
1062
_gdk_wayland_is_shm_surface (cairo_surface_t *surface)
1065
_gdk_wayland_is_shm_surface (cairo_surface_t *surface)
1063
{
1066
{
1064
  return cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key) != NULL;
1067
  return cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key) != NULL;
1065
}
1068
}
1066
1069
1067
GdkWaylandSelection *
1070
GdkWaylandSelection *
1068
gdk_wayland_display_get_selection (GdkDisplay *display)
1071
gdk_wayland_display_get_selection (GdkDisplay *display)
1069
{
1072
{
1070
  GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
1073
  GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
1071
1074
1072
  return wayland_display->selection;
1075
  return wayland_display->selection;
1073
}
1076
}
(-)a/gdk/wayland/gdkwindow-wayland.c (-1 / +1 lines)
 Lines 420-480   on_frame_clock_before_paint (GdkFrameClock *clock, Link Here 
420
      timings->predicted_presentation_time = presentation_time + refresh_interval;
420
      timings->predicted_presentation_time = presentation_time + refresh_interval;
421
    }
421
    }
422
  else
422
  else
423
    {
423
    {
424
      /* As above, but we don't actually know the phase of the vblank,
424
      /* As above, but we don't actually know the phase of the vblank,
425
       * so just assume that we're half way through a refresh cycle.
425
       * so just assume that we're half way through a refresh cycle.
426
       */
426
       */
427
      timings->predicted_presentation_time = timings->frame_time + refresh_interval / 2 + refresh_interval;
427
      timings->predicted_presentation_time = timings->frame_time + refresh_interval / 2 + refresh_interval;
428
    }
428
    }
429
}
429
}
430
430
431
static void
431
static void
432
on_frame_clock_after_paint (GdkFrameClock *clock,
432
on_frame_clock_after_paint (GdkFrameClock *clock,
433
                            GdkWindow     *window)
433
                            GdkWindow     *window)
434
{
434
{
435
  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
435
  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
436
  struct wl_callback *callback;
436
  struct wl_callback *callback;
437
437
438
  if (!impl->pending_commit)
438
  if (!impl->pending_commit)
439
    return;
439
    return;
440
440
441
  impl->pending_commit = FALSE;
441
  impl->pending_commit = FALSE;
442
  impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock);
442
  impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock);
443
  impl->awaiting_frame = TRUE;
443
  impl->awaiting_frame = TRUE;
444
444
445
  callback = wl_surface_frame (impl->surface);
445
  callback = wl_surface_frame (impl->surface);
446
  wl_callback_add_listener (callback, &frame_listener, window);
446
  wl_callback_add_listener (callback, &frame_listener, window);
447
  _gdk_frame_clock_freeze (clock);
447
  _gdk_frame_clock_freeze (clock);
448
448
449
  wl_surface_commit (impl->surface);
449
  wl_surface_commit (impl->surface);
450
  if (_gdk_wayland_is_shm_surface (impl->cairo_surface))
450
  if (_gdk_wayland_is_shm_surface (impl->cairo_surface) && !_gdk_wayland_shm_surface_get_busy (impl->cairo_surface))
451
    _gdk_wayland_shm_surface_set_busy (impl->cairo_surface);
451
    _gdk_wayland_shm_surface_set_busy (impl->cairo_surface);
452
452
453
  g_signal_emit (impl, signals[COMMITTED], 0);
453
  g_signal_emit (impl, signals[COMMITTED], 0);
454
}
454
}
455
455
456
static void
456
static void
457
window_update_scale (GdkWindow *window)
457
window_update_scale (GdkWindow *window)
458
{
458
{
459
  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
459
  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
460
  GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
460
  GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
461
  guint32 scale;
461
  guint32 scale;
462
  GSList *l;
462
  GSList *l;
463
463
464
  if (wayland_display->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE)
464
  if (wayland_display->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE)
465
    {
465
    {
466
      /* We can't set the scale on this surface */
466
      /* We can't set the scale on this surface */
467
      return;
467
      return;
468
    }
468
    }
469
469
470
  scale = 1;
470
  scale = 1;
471
  for (l = impl->outputs; l != NULL; l = l->next)
471
  for (l = impl->outputs; l != NULL; l = l->next)
472
    {
472
    {
473
      guint32 output_scale =
473
      guint32 output_scale =
474
        _gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data);
474
        _gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data);
475
      scale = MAX (scale, output_scale);
475
      scale = MAX (scale, output_scale);
476
    }
476
    }
477
477
478
  /* Notify app that scale changed */
478
  /* Notify app that scale changed */
479
  gdk_wayland_window_configure (window, window->width, window->height, scale);
479
  gdk_wayland_window_configure (window, window->width, window->height, scale);
480
}
480
}

Return to bug 761312