diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index 4a352938b..12dbd006e 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -567,3 +567,11 @@ cogl_context_get_gpu_time_ns (CoglContext *context) return context->driver_vtable->get_gpu_time_ns (context); } + +/* FIXME: we should distinguish renderer and context features */ +gboolean +cogl_context_has_winsys_feature (CoglContext *context, + CoglWinsysFeature feature) +{ + return COGL_FLAGS_GET (context->winsys_features, feature); +} diff --git a/cogl/cogl/cogl-context.h b/cogl/cogl/cogl-context.h index f6e383e9a..36ed70844 100644 --- a/cogl/cogl/cogl-context.h +++ b/cogl/cogl/cogl-context.h @@ -342,4 +342,8 @@ cogl_context_get_gpu_time_ns (CoglContext *context); COGL_EXPORT int cogl_context_get_latest_sync_fd (CoglContext *context); +COGL_EXPORT gboolean +cogl_context_has_winsys_feature (CoglContext *context, + CoglWinsysFeature feature); + G_END_DECLS diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c index 71a936722..4780c45f1 100644 --- a/cogl/cogl/cogl-onscreen.c +++ b/cogl/cogl/cogl-onscreen.c @@ -334,7 +334,7 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, info, user_data); - if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + if (!cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) { g_autoptr (CoglFrameInfo) pending_info = NULL; @@ -367,6 +367,7 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen, CoglOnscreenPrivate *priv = cogl_onscreen_get_instance_private (onscreen); CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglOnscreenClass *klass = COGL_ONSCREEN_GET_CLASS (onscreen); + CoglContext *context = cogl_framebuffer_get_context (framebuffer); g_return_if_fail (COGL_IS_ONSCREEN (framebuffer)); @@ -392,7 +393,7 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen, info, user_data); - if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + if (!cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) { g_autoptr (CoglFrameInfo) pending_info = NULL; @@ -431,9 +432,10 @@ cogl_onscreen_direct_scanout (CoglOnscreen *onscreen, CoglOnscreenPrivate *priv = cogl_onscreen_get_instance_private (onscreen); CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglOnscreenClass *klass = COGL_ONSCREEN_GET_CLASS (onscreen); + CoglContext *context = cogl_framebuffer_get_context (framebuffer); g_warn_if_fail (COGL_IS_ONSCREEN (framebuffer)); - g_warn_if_fail (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)); + g_warn_if_fail (cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)); if (!klass->direct_scanout) { diff --git a/cogl/cogl/cogl.h b/cogl/cogl/cogl.h index 652bc8943..983e0770a 100644 --- a/cogl/cogl/cogl.h +++ b/cogl/cogl/cogl.h @@ -92,9 +92,6 @@ #include "cogl/cogl-trace.h" #include "cogl/cogl-scanout.h" #include "cogl/cogl-graphene.h" -/* XXX: This will definitely go away once all the Clutter winsys - * code has been migrated down into Cogl! */ -#include "cogl/deprecated/cogl-clutter.h" /* The gobject introspection scanner seems to parse public headers in * isolation which means we need to be extra careful about how we diff --git a/cogl/cogl/deprecated/cogl-clutter.c b/cogl/cogl/deprecated/cogl-clutter.c deleted file mode 100644 index f1fc685b1..000000000 --- a/cogl/cogl/deprecated/cogl-clutter.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Robert Bragg - */ - -#include "config.h" - -#include -#include - -#include "cogl/cogl-util.h" -#include "cogl/cogl-types.h" -#include "cogl/cogl-private.h" -#include "cogl/cogl-context-private.h" -#include "cogl/cogl-framebuffer-private.h" -#include "cogl/cogl-onscreen-private.h" -#ifdef HAVE_X11 -#include "cogl/cogl-xlib-renderer.h" -#endif -#include "cogl/winsys/cogl-winsys-private.h" -#include "cogl/deprecated/cogl-clutter.h" - -gboolean -cogl_clutter_winsys_has_feature (CoglWinsysFeature feature) -{ - return _cogl_winsys_has_feature (feature); -} diff --git a/cogl/cogl/deprecated/cogl-clutter.h b/cogl/cogl/deprecated/cogl-clutter.h deleted file mode 100644 index 604ad3f3a..000000000 --- a/cogl/cogl/deprecated/cogl-clutter.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#pragma once - -#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) -#error "Only can be included directly." -#endif - -G_BEGIN_DECLS - -COGL_DEPRECATED_FOR (cogl_has_feature) -COGL_EXPORT gboolean -cogl_clutter_winsys_has_feature (CoglWinsysFeature feature); - -G_END_DECLS diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index 604a9a361..08431c7f1 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -16,7 +16,6 @@ endif cogl_deprecated_headers = [ 'deprecated/cogl-program.h', 'deprecated/cogl-shader.h', - 'deprecated/cogl-clutter.h', ] cogl_headers = [ @@ -283,7 +282,6 @@ cogl_sources = [ 'cogl-util.c', 'cogl-util.h', 'cogl.c', - 'deprecated/cogl-clutter.c', 'deprecated/cogl-program-private.h', 'deprecated/cogl-program.c', 'deprecated/cogl-shader-private.h', diff --git a/cogl/cogl/winsys/cogl-onscreen-glx.c b/cogl/cogl/winsys/cogl-onscreen-glx.c index acb511006..eb11ea069 100644 --- a/cogl/cogl/winsys/cogl-onscreen-glx.c +++ b/cogl/cogl/winsys/cogl-onscreen-glx.c @@ -192,7 +192,7 @@ cogl_onscreen_glx_allocate (CoglFramebuffer *framebuffer, } #ifdef GLX_INTEL_swap_event - if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + if (cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) { GLXDrawable drawable = onscreen_glx->glxwin ? onscreen_glx->glxwin : onscreen_glx->xwin; @@ -530,7 +530,7 @@ cogl_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen) GLXDrawable drawable; unsigned int age = 0; - if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE)) + if (!cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_BUFFER_AGE)) return 0; cogl_onscreen_bind (onscreen); @@ -677,7 +677,7 @@ cogl_onscreen_glx_swap_region (CoglOnscreen *onscreen, * we only need it to throttle redraws. */ gboolean blit_sub_buffer_is_synchronized = - _cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED); + cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED); int framebuffer_width = cogl_framebuffer_get_width (framebuffer); int framebuffer_height = cogl_framebuffer_get_height (framebuffer); @@ -844,7 +844,7 @@ cogl_onscreen_glx_swap_region (CoglOnscreen *onscreen, * handling _SYNC and _COMPLETE events in the winsys then we need to * send fake events in this case. */ - if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + if (cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) { set_sync_pending (onscreen); set_complete_pending (onscreen); diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index 3799fe70c..a6851ce53 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -473,12 +473,12 @@ update_winsys_features (CoglContext *context, GError **error) /* Note: glXCopySubBuffer and glBlitFramebuffer won't be throttled * by the SwapInterval so we have to throttle swap_region requests * manually... */ - if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION) && + if (cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SWAP_REGION) && (glx_display->have_vblank_counter || glx_display->can_vblank_wait)) COGL_FLAGS_SET (context->winsys_features, COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE, TRUE); - if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) + if (cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)) { COGL_FLAGS_SET (context->winsys_features, COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT, TRUE); @@ -490,7 +490,7 @@ update_winsys_features (CoglContext *context, GError **error) COGL_PRIVATE_FEATURE_DIRTY_EVENTS, TRUE); - if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE)) + if (cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_BUFFER_AGE)) COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_BUFFER_AGE, TRUE); return TRUE; @@ -1123,7 +1123,7 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap) CoglTexturePixmapGLX *glx_tex_pixmap; CoglContext *ctx = cogl_texture_get_context (COGL_TEXTURE (tex_pixmap)); - if (!_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP)) + if (!cogl_context_has_winsys_feature (ctx, COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP)) { tex_pixmap->winsys = NULL; return FALSE; diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h index c7670b0f4..21ac6113e 100644 --- a/cogl/cogl/winsys/cogl-winsys-private.h +++ b/cogl/cogl/winsys/cogl-winsys-private.h @@ -135,6 +135,3 @@ typedef struct _CoglWinsysVtable } CoglWinsysVtable; typedef const CoglWinsysVtable *(*CoglWinsysVtableGetter) (void); - -gboolean -_cogl_winsys_has_feature (CoglWinsysFeature feature); diff --git a/cogl/cogl/winsys/cogl-winsys.c b/cogl/cogl/winsys/cogl-winsys.c index 687dbd0d6..5b29ae703 100644 --- a/cogl/cogl/winsys/cogl-winsys.c +++ b/cogl/cogl/winsys/cogl-winsys.c @@ -39,12 +39,3 @@ _cogl_winsys_error_quark (void) { return g_quark_from_static_string ("cogl-winsys-error-quark"); } - -/* FIXME: we should distinguish renderer and context features */ -gboolean -_cogl_winsys_has_feature (CoglWinsysFeature feature) -{ - _COGL_GET_CONTEXT (ctx, FALSE); - - return COGL_FLAGS_GET (ctx->winsys_features, feature); -} diff --git a/src/backends/meta-stage-impl.c b/src/backends/meta-stage-impl.c index 552cc1637..a633d0b08 100644 --- a/src/backends/meta-stage-impl.c +++ b/src/backends/meta-stage-impl.c @@ -472,6 +472,7 @@ should_use_clipped_redraw (gboolean is_full_redraw, gboolean can_blit_sub_buffer; gboolean can_use_clipped_redraw; gboolean is_warmed_up; + CoglContext *context = cogl_framebuffer_get_context (framebuffer); if (is_full_redraw) return FALSE; @@ -490,7 +491,7 @@ should_use_clipped_redraw (gboolean is_full_redraw, } can_blit_sub_buffer = - cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_REGION); + cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_SWAP_REGION); can_use_clipped_redraw = _clutter_stage_window_can_clip_redraws (stage_window) && (can_blit_sub_buffer || has_buffer_age); @@ -509,6 +510,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl, ClutterStageWindow *stage_window = CLUTTER_STAGE_WINDOW (stage_impl); MetaStageView *view = META_STAGE_VIEW (stage_view); CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (stage_view); + CoglContext *context = cogl_framebuffer_get_context (fb); CoglFramebuffer *onscreen = clutter_stage_view_get_onscreen (stage_view); MtkRectangle view_rect; gboolean is_full_redraw; @@ -536,7 +538,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl, has_buffer_age = COGL_IS_ONSCREEN (onscreen) && - cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); + cogl_context_has_winsys_feature (context, COGL_WINSYS_FEATURE_BUFFER_AGE); redraw_clip = clutter_stage_view_take_accumulated_redraw_clip (stage_view);