diff --git a/.cogl.metadata b/.cogl.metadata index 8154318..755dde2 100644 --- a/.cogl.metadata +++ b/.cogl.metadata @@ -1 +1 @@ -40be1ceb45701d27d1e506efbbbdea8a06daf354 SOURCES/cogl-1.18.2.tar.xz +75f464d5156feb1b6c1fb553d543691711ff01a2 SOURCES/cogl-1.22.2.tar.xz diff --git a/.gitignore b/.gitignore index 58f9b30..f5d1e52 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/cogl-1.18.2.tar.xz +SOURCES/cogl-1.22.2.tar.xz diff --git a/SOURCES/0001-egl-Use-eglGetPlatformDisplay-not-eglGetDisplay.patch b/SOURCES/0001-egl-Use-eglGetPlatformDisplay-not-eglGetDisplay.patch new file mode 100644 index 0000000..a507b2a --- /dev/null +++ b/SOURCES/0001-egl-Use-eglGetPlatformDisplay-not-eglGetDisplay.patch @@ -0,0 +1,117 @@ +From 988e021960eb372be50038fdf0b2874f063c02b6 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Tue, 11 Oct 2016 16:16:38 -0400 +Subject: [PATCH] egl: Use eglGetPlatformDisplay not eglGetDisplay + +The latter requires the implementation to guess which kind of display it +is. Different implementations do different thing, in particular glvnd +does something different from Mesa, and it's better to be explicit about +what we need. + +Signed-off-by: Adam Jackson +--- + cogl/cogl-egl.h | 1 - + cogl/winsys/cogl-winsys-egl-kms.c | 3 ++- + cogl/winsys/cogl-winsys-egl-private.h | 33 +++++++++++++++++++++++++++++++++ + cogl/winsys/cogl-winsys-egl-wayland.c | 3 ++- + cogl/winsys/cogl-winsys-egl-x11.c | 2 +- + 5 files changed, 38 insertions(+), 4 deletions(-) + +diff --git a/cogl/cogl-egl.h b/cogl/cogl-egl.h +index cea7b10..5dac55f 100644 +--- a/cogl/cogl-egl.h ++++ b/cogl/cogl-egl.h +@@ -98,7 +98,6 @@ cogl_egl_context_get_egl_display (CoglContext *context); + EGLContext + cogl_egl_context_get_egl_context (CoglContext *context); + +- + COGL_END_DECLS + + /* The gobject introspection scanner seems to parse public headers in +diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c +index 4da1f14..ae9f6fc 100644 +--- a/cogl/winsys/cogl-winsys-egl-kms.c ++++ b/cogl/winsys/cogl-winsys-egl-kms.c +@@ -342,7 +342,8 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer, + goto fail; + } + +- egl_renderer->edpy = eglGetDisplay ((EGLNativeDisplayType)kms_renderer->gbm); ++ egl_renderer->edpy = cogl_winsys_egl_get_display(EGL_PLATFORM_GBM_KHR, ++ kms_renderer->gbm); + if (egl_renderer->edpy == EGL_NO_DISPLAY) + { + _cogl_set_error (error, COGL_WINSYS_ERROR, +diff --git a/cogl/winsys/cogl-winsys-egl-private.h b/cogl/winsys/cogl-winsys-egl-private.h +index 5d21b4f..27ac25c 100644 +--- a/cogl/winsys/cogl-winsys-egl-private.h ++++ b/cogl/winsys/cogl-winsys-egl-private.h +@@ -200,4 +200,37 @@ CoglBool + _cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, + CoglError **error); + ++static inline EGLDisplay ++cogl_winsys_egl_get_display (EGLint type, void *native) ++{ ++ EGLDisplay dpy = NULL; ++ const char *client_exts = eglQueryString (NULL, EGL_EXTENSIONS); ++ ++ if (g_strstr_len (client_exts, -1, "EGL_KHR_platform_base")) ++ { ++ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = ++ (void *) eglGetProcAddress ("eglGetPlatformDisplay"); ++ ++ if (get_platform_display) ++ dpy = get_platform_display (type, native, NULL); ++ ++ if (dpy) ++ return dpy; ++ } ++ ++ if (g_strstr_len (client_exts, -1, "EGL_EXT_platform_base")) ++ { ++ PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = ++ (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT"); ++ ++ if (get_platform_display) ++ dpy = get_platform_display (type, native, NULL); ++ ++ if (dpy) ++ return dpy; ++ } ++ ++ return eglGetDisplay ((EGLNativeDisplayType) native); ++} ++ + #endif /* __COGL_WINSYS_EGL_PRIVATE_H */ +diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c +index 2e22052..463041b 100644 +--- a/cogl/winsys/cogl-winsys-egl-wayland.c ++++ b/cogl/winsys/cogl-winsys-egl-wayland.c +@@ -289,7 +289,8 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer, + } + + egl_renderer->edpy = +- eglGetDisplay ((EGLNativeDisplayType) wayland_renderer->wayland_display); ++ cogl_winsys_egl_get_display (EGL_PLATFORM_WAYLAND_KHR, ++ wayland_renderer->wayland_display); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; +diff --git a/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/winsys/cogl-winsys-egl-x11.c +index 724a4d0..a7e9c2f 100644 +--- a/cogl/winsys/cogl-winsys-egl-x11.c ++++ b/cogl/winsys/cogl-winsys-egl-x11.c +@@ -278,7 +278,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer, + goto error; + + egl_renderer->edpy = +- eglGetDisplay ((EGLNativeDisplayType) xlib_renderer->xdpy); ++ cogl_winsys_egl_get_display (EGL_PLATFORM_X11_KHR, xlib_renderer->xdpy); + + if (!_cogl_winsys_egl_renderer_connect_common (renderer, error)) + goto error; +-- +2.9.3 + diff --git a/SOURCES/0001-examples-cogl-crate.c-fix-bug-when-waiting-for-next-.patch b/SOURCES/0001-examples-cogl-crate.c-fix-bug-when-waiting-for-next-.patch deleted file mode 100644 index 6c1e9f4..0000000 --- a/SOURCES/0001-examples-cogl-crate.c-fix-bug-when-waiting-for-next-.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 9d33312a2b78960d2cb840f60d2e5d6eb6ac87da Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Wed, 10 Feb 2016 17:20:00 -0500 -Subject: [PATCH 1/6] examples/cogl-crate.c: fix bug when waiting for next - frame - -The swap_ready variable was never reset, meaning that we weren't -effectively waiting for SYNC events that signal frame completion. ---- - examples/cogl-crate.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c -index 0836b82..1933c7c 100644 ---- a/examples/cogl-crate.c -+++ b/examples/cogl-crate.c -@@ -285,6 +285,7 @@ main (int argc, char **argv) - { - paint (&data); - cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb)); -+ data.swap_ready = FALSE; - } - - cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx), --- -1.8.3.1 - diff --git a/SOURCES/0002-CoglGPUInfo-fix-check-for-NVIDIA.patch b/SOURCES/0002-CoglGPUInfo-fix-check-for-NVIDIA.patch deleted file mode 100644 index dde2625..0000000 --- a/SOURCES/0002-CoglGPUInfo-fix-check-for-NVIDIA.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 30ee61a38eb9098cb45e566bef6c4d5a3a35f14b Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Thu, 11 Feb 2016 15:06:23 -0500 -Subject: [PATCH 2/6] CoglGPUInfo - fix check for NVIDIA - -NVIDIA drivers have a vendor of "NVIDIA Corporation" not "NVIDIA". -Check for both in case older drivers did use "NVIDIA" ---- - cogl/cogl-gpu-info.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/cogl/cogl-gpu-info.c b/cogl/cogl-gpu-info.c -index 54dfe18..d91830d 100644 ---- a/cogl/cogl-gpu-info.c -+++ b/cogl/cogl-gpu-info.c -@@ -169,7 +169,8 @@ check_qualcomm_vendor (const CoglGpuInfoStrings *strings) - static CoglBool - check_nvidia_vendor (const CoglGpuInfoStrings *strings) - { -- if (strcmp (strings->vendor_string, "NVIDIA") != 0) -+ if (strcmp (strings->vendor_string, "NVIDIA") != 0 && -+ strcmp (strings->vendor_string, "NVIDIA Corporation") != 0) - return FALSE; - - return TRUE; --- -1.8.3.1 - diff --git a/SOURCES/0003-CoglWinsysGLX-factor-out-some-duplicated-code.patch b/SOURCES/0003-CoglWinsysGLX-factor-out-some-duplicated-code.patch deleted file mode 100644 index be73758..0000000 --- a/SOURCES/0003-CoglWinsysGLX-factor-out-some-duplicated-code.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 603f16c96b2f1e5040d819277602086cc9e03699 Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Thu, 11 Feb 2016 16:33:03 -0500 -Subject: [PATCH 3/7] CoglWinsysGLX: factor out some duplicated code - -Add a helper function for repeated calls to clock_gettime(CLOCK_MONOTONIC) ---- - cogl/winsys/cogl-winsys-glx.c | 24 ++++++++++++------------ - 1 file changed, 12 insertions(+), 12 deletions(-) - -diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c -index 34fb071..ed20e81 100644 ---- a/cogl/winsys/cogl-winsys-glx.c -+++ b/cogl/winsys/cogl-winsys-glx.c -@@ -187,6 +187,15 @@ find_onscreen_for_xid (CoglContext *context, uint32_t xid) - return NULL; - } - -+static int64_t -+get_monotonic_time_ns (void) -+{ -+ struct timespec ts; -+ -+ clock_gettime (CLOCK_MONOTONIC, &ts); -+ return ts.tv_sec * G_GINT64_CONSTANT (1000000000) + ts.tv_nsec; -+} -+ - static void - ensure_ust_type (CoglRenderer *renderer, - GLXDrawable drawable) -@@ -197,7 +206,6 @@ ensure_ust_type (CoglRenderer *renderer, - int64_t msc; - int64_t sbc; - struct timeval tv; -- struct timespec ts; - int64_t current_system_time; - int64_t current_monotonic_time; - -@@ -227,9 +235,7 @@ ensure_ust_type (CoglRenderer *renderer, - - /* This is the time source that the newer (fixed) linux drm - * drivers use (Linux >= 3.8) */ -- clock_gettime (CLOCK_MONOTONIC, &ts); -- current_monotonic_time = (ts.tv_sec * G_GINT64_CONSTANT (1000000)) + -- (ts.tv_nsec / G_GINT64_CONSTANT (1000)); -+ current_monotonic_time = get_monotonic_time_ns () / 1000; - - if (current_monotonic_time > ust - 1000000 && - current_monotonic_time < ust + 1000000) -@@ -305,10 +311,7 @@ _cogl_winsys_get_clock_time (CoglContext *context) - } - case COGL_GLX_UST_IS_MONOTONIC_TIME: - { -- struct timespec ts; -- -- clock_gettime (CLOCK_MONOTONIC, &ts); -- return ts.tv_sec * G_GINT64_CONSTANT (1000000000) + ts.tv_nsec; -+ return get_monotonic_time_ns (); - } - } - -@@ -1636,16 +1639,13 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen) - else - { - uint32_t current_count; -- struct timespec ts; - - glx_renderer->glXGetVideoSync (¤t_count); - glx_renderer->glXWaitVideoSync (2, - (current_count + 1) % 2, - ¤t_count); - -- clock_gettime (CLOCK_MONOTONIC, &ts); -- info->presentation_time = -- ts.tv_sec * G_GINT64_CONSTANT (1000000000) + ts.tv_nsec; -+ info->presentation_time = get_monotonic_time_ns (); - } - } - } --- -1.8.3.1 - diff --git a/SOURCES/0004-Usability-of-SGI_video_sync-is-per-display-not-per-r.patch b/SOURCES/0004-Usability-of-SGI_video_sync-is-per-display-not-per-r.patch deleted file mode 100644 index b8a59b7..0000000 --- a/SOURCES/0004-Usability-of-SGI_video_sync-is-per-display-not-per-r.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 34419e3631d1e7e22441e611f686f6f9ca27b12a Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Thu, 11 Feb 2016 17:04:08 -0500 -Subject: [PATCH 4/6] Usability of SGI_video_sync is per-display not - per-renderer - -As previously commented in the code, SGI_video_sync is per-display, rather -than per-renderer. The is_direct flag for the renderer was tested before -it was initialized (per-display) and that resulted in SGI_video_sync -never being used. ---- - cogl/cogl-glx-display-private.h | 3 +++ - cogl/cogl-glx-renderer-private.h | 2 -- - cogl/winsys/cogl-winsys-glx.c | 52 +++++++++++++++++++++------------------- - 3 files changed, 31 insertions(+), 26 deletions(-) - -diff --git a/cogl/cogl-glx-display-private.h b/cogl/cogl-glx-display-private.h -index 133c118..1d1afc0 100644 ---- a/cogl/cogl-glx-display-private.h -+++ b/cogl/cogl-glx-display-private.h -@@ -51,6 +51,9 @@ typedef struct _CoglGLXDisplay - - CoglBool found_fbconfig; - CoglBool fbconfig_has_rgba_visual; -+ CoglBool is_direct; -+ CoglBool have_vblank_counter; -+ CoglBool can_vblank_wait; - GLXFBConfig fbconfig; - - /* Single context for all wins */ -diff --git a/cogl/cogl-glx-renderer-private.h b/cogl/cogl-glx-renderer-private.h -index cb8ff97..061f2cc 100644 ---- a/cogl/cogl-glx-renderer-private.h -+++ b/cogl/cogl-glx-renderer-private.h -@@ -43,8 +43,6 @@ typedef struct _CoglGLXRenderer - int glx_error_base; - int glx_event_base; - -- CoglBool is_direct; -- - /* Vblank stuff */ - int dri_fd; - -diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c -index 4450365..cd0b211 100644 ---- a/cogl/winsys/cogl-winsys-glx.c -+++ b/cogl/winsys/cogl-winsys-glx.c -@@ -710,23 +710,25 @@ update_base_winsys_features (CoglRenderer *renderer) - - g_strfreev (split_extensions); - -- /* Note: the GLX_SGI_video_sync spec explicitly states this extension -- * only works for direct contexts. */ -- if (!glx_renderer->is_direct) -- { -- glx_renderer->glXGetVideoSync = NULL; -- glx_renderer->glXWaitVideoSync = NULL; -- COGL_FLAGS_SET (glx_renderer->base_winsys_features, -- COGL_WINSYS_FEATURE_VBLANK_COUNTER, -- FALSE); -- } -+ /* The GLX_SGI_video_sync spec explicitly states this extension -+ * only works for direct contexts; we don't know per-renderer -+ * if the context is direct or not, so we turn off the feature -+ * flag; we still use the extension within this file looking -+ * instead at glx_display->have_vblank_counter. -+ */ -+ COGL_FLAGS_SET (glx_renderer->base_winsys_features, -+ COGL_WINSYS_FEATURE_VBLANK_COUNTER, -+ FALSE); -+ - - COGL_FLAGS_SET (glx_renderer->base_winsys_features, - COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN, - TRUE); - -- if (glx_renderer->glXWaitVideoSync || -- glx_renderer->glXWaitForMsc) -+ /* Because of the direct-context dependency, the VBLANK_WAIT feature -+ * doesn't reflect the presence of GLX_SGI_video_sync. -+ */ -+ if (glx_renderer->glXWaitForMsc) - COGL_FLAGS_SET (glx_renderer->base_winsys_features, - COGL_WINSYS_FEATURE_VBLANK_WAIT, - TRUE); -@@ -859,7 +861,7 @@ update_winsys_features (CoglContext *context, CoglError **error) - * by the SwapInterval so we have to throttle swap_region requests - * manually... */ - if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION) && -- _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_WAIT)) -+ (glx_display->have_vblank_counter || glx_display->can_vblank_wait)) - COGL_FLAGS_SET (context->winsys_features, - COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE, TRUE); - -@@ -1096,11 +1098,13 @@ create_context (CoglDisplay *display, CoglError **error) - return FALSE; - } - -- glx_renderer->is_direct = -+ glx_display->is_direct = - glx_renderer->glXIsDirect (xlib_renderer->xdpy, glx_display->glx_context); -+ glx_display->have_vblank_counter = glx_display->is_direct && glx_renderer->glXWaitVideoSync; -+ glx_display->can_vblank_wait = glx_renderer->glXWaitForMsc || glx_display->have_vblank_counter; - - COGL_NOTE (WINSYS, "Setting %s context", -- glx_renderer->is_direct ? "direct" : "indirect"); -+ glx_display->is_direct ? "direct" : "indirect"); - - /* XXX: GLX doesn't let us make a context current without a window - * so we create a dummy window that we can use while no CoglOnscreen -@@ -1612,12 +1616,13 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen) - CoglContext *ctx = framebuffer->context; - CoglGLXRenderer *glx_renderer; - CoglXlibRenderer *xlib_renderer; -+ CoglGLXDisplay *glx_display; - - glx_renderer = ctx->display->renderer->winsys; - xlib_renderer = _cogl_xlib_renderer_get_data (ctx->display->renderer); -+ glx_display = ctx->display->winsys; - -- if (glx_renderer->glXWaitForMsc || -- glx_renderer->glXGetVideoSync) -+ if (glx_display->can_vblank_wait) - { - CoglFrameInfo *info = g_queue_peek_tail (&onscreen->pending_frame_infos); - -@@ -1713,6 +1718,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, - CoglXlibRenderer *xlib_renderer = - _cogl_xlib_renderer_get_data (context->display->renderer); - CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; -+ CoglGLXDisplay *glx_display = context->display->winsys; - CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; - CoglOnscreenGLX *glx_onscreen = onscreen->winsys; - GLXDrawable drawable = -@@ -1769,9 +1775,8 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, - - if (framebuffer->config.swap_throttled) - { -- have_counter = -- _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_COUNTER); -- can_wait = _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_WAIT); -+ have_counter = glx_display->have_vblank_counter; -+ can_wait = glx_display->can_vblank_wait; - } - else - { -@@ -1928,6 +1933,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, - CoglXlibRenderer *xlib_renderer = - _cogl_xlib_renderer_get_data (context->display->renderer); - CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; -+ CoglGLXDisplay *glx_display = context->display->winsys; - CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; - CoglOnscreenGLX *glx_onscreen = onscreen->winsys; - CoglBool have_counter; -@@ -1947,8 +1953,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, - { - uint32_t end_frame_vsync_counter = 0; - -- have_counter = -- _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_COUNTER); -+ have_counter = glx_display->have_vblank_counter; - - /* If the swap_region API is also being used then we need to track - * the vsync counter for each swap request so we can manually -@@ -1958,8 +1963,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, - - if (!glx_renderer->glXSwapInterval) - { -- CoglBool can_wait = -- _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_VBLANK_WAIT); -+ CoglBool can_wait = glx_display->can_vblank_wait; - - /* If we are going to wait for VBLANK manually, we not only - * need to flush out pending drawing to the GPU before we --- -1.8.3.1 - diff --git a/SOURCES/0005-Fix-the-get_clock_time-without-GLX_OML_sync_control.patch b/SOURCES/0005-Fix-the-get_clock_time-without-GLX_OML_sync_control.patch deleted file mode 100644 index b174544..0000000 --- a/SOURCES/0005-Fix-the-get_clock_time-without-GLX_OML_sync_control.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 9259fc8ce95e38771e3501bd3936582f9a85b3a0 Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Thu, 11 Feb 2016 17:12:09 -0500 -Subject: [PATCH 5/6] Fix the get_clock_time() without GLX_OML_sync_control - -When we don't have GLX_OML_sync_control, we still can set the -frame presentation time, but we always use the system monotonic time, -so return that from get_clock_time(). ---- - cogl/winsys/cogl-winsys-glx.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c -index cd0b211..8ce1e37 100644 ---- a/cogl/winsys/cogl-winsys-glx.c -+++ b/cogl/winsys/cogl-winsys-glx.c -@@ -291,6 +291,9 @@ _cogl_winsys_get_clock_time (CoglContext *context) - { - CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; - -+ if (!glx_renderer->glXWaitForMsc) -+ return get_monotonic_time_ns (); -+ - /* We don't call ensure_ust_type() because we don't have a drawable - * to work with. cogl_get_clock_time() is documented to only work - * once a valid, non-zero, timestamp has been retrieved from Cogl. --- -1.8.3.1 - diff --git a/SOURCES/0006-For-NVIDIA-proprietary-drivers-implement-sync-events.patch b/SOURCES/0006-For-NVIDIA-proprietary-drivers-implement-sync-events.patch deleted file mode 100644 index 445fc23..0000000 --- a/SOURCES/0006-For-NVIDIA-proprietary-drivers-implement-sync-events.patch +++ /dev/null @@ -1,404 +0,0 @@ -From 062fd3cc6bf40990f748af9244728060f5330109 Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Thu, 11 Feb 2016 17:15:13 -0500 -Subject: [PATCH 6/7] For NVIDIA proprietary drivers, implement sync events - with a thread - -It's a good guess that the buffer swap will occur at the next vblank, -so use glXWaitVideoSync in a separate thread to deliver a sync event -rather than just letting the client block when frame drawing, which -can signficantly change app logic as compared to the INTEL_swap_event -case. ---- - cogl/cogl-private.h | 3 + - cogl/winsys/cogl-winsys-glx.c | 294 ++++++++++++++++++++++++++++++++++++++++-- - examples/cogl-crate.c | 3 + - 3 files changed, 289 insertions(+), 11 deletions(-) - -diff -up cogl-1.18.2/cogl/cogl-private.h.threaded-sync-events cogl-1.18.2/cogl/cogl-private.h ---- cogl-1.18.2/cogl/cogl-private.h.threaded-sync-events 2014-07-02 19:31:31.000000000 -0400 -+++ cogl-1.18.2/cogl/cogl-private.h 2016-06-30 15:44:39.823352236 -0400 -@@ -77,6 +77,9 @@ typedef enum - COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, - COGL_PRIVATE_FEATURE_GL_EMBEDDED, - COGL_PRIVATE_FEATURE_GL_WEB, -+ /* This is currently only implemented for GLX, but isn't actually -+ * that winsys dependent */ -+ COGL_PRIVATE_FEATURE_THREADED_SWAP_WAIT, - - COGL_N_PRIVATE_FEATURES - } CoglPrivateFeature; -diff -up cogl-1.18.2/cogl/winsys/cogl-winsys-glx.c.threaded-sync-events cogl-1.18.2/cogl/winsys/cogl-winsys-glx.c ---- cogl-1.18.2/cogl/winsys/cogl-winsys-glx.c.threaded-sync-events 2016-06-30 15:44:39.822352220 -0400 -+++ cogl-1.18.2/cogl/winsys/cogl-winsys-glx.c 2016-06-30 15:48:22.371948425 -0400 -@@ -65,12 +65,16 @@ - #include - #include - #include -+#include - #include - #include -+#include - - #include - #include - -+#include -+ - /* This is a relatively new extension */ - #ifndef GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV - #define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7 -@@ -100,6 +104,14 @@ typedef struct _CoglOnscreenGLX - CoglBool pending_sync_notify; - CoglBool pending_complete_notify; - CoglBool pending_resize_notify; -+ -+ GThread *swap_wait_thread; -+ GQueue *swap_wait_queue; -+ GCond swap_wait_cond; -+ GMutex swap_wait_mutex; -+ int swap_wait_pipe[2]; -+ GLXContext swap_wait_context; -+ CoglBool closing_down; - } CoglOnscreenGLX; - - typedef struct _CoglPixmapTextureEyeGLX -@@ -885,6 +897,28 @@ update_winsys_features (CoglContext *con - COGL_FEATURE_ID_PRESENTATION_TIME, - TRUE); - } -+ else -+ { -+ CoglGpuInfo *info = &context->gpu; -+ if (glx_display->have_vblank_counter && -+ info->vendor == COGL_GPU_INFO_VENDOR_NVIDIA) -+ { -+ COGL_FLAGS_SET (context->winsys_features, -+ COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT, TRUE); -+ COGL_FLAGS_SET (context->winsys_features, -+ COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT, TRUE); -+ /* TODO: remove this deprecated feature */ -+ COGL_FLAGS_SET (context->features, -+ COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, -+ TRUE); -+ COGL_FLAGS_SET (context->features, -+ COGL_FEATURE_ID_PRESENTATION_TIME, -+ TRUE); -+ COGL_FLAGS_SET (context->private_features, -+ COGL_PRIVATE_FEATURE_THREADED_SWAP_WAIT, -+ TRUE); -+ } -+ } - - /* We'll manually handle queueing dirty events in response to - * Expose events from X */ -@@ -1481,7 +1515,8 @@ _cogl_winsys_onscreen_init (CoglOnscreen - } - - #ifdef GLX_INTEL_swap_event -- if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) -+ if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT) && -+ !_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_THREADED_SWAP_WAIT)) - { - GLXDrawable drawable = - glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin; -@@ -1524,6 +1559,31 @@ _cogl_winsys_onscreen_deinit (CoglOnscre - xlib_onscreen->output = NULL; - } - -+ if (glx_onscreen->swap_wait_thread) -+ { -+ g_mutex_lock (&glx_onscreen->swap_wait_mutex); -+ glx_onscreen->closing_down = TRUE; -+ g_cond_signal (&glx_onscreen->swap_wait_cond); -+ g_mutex_unlock (&glx_onscreen->swap_wait_mutex); -+ g_thread_join (glx_onscreen->swap_wait_thread); -+ glx_onscreen->swap_wait_thread = NULL; -+ -+ g_cond_clear (&glx_onscreen->swap_wait_cond); -+ g_mutex_clear (&glx_onscreen->swap_wait_mutex); -+ -+ g_queue_free (glx_onscreen->swap_wait_queue); -+ glx_onscreen->swap_wait_queue = NULL; -+ -+ _cogl_poll_renderer_remove_fd (context->display->renderer, -+ glx_onscreen->swap_wait_pipe[0]); -+ -+ close (glx_onscreen->swap_wait_pipe[0]); -+ close (glx_onscreen->swap_wait_pipe[1]); -+ -+ glx_renderer->glXDestroyContext (xlib_renderer->xdpy, -+ glx_onscreen->swap_wait_context); -+ } -+ - _cogl_xlib_renderer_trap_errors (context->display->renderer, &old_state); - - drawable = -@@ -1759,6 +1819,199 @@ set_frame_info_output (CoglOnscreen *ons - } - } - -+static gpointer -+threaded_swap_wait (gpointer data) -+{ -+ CoglOnscreen *onscreen = data; -+ -+ CoglOnscreenGLX *glx_onscreen = onscreen->winsys; -+ -+ CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); -+ CoglContext *context = framebuffer->context; -+ CoglDisplay *display = context->display; -+ CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (display->renderer); -+ CoglGLXDisplay *glx_display = display->winsys; -+ CoglGLXRenderer *glx_renderer = display->renderer->winsys; -+ GLXDrawable dummy_drawable; -+ -+ if (glx_display->dummy_glxwin) -+ dummy_drawable = glx_display->dummy_glxwin; -+ else -+ dummy_drawable = glx_display->dummy_xwin; -+ -+ glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy, -+ dummy_drawable, -+ dummy_drawable, -+ glx_onscreen->swap_wait_context); -+ -+ g_mutex_lock (&glx_onscreen->swap_wait_mutex); -+ -+ while (TRUE) -+ { -+ gpointer queue_element; -+ uint32_t vblank_counter; -+ -+ while (!glx_onscreen->closing_down && glx_onscreen->swap_wait_queue->length == 0) -+ g_cond_wait (&glx_onscreen->swap_wait_cond, &glx_onscreen->swap_wait_mutex); -+ -+ if (glx_onscreen->closing_down) -+ break; -+ -+ queue_element = g_queue_pop_tail (glx_onscreen->swap_wait_queue); -+ vblank_counter = GPOINTER_TO_UINT(queue_element); -+ -+ g_mutex_unlock (&glx_onscreen->swap_wait_mutex); -+ glx_renderer->glXWaitVideoSync (2, -+ (vblank_counter + 1) % 2, -+ &vblank_counter); -+ g_mutex_lock (&glx_onscreen->swap_wait_mutex); -+ -+ if (!glx_onscreen->closing_down) -+ { -+ int bytes_written = 0; -+ -+ union { -+ char bytes[8]; -+ int64_t presentation_time; -+ } u; -+ -+ u.presentation_time = get_monotonic_time_ns (); -+ -+ while (bytes_written < 8) -+ { -+ int res = write (glx_onscreen->swap_wait_pipe[1], u.bytes + bytes_written, 8 - bytes_written); -+ if (res == -1) -+ { -+ if (errno != EINTR) -+ g_error ("Error writing to swap notification pipe: %s\n", -+ g_strerror (errno)); -+ } -+ else -+ { -+ bytes_written += res; -+ } -+ } -+ } -+ } -+ -+ g_mutex_unlock (&glx_onscreen->swap_wait_mutex); -+ -+ glx_renderer->glXMakeContextCurrent (xlib_renderer->xdpy, -+ None, -+ None, -+ NULL); -+ -+ return NULL; -+} -+ -+static int64_t -+threaded_swap_wait_pipe_prepare (void *user_data) -+{ -+ return -1; -+} -+ -+static void -+threaded_swap_wait_pipe_dispatch (void *user_data, int revents) -+{ -+ CoglOnscreen *onscreen = user_data; -+ CoglOnscreenGLX *glx_onscreen = onscreen->winsys; -+ -+ CoglFrameInfo *info; -+ -+ if ((revents & COGL_POLL_FD_EVENT_IN)) -+ { -+ int bytes_read = 0; -+ -+ union { -+ char bytes[8]; -+ int64_t presentation_time; -+ } u; -+ -+ while (bytes_read < 8) -+ { -+ int res = read (glx_onscreen->swap_wait_pipe[0], u.bytes + bytes_read, 8 - bytes_read); -+ if (res == -1) -+ { -+ if (errno != EINTR) -+ g_error ("Error reading from swap notification pipe: %s\n", -+ g_strerror (errno)); -+ } -+ else -+ { -+ bytes_read += res; -+ } -+ } -+ -+ set_sync_pending (onscreen); -+ set_complete_pending (onscreen); -+ -+ info = g_queue_peek_head (&onscreen->pending_frame_infos); -+ info->presentation_time = u.presentation_time; -+ } -+} -+ -+static void -+start_threaded_swap_wait (CoglOnscreen *onscreen, -+ uint32_t vblank_counter) -+{ -+ CoglOnscreenGLX *glx_onscreen = onscreen->winsys; -+ CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); -+ CoglContext *context = framebuffer->context; -+ -+ if (glx_onscreen->swap_wait_thread == NULL) -+ { -+ CoglDisplay *display = context->display; -+ CoglGLXRenderer *glx_renderer = display->renderer->winsys; -+ CoglGLXDisplay *glx_display = display->winsys; -+ CoglOnscreenXlib *xlib_onscreen = onscreen->winsys; -+ CoglXlibRenderer *xlib_renderer = -+ _cogl_xlib_renderer_get_data (display->renderer); -+ -+ GLXDrawable drawable = -+ glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin; -+ int i; -+ -+ ensure_ust_type (display->renderer, drawable); -+ -+ if ((pipe (glx_onscreen->swap_wait_pipe) == -1)) -+ g_error ("Couldn't create pipe for swap notification: %s\n", -+ g_strerror (errno)); -+ -+ for (i = 0; i < 2; i++) -+ { -+ if (fcntl(glx_onscreen->swap_wait_pipe[i], F_SETFD, -+ fcntl(glx_onscreen->swap_wait_pipe[i], F_GETFD, 0) | FD_CLOEXEC) == -1) -+ g_error ("Couldn't set swap notification pipe CLOEXEC: %s\n", -+ g_strerror (errno)); -+ } -+ -+ _cogl_poll_renderer_add_fd (display->renderer, -+ glx_onscreen->swap_wait_pipe[0], -+ COGL_POLL_FD_EVENT_IN, -+ threaded_swap_wait_pipe_prepare, -+ threaded_swap_wait_pipe_dispatch, -+ onscreen); -+ -+ glx_onscreen->swap_wait_queue = g_queue_new (); -+ g_mutex_init (&glx_onscreen->swap_wait_mutex); -+ g_cond_init (&glx_onscreen->swap_wait_cond); -+ glx_onscreen->swap_wait_context = -+ glx_renderer->glXCreateNewContext (xlib_renderer->xdpy, -+ glx_display->fbconfig, -+ GLX_RGBA_TYPE, -+ glx_display->glx_context, -+ True); -+ glx_onscreen->swap_wait_thread = g_thread_new ("cogl_glx_swap_wait", -+ threaded_swap_wait, -+ onscreen); -+ } -+ -+ g_mutex_lock (&glx_onscreen->swap_wait_mutex); -+ g_queue_push_head (glx_onscreen->swap_wait_queue, GUINT_TO_POINTER(vblank_counter)); -+ g_cond_signal (&glx_onscreen->swap_wait_cond); -+ g_mutex_unlock (&glx_onscreen->swap_wait_mutex); -+} -+ - static void - _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, - const int *user_rectangles, -@@ -2002,19 +2255,38 @@ _cogl_winsys_onscreen_swap_buffers_with_ - - if (framebuffer->config.swap_throttled) - { -- uint32_t end_frame_vsync_counter = 0; -- - have_counter = glx_display->have_vblank_counter; - -- /* If the swap_region API is also being used then we need to track -- * the vsync counter for each swap request so we can manually -- * throttle swap_region requests. */ -- if (have_counter) -- end_frame_vsync_counter = _cogl_winsys_get_vsync_counter (context); -- -- if (!glx_renderer->glXSwapInterval) -+ if (glx_renderer->glXSwapInterval) - { -- CoglBool can_wait = glx_display->can_vblank_wait; -+ if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_THREADED_SWAP_WAIT)) -+ { -+ /* If we didn't wait for the GPU here, then it's easy to get the case -+ * where there is a VBlank between the point where we get the vsync counter -+ * and the point where the GPU is ready to actually perform the glXSwapBuffers(), -+ * and the swap wait terminates at the first VBlank rather than the one -+ * where the swap buffers happens. Calling glFinish() here makes this a -+ * rare race since the GPU is already ready to swap when we call glXSwapBuffers(). -+ * The glFinish() also prevents any serious damage if the rare race happens, -+ * since it will wait for the preceding glXSwapBuffers() and prevent us from -+ * getting premanently ahead. (For NVIDIA drivers, glFinish() after glXSwapBuffers() -+ * waits for the buffer swap to happen.) -+ */ -+ _cogl_winsys_wait_for_gpu (onscreen); -+ start_threaded_swap_wait (onscreen, _cogl_winsys_get_vsync_counter (context)); -+ } -+ } -+ else -+ { -+ CoglBool can_wait = have_counter || glx_display->can_vblank_wait; -+ -+ uint32_t end_frame_vsync_counter = 0; -+ -+ /* If the swap_region API is also being used then we need to track -+ * the vsync counter for each swap request so we can manually -+ * throttle swap_region requests. */ -+ if (have_counter) -+ end_frame_vsync_counter = _cogl_winsys_get_vsync_counter (context); - - /* If we are going to wait for VBLANK manually, we not only - * need to flush out pending drawing to the GPU before we -diff -up cogl-1.18.2/examples/cogl-crate.c.threaded-sync-events cogl-1.18.2/examples/cogl-crate.c ---- cogl-1.18.2/examples/cogl-crate.c.threaded-sync-events 2016-06-30 15:44:39.804351929 -0400 -+++ cogl-1.18.2/examples/cogl-crate.c 2016-06-30 15:44:39.824352252 -0400 -@@ -1,5 +1,6 @@ - #include - #include -+#include - - /* The state for this example... */ - typedef struct _Data -@@ -153,6 +154,8 @@ main (int argc, char **argv) - float fovy, aspect, z_near, z_2d, z_far; - CoglDepthState depth_state; - -+ XInitThreads (); -+ - ctx = cogl_context_new (NULL, &error); - if (!ctx) { - fprintf (stderr, "Failed to create context: %s\n", error->message); diff --git a/SOURCES/0007-Add-cogl_xlib_renderer_set_threaded_swap_wait_enable.patch b/SOURCES/0007-Add-cogl_xlib_renderer_set_threaded_swap_wait_enable.patch deleted file mode 100644 index 3141576..0000000 --- a/SOURCES/0007-Add-cogl_xlib_renderer_set_threaded_swap_wait_enable.patch +++ /dev/null @@ -1,159 +0,0 @@ -From e31a4722c43db908e1831f77559d7a721cc08c1d Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Wed, 29 Jun 2016 13:52:59 -0400 -Subject: [PATCH] Add cogl_xlib_renderer_set_threaded_swap_wait_enabled() - -Because the threaded-swap-wait functionality requires XInitThreads(), -and because it isn't clear that it is a win for all applications, -add a API function to conditionally enable it. - -Fix the cogl-crate example not to just have a hard-coded dependency -on libX11. ---- - cogl/cogl-renderer-private.h | 1 + - cogl/cogl-renderer.c | 11 +++++++++++ - cogl/cogl-xlib-renderer.h | 30 ++++++++++++++++++++++++++++++ - cogl/winsys/cogl-winsys-glx.c | 4 +++- - examples/cogl-crate.c | 32 ++++++++++++++++++++++++++++++-- - 5 files changed, 75 insertions(+), 3 deletions(-) - -diff -up cogl-1.18.2/cogl/cogl-renderer.c.swap-wait-setter cogl-1.18.2/cogl/cogl-renderer.c ---- cogl-1.18.2/cogl/cogl-renderer.c.swap-wait-setter 2016-06-30 15:58:16.047534998 -0400 -+++ cogl-1.18.2/cogl/cogl-renderer.c 2016-06-30 15:58:16.084535595 -0400 -@@ -357,6 +357,17 @@ cogl_xlib_renderer_request_reset_on_vide - - renderer->xlib_want_reset_on_video_memory_purge = enable; - } -+ -+void -+cogl_xlib_renderer_set_threaded_swap_wait_enabled (CoglRenderer *renderer, -+ CoglBool enable) -+{ -+ _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); -+ /* NB: Renderers are considered immutable once connected */ -+ _COGL_RETURN_IF_FAIL (!renderer->connected); -+ -+ renderer->xlib_enable_threaded_swap_wait = enable; -+} - #endif /* COGL_HAS_XLIB_SUPPORT */ - - CoglBool -diff -up cogl-1.18.2/cogl/cogl-renderer-private.h.swap-wait-setter cogl-1.18.2/cogl/cogl-renderer-private.h ---- cogl-1.18.2/cogl/cogl-renderer-private.h.swap-wait-setter 2016-06-30 15:58:16.047534998 -0400 -+++ cogl-1.18.2/cogl/cogl-renderer-private.h 2016-06-30 15:58:16.084535595 -0400 -@@ -71,6 +71,7 @@ struct _CoglRenderer - Display *foreign_xdpy; - CoglBool xlib_enable_event_retrieval; - CoglBool xlib_want_reset_on_video_memory_purge; -+ CoglBool xlib_enable_threaded_swap_wait; - #endif - - #ifdef COGL_HAS_WIN32_SUPPORT -diff -up cogl-1.18.2/cogl/cogl-xlib-renderer.h.swap-wait-setter cogl-1.18.2/cogl/cogl-xlib-renderer.h ---- cogl-1.18.2/cogl/cogl-xlib-renderer.h.swap-wait-setter 2016-06-30 15:58:16.047534998 -0400 -+++ cogl-1.18.2/cogl/cogl-xlib-renderer.h 2016-06-30 15:58:16.084535595 -0400 -@@ -166,6 +166,36 @@ void - cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer, - CoglBool enable); - -+/** -+ * cogl_xlib_renderer_set_threaded_swap_wait_enabled: -+ * @renderer: a #CoglRenderer -+ * @enable: The new value -+ * -+ * Sets whether Cogl is allowed to use a separate threaded to wait for the -+ * completion of glXSwapBuffers() and call the frame callback for the -+ * corresponding #CoglOnscreen. This is a way of emulating the -+ * INTEL_swap_event extension, and will only ever be used if -+ * INTEL_swap_event is not present; it will also only be used for -+ * specific white-listed drivers that are known to work correctly with -+ * multiple contexts sharing state between threads. -+ * -+ * The advantage of enabling this is that it will allow your main loop -+ * to do other work while waiting for the system to be ready to draw -+ * the next frame, instead of blocking in glXSwapBuffers(). A disadvantage -+ * is that the driver will be prevented from buffering up multiple frames -+ * even if it thinks that it would be advantageous. In general, this -+ * will work best for something like a system compositor that is doing -+ * simple drawing but handling lots of other complex tasks. -+ * -+ * If you enable this, you must call XInitThreads() before any other -+ * X11 calls in your program. (See the documentation for XInitThreads()) -+ * -+ * Stability: unstable -+ */ -+void -+cogl_xlib_renderer_set_threaded_swap_wait_enabled (CoglRenderer *renderer, -+ CoglBool enable); -+ - Display * - cogl_xlib_renderer_get_display (CoglRenderer *renderer); - -diff -up cogl-1.18.2/cogl/winsys/cogl-winsys-glx.c.swap-wait-setter cogl-1.18.2/cogl/winsys/cogl-winsys-glx.c ---- cogl-1.18.2/cogl/winsys/cogl-winsys-glx.c.swap-wait-setter 2016-06-30 15:58:16.085535611 -0400 -+++ cogl-1.18.2/cogl/winsys/cogl-winsys-glx.c 2016-06-30 15:58:55.708175372 -0400 -@@ -901,6 +901,7 @@ update_winsys_features (CoglContext *con - { - CoglGpuInfo *info = &context->gpu; - if (glx_display->have_vblank_counter && -+ context->display->renderer->xlib_enable_threaded_swap_wait && - info->vendor == COGL_GPU_INFO_VENDOR_NVIDIA) - { - COGL_FLAGS_SET (context->winsys_features, -diff -up cogl-1.18.2/examples/cogl-crate.c.swap-wait-setter cogl-1.18.2/examples/cogl-crate.c ---- cogl-1.18.2/examples/cogl-crate.c.swap-wait-setter 2016-06-30 15:58:16.082535563 -0400 -+++ cogl-1.18.2/examples/cogl-crate.c 2016-06-30 15:58:16.085535611 -0400 -@@ -1,6 +1,9 @@ - #include - #include -+#ifdef COGL_HAS_XLIB_SUPPORT - #include -+#include -+#endif /* COGL_HAS_XLIB_SUPPORT */ - - /* The state for this example... */ - typedef struct _Data -@@ -145,6 +148,8 @@ frame_event_cb (CoglOnscreen *onscreen, - int - main (int argc, char **argv) - { -+ CoglRenderer *renderer; -+ CoglDisplay *display; - CoglContext *ctx; - CoglOnscreen *onscreen; - CoglFramebuffer *fb; -@@ -154,9 +159,32 @@ main (int argc, char **argv) - float fovy, aspect, z_near, z_2d, z_far; - CoglDepthState depth_state; - -- XInitThreads (); -+ renderer = cogl_renderer_new (); - -- ctx = cogl_context_new (NULL, &error); -+#ifdef COGL_HAS_XLIB_SUPPORT -+ /* Guess if we're using the GLX renderer; we could just blindly -+ * call XInitThreads() as long as we're linked against Xlib -+ * but it's a bit cleaner not to if we're not going to even -+ * open a display. -+ */ -+ if (g_getenv("DISPLAY") != NULL) -+ { -+ const char *renderer_environment = g_getenv("COGL_RENDERER_NEW"); -+ if (renderer_environment == NULL || g_strcmp0 (renderer_environment, "GLX") == 0) -+ { -+ XInitThreads (); -+ cogl_xlib_renderer_set_threaded_swap_wait_enabled (renderer, TRUE); -+ } -+ } -+#endif /* COGL_HAS_XLIB_SUPPORT */ -+ -+ if (!cogl_renderer_connect (renderer, &error)) { -+ fprintf (stderr, "Failed to connect CoglRenderer: %s\n", error->message); -+ return 1; -+ } -+ -+ display = cogl_display_new (renderer, NULL); -+ ctx = cogl_context_new (display, &error); - if (!ctx) { - fprintf (stderr, "Failed to create context: %s\n", error->message); - return 1; diff --git a/SOURCES/Add-support-for-setting-up-stereo-CoglOnscreens.patch b/SOURCES/Add-support-for-setting-up-stereo-CoglOnscreens.patch deleted file mode 100644 index f39b62c..0000000 --- a/SOURCES/Add-support-for-setting-up-stereo-CoglOnscreens.patch +++ /dev/null @@ -1,398 +0,0 @@ -From d16df5a5aab126d8114b932ba8abab05ff242026 Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Mon, 28 Apr 2014 12:37:32 -0400 -Subject: [PATCH] Add support for setting up stereo CoglOnscreens - -If we want to show quad-buffer stereo with Cogl, we need to pick an -appropriate fbconfig for creating the CoglOnscreen objects. Add -cogl_onscreen_template_set_stereo_enabled() to indicate whether -stereo support is needed. - -Add cogl_framebuffer_get_stereo_mode() to see if a framebuffer was -created with stereo support. - -Add cogl_framebuffer_get_stereo_mode() to pick whether to draw to -the left, right, or both buffers. - -Reviewed-by: Robert Bragg ---- - cogl/cogl-context-private.h | 1 + - cogl/cogl-framebuffer-private.h | 8 +++- - cogl/cogl-framebuffer.c | 41 +++++++++++++++++++ - cogl/cogl-framebuffer.h | 52 +++++++++++++++++++++++++ - cogl/cogl-onscreen-template.c | 8 ++++ - cogl/cogl-onscreen-template.h | 18 +++++++++ - cogl/cogl-types.h | 15 +++++++ - cogl/driver/gl/cogl-framebuffer-gl.c | 36 +++++++++++++++++ - cogl/winsys/cogl-winsys-glx-feature-functions.h | 1 + - cogl/winsys/cogl-winsys-glx.c | 8 +++- - 10 files changed, 185 insertions(+), 3 deletions(-) - -diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h -index 1000ee5..9e66207 100644 ---- a/cogl/cogl-context-private.h -+++ b/cogl/cogl-context-private.h -@@ -270,6 +270,7 @@ struct _CoglContext - - CoglBool current_gl_dither_enabled; - CoglColorMask current_gl_color_mask; -+ GLenum current_gl_draw_buffer; - - /* Clipping */ - /* TRUE if we have a valid clipping stack flushed. In that case -diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h -index 4891d53..99ac2fb 100644 ---- a/cogl/cogl-framebuffer-private.h -+++ b/cogl/cogl-framebuffer-private.h -@@ -61,6 +61,7 @@ typedef struct - int samples_per_pixel; - CoglBool swap_throttled; - CoglBool depth_texture_enabled; -+ CoglBool stereo_enabled; - } CoglFramebufferConfig; - - /* Flags to pass to _cogl_offscreen_new_with_texture_full */ -@@ -86,7 +87,8 @@ typedef enum _CoglFramebufferStateIndex - COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK = 6, - COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING = 7, - COGL_FRAMEBUFFER_STATE_INDEX_DEPTH_WRITE = 8, -- COGL_FRAMEBUFFER_STATE_INDEX_MAX = 9 -+ COGL_FRAMEBUFFER_STATE_INDEX_STEREO_MODE = 9, -+ COGL_FRAMEBUFFER_STATE_INDEX_MAX = 10 - } CoglFramebufferStateIndex; - - typedef enum _CoglFramebufferState -@@ -99,7 +101,8 @@ typedef enum _CoglFramebufferState - COGL_FRAMEBUFFER_STATE_PROJECTION = 1<<5, - COGL_FRAMEBUFFER_STATE_COLOR_MASK = 1<<6, - COGL_FRAMEBUFFER_STATE_FRONT_FACE_WINDING = 1<<7, -- COGL_FRAMEBUFFER_STATE_DEPTH_WRITE = 1<<8 -+ COGL_FRAMEBUFFER_STATE_DEPTH_WRITE = 1<<8, -+ COGL_FRAMEBUFFER_STATE_STEREO_MODE = 1<<9 - } CoglFramebufferState; - - #define COGL_FRAMEBUFFER_STATE_ALL ((1<stereo_mode != b->stereo_mode ? -+ COGL_FRAMEBUFFER_STATE_STEREO_MODE : 0; -+} -+ - unsigned long - _cogl_framebuffer_compare (CoglFramebuffer *a, - CoglFramebuffer *b, -@@ -959,6 +967,10 @@ _cogl_framebuffer_compare (CoglFramebuffer *a, - differences |= - _cogl_framebuffer_compare_depth_write_state (a, b); - break; -+ case COGL_FRAMEBUFFER_STATE_INDEX_STEREO_MODE: -+ differences |= -+ _cogl_framebuffer_compare_stereo_mode (a, b); -+ break; - default: - g_warn_if_reached (); - } -@@ -1046,6 +1058,12 @@ _cogl_framebuffer_get_stencil_bits (CoglFramebuffer *framebuffer) - return bits.stencil; - } - -+gboolean -+cogl_framebuffer_get_is_stereo (CoglFramebuffer *framebuffer) -+{ -+ return framebuffer->config.stereo_enabled; -+} -+ - CoglColorMask - cogl_framebuffer_get_color_mask (CoglFramebuffer *framebuffer) - { -@@ -1069,6 +1087,29 @@ cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer, - COGL_FRAMEBUFFER_STATE_COLOR_MASK; - } - -+CoglStereoMode -+cogl_framebuffer_get_stereo_mode (CoglFramebuffer *framebuffer) -+{ -+ return framebuffer->stereo_mode; -+} -+ -+void -+cogl_framebuffer_set_stereo_mode (CoglFramebuffer *framebuffer, -+ CoglStereoMode stereo_mode) -+{ -+ if (framebuffer->stereo_mode == stereo_mode) -+ return; -+ -+ /* Stereo mode changes don't go through the journal */ -+ _cogl_framebuffer_flush_journal (framebuffer); -+ -+ framebuffer->stereo_mode = stereo_mode; -+ -+ if (framebuffer->context->current_draw_buffer == framebuffer) -+ framebuffer->context->current_draw_buffer_changes |= -+ COGL_FRAMEBUFFER_STATE_STEREO_MODE; -+} -+ - CoglBool - cogl_framebuffer_get_depth_write_enabled (CoglFramebuffer *framebuffer) - { -diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h -index 347284f..58d65a8 100644 ---- a/cogl/cogl-framebuffer.h -+++ b/cogl/cogl-framebuffer.h -@@ -737,6 +737,23 @@ cogl_framebuffer_get_alpha_bits (CoglFramebuffer *framebuffer); - int - cogl_framebuffer_get_depth_bits (CoglFramebuffer *framebuffer); - -+/* -+ * cogl_framebuffer_get_is_stereo: -+ * @framebuffer: a pointer to a #CoglFramebuffer -+ * -+ * Retrieves whether @framebuffer has separate left and right -+ * buffers for use with stereo drawing. See -+ * cogl_framebuffer_set_stereo_mode(). -+ * -+ * Return value: %TRUE if @framebuffer has separate left and -+ * right buffers. -+ * -+ * Since: 1.20 -+ * Stability: unstable -+ */ -+CoglBool -+cogl_framebuffer_get_is_stereo (CoglFramebuffer *framebuffer); -+ - /** - * cogl_framebuffer_get_dither_enabled: - * @framebuffer: a pointer to a #CoglFramebuffer -@@ -847,6 +864,41 @@ cogl_framebuffer_set_color_mask (CoglFramebuffer *framebuffer, - CoglColorMask color_mask); - - /** -+ * cogl_framebuffer_get_stereo_mode: -+ * @framebuffer: a pointer to a #CoglFramebuffer -+ * -+ * Gets the current #CoglStereoMode, which defines which stereo buffers -+ * should be drawn to. See cogl_framebuffer_set_stereo_mode(). -+ * -+ * Returns: A #CoglStereoMode -+ * Since: 1.20 -+ * Stability: unstable -+ */ -+CoglStereoMode -+cogl_framebuffer_get_stereo_mode (CoglFramebuffer *framebuffer); -+ -+/** -+ * cogl_framebuffer_set_stereo_mode: -+ * @framebuffer: a pointer to a #CoglFramebuffer -+ * @stereo_mode: A #CoglStereoMode specifying which stereo buffers -+ * should be drawn tow. -+ * -+ * Sets which stereo buffers should be drawn to. The default -+ * is %COGL_STEREO_BOTH, which means that both the left and -+ * right buffers will be affected by drawing. For this to have -+ * an effect, the display system must support stereo drawables, -+ * and the framebuffer must have been created with stereo -+ * enabled. (See cogl_onscreen_template_set_stereo_enabled(), -+ * cogl_framebuffer_get_is_stereo().) -+ * -+ * Since: 1.20 -+ * Stability: unstable -+ */ -+void -+cogl_framebuffer_set_stereo_mode (CoglFramebuffer *framebuffer, -+ CoglStereoMode stereo_mode); -+ -+/** - * cogl_framebuffer_set_depth_texture_enabled: - * @framebuffer: A #CoglFramebuffer - * @enabled: TRUE or FALSE -diff --git a/cogl/cogl-onscreen-template.c b/cogl/cogl-onscreen-template.c -index 5a5e54c..3940627 100644 ---- a/cogl/cogl-onscreen-template.c -+++ b/cogl/cogl-onscreen-template.c -@@ -95,3 +95,11 @@ cogl_onscreen_template_set_swap_throttled ( - { - onscreen_template->config.swap_throttled = throttled; - } -+ -+void -+cogl_onscreen_template_set_stereo_enabled ( -+ CoglOnscreenTemplate *onscreen_template, -+ CoglBool enabled) -+{ -+ onscreen_template->config.stereo_enabled = enabled; -+} -diff --git a/cogl/cogl-onscreen-template.h b/cogl/cogl-onscreen-template.h -index cd1d853..d8714fa 100644 ---- a/cogl/cogl-onscreen-template.h -+++ b/cogl/cogl-onscreen-template.h -@@ -107,6 +107,24 @@ cogl_onscreen_template_set_swap_throttled ( - CoglBool throttled); - - /** -+ * cogl_onscreen_template_set_stereo_enabled: -+ * @onscreen_template: A #CoglOnscreenTemplate template framebuffer -+ * @enabled: Whether framebuffers are created with stereo buffers -+ * -+ * Sets whether future #CoglOnscreen framebuffers derived from this -+ * template are attempted to be created with both left and right -+ * buffers, for use with stereo display. If the display system -+ * does not support stereo, then creation of the framebuffer will -+ * fail. -+ * -+ * Since: 1.20 -+ * Stability: unstable -+ */ -+void -+cogl_onscreen_template_set_stereo_enabled ( -+ CoglOnscreenTemplate *onscreen_template, -+ CoglBool enabled); -+/** - * cogl_is_onscreen_template: - * @object: A #CoglObject pointer - * -diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h -index b4d79c7..6accf8d 100644 ---- a/cogl/cogl-types.h -+++ b/cogl/cogl-types.h -@@ -920,6 +920,21 @@ typedef enum { /*< prefix=COGL_READ_PIXELS >*/ - COGL_READ_PIXELS_COLOR_BUFFER = 1L << 0 - } CoglReadPixelsFlags; - -+/** -+ * CoglStereoMode: -+ * @COGL_STEREO_BOTH: draw to both stereo buffers -+ * @COGL_STEREO_LEFT: draw only to the left stereo buffer -+ * @COGL_STEREO_RIGHT: draw only to the left stereo buffer -+ * -+ * Represents how draw should affect the two buffers -+ * of a stereo framebuffer. See cogl_framebuffer_set_stereo_mode(). -+ */ -+typedef enum { -+ COGL_STEREO_BOTH, -+ COGL_STEREO_LEFT, -+ COGL_STEREO_RIGHT -+} CoglStereoMode; -+ - COGL_END_DECLS - - #endif /* __COGL_TYPES_H__ */ -diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c -index c0f094d..793b10b 100644 ---- a/cogl/driver/gl/cogl-framebuffer-gl.c -+++ b/cogl/driver/gl/cogl-framebuffer-gl.c -@@ -236,6 +236,39 @@ _cogl_framebuffer_gl_flush_front_face_winding_state (CoglFramebuffer *framebuffe - context->current_pipeline_age--; - } - -+static void -+_cogl_framebuffer_gl_flush_stereo_mode_state (CoglFramebuffer *framebuffer) -+{ -+ CoglContext *ctx = framebuffer->context; -+ GLenum draw_buffer = GL_BACK; -+ -+ if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN) -+ return; -+ -+ /* The one-shot default draw buffer setting in _cogl_framebuffer_gl_bind -+ * must have already happened. If not it would override what we set here. */ -+ g_assert (ctx->was_bound_to_onscreen); -+ -+ switch (framebuffer->stereo_mode) -+ { -+ case COGL_STEREO_BOTH: -+ draw_buffer = GL_BACK; -+ break; -+ case COGL_STEREO_LEFT: -+ draw_buffer = GL_BACK_LEFT; -+ break; -+ case COGL_STEREO_RIGHT: -+ draw_buffer = GL_BACK_RIGHT; -+ break; -+ } -+ -+ if (ctx->current_gl_draw_buffer != draw_buffer) -+ { -+ GE (ctx, glDrawBuffer (draw_buffer)); -+ ctx->current_gl_draw_buffer = draw_buffer; -+ } -+} -+ - void - _cogl_framebuffer_gl_bind (CoglFramebuffer *framebuffer, GLenum target) - { -@@ -406,6 +439,9 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer, - /* Nothing to do for depth write state change; the state will always - * be taken into account when flushing the pipeline's depth state. */ - break; -+ case COGL_FRAMEBUFFER_STATE_INDEX_STEREO_MODE: -+ _cogl_framebuffer_gl_flush_stereo_mode_state (draw_buffer); -+ break; - default: - g_warn_if_reached (); - } -diff --git a/cogl/winsys/cogl-winsys-glx-feature-functions.h b/cogl/winsys/cogl-winsys-glx-feature-functions.h -index 1e2cec1..ed9df70 100644 ---- a/cogl/winsys/cogl-winsys-glx-feature-functions.h -+++ b/cogl/winsys/cogl-winsys-glx-feature-functions.h -@@ -184,6 +184,7 @@ COGL_WINSYS_FEATURE_BEGIN (255, 255, - "swap_event\0", - 0, - COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT) -+ - COGL_WINSYS_FEATURE_END () - - COGL_WINSYS_FEATURE_BEGIN (255, 255, -diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c -index 3095acf..bf2b5be 100644 ---- a/cogl/winsys/cogl-winsys-glx.c -+++ b/cogl/winsys/cogl-winsys-glx.c -@@ -909,6 +909,11 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display, - attributes[i++] = 1; - attributes[i++] = GLX_STENCIL_SIZE; - attributes[i++] = config->need_stencil ? 1: GLX_DONT_CARE; -+ if (config->stereo_enabled) -+ { -+ attributes[i++] = GLX_STEREO; -+ attributes[i++] = TRUE; -+ } - - if (glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 4 && - config->samples_per_pixel) -@@ -948,6 +953,7 @@ find_fbconfig (CoglDisplay *display, - xscreen_num, - attributes, - &n_configs); -+ - if (!configs || n_configs == 0) - { - _cogl_set_error (error, COGL_WINSYS_ERROR, -@@ -1856,7 +1862,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, - rect[0], rect[1], x2, y2, - GL_COLOR_BUFFER_BIT, GL_NEAREST); - } -- context->glDrawBuffer (GL_BACK); -+ context->glDrawBuffer (context->current_gl_draw_buffer); - } - - /* NB: unlike glXSwapBuffers, glXCopySubBuffer and --- -2.1.0 - diff --git a/SOURCES/CoglTexturePixmapX11-add-support-for-stereo-content.patch b/SOURCES/CoglTexturePixmapX11-add-support-for-stereo-content.patch deleted file mode 100644 index 597b587..0000000 --- a/SOURCES/CoglTexturePixmapX11-add-support-for-stereo-content.patch +++ /dev/null @@ -1,667 +0,0 @@ -From 4d8771a8c2ea11e37db8f86153286c741576b8ca Mon Sep 17 00:00:00 2001 -From: "Owen W. Taylor" -Date: Sat, 26 Apr 2014 16:38:58 -0400 -Subject: [PATCH] CoglTexturePixmapX11: add support for stereo content - -Add cogl_texture_pixmap_x11_new_left() and -cogl_texture_pixmap_x11_new_right() (which takes the left texture -as an argument) for texture pixmap rendering with stereo content. -The underlying GLXPixmap is created using a stereo visual and shared -between the left and right textures. - -Reviewed-by: Robert Bragg ---- - cogl/cogl-glx-display-private.h | 3 +- - cogl/winsys/cogl-texture-pixmap-x11-private.h | 18 ++++ - cogl/winsys/cogl-texture-pixmap-x11.c | 99 ++++++++++++++++++++-- - cogl/winsys/cogl-texture-pixmap-x11.h | 56 +++++++++++++ - cogl/winsys/cogl-winsys-egl-x11.c | 4 +- - cogl/winsys/cogl-winsys-glx.c | 113 ++++++++++++++++++-------- - cogl/winsys/cogl-winsys-private.h | 4 +- - 7 files changed, 253 insertions(+), 44 deletions(-) - -diff --git a/cogl/cogl-glx-display-private.h b/cogl/cogl-glx-display-private.h -index 20b7e67..133c118 100644 ---- a/cogl/cogl-glx-display-private.h -+++ b/cogl/cogl-glx-display-private.h -@@ -39,10 +39,11 @@ typedef struct _CoglGLXCachedConfig - int depth; - CoglBool found; - GLXFBConfig fb_config; -+ CoglBool stereo; - CoglBool can_mipmap; - } CoglGLXCachedConfig; - --#define COGL_GLX_N_CACHED_CONFIGS 3 -+#define COGL_GLX_N_CACHED_CONFIGS 6 - - typedef struct _CoglGLXDisplay - { -diff --git a/cogl/winsys/cogl-texture-pixmap-x11-private.h b/cogl/winsys/cogl-texture-pixmap-x11-private.h -index 948e67b..5da998f 100644 ---- a/cogl/winsys/cogl-texture-pixmap-x11-private.h -+++ b/cogl/winsys/cogl-texture-pixmap-x11-private.h -@@ -55,10 +55,27 @@ struct _CoglDamageRectangle - unsigned int y2; - }; - -+/* For stereo, there are a pair of textures, but we want to share most -+ * other state (the GLXPixmap, visual, etc.) The way we do this is that -+ * the left-eye texture has all the state (there is in fact, no internal -+ * difference between the a MONO and a LEFT texture ), and the -+ * right-eye texture simply points to the left eye texture, with all -+ * other fields ignored. -+ */ -+typedef enum -+{ -+ COGL_TEXTURE_PIXMAP_MONO, -+ COGL_TEXTURE_PIXMAP_LEFT, -+ COGL_TEXTURE_PIXMAP_RIGHT -+} CoglTexturePixmapStereoMode; -+ - struct _CoglTexturePixmapX11 - { - CoglTexture _parent; - -+ CoglTexturePixmapStereoMode stereo_mode; -+ CoglTexturePixmapX11 *left; /* Set only if stereo_mode=RIGHT */ -+ - Pixmap pixmap; - CoglTexture *tex; - -@@ -82,4 +99,5 @@ struct _CoglTexturePixmapX11 - CoglBool use_winsys_texture; - }; - -+ - #endif /* __COGL_TEXTURE_PIXMAP_X11_PRIVATE_H */ -diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c -index 6c1edeb..398c357 100644 ---- a/cogl/winsys/cogl-texture-pixmap-x11.c -+++ b/cogl/winsys/cogl-texture-pixmap-x11.c -@@ -284,11 +284,12 @@ set_damage_object_internal (CoglContext *ctx, - tex_pixmap); - } - --CoglTexturePixmapX11 * --cogl_texture_pixmap_x11_new (CoglContext *ctxt, -- uint32_t pixmap, -- CoglBool automatic_updates, -- CoglError **error) -+static CoglTexturePixmapX11 * -+_cogl_texture_pixmap_x11_new (CoglContext *ctxt, -+ uint32_t pixmap, -+ CoglBool automatic_updates, -+ CoglTexturePixmapStereoMode stereo_mode, -+ CoglError **error) - { - CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1); - Display *display = cogl_xlib_renderer_get_display (ctxt->display->renderer); -@@ -327,6 +328,8 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt, - &cogl_texture_pixmap_x11_vtable); - - tex_pixmap->pixmap = pixmap; -+ tex_pixmap->stereo_mode = stereo_mode; -+ tex_pixmap->left = NULL; - tex_pixmap->image = NULL; - tex_pixmap->shm_info.shmid = -1; - tex_pixmap->tex = NULL; -@@ -387,6 +390,59 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt, - return _cogl_texture_pixmap_x11_object_new (tex_pixmap); - } - -+CoglTexturePixmapX11 * -+cogl_texture_pixmap_x11_new (CoglContext *ctxt, -+ uint32_t pixmap, -+ CoglBool automatic_updates, -+ CoglError **error) -+ -+{ -+ return _cogl_texture_pixmap_x11_new (ctxt, pixmap, -+ automatic_updates, COGL_TEXTURE_PIXMAP_MONO, -+ error); -+} -+ -+CoglTexturePixmapX11 * -+cogl_texture_pixmap_x11_new_left (CoglContext *ctxt, -+ uint32_t pixmap, -+ CoglBool automatic_updates, -+ CoglError **error) -+{ -+ return _cogl_texture_pixmap_x11_new (ctxt, pixmap, -+ automatic_updates, COGL_TEXTURE_PIXMAP_LEFT, -+ error); -+} -+ -+CoglTexturePixmapX11 * -+cogl_texture_pixmap_x11_new_right (CoglTexturePixmapX11 *tfp_left) -+{ -+ CoglTexture *texture_left = COGL_TEXTURE (tfp_left); -+ CoglTexturePixmapX11 *tfp_right; -+ CoglPixelFormat internal_format; -+ -+ g_return_val_if_fail (tfp_left->stereo_mode == COGL_TEXTURE_PIXMAP_LEFT, NULL); -+ -+ tfp_right = g_new0 (CoglTexturePixmapX11, 1); -+ tfp_right->stereo_mode = COGL_TEXTURE_PIXMAP_RIGHT; -+ tfp_right->left = cogl_object_ref (tfp_left); -+ -+ internal_format = (tfp_left->depth >= 32 -+ ? COGL_PIXEL_FORMAT_RGBA_8888_PRE -+ : COGL_PIXEL_FORMAT_RGB_888); -+ _cogl_texture_init (COGL_TEXTURE (tfp_right), -+ texture_left->context, -+ texture_left->width, -+ texture_left->height, -+ internal_format, -+ NULL, /* no loader */ -+ &cogl_texture_pixmap_x11_vtable); -+ -+ _cogl_texture_set_allocated (COGL_TEXTURE (tfp_right), internal_format, -+ texture_left->width, texture_left->height); -+ -+ return _cogl_texture_pixmap_x11_object_new (tfp_right); -+} -+ - static CoglBool - _cogl_texture_pixmap_x11_allocate (CoglTexture *tex, - CoglError **error) -@@ -478,6 +534,9 @@ cogl_texture_pixmap_x11_update_area (CoglTexturePixmapX11 *tex_pixmap, - texture because we can't determine which will be needed until we - actually render something */ - -+ if (tex_pixmap->stereo_mode == COGL_TEXTURE_PIXMAP_RIGHT) -+ tex_pixmap = tex_pixmap->left; -+ - if (tex_pixmap->winsys) - { - const CoglWinsysVtable *winsys; -@@ -492,6 +551,9 @@ cogl_texture_pixmap_x11_update_area (CoglTexturePixmapX11 *tex_pixmap, - CoglBool - cogl_texture_pixmap_x11_is_using_tfp_extension (CoglTexturePixmapX11 *tex_pixmap) - { -+ if (tex_pixmap->stereo_mode == COGL_TEXTURE_PIXMAP_RIGHT) -+ tex_pixmap = tex_pixmap->left; -+ - return !!tex_pixmap->winsys; - } - -@@ -505,6 +567,8 @@ cogl_texture_pixmap_x11_set_damage_object (CoglTexturePixmapX11 *tex_pixmap, - - _COGL_GET_CONTEXT (ctxt, NO_RETVAL); - -+ g_return_if_fail (tex_pixmap->stereo_mode != COGL_TEXTURE_PIXMAP_RIGHT); -+ - damage_base = _cogl_xlib_get_damage_base (); - if (damage_base >= 0) - set_damage_object_internal (ctxt, tex_pixmap, damage, report_level); -@@ -717,12 +781,16 @@ static void - _cogl_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, - CoglBool needs_mipmap) - { -+ CoglTexturePixmapStereoMode stereo_mode = tex_pixmap->stereo_mode; -+ if (stereo_mode == COGL_TEXTURE_PIXMAP_RIGHT) -+ tex_pixmap = tex_pixmap->left; -+ - if (tex_pixmap->winsys) - { - const CoglWinsysVtable *winsys = - _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); - -- if (winsys->texture_pixmap_x11_update (tex_pixmap, needs_mipmap)) -+ if (winsys->texture_pixmap_x11_update (tex_pixmap, stereo_mode, needs_mipmap)) - { - _cogl_texture_pixmap_x11_set_use_winsys_texture (tex_pixmap, TRUE); - return; -@@ -739,8 +807,13 @@ _cogl_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, - static CoglTexture * - _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) - { -+ CoglTexturePixmapX11 *original_pixmap = tex_pixmap; - CoglTexture *tex; - int i; -+ CoglTexturePixmapStereoMode stereo_mode = tex_pixmap->stereo_mode; -+ -+ if (stereo_mode == COGL_TEXTURE_PIXMAP_RIGHT) -+ tex_pixmap = tex_pixmap->left; - - /* We try getting the texture twice, once without flushing the - updates and once with. If pre_paint has been called already then -@@ -757,7 +830,7 @@ _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) - { - const CoglWinsysVtable *winsys = - _cogl_texture_pixmap_x11_get_winsys (tex_pixmap); -- tex = winsys->texture_pixmap_x11_get_texture (tex_pixmap); -+ tex = winsys->texture_pixmap_x11_get_texture (tex_pixmap, stereo_mode); - } - else - tex = tex_pixmap->tex; -@@ -765,7 +838,7 @@ _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) - if (tex) - return tex; - -- _cogl_texture_pixmap_x11_update (tex_pixmap, FALSE); -+ _cogl_texture_pixmap_x11_update (original_pixmap, FALSE); - } - - g_assert_not_reached (); -@@ -1047,6 +1120,16 @@ _cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap) - - _COGL_GET_CONTEXT (ctxt, NO_RETVAL); - -+ if (tex_pixmap->stereo_mode == COGL_TEXTURE_PIXMAP_RIGHT) -+ { -+ cogl_object_unref (tex_pixmap->left); -+ -+ /* Chain up */ -+ _cogl_texture_free (COGL_TEXTURE (tex_pixmap)); -+ -+ return; -+ } -+ - display = cogl_xlib_renderer_get_display (ctxt->display->renderer); - - set_damage_object_internal (ctxt, tex_pixmap, 0, 0); -diff --git a/cogl/winsys/cogl-texture-pixmap-x11.h b/cogl/winsys/cogl-texture-pixmap-x11.h -index 35155cd..6340bb5 100644 ---- a/cogl/winsys/cogl-texture-pixmap-x11.h -+++ b/cogl/winsys/cogl-texture-pixmap-x11.h -@@ -138,6 +138,62 @@ cogl_texture_pixmap_x11_new (CoglContext *context, - CoglError **error); - - /** -+ * cogl_texture_pixmap_x11_new_left: -+ * @context: A #CoglContext -+ * @pixmap: A X11 pixmap ID -+ * @automatic_updates: Whether to automatically copy the contents of -+ * the pixmap to the texture. -+ * @error: A #CoglError for exceptions -+ * -+ * Creates one of a pair of textures to contain the contents of @pixmap, -+ * which has stereo content. (Different images for the right and left eyes.) -+ * The left image is drawn using this texture; the right image is drawn -+ * using a texture created by calling -+ * cogl_texture_pixmap_x11_new_right() and passing in this texture as an -+ * argument. -+ * -+ * In general, you should not use this function unless you have -+ * queried the %GLX_STEREO_TREE_EXT attribute of the corresponding -+ * window using glXQueryDrawable() and determined that the window is -+ * stereo. Note that this attribute can change over time and -+ * notification is also provided through events defined in the -+ * EXT_stereo_tree GLX extension. As long as the system has support for -+ * stereo content, drawing using the left and right pixmaps will not -+ * produce an error even if the window doesn't have stereo -+ * content any more, but drawing with the right pixmap will produce -+ * undefined output, so you need to listen for these events and -+ * re-render to avoid race conditions. (Recreating a non-stereo -+ * pixmap is not necessary, but may save resources.) -+ * -+ * Return value: a new #CoglTexturePixmapX11 instance -+ * -+ * Since: 1.20 -+ * Stability: Unstable -+ */ -+CoglTexturePixmapX11 * -+cogl_texture_pixmap_x11_new_left (CoglContext *context, -+ uint32_t pixmap, -+ CoglBool automatic_updates, -+ CoglError **error); -+ -+/** -+ * cogl_texture_pixmap_x11_new_right: -+ * @left_texture: A #CoglTexturePixmapX11 instance created with -+ * cogl_texture_pixmap_x11_new_left(). -+ * -+ * Creates a texture object that corresponds to the right-eye image -+ * of a pixmap with stereo content. @left_texture must have been -+ * created using cogl_texture_pixmap_x11_new_left(). -+ * -+ * Return value: a new #CoglTexturePixmapX11 instance -+ * -+ * Since: 1.20 -+ * Stability: Unstable -+ */ -+CoglTexturePixmapX11 * -+cogl_texture_pixmap_x11_new_right (CoglTexturePixmapX11 *left_texture); -+ -+/** - * cogl_texture_pixmap_x11_update_area: - * @texture: A #CoglTexturePixmapX11 instance - * @x: x coordinate of the area to update -diff --git a/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/winsys/cogl-winsys-egl-x11.c -index 26c9606..0e55d41 100644 ---- a/cogl/winsys/cogl-winsys-egl-x11.c -+++ b/cogl/winsys/cogl-winsys-egl-x11.c -@@ -784,6 +784,7 @@ _cogl_winsys_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap) - - static CoglBool - _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, -+ CoglBool right, - CoglBool needs_mipmap) - { - if (needs_mipmap) -@@ -798,7 +799,8 @@ _cogl_winsys_texture_pixmap_x11_damage_notify (CoglTexturePixmapX11 *tex_pixmap) - } - - static CoglTexture * --_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) -+_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap, -+ CoglBool right) - { - CoglTexturePixmapEGL *egl_tex_pixmap = tex_pixmap->winsys; - -diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c -index bf2b5be..0487b79 100644 ---- a/cogl/winsys/cogl-winsys-glx.c -+++ b/cogl/winsys/cogl-winsys-glx.c -@@ -97,16 +97,21 @@ typedef struct _CoglOnscreenGLX - CoglBool pending_resize_notify; - } CoglOnscreenGLX; - -+typedef struct _CoglPixmapTextureEyeGLX -+{ -+ CoglTexture *glx_tex; -+ CoglBool bind_tex_image_queued; -+ CoglBool pixmap_bound; -+} CoglPixmapTextureEyeGLX; -+ - typedef struct _CoglTexturePixmapGLX - { - GLXPixmap glx_pixmap; - CoglBool has_mipmap_space; - CoglBool can_mipmap; - -- CoglTexture *glx_tex; -- -- CoglBool bind_tex_image_queued; -- CoglBool pixmap_bound; -+ CoglPixmapTextureEyeGLX left; -+ CoglPixmapTextureEyeGLX right; - } CoglTexturePixmapGLX; - - /* Define a set of arrays containing the functions required from GL -@@ -2101,6 +2106,7 @@ _cogl_winsys_xlib_get_visual_info (void) - static CoglBool - get_fbconfig_for_depth (CoglContext *context, - unsigned int depth, -+ CoglBool stereo, - GLXFBConfig *fbconfig_ret, - CoglBool *can_mipmap_ret) - { -@@ -2118,11 +2124,12 @@ get_fbconfig_for_depth (CoglContext *context, - glx_renderer = context->display->renderer->winsys; - glx_display = context->display->winsys; - -- /* Check if we've already got a cached config for this depth */ -+ /* Check if we've already got a cached config for this depth and stereo */ - for (i = 0; i < COGL_GLX_N_CACHED_CONFIGS; i++) - if (glx_display->glx_cached_configs[i].depth == -1) - spare_cache_slot = i; -- else if (glx_display->glx_cached_configs[i].depth == depth) -+ else if (glx_display->glx_cached_configs[i].depth == depth && -+ glx_display->glx_cached_configs[i].stereo == stereo) - { - *fbconfig_ret = glx_display->glx_cached_configs[i].fb_config; - *can_mipmap_ret = glx_display->glx_cached_configs[i].can_mipmap; -@@ -2166,6 +2173,13 @@ get_fbconfig_for_depth (CoglContext *context, - if (value != depth && (value - alpha) != depth) - continue; - -+ glx_renderer->glXGetFBConfigAttrib (dpy, -+ fbconfigs[i], -+ GLX_STEREO, -+ &value); -+ if (!!value != !!stereo) -+ continue; -+ - if (glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 4) - { - glx_renderer->glXGetFBConfigAttrib (dpy, -@@ -2323,7 +2337,9 @@ try_create_glx_pixmap (CoglContext *context, - glx_renderer = renderer->winsys; - dpy = xlib_renderer->xdpy; - -- if (!get_fbconfig_for_depth (context, depth, &fb_config, -+ if (!get_fbconfig_for_depth (context, depth, -+ tex_pixmap->stereo_mode != COGL_TEXTURE_PIXMAP_MONO, -+ &fb_config, - &glx_tex_pixmap->can_mipmap)) - { - COGL_NOTE (TEXTURE_PIXMAP, "No suitable FBConfig found for depth %i", -@@ -2412,10 +2428,13 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap) - glx_tex_pixmap->can_mipmap = FALSE; - glx_tex_pixmap->has_mipmap_space = FALSE; - -- glx_tex_pixmap->glx_tex = NULL; -+ glx_tex_pixmap->left.glx_tex = NULL; -+ glx_tex_pixmap->right.glx_tex = NULL; - -- glx_tex_pixmap->bind_tex_image_queued = TRUE; -- glx_tex_pixmap->pixmap_bound = FALSE; -+ glx_tex_pixmap->left.bind_tex_image_queued = TRUE; -+ glx_tex_pixmap->right.bind_tex_image_queued = TRUE; -+ glx_tex_pixmap->left.pixmap_bound = FALSE; -+ glx_tex_pixmap->right.pixmap_bound = FALSE; - - tex_pixmap->winsys = glx_tex_pixmap; - -@@ -2442,10 +2461,14 @@ free_glx_pixmap (CoglContext *context, - xlib_renderer = _cogl_xlib_renderer_get_data (renderer); - glx_renderer = renderer->winsys; - -- if (glx_tex_pixmap->pixmap_bound) -+ if (glx_tex_pixmap->left.pixmap_bound) - glx_renderer->glXReleaseTexImage (xlib_renderer->xdpy, - glx_tex_pixmap->glx_pixmap, - GLX_FRONT_LEFT_EXT); -+ if (glx_tex_pixmap->right.pixmap_bound) -+ glx_renderer->glXReleaseTexImage (xlib_renderer->xdpy, -+ glx_tex_pixmap->glx_pixmap, -+ GLX_FRONT_RIGHT_EXT); - - /* FIXME - we need to trap errors and synchronize here because - * of ordering issues between the XPixmap destruction and the -@@ -2470,7 +2493,8 @@ free_glx_pixmap (CoglContext *context, - _cogl_xlib_renderer_untrap_errors (renderer, &trap_state); - - glx_tex_pixmap->glx_pixmap = None; -- glx_tex_pixmap->pixmap_bound = FALSE; -+ glx_tex_pixmap->left.pixmap_bound = FALSE; -+ glx_tex_pixmap->right.pixmap_bound = FALSE; - } - - static void -@@ -2485,8 +2509,11 @@ _cogl_winsys_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap) - - free_glx_pixmap (COGL_TEXTURE (tex_pixmap)->context, glx_tex_pixmap); - -- if (glx_tex_pixmap->glx_tex) -- cogl_object_unref (glx_tex_pixmap->glx_tex); -+ if (glx_tex_pixmap->left.glx_tex) -+ cogl_object_unref (glx_tex_pixmap->left.glx_tex); -+ -+ if (glx_tex_pixmap->right.glx_tex) -+ cogl_object_unref (glx_tex_pixmap->right.glx_tex); - - tex_pixmap->winsys = NULL; - g_free (glx_tex_pixmap); -@@ -2494,13 +2521,27 @@ _cogl_winsys_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap) - - static CoglBool - _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, -+ CoglTexturePixmapStereoMode stereo_mode, - CoglBool needs_mipmap) - { - CoglTexture *tex = COGL_TEXTURE (tex_pixmap); - CoglContext *ctx = COGL_TEXTURE (tex_pixmap)->context; - CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; -+ CoglPixmapTextureEyeGLX *texture_info; -+ int buffer; - CoglGLXRenderer *glx_renderer; - -+ if (stereo_mode == COGL_TEXTURE_PIXMAP_RIGHT) -+ { -+ texture_info = &glx_tex_pixmap->right; -+ buffer = GLX_FRONT_RIGHT_EXT; -+ } -+ else -+ { -+ texture_info = &glx_tex_pixmap->left; -+ buffer = GLX_FRONT_LEFT_EXT; -+ } -+ - /* If we don't have a GLX pixmap then fallback */ - if (glx_tex_pixmap->glx_pixmap == None) - return FALSE; -@@ -2508,7 +2549,7 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, - glx_renderer = ctx->display->renderer->winsys; - - /* Lazily create a texture to hold the pixmap */ -- if (glx_tex_pixmap->glx_tex == NULL) -+ if (texture_info->glx_tex == NULL) - { - CoglPixelFormat texture_format; - CoglError *error = NULL; -@@ -2519,14 +2560,14 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, - - if (should_use_rectangle (ctx)) - { -- glx_tex_pixmap->glx_tex = COGL_TEXTURE ( -+ texture_info->glx_tex = COGL_TEXTURE ( - cogl_texture_rectangle_new_with_size (ctx, - tex->width, - tex->height)); - - _cogl_texture_set_internal_format (tex, texture_format); - -- if (cogl_texture_allocate (glx_tex_pixmap->glx_tex, &error)) -+ if (cogl_texture_allocate (texture_info->glx_tex, &error)) - COGL_NOTE (TEXTURE_PIXMAP, "Created a texture rectangle for %p", - tex_pixmap); - else -@@ -2541,14 +2582,14 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, - } - else - { -- glx_tex_pixmap->glx_tex = COGL_TEXTURE ( -+ texture_info->glx_tex = COGL_TEXTURE ( - cogl_texture_2d_new_with_size (ctx, - tex->width, - tex->height)); - - _cogl_texture_set_internal_format (tex, texture_format); - -- if (cogl_texture_allocate (glx_tex_pixmap->glx_tex, &error)) -+ if (cogl_texture_allocate (texture_info->glx_tex, &error)) - COGL_NOTE (TEXTURE_PIXMAP, "Created a texture 2d for %p", - tex_pixmap); - else -@@ -2586,36 +2627,37 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, - "updates for %p because creating the GLXPixmap " - "with mipmap support failed", tex_pixmap); - -- if (glx_tex_pixmap->glx_tex) -- cogl_object_unref (glx_tex_pixmap->glx_tex); -+ if (texture_info->glx_tex) -+ cogl_object_unref (texture_info->glx_tex); - return FALSE; - } - -- glx_tex_pixmap->bind_tex_image_queued = TRUE; -+ glx_tex_pixmap->left.bind_tex_image_queued = TRUE; -+ glx_tex_pixmap->right.bind_tex_image_queued = TRUE; - } - } - -- if (glx_tex_pixmap->bind_tex_image_queued) -+ if (texture_info->bind_tex_image_queued) - { - GLuint gl_handle, gl_target; - CoglXlibRenderer *xlib_renderer = - _cogl_xlib_renderer_get_data (ctx->display->renderer); - -- cogl_texture_get_gl_texture (glx_tex_pixmap->glx_tex, -+ cogl_texture_get_gl_texture (texture_info->glx_tex, - &gl_handle, &gl_target); - - COGL_NOTE (TEXTURE_PIXMAP, "Rebinding GLXPixmap for %p", tex_pixmap); - - _cogl_bind_gl_texture_transient (gl_target, gl_handle, FALSE); - -- if (glx_tex_pixmap->pixmap_bound) -+ if (texture_info->pixmap_bound) - glx_renderer->glXReleaseTexImage (xlib_renderer->xdpy, - glx_tex_pixmap->glx_pixmap, -- GLX_FRONT_LEFT_EXT); -+ buffer); - - glx_renderer->glXBindTexImage (xlib_renderer->xdpy, - glx_tex_pixmap->glx_pixmap, -- GLX_FRONT_LEFT_EXT, -+ buffer, - NULL); - - /* According to the recommended usage in the spec for -@@ -2628,10 +2670,10 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, - * on Mesa and NVidia drivers and it is also what Compiz does so - * it is probably ok */ - -- glx_tex_pixmap->bind_tex_image_queued = FALSE; -- glx_tex_pixmap->pixmap_bound = TRUE; -+ texture_info->bind_tex_image_queued = FALSE; -+ texture_info->pixmap_bound = TRUE; - -- _cogl_texture_2d_externally_modified (glx_tex_pixmap->glx_tex); -+ _cogl_texture_2d_externally_modified (texture_info->glx_tex); - } - - return TRUE; -@@ -2642,15 +2684,20 @@ _cogl_winsys_texture_pixmap_x11_damage_notify (CoglTexturePixmapX11 *tex_pixmap) - { - CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; - -- glx_tex_pixmap->bind_tex_image_queued = TRUE; -+ glx_tex_pixmap->left.bind_tex_image_queued = TRUE; -+ glx_tex_pixmap->right.bind_tex_image_queued = TRUE; - } - - static CoglTexture * --_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap) -+_cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap, -+ CoglTexturePixmapStereoMode stereo_mode) - { - CoglTexturePixmapGLX *glx_tex_pixmap = tex_pixmap->winsys; - -- return glx_tex_pixmap->glx_tex; -+ if (stereo_mode == COGL_TEXTURE_PIXMAP_RIGHT) -+ return glx_tex_pixmap->right.glx_tex; -+ else -+ return glx_tex_pixmap->left.glx_tex; - } - - static CoglWinsysVtable _cogl_winsys_vtable = -diff --git a/cogl/winsys/cogl-winsys-private.h b/cogl/winsys/cogl-winsys-private.h -index d6ff165..2c9cc98 100644 ---- a/cogl/winsys/cogl-winsys-private.h -+++ b/cogl/winsys/cogl-winsys-private.h -@@ -166,13 +166,15 @@ typedef struct _CoglWinsysVtable - - CoglBool - (*texture_pixmap_x11_update) (CoglTexturePixmapX11 *tex_pixmap, -+ CoglTexturePixmapStereoMode stereo_mode, - CoglBool needs_mipmap); - - void - (*texture_pixmap_x11_damage_notify) (CoglTexturePixmapX11 *tex_pixmap); - - CoglTexture * -- (*texture_pixmap_x11_get_texture) (CoglTexturePixmapX11 *tex_pixmap); -+ (*texture_pixmap_x11_get_texture) (CoglTexturePixmapX11 *tex_pixmap, -+ CoglTexturePixmapStereoMode stereo_mode); - #endif - - void --- -2.1.0 - diff --git a/SOURCES/cogl-1.22.2-fix-ifdef.patch b/SOURCES/cogl-1.22.2-fix-ifdef.patch new file mode 100644 index 0000000..544e09e --- /dev/null +++ b/SOURCES/cogl-1.22.2-fix-ifdef.patch @@ -0,0 +1,26 @@ +From b583e21d8698dbd58013320cfb47739102efdea7 Mon Sep 17 00:00:00 2001 +From: Kalev Lember +Date: Wed, 19 Oct 2016 23:38:28 +0200 +Subject: [PATCH] Fix an incorrect preprocessor conditional + +This fixes the build with wayland wayland egl server support disabled. +--- + cogl/winsys/cogl-winsys-egl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c +index 39bfd88..4a9f3aa 100644 +--- a/cogl/winsys/cogl-winsys-egl.c ++++ b/cogl/winsys/cogl-winsys-egl.c +@@ -1029,7 +1029,7 @@ _cogl_egl_create_image (CoglContext *ctx, + egl_ctx = EGL_NO_CONTEXT; + else + #endif +-#if COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT ++#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT + /* The WL_bind_wayland_display spec states that EGL_NO_CONTEXT is to be used + * in conjunction with the EGL_WAYLAND_BUFFER_WL target */ + if (target == EGL_WAYLAND_BUFFER_WL) +-- +2.7.4 + diff --git a/SOURCES/video-memory-purge.patch b/SOURCES/video-memory-purge.patch deleted file mode 100644 index 619e6eb..0000000 --- a/SOURCES/video-memory-purge.patch +++ /dev/null @@ -1,962 +0,0 @@ -From c0bc9bef7fb7bb416acff6160338664a17874773 Mon Sep 17 00:00:00 2001 -From: Adel Gadllah -Date: Sun, 26 Jul 2015 11:27:00 +0200 -Subject: [PATCH 1/5] winsys-glx: Add error traps in create_context - -Both create_gl3_context and glXCreateNewContext can fail with an X error. - -https://bugzilla.gnome.org/show_bug.cgi?id=742678 ---- - cogl/winsys/cogl-winsys-glx.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c -index 0487b79..4f7abfb 100644 ---- a/cogl/winsys/cogl-winsys-glx.c -+++ b/cogl/winsys/cogl-winsys-glx.c -@@ -1075,6 +1075,8 @@ create_context (CoglDisplay *display, CoglError **error) - COGL_NOTE (WINSYS, "Creating GLX Context (display: %p)", - xlib_renderer->xdpy); - -+ _cogl_xlib_renderer_trap_errors (display->renderer, &old_state); -+ - if (display->renderer->driver == COGL_DRIVER_GL3) - glx_display->glx_context = create_gl3_context (display, config); - else -@@ -1085,7 +1087,8 @@ create_context (CoglDisplay *display, CoglError **error) - NULL, - True); - -- if (glx_display->glx_context == NULL) -+ if (_cogl_xlib_renderer_untrap_errors (display->renderer, &old_state) || -+ glx_display->glx_context == NULL) - { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, --- -2.7.4 - - -From 55af12d4ec146c610dd3c05d777f1ae33738c218 Mon Sep 17 00:00:00 2001 -From: Emmanuele Bassi -Date: Thu, 6 Aug 2015 12:19:52 +0100 -Subject: [PATCH 2/5] gl: Do not use deprecated constants with the GL3 driver - -glGetIntegerv (GL_DEPTH_BITS, ...) and friends are deprecated in GL3; we -have to use glGetFramebufferAttachmentParameteriv() instead, like we do -for offscreen framebuffers. - -Based on a patch by: Adel Gadllah -Signed-off-by: Emmanuele Bassi - -https://bugzilla.gnome.org/show_bug.cgi?id=753295 ---- - cogl/driver/gl/cogl-framebuffer-gl.c | 46 ++++++++++++++++++++---------------- - 1 file changed, 26 insertions(+), 20 deletions(-) - -diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c -index 793b10b..26bcc5f 100644 ---- a/cogl/driver/gl/cogl-framebuffer-gl.c -+++ b/cogl/driver/gl/cogl-framebuffer-gl.c -@@ -1028,29 +1028,35 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer) - COGL_FRAMEBUFFER_STATE_BIND); - - #ifdef HAVE_COGL_GL -- if (_cogl_has_private_feature -- (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS) && -- framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN) -+ if ((ctx->driver == COGL_DRIVER_GL3 && -+ framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) || -+ (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS) && -+ framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN)) - { -- static const struct -- { -+ gboolean is_offscreen = framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN; -+ const struct { - GLenum attachment, pname; - size_t offset; -- } params[] = -- { -- { GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, -- offsetof (CoglFramebufferBits, red) }, -- { GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, -- offsetof (CoglFramebufferBits, green) }, -- { GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, -- offsetof (CoglFramebufferBits, blue) }, -- { GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, -- offsetof (CoglFramebufferBits, alpha) }, -- { GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, -- offsetof (CoglFramebufferBits, depth) }, -- { GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, -- offsetof (CoglFramebufferBits, stencil) }, -- }; -+ } params[] = { -+ { is_offscreen ? GL_COLOR_ATTACHMENT0 : GL_BACK_LEFT, -+ GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, -+ offsetof (CoglFramebufferBits, red) }, -+ { is_offscreen ? GL_COLOR_ATTACHMENT0 : GL_BACK_LEFT, -+ GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, -+ offsetof (CoglFramebufferBits, green) }, -+ { is_offscreen ? GL_COLOR_ATTACHMENT0 : GL_BACK_LEFT, -+ GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, -+ offsetof (CoglFramebufferBits, blue) }, -+ { is_offscreen ? GL_COLOR_ATTACHMENT0 : GL_BACK_LEFT, -+ GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, -+ offsetof (CoglFramebufferBits, alpha) }, -+ { is_offscreen ? GL_DEPTH_ATTACHMENT : GL_DEPTH, -+ GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, -+ offsetof (CoglFramebufferBits, depth) }, -+ { is_offscreen ? GL_STENCIL_ATTACHMENT : GL_STENCIL, -+ GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, -+ offsetof (CoglFramebufferBits, stencil) }, -+ }; - int i; - - for (i = 0; i < G_N_ELEMENTS (params); i++) --- -2.7.4 - - -From 067d3cb0f8a67a1c5ba144505c124ec42f409aaf Mon Sep 17 00:00:00 2001 -From: Rui Matos -Date: Wed, 29 Jun 2016 15:37:14 +0200 -Subject: [PATCH 3/5] cogl-winsys-glx: Add support for - NV_robustness_video_memory_purge - -This adds API to allow callers to specify that they're interested in -video memory purge errors. - -https://bugzilla.gnome.org/show_bug.cgi?id=739178 ---- - cogl/cogl-renderer-private.h | 1 + - cogl/cogl-renderer.c | 10 ++++++++ - cogl/cogl-xlib-renderer.h | 41 +++++++++++++++++++++++++++++++ - cogl/cogl.symbols | 1 + - cogl/gl-prototypes/cogl-all-functions.h | 8 ++++++ - cogl/winsys/cogl-winsys-glx.c | 43 +++++++++++++++++++++++++++++++++ - 6 files changed, 104 insertions(+) - -diff --git a/cogl/cogl-renderer-private.h b/cogl/cogl-renderer-private.h -index 3871d91..4a2fa6e 100644 ---- a/cogl/cogl-renderer-private.h -+++ b/cogl/cogl-renderer-private.h -@@ -70,6 +70,7 @@ struct _CoglRenderer - #ifdef COGL_HAS_XLIB_SUPPORT - Display *foreign_xdpy; - CoglBool xlib_enable_event_retrieval; -+ CoglBool xlib_want_reset_on_video_memory_purge; - #endif - - #ifdef COGL_HAS_WIN32_SUPPORT -diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c -index ef6e900..52a4732 100644 ---- a/cogl/cogl-renderer.c -+++ b/cogl/cogl-renderer.c -@@ -347,6 +347,16 @@ cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer, - - renderer->xlib_enable_event_retrieval = enable; - } -+ -+void -+cogl_xlib_renderer_request_reset_on_video_memory_purge (CoglRenderer *renderer, -+ CoglBool enable) -+{ -+ _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer)); -+ _COGL_RETURN_IF_FAIL (!renderer->connected); -+ -+ renderer->xlib_want_reset_on_video_memory_purge = enable; -+} - #endif /* COGL_HAS_XLIB_SUPPORT */ - - CoglBool -diff --git a/cogl/cogl-xlib-renderer.h b/cogl/cogl-xlib-renderer.h -index 6318957..a81f275 100644 ---- a/cogl/cogl-xlib-renderer.h -+++ b/cogl/cogl-xlib-renderer.h -@@ -169,6 +169,47 @@ cogl_xlib_renderer_set_event_retrieval_enabled (CoglRenderer *renderer, - Display * - cogl_xlib_renderer_get_display (CoglRenderer *renderer); - -+/** -+ * cogl_xlib_renderer_request_reset_on_video_memory_purge: -+ * @renderer: a #CoglRenderer -+ * @enable: The new value -+ * -+ * Sets whether Cogl should make use of the -+ * NV_robustness_video_memory_purge extension, if exposed by the -+ * driver, by initializing the GLX context appropriately. -+ * -+ * The extension is only useful when running on certain versions of -+ * the NVIDIA driver. Quoting from the spec: -+ * -+ * "The NVIDIA OpenGL driver architecture on Linux has a limitation: -+ * resources located in video memory are not persistent across certain -+ * events. VT switches, suspend/resume events, and mode switching -+ * events may erase the contents of video memory. Any resource that -+ * is located exclusively in video memory, such as framebuffer objects -+ * (FBOs), will be lost." -+ * -+ * "This extension provides a way for applications to discover when video -+ * memory content has been lost, so that the application can re-populate -+ * the video memory content as necessary." -+ * -+ * "Any driver that exposes this extension is a driver that considers -+ * video memory to be volatile. Once the driver stack has been -+ * improved, the extension will no longer be exposed." -+ * -+ * cogl_get_graphics_reset_status() needs to be called at least once -+ * every frame to find out if video memory was purged. -+ * -+ * Note that this doesn't cause Cogl to enable robust buffer access -+ * but other context reset errors may still happen and be reported via -+ * cogl_get_graphics_reset_status() if external factors cause the -+ * driver to trigger them. -+ * -+ * This defaults to %FALSE and is effective only if called before -+ * cogl_display_setup() . -+ */ -+void -+cogl_xlib_renderer_request_reset_on_video_memory_purge (CoglRenderer *renderer, -+ CoglBool enable); - COGL_END_DECLS - - /* The gobject introspection scanner seems to parse public headers in -diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols -index c48314a..feb9e65 100644 ---- a/cogl/cogl.symbols -+++ b/cogl/cogl.symbols -@@ -1065,6 +1065,7 @@ cogl_xlib_renderer_get_display - cogl_xlib_renderer_get_foreign_display - cogl_xlib_renderer_handle_event - cogl_xlib_renderer_remove_filter -+cogl_xlib_renderer_request_reset_on_video_memory_purge - cogl_xlib_renderer_set_event_retrieval_enabled - cogl_xlib_renderer_set_foreign_display - cogl_xlib_set_display -diff --git a/cogl/gl-prototypes/cogl-all-functions.h b/cogl/gl-prototypes/cogl-all-functions.h -index dda08f7..c1c5462 100644 ---- a/cogl/gl-prototypes/cogl-all-functions.h -+++ b/cogl/gl-prototypes/cogl-all-functions.h -@@ -326,3 +326,11 @@ COGL_EXT_BEGIN (draw_buffers, 2, 0, - COGL_EXT_FUNCTION (void, glDrawBuffers, - (GLsizei n, const GLenum *bufs)) - COGL_EXT_END () -+ -+COGL_EXT_BEGIN (robustness, 255, 255, -+ 0, -+ "ARB\0", -+ "robustness\0") -+COGL_EXT_FUNCTION (GLenum, glGetGraphicsResetStatus, -+ (void)) -+COGL_EXT_END () -diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c -index 4f7abfb..097589f 100644 ---- a/cogl/winsys/cogl-winsys-glx.c -+++ b/cogl/winsys/cogl-winsys-glx.c -@@ -71,6 +71,11 @@ - #include - #include - -+/* This is a relatively new extension */ -+#ifndef GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV -+#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7 -+#endif -+ - #define COGL_ONSCREEN_X11_EVENT_MASK (StructureNotifyMask | ExposureMask) - #define MAX_GLX_CONFIG_ATTRIBS 30 - -@@ -1025,12 +1030,50 @@ create_gl3_context (CoglDisplay *display, - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, - None - }; -+ /* NV_robustness_video_memory_purge relies on GLX_ARB_create_context -+ and in part on ARB_robustness. Namely, it needs the notification -+ strategy to be set to GLX_LOSE_CONTEXT_ON_RESET_ARB and that the -+ driver exposes the GetGraphicsResetStatusARB function. This means -+ we don't actually enable robust buffer access. */ -+ static const int attrib_list_reset_on_purge[] = -+ { -+ GLX_CONTEXT_MAJOR_VERSION_ARB, 3, -+ GLX_CONTEXT_MINOR_VERSION_ARB, 1, -+ GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, -+ GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, -+ GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV, -+ GL_TRUE, -+ GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, -+ GLX_LOSE_CONTEXT_ON_RESET_ARB, -+ None -+ }; - - /* Make sure that the display supports the GLX_ARB_create_context - extension */ - if (glx_renderer->glXCreateContextAttribs == NULL) - return NULL; - -+ /* We can't check the presence of this extension with the usual -+ COGL_WINSYS_FEATURE machinery because that only gets initialized -+ later when the CoglContext is created. */ -+ if (display->renderer->xlib_want_reset_on_video_memory_purge && -+ strstr (glx_renderer->glXQueryExtensionsString (xlib_renderer->xdpy, -+ DefaultScreen (xlib_renderer->xdpy)), -+ "GLX_NV_robustness_video_memory_purge")) -+ { -+ CoglXlibTrapState old_state; -+ GLXContext ctx; -+ -+ _cogl_xlib_renderer_trap_errors (display->renderer, &old_state); -+ ctx = glx_renderer->glXCreateContextAttribs (xlib_renderer->xdpy, -+ fb_config, -+ NULL /* share_context */, -+ True, /* direct */ -+ attrib_list_reset_on_purge); -+ if (!_cogl_xlib_renderer_untrap_errors (display->renderer, &old_state) && ctx) -+ return ctx; -+ } -+ - return glx_renderer->glXCreateContextAttribs (xlib_renderer->xdpy, - fb_config, - NULL /* share_context */, --- -2.7.4 - - -From e91a1f5217d28e8e181e4fd98b78ec180d601228 Mon Sep 17 00:00:00 2001 -From: Rui Matos -Date: Sun, 29 May 2016 20:30:36 +0200 -Subject: [PATCH 4/5] cogl-context: Add a cogl_get_graphics_reset_status API - -If the driver supports the GL_ARB_robustness extension we can expose -the graphics reset status this way. - -https://bugzilla.gnome.org/show_bug.cgi?id=739178 ---- - cogl/cogl-context.c | 30 ++++++++++++++++++++++++++++++ - cogl/cogl-context.h | 42 ++++++++++++++++++++++++++++++++++++++++++ - cogl/cogl.symbols | 1 + - 3 files changed, 73 insertions(+) - -diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c -index a7eed29..4b1af61 100644 ---- a/cogl/cogl-context.c -+++ b/cogl/cogl-context.c -@@ -76,6 +76,11 @@ - #define GL_NUM_EXTENSIONS 0x821D - #endif - -+/* This is a relatively new extension */ -+#ifndef GL_PURGED_CONTEXT_RESET_NV -+#define GL_PURGED_CONTEXT_RESET_NV 0x92BB -+#endif -+ - static void _cogl_context_free (CoglContext *context); - - COGL_OBJECT_DEFINE (Context, context); -@@ -784,3 +789,28 @@ cogl_get_clock_time (CoglContext *context) - else - return 0; - } -+ -+CoglGraphicsResetStatus -+cogl_get_graphics_reset_status (CoglContext *context) -+{ -+ if (!context->glGetGraphicsResetStatus) -+ return COGL_GRAPHICS_RESET_STATUS_NO_ERROR; -+ -+ switch (context->glGetGraphicsResetStatus ()) -+ { -+ case GL_GUILTY_CONTEXT_RESET_ARB: -+ return COGL_GRAPHICS_RESET_STATUS_GUILTY_CONTEXT_RESET; -+ -+ case GL_INNOCENT_CONTEXT_RESET_ARB: -+ return COGL_GRAPHICS_RESET_STATUS_INNOCENT_CONTEXT_RESET; -+ -+ case GL_UNKNOWN_CONTEXT_RESET_ARB: -+ return COGL_GRAPHICS_RESET_STATUS_UNKNOWN_CONTEXT_RESET; -+ -+ case GL_PURGED_CONTEXT_RESET_NV: -+ return COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET; -+ -+ default: -+ return COGL_GRAPHICS_RESET_STATUS_NO_ERROR; -+ } -+} -diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h -index 07badeb..cab586b 100644 ---- a/cogl/cogl-context.h -+++ b/cogl/cogl-context.h -@@ -393,6 +393,48 @@ cogl_foreach_feature (CoglContext *context, - int64_t - cogl_get_clock_time (CoglContext *context); - -+/** -+ * CoglGraphicsResetStatus: -+ * @COGL_GRAPHICS_RESET_STATUS_NO_ERROR: -+ * @COGL_GRAPHICS_RESET_STATUS_GUILTY_CONTEXT_RESET: -+ * @COGL_GRAPHICS_RESET_STATUS_INNOCENT_CONTEXT_RESET: -+ * @COGL_GRAPHICS_RESET_STATUS_UNKNOWN_CONTEXT_RESET: -+ * @COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET: -+ * -+ * All the error values that might be returned by -+ * cogl_get_graphics_reset_status(). Each value's meaning corresponds -+ * to the similarly named value defined in the ARB_robustness and -+ * NV_robustness_video_memory_purge extensions. -+ */ -+typedef enum _CoglGraphicsResetStatus -+{ -+ COGL_GRAPHICS_RESET_STATUS_NO_ERROR, -+ COGL_GRAPHICS_RESET_STATUS_GUILTY_CONTEXT_RESET, -+ COGL_GRAPHICS_RESET_STATUS_INNOCENT_CONTEXT_RESET, -+ COGL_GRAPHICS_RESET_STATUS_UNKNOWN_CONTEXT_RESET, -+ COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET, -+} CoglGraphicsResetStatus; -+ -+/** -+ * cogl_get_graphics_reset_status: -+ * @context: a #CoglContext pointer -+ * -+ * Returns the graphics reset status as reported by -+ * GetGraphicsResetStatusARB defined in the ARB_robustness extension. -+ * -+ * Note that Cogl doesn't normally enable the ARB_robustness -+ * extension in which case this will only ever return -+ * #COGL_GRAPHICS_RESET_STATUS_NO_ERROR. -+ * -+ * Applications must explicitly use a backend specific method to -+ * request that errors get reported such as X11's -+ * cogl_xlib_renderer_request_reset_on_video_memory_purge(). -+ * -+ * Return value: a #CoglGraphicsResetStatus -+ */ -+CoglGraphicsResetStatus -+cogl_get_graphics_reset_status (CoglContext *context); -+ - #endif /* COGL_ENABLE_EXPERIMENTAL_API */ - - COGL_END_DECLS -diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols -index feb9e65..eb72407 100644 ---- a/cogl/cogl.symbols -+++ b/cogl/cogl.symbols -@@ -334,6 +334,7 @@ cogl_get_clock_time - cogl_get_depth_test_enabled - cogl_get_draw_framebuffer - cogl_get_features -+cogl_get_graphics_reset_status - cogl_get_modelview_matrix - cogl_get_option_group - cogl_get_proc_address --- -2.7.4 - - -From 6361d971c0775b4d7c20e3c2deb8c87ce546a94d Mon Sep 17 00:00:00 2001 -From: Rui Matos -Date: Tue, 24 May 2016 19:37:02 +0200 -Subject: [PATCH 5/5] cogl: Ignore GL_CONTEXT_LOST when checking for GL errors - -When using a context with robustness, glGetError() may return -GL_CONTEXT_LOST at any time and this error doesn't get cleared until -the application calls glGetGraphicsResetStatus() . This means that our -error checking can't call glGetError() in a loop without checking for -that return value and returning in that case. - -https://bugzilla.gnome.org/show_bug.cgi?id=739178 ---- - cogl/cogl-texture-3d.c | 4 +--- - cogl/cogl-texture-rectangle.c | 10 +++------- - cogl/deprecated/cogl-shader.c | 5 ++--- - cogl/driver/gl/cogl-buffer-gl.c | 15 ++++----------- - cogl/driver/gl/cogl-pipeline-opengl.c | 7 ++----- - cogl/driver/gl/cogl-texture-2d-gl.c | 16 +++++----------- - cogl/driver/gl/cogl-util-gl-private.h | 10 ++++++++-- - cogl/driver/gl/cogl-util-gl.c | 22 +++++++++++++++++++++- - cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c | 6 ++---- - cogl/driver/gl/gl/cogl-texture-driver-gl.c | 12 +++--------- - cogl/driver/gl/gles/cogl-texture-driver-gles.c | 18 +++++------------- - 11 files changed, 56 insertions(+), 69 deletions(-) - -diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c -index 8e2ff08..31d2941 100644 ---- a/cogl/cogl-texture-3d.c -+++ b/cogl/cogl-texture-3d.c -@@ -361,7 +361,6 @@ allocate_with_size (CoglTexture3D *tex_3d, - GLenum gl_intformat; - GLenum gl_format; - GLenum gl_type; -- GLenum gl_error; - GLenum gl_texture; - - internal_format = -@@ -387,8 +386,7 @@ allocate_with_size (CoglTexture3D *tex_3d, - gl_texture, - FALSE); - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexImage3D (GL_TEXTURE_3D, 0, gl_intformat, - width, height, depth, -diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c -index 65d2f06..da5f1f0 100644 ---- a/cogl/cogl-texture-rectangle.c -+++ b/cogl/cogl-texture-rectangle.c -@@ -228,7 +228,6 @@ allocate_with_size (CoglTextureRectangle *tex_rect, - GLenum gl_intformat; - GLenum gl_format; - GLenum gl_type; -- GLenum gl_error; - GLenum gl_texture; - - internal_format = -@@ -256,8 +255,7 @@ allocate_with_size (CoglTextureRectangle *tex_rect, - tex_rect->is_foreign); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, gl_intformat, - width, height, 0, gl_format, gl_type, NULL); -@@ -361,7 +359,6 @@ allocate_from_gl_foreign (CoglTextureRectangle *tex_rect, - CoglTexture *tex = COGL_TEXTURE (tex_rect); - CoglContext *ctx = tex->context; - CoglPixelFormat format = loader->src.gl_foreign.format; -- GLenum gl_error = 0; - GLint gl_compressed = GL_FALSE; - GLenum gl_int_format = 0; - -@@ -377,12 +374,11 @@ allocate_from_gl_foreign (CoglTextureRectangle *tex_rect, - } - - /* Make sure binding succeeds */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB, - loader->src.gl_foreign.gl_handle, TRUE); -- if (ctx->glGetError () != GL_NO_ERROR) -+ if (_cogl_gl_util_get_error (ctx) != GL_NO_ERROR) - { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, -diff --git a/cogl/deprecated/cogl-shader.c b/cogl/deprecated/cogl-shader.c -index 08dcb82..d4b687c 100644 ---- a/cogl/deprecated/cogl-shader.c -+++ b/cogl/deprecated/cogl-shader.c -@@ -213,15 +213,14 @@ _cogl_shader_compile_real (CoglHandle handle, - g_message ("user ARBfp program:\n%s", shader->source); - - #ifdef COGL_GL_DEBUG -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - #endif - ctx->glProgramString (GL_FRAGMENT_PROGRAM_ARB, - GL_PROGRAM_FORMAT_ASCII_ARB, - strlen (shader->source), - shader->source); - #ifdef COGL_GL_DEBUG -- gl_error = ctx->glGetError (); -+ gl_error = _cogl_gl_util_get_error (ctx); - if (gl_error != GL_NO_ERROR) - { - g_warning ("%s: GL error (%d): Failed to compile ARBfp:\n%s\n%s", -diff --git a/cogl/driver/gl/cogl-buffer-gl.c b/cogl/driver/gl/cogl-buffer-gl.c -index 0f98406..b8cd03f 100644 ---- a/cogl/driver/gl/cogl-buffer-gl.c -+++ b/cogl/driver/gl/cogl-buffer-gl.c -@@ -142,7 +142,6 @@ recreate_store (CoglBuffer *buffer, - CoglContext *ctx = buffer->context; - GLenum gl_target; - GLenum gl_enum; -- GLenum gl_error; - - /* This assumes the buffer is already bound */ - -@@ -150,8 +149,7 @@ recreate_store (CoglBuffer *buffer, - gl_enum = update_hints_to_gl_enum (buffer); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glBufferData (gl_target, - buffer->size, -@@ -216,7 +214,6 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer, - CoglBufferBindTarget target; - GLenum gl_target; - CoglContext *ctx = buffer->context; -- GLenum gl_error; - - if (((access & COGL_BUFFER_ACCESS_READ) && - !cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_READ)) || -@@ -282,8 +279,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer, - } - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - data = ctx->glMapBufferRange (gl_target, - offset, -@@ -314,8 +310,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer, - } - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - data = ctx->glMapBuffer (gl_target, - _cogl_buffer_access_to_gl_enum (access)); -@@ -363,7 +358,6 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer, - CoglBufferBindTarget target; - GLenum gl_target; - CoglContext *ctx = buffer->context; -- GLenum gl_error; - CoglBool status = TRUE; - CoglError *internal_error = NULL; - -@@ -384,8 +378,7 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer, - gl_target = convert_bind_target_to_gl_target (target); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glBufferSubData (gl_target, offset, size, data); - -diff --git a/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c -index c7b44ee..52c2392 100644 ---- a/cogl/driver/gl/cogl-pipeline-opengl.c -+++ b/cogl/driver/gl/cogl-pipeline-opengl.c -@@ -253,12 +253,9 @@ set_glsl_program (GLuint gl_program) - - if (ctx->current_gl_program != gl_program) - { -- GLenum gl_error; -- -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - ctx->glUseProgram (gl_program); -- if (ctx->glGetError () == GL_NO_ERROR) -+ if (_cogl_gl_util_get_error (ctx) == GL_NO_ERROR) - ctx->current_gl_program = gl_program; - else - { -diff --git a/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/driver/gl/cogl-texture-2d-gl.c -index 8675f52..1cae680 100644 ---- a/cogl/driver/gl/cogl-texture-2d-gl.c -+++ b/cogl/driver/gl/cogl-texture-2d-gl.c -@@ -116,7 +116,6 @@ allocate_with_size (CoglTexture2D *tex_2d, - GLenum gl_intformat; - GLenum gl_format; - GLenum gl_type; -- GLenum gl_error; - GLenum gl_texture; - - internal_format = -@@ -149,8 +148,7 @@ allocate_with_size (CoglTexture2D *tex_2d, - tex_2d->is_foreign); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexImage2D (GL_TEXTURE_2D, 0, gl_intformat, - width, height, 0, gl_format, gl_type, NULL); -@@ -286,18 +284,16 @@ allocate_from_egl_image (CoglTexture2D *tex_2d, - CoglTexture *tex = COGL_TEXTURE (tex_2d); - CoglContext *ctx = tex->context; - CoglPixelFormat internal_format = loader->src.egl_image.format; -- GLenum gl_error; - - tex_2d->gl_texture = - ctx->texture_driver->gen (ctx, GL_TEXTURE_2D, internal_format); - _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, - tex_2d->gl_texture, - FALSE); -+ _cogl_gl_util_clear_gl_errors (ctx); - -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; - ctx->glEGLImageTargetTexture2D (GL_TEXTURE_2D, loader->src.egl_image.image); -- if (ctx->glGetError () != GL_NO_ERROR) -+ if (_cogl_gl_util_get_error (ctx) != GL_NO_ERROR) - { - _cogl_set_error (error, - COGL_TEXTURE_ERROR, -@@ -327,7 +323,6 @@ allocate_from_gl_foreign (CoglTexture2D *tex_2d, - CoglTexture *tex = COGL_TEXTURE (tex_2d); - CoglContext *ctx = tex->context; - CoglPixelFormat format = loader->src.gl_foreign.format; -- GLenum gl_error = 0; - GLint gl_compressed = GL_FALSE; - GLenum gl_int_format = 0; - -@@ -342,12 +337,11 @@ allocate_from_gl_foreign (CoglTexture2D *tex_2d, - } - - /* Make sure binding succeeds */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, - loader->src.gl_foreign.gl_handle, TRUE); -- if (ctx->glGetError () != GL_NO_ERROR) -+ if (_cogl_gl_util_get_error (ctx) != GL_NO_ERROR) - { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, -diff --git a/cogl/driver/gl/cogl-util-gl-private.h b/cogl/driver/gl/cogl-util-gl-private.h -index dcc61c0..1407e0f 100644 ---- a/cogl/driver/gl/cogl-util-gl-private.h -+++ b/cogl/driver/gl/cogl-util-gl-private.h -@@ -45,7 +45,7 @@ _cogl_gl_error_to_string (GLenum error_code); - #define GE(ctx, x) G_STMT_START { \ - GLenum __err; \ - (ctx)->x; \ -- while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \ -+ while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR && __err != GL_CONTEXT_LOST) \ - { \ - g_warning ("%s: GL error (%d): %s\n", \ - G_STRLOC, \ -@@ -56,7 +56,7 @@ _cogl_gl_error_to_string (GLenum error_code); - #define GE_RET(ret, ctx, x) G_STMT_START { \ - GLenum __err; \ - ret = (ctx)->x; \ -- while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \ -+ while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR && __err != GL_CONTEXT_LOST) \ - { \ - g_warning ("%s: GL error (%d): %s\n", \ - G_STRLOC, \ -@@ -71,6 +71,12 @@ _cogl_gl_error_to_string (GLenum error_code); - - #endif /* COGL_GL_DEBUG */ - -+GLenum -+_cogl_gl_util_get_error (CoglContext *ctx); -+ -+void -+_cogl_gl_util_clear_gl_errors (CoglContext *ctx); -+ - CoglBool - _cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error); - -diff --git a/cogl/driver/gl/cogl-util-gl.c b/cogl/driver/gl/cogl-util-gl.c -index 814621a..f136673 100644 ---- a/cogl/driver/gl/cogl-util-gl.c -+++ b/cogl/driver/gl/cogl-util-gl.c -@@ -77,13 +77,33 @@ _cogl_gl_error_to_string (GLenum error_code) - } - #endif /* COGL_GL_DEBUG */ - -+GLenum -+_cogl_gl_util_get_error (CoglContext *ctx) -+{ -+ GLenum gl_error = ctx->glGetError (); -+ -+ if (gl_error != GL_NO_ERROR && gl_error != GL_CONTEXT_LOST) -+ return gl_error; -+ else -+ return GL_NO_ERROR; -+} -+ -+void -+_cogl_gl_util_clear_gl_errors (CoglContext *ctx) -+{ -+ GLenum gl_error; -+ -+ while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR && gl_error != GL_CONTEXT_LOST) -+ ; -+} -+ - CoglBool - _cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error) - { - GLenum gl_error; - CoglBool out_of_memory = FALSE; - -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -+ while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR && gl_error != GL_CONTEXT_LOST) - { - if (gl_error == GL_OUT_OF_MEMORY) - out_of_memory = TRUE; -diff --git a/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c -index 16b13be..7be4a3f 100644 ---- a/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c -+++ b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c -@@ -837,7 +837,6 @@ _cogl_pipeline_fragend_arbfp_end (CoglPipeline *pipeline, - - if (shader_state->source) - { -- GLenum gl_error; - COGL_STATIC_COUNTER (fragend_arbfp_compile_counter, - "arbfp compile counter", - "Increments each time a new ARBfp " -@@ -857,14 +856,13 @@ _cogl_pipeline_fragend_arbfp_end (CoglPipeline *pipeline, - - GE (ctx, glBindProgram (GL_FRAGMENT_PROGRAM_ARB, - shader_state->gl_program)); -+ _cogl_gl_util_clear_gl_errors (ctx); - -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; - ctx->glProgramString (GL_FRAGMENT_PROGRAM_ARB, - GL_PROGRAM_FORMAT_ASCII_ARB, - shader_state->source->len, - shader_state->source->str); -- if (ctx->glGetError () != GL_NO_ERROR) -+ if (_cogl_gl_util_get_error (ctx) != GL_NO_ERROR) - { - g_warning ("\n%s\n%s", - shader_state->source->str, -diff --git a/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/gl/cogl-texture-driver-gl.c -index 109af81..1113966 100644 ---- a/cogl/driver/gl/gl/cogl-texture-driver-gl.c -+++ b/cogl/driver/gl/gl/cogl-texture-driver-gl.c -@@ -207,7 +207,6 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, - uint8_t *data; - CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); - int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); -- GLenum gl_error; - CoglBool status = TRUE; - CoglError *internal_error = NULL; - int level_width; -@@ -237,8 +236,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, - _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - _cogl_texture_get_level_size (texture, - level, -@@ -315,7 +313,6 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, - uint8_t *data; - CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); - int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); -- GLenum gl_error; - CoglBool status = TRUE; - CoglError *internal_error = NULL; - -@@ -341,8 +338,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, - _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexImage2D (gl_target, 0, - internal_gl_format, -@@ -377,7 +373,6 @@ _cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, - uint8_t *data; - CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); - int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); -- GLenum gl_error; - CoglBool status = TRUE; - - data = _cogl_bitmap_gl_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0, error); -@@ -394,8 +389,7 @@ _cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, - _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexImage3D (gl_target, - 0, /* level */ -diff --git a/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/driver/gl/gles/cogl-texture-driver-gles.c -index f87f1e9..85412a8 100644 ---- a/cogl/driver/gl/gles/cogl-texture-driver-gles.c -+++ b/cogl/driver/gl/gles/cogl-texture-driver-gles.c -@@ -201,7 +201,6 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, - int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); - CoglBitmap *slice_bmp; - int rowstride; -- GLenum gl_error; - CoglBool status = TRUE; - CoglError *internal_error = NULL; - int level_width; -@@ -265,8 +264,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, - _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - _cogl_texture_get_level_size (texture, - level, -@@ -348,7 +346,6 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, - int bmp_height = cogl_bitmap_get_height (source_bmp); - CoglBitmap *bmp; - uint8_t *data; -- GLenum gl_error; - CoglError *internal_error = NULL; - CoglBool status = TRUE; - -@@ -379,8 +376,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, - } - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexImage2D (gl_target, 0, - internal_gl_format, -@@ -419,7 +415,6 @@ _cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, - int bmp_width = cogl_bitmap_get_width (source_bmp); - int bmp_height = cogl_bitmap_get_height (source_bmp); - uint8_t *data; -- GLenum gl_error; - - _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); - -@@ -440,8 +435,7 @@ _cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, - image with a sub-region update */ - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexImage3D (gl_target, - 0, /* level */ -@@ -488,8 +482,7 @@ _cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, - } - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexSubImage3D (gl_target, - 0, /* level */ -@@ -524,8 +517,7 @@ _cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, - _cogl_texture_driver_prep_gl_for_pixels_upload (ctx, rowstride, bpp); - - /* Clear any GL errors */ -- while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) -- ; -+ _cogl_gl_util_clear_gl_errors (ctx); - - ctx->glTexImage3D (gl_target, - 0, /* level */ --- -2.7.4 - diff --git a/SPECS/cogl.spec b/SPECS/cogl.spec index 0cbb489..1959580 100644 --- a/SPECS/cogl.spec +++ b/SPECS/cogl.spec @@ -2,34 +2,23 @@ %global with_wayland 1 %endif -#global with_tests 1 +%global with_tests 1 Name: cogl -Version: 1.18.2 -Release: 12%{?dist} +Version: 1.22.2 +Release: 1%{?dist} Summary: A library for using 3D graphics hardware to draw pretty pictures -Group: Development/Libraries License: LGPLv2+ URL: http://www.clutter-project.org/ -Source0: http://download.gnome.org/sources/cogl/1.18/cogl-%{version}.tar.xz +Source0: http://download.gnome.org/sources/cogl/1.22/cogl-%{version}.tar.xz -# Support for quadbuffer stereo (patches upstream as of the Cogl 1.20 -# development branch) -Patch10: Add-support-for-setting-up-stereo-CoglOnscreens.patch -Patch11: CoglTexturePixmapX11-add-support-for-stereo-content.patch -Patch12: video-memory-purge.patch - -# See https://bugzilla.gnome.org/show_bug.cgi?id=768190 -Patch21: 0001-examples-cogl-crate.c-fix-bug-when-waiting-for-next-.patch -Patch22: 0002-CoglGPUInfo-fix-check-for-NVIDIA.patch -Patch23: 0003-CoglWinsysGLX-factor-out-some-duplicated-code.patch -Patch24: 0004-Usability-of-SGI_video_sync-is-per-display-not-per-r.patch -Patch25: 0005-Fix-the-get_clock_time-without-GLX_OML_sync_control.patch -Patch26: 0006-For-NVIDIA-proprietary-drivers-implement-sync-events.patch -Patch27: 0007-Add-cogl_xlib_renderer_set_threaded_swap_wait_enable.patch - -BuildRequires: autoconf automake libtool gettext-devel +# Vaguely related to https://bugzilla.gnome.org/show_bug.cgi?id=772419 +# but on the 1.22 branch, and the static inline in the header is gross +# ajax promises he'll clean this up. +Patch0: 0001-egl-Use-eglGetPlatformDisplay-not-eglGetDisplay.patch +# Backported from upstream to fix the build +Patch1: cogl-1.22.2-fix-ifdef.patch BuildRequires: cairo-devel BuildRequires: chrpath @@ -79,7 +68,6 @@ options we are interested in for the future. %package devel Summary: %{name} development environment -Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description devel @@ -87,7 +75,6 @@ Header files and libraries for building and developing apps with %{name}. %package doc Summary: Documentation for %{name} -Group: Documentation Requires: %{name} = %{version}-%{release} BuildArch: noarch @@ -97,7 +84,6 @@ This package contains documentation for %{name}. %if 0%{?with_tests} %package tests Summary: Tests for %{name} -Group: Development/Tools %description tests This package contains the installable tests for %{cogl}. @@ -105,22 +91,11 @@ This package contains the installable tests for %{cogl}. %prep %setup -q - -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 - -%patch21 -p1 -b .cogl-crate -%patch22 -p1 -b .gpuinfo -%patch23 -p1 -b .duplicated-code -%patch24 -p1 -b .video-sync -%patch25 -p1 -b .clock-time -%patch26 -p1 -b .threaded-sync-events -%patch27 -p1 -b .swap-wait-setter +%patch0 -p1 +%patch1 -p1 %build CFLAGS="$RPM_OPT_FLAGS -fPIC" -autoreconf -vif %configure \ --enable-cairo=yes \ --enable-cogl-pango=yes \ @@ -139,7 +114,7 @@ autoreconf -vif make %{?_smp_mflags} V=1 %install -make install DESTDIR=%{buildroot} INSTALL='install -p' +%make_install #Remove libtool archives. find %{buildroot} -name '*.la' -delete @@ -153,12 +128,16 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libcogl-pango.so %find_lang %{name} +%check +# make check + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files -f %{name}.lang -%doc COPYING NEWS README ChangeLog +%license COPYING +%doc NEWS README %{_libdir}/libcogl*.so.20* %{_libdir}/girepository-1.0/Cogl*.typelib @@ -179,6 +158,10 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libcogl-pango.so %endif %changelog +* Fri Aug 26 2016 Kalev Lember - 1.22.2-1 +- Update to 1.22.2 +- Resolves: #1386835 + * Wed Jun 29 2016 Owen Taylor - 1.18.2-12 - Add patches to improve display synchronization on NVIDIA