1
0
Fork 0

cogl: Remove poll renderer

As it is only composed of idle callbacks now, replace
those functions where they are used

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3887>
This commit is contained in:
Bilal Elmoussaoui 2024-07-17 00:25:56 +02:00 committed by Marge Bot
parent 24c338cc0e
commit c65bb3b9ce
14 changed files with 21 additions and 226 deletions

View file

@ -48,7 +48,6 @@
#include "cogl/cogl-framebuffer-private.h" #include "cogl/cogl-framebuffer-private.h"
#include "cogl/cogl-offscreen-private.h" #include "cogl/cogl-offscreen-private.h"
#include "cogl/cogl-onscreen-private.h" #include "cogl/cogl-onscreen-private.h"
#include "cogl/cogl-poll-private.h"
#include "cogl/cogl-private.h" #include "cogl/cogl-private.h"
#include "cogl/winsys/cogl-winsys-private.h" #include "cogl/winsys/cogl-winsys-private.h"

View file

@ -30,8 +30,8 @@
#include "config.h" #include "config.h"
#include "cogl/cogl-renderer-private.h"
#include "cogl/cogl-glib-source.h" #include "cogl/cogl-glib-source.h"
#include "cogl/cogl-poll.h"
typedef struct _CoglGLibSource typedef struct _CoglGLibSource
{ {
@ -47,7 +47,7 @@ cogl_glib_source_prepare (GSource *source, int *timeout)
{ {
CoglGLibSource *cogl_source = (CoglGLibSource *) source; CoglGLibSource *cogl_source = (CoglGLibSource *) source;
if (!cogl_poll_renderer_has_idle_closures (cogl_source->renderer)) if (_cogl_list_empty (&cogl_source->renderer->idle_closures))
{ {
*timeout = -1; *timeout = -1;
cogl_source->expiration_time = -1; cogl_source->expiration_time = -1;
@ -81,7 +81,7 @@ cogl_glib_source_dispatch (GSource *source,
{ {
CoglGLibSource *cogl_source = (CoglGLibSource *) source; CoglGLibSource *cogl_source = (CoglGLibSource *) source;
cogl_poll_renderer_dispatch (cogl_source->renderer); _cogl_closure_list_invoke_no_args (&cogl_source->renderer->idle_closures);
return TRUE; return TRUE;
} }
@ -122,5 +122,3 @@ cogl_glib_source_new (CoglContext *context,
return cogl_glib_renderer_source_new (cogl_context_get_renderer (context), return cogl_glib_renderer_source_new (cogl_context_get_renderer (context),
priority); priority);
} }

View file

@ -39,7 +39,7 @@
#include "cogl/cogl-onscreen-template-private.h" #include "cogl/cogl-onscreen-template-private.h"
#include "cogl/cogl-context-private.h" #include "cogl/cogl-context-private.h"
#include "cogl/cogl-closure-list-private.h" #include "cogl/cogl-closure-list-private.h"
#include "cogl/cogl-poll-private.h" #include "cogl/cogl-renderer-private.h"
typedef struct _CoglOnscreenPrivate typedef struct _CoglOnscreenPrivate
{ {
@ -223,11 +223,10 @@ _cogl_onscreen_queue_dispatch_idle (CoglOnscreen *onscreen)
if (!ctx->onscreen_dispatch_idle) if (!ctx->onscreen_dispatch_idle)
{ {
ctx->onscreen_dispatch_idle = ctx->onscreen_dispatch_idle =
_cogl_poll_renderer_add_idle (ctx->display->renderer, _cogl_closure_list_add (&ctx->display->renderer->idle_closures,
(CoglIdleCallback) _cogl_dispatch_onscreen_cb,
_cogl_dispatch_onscreen_cb, ctx,
ctx, NULL);
NULL);
} }
} }

View file

@ -1,43 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2013 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
#include "cogl/cogl-poll.h"
#include "cogl/cogl-renderer.h"
#include "cogl/cogl-closure-list-private.h"
typedef void (*CoglIdleCallback) (void *user_data);
CoglClosure *
_cogl_poll_renderer_add_idle (CoglRenderer *renderer,
CoglIdleCallback idle_cb,
void *user_data,
GDestroyNotify destroy_cb);

View file

@ -1,66 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2012 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:
* Neil Roberts <neil@linux.intel.com>
*/
#include "config.h"
#include "cogl/cogl-poll.h"
#include "cogl/cogl-poll-private.h"
#include "cogl/cogl-renderer-private.h"
#include "cogl/winsys/cogl-winsys-private.h"
gboolean
cogl_poll_renderer_has_idle_closures (CoglRenderer *renderer)
{
g_return_val_if_fail (COGL_IS_RENDERER (renderer), FALSE);
return !_cogl_list_empty (&renderer->idle_closures);
}
void
cogl_poll_renderer_dispatch (CoglRenderer *renderer)
{
g_return_if_fail (COGL_IS_RENDERER (renderer));
_cogl_closure_list_invoke_no_args (&renderer->idle_closures);
}
CoglClosure *
_cogl_poll_renderer_add_idle (CoglRenderer *renderer,
CoglIdleCallback idle_cb,
void *user_data,
GDestroyNotify destroy_cb)
{
return _cogl_closure_list_add (&renderer->idle_closures,
idle_cb,
user_data,
destroy_cb);
}

View file

@ -1,84 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2012 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:
* Neil Roberts <neil@linux.intel.com>
*/
#pragma once
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#include "cogl/cogl-context.h"
#include <poll.h>
#define COGL_SYSDEF_POLLIN POLLIN
#define COGL_SYSDEF_POLLPRI POLLPRI
#define COGL_SYSDEF_POLLOUT POLLOUT
#define COGL_SYSDEF_POLLERR POLLERR
#define COGL_SYSDEF_POLLHUP POLLHUP
#define COGL_SYSDEF_POLLNVAL POLLNVAL
G_BEGIN_DECLS
/**
* CoglPoll:
*
* Functions for integrating Cogl with an application's main loop
*
* Cogl needs to integrate with the application's main loop so that it
* can internally handle some events from the driver. All Cogl
* applications must use these functions. They provide enough
* information to describe the state that Cogl will need to wake up
* on. An application using the GLib main loop can instead use
* cogl_glib_source_new() which provides a #GSource ready to be added
* to the main loop.
*/
/**
* cogl_poll_renderer_has_idle_closures:
* @renderer: A #CoglRenderer
*/
COGL_EXPORT gboolean
cogl_poll_renderer_has_idle_closures (CoglRenderer *renderer);
/**
* cogl_poll_renderer_dispatch:
* @renderer: A #CoglRenderer
*
* This should be called whenever an application is woken up from
* going idle in its main loop.
*/
COGL_EXPORT void
cogl_poll_renderer_dispatch (CoglRenderer *renderer);
G_END_DECLS

View file

@ -37,7 +37,6 @@
#include "cogl/cogl-renderer-private.h" #include "cogl/cogl-renderer-private.h"
#include "cogl/cogl-xlib-renderer-private.h" #include "cogl/cogl-xlib-renderer-private.h"
#include "cogl/cogl-x11-renderer-private.h" #include "cogl/cogl-x11-renderer-private.h"
#include "cogl/cogl-poll-private.h"
#include "cogl/winsys/cogl-winsys-private.h" #include "cogl/winsys/cogl-winsys-private.h"
#include "mtk/mtk-x11.h" #include "mtk/mtk-x11.h"

View file

@ -85,7 +85,6 @@
#include "cogl/cogl-framebuffer.h" #include "cogl/cogl-framebuffer.h"
#include "cogl/cogl-onscreen.h" #include "cogl/cogl-onscreen.h"
#include "cogl/cogl-frame-info.h" #include "cogl/cogl-frame-info.h"
#include "cogl/cogl-poll.h"
#include "cogl/cogl-glib-source.h" #include "cogl/cogl-glib-source.h"
#include "cogl/cogl-trace.h" #include "cogl/cogl-trace.h"
#include "cogl/cogl-scanout.h" #include "cogl/cogl-scanout.h"

View file

@ -45,7 +45,6 @@ cogl_headers = [
'cogl-pipeline-layer-state.h', 'cogl-pipeline-layer-state.h',
'cogl-pipeline-state.h', 'cogl-pipeline-state.h',
'cogl-pixel-buffer.h', 'cogl-pixel-buffer.h',
'cogl-poll.h',
'cogl-primitive.h', 'cogl-primitive.h',
'cogl-renderer.h', 'cogl-renderer.h',
'cogl-scanout.h', 'cogl-scanout.h',
@ -242,8 +241,6 @@ cogl_sources = [
'cogl-pixel-format.c', 'cogl-pixel-format.c',
'cogl-point-in-poly-private.h', 'cogl-point-in-poly-private.h',
'cogl-point-in-poly.c', 'cogl-point-in-poly.c',
'cogl-poll-private.h',
'cogl-poll.c',
'cogl-primitive-private.h', 'cogl-primitive-private.h',
'cogl-primitive.c', 'cogl-primitive.c',
'cogl-primitives-private.h', 'cogl-primitives-private.h',

View file

@ -618,10 +618,10 @@ set_sync_pending (CoglOnscreen *onscreen)
if (!glx_renderer->flush_notifications_idle) if (!glx_renderer->flush_notifications_idle)
{ {
glx_renderer->flush_notifications_idle = glx_renderer->flush_notifications_idle =
_cogl_poll_renderer_add_idle (renderer, _cogl_closure_list_add (&renderer->idle_closures,
flush_pending_notifications_idle, flush_pending_notifications_idle,
context, context,
NULL); NULL);
} }
onscreen_glx->pending_sync_notify++; onscreen_glx->pending_sync_notify++;
@ -642,10 +642,10 @@ set_complete_pending (CoglOnscreen *onscreen)
if (!glx_renderer->flush_notifications_idle) if (!glx_renderer->flush_notifications_idle)
{ {
glx_renderer->flush_notifications_idle = glx_renderer->flush_notifications_idle =
_cogl_poll_renderer_add_idle (renderer, _cogl_closure_list_add (&renderer->idle_closures,
flush_pending_notifications_idle, flush_pending_notifications_idle,
context, context,
NULL); NULL);
} }
onscreen_glx->pending_complete_notify++; onscreen_glx->pending_complete_notify++;
@ -1016,10 +1016,10 @@ cogl_onscreen_glx_resize (CoglOnscreen *onscreen,
if (!glx_renderer->flush_notifications_idle) if (!glx_renderer->flush_notifications_idle)
{ {
glx_renderer->flush_notifications_idle = glx_renderer->flush_notifications_idle =
_cogl_poll_renderer_add_idle (renderer, _cogl_closure_list_add (&renderer->idle_closures,
flush_pending_notifications_idle, flush_pending_notifications_idle,
context, context,
NULL); NULL);
} }
if (configure_event->send_event) if (configure_event->send_event)

View file

@ -45,7 +45,6 @@
#include "cogl/cogl-texture-2d-private.h" #include "cogl/cogl-texture-2d-private.h"
#include "cogl/driver/gl/cogl-texture-2d-gl-private.h" #include "cogl/driver/gl/cogl-texture-2d-gl-private.h"
#include "cogl/cogl-texture-2d.h" #include "cogl/cogl-texture-2d.h"
#include "cogl/cogl-poll-private.h"
#include "cogl/winsys/cogl-onscreen-egl.h" #include "cogl/winsys/cogl-onscreen-egl.h"
#include "cogl/winsys/cogl-onscreen-xlib.h" #include "cogl/winsys/cogl-onscreen-xlib.h"
#include "cogl/winsys/cogl-winsys-egl-x11-private.h" #include "cogl/winsys/cogl-winsys-egl-x11-private.h"

View file

@ -45,7 +45,6 @@
#include "cogl/cogl-onscreen-private.h" #include "cogl/cogl-onscreen-private.h"
#include "cogl/cogl-xlib-renderer.h" #include "cogl/cogl-xlib-renderer.h"
#include "cogl/cogl-util.h" #include "cogl/cogl-util.h"
#include "cogl/cogl-poll-private.h"
#include "cogl/driver/gl/cogl-pipeline-opengl-private.h" #include "cogl/driver/gl/cogl-pipeline-opengl-private.h"
#include "cogl/winsys/cogl-glx-renderer-private.h" #include "cogl/winsys/cogl-glx-renderer-private.h"
#include "cogl/winsys/cogl-glx-display-private.h" #include "cogl/winsys/cogl-glx-display-private.h"

View file

@ -38,8 +38,6 @@
#include "cogl/winsys/cogl-texture-pixmap-x11-private.h" #include "cogl/winsys/cogl-texture-pixmap-x11-private.h"
#endif #endif
#include "cogl/cogl-poll.h"
COGL_EXPORT uint32_t COGL_EXPORT uint32_t
_cogl_winsys_error_quark (void); _cogl_winsys_error_quark (void);

View file

@ -23,6 +23,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
#include <poll.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/timerfd.h> #include <sys/timerfd.h>
#include <xf86drm.h> #include <xf86drm.h>