mirror of
https://github.com/brl/mutter.git
synced 2025-03-23 03:33:52 +00:00
cogl: Port FrameInfo away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
This commit is contained in:
parent
f2c55d6479
commit
748c1fb9f4
@ -31,7 +31,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cogl/cogl-frame-info.h"
|
#include "cogl/cogl-frame-info.h"
|
||||||
#include "cogl/cogl-object-private.h"
|
|
||||||
#include "cogl/cogl-context.h"
|
#include "cogl/cogl-context.h"
|
||||||
|
|
||||||
typedef enum _CoglFrameInfoFlag
|
typedef enum _CoglFrameInfoFlag
|
||||||
@ -60,7 +59,7 @@ typedef enum _CoglFrameInfoFlag
|
|||||||
|
|
||||||
struct _CoglFrameInfo
|
struct _CoglFrameInfo
|
||||||
{
|
{
|
||||||
CoglObject _parent;
|
GObject parent_instance;
|
||||||
|
|
||||||
CoglContext *context;
|
CoglContext *context;
|
||||||
|
|
||||||
|
@ -31,13 +31,33 @@
|
|||||||
#include "cogl-config.h"
|
#include "cogl-config.h"
|
||||||
|
|
||||||
#include "cogl/cogl-frame-info-private.h"
|
#include "cogl/cogl-frame-info-private.h"
|
||||||
#include "cogl/cogl-gtype-private.h"
|
|
||||||
#include "cogl/cogl-context-private.h"
|
#include "cogl/cogl-context-private.h"
|
||||||
|
|
||||||
static void _cogl_frame_info_free (CoglFrameInfo *info);
|
G_DEFINE_TYPE (CoglFrameInfo, cogl_frame_info, G_TYPE_OBJECT);
|
||||||
|
|
||||||
COGL_OBJECT_DEFINE (FrameInfo, frame_info);
|
static void
|
||||||
COGL_GTYPE_DEFINE_CLASS (FrameInfo, frame_info);
|
cogl_frame_info_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
CoglFrameInfo *info = COGL_FRAME_INFO (object);
|
||||||
|
|
||||||
|
if (info->timestamp_query)
|
||||||
|
cogl_context_free_timestamp_query (info->context, info->timestamp_query);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (cogl_frame_info_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_frame_info_init (CoglFrameInfo *info)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_frame_info_class_init (CoglFrameInfoClass *class)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
|
|
||||||
|
object_class->dispose = cogl_frame_info_dispose;
|
||||||
|
}
|
||||||
|
|
||||||
CoglFrameInfo *
|
CoglFrameInfo *
|
||||||
cogl_frame_info_new (CoglContext *context,
|
cogl_frame_info_new (CoglContext *context,
|
||||||
@ -45,20 +65,11 @@ cogl_frame_info_new (CoglContext *context,
|
|||||||
{
|
{
|
||||||
CoglFrameInfo *info;
|
CoglFrameInfo *info;
|
||||||
|
|
||||||
info = g_new0 (CoglFrameInfo, 1);
|
info = g_object_new (COGL_TYPE_FRAME_INFO, NULL);
|
||||||
info->context = context;
|
info->context = context;
|
||||||
info->global_frame_counter = global_frame_counter;
|
info->global_frame_counter = global_frame_counter;
|
||||||
|
|
||||||
return _cogl_frame_info_object_new (info);
|
return info;
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cogl_frame_info_free (CoglFrameInfo *info)
|
|
||||||
{
|
|
||||||
if (info->timestamp_query)
|
|
||||||
cogl_context_free_timestamp_query (info->context, info->timestamp_query);
|
|
||||||
|
|
||||||
g_free (info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
|
@ -51,27 +51,15 @@ G_BEGIN_DECLS
|
|||||||
* Frame information.
|
* Frame information.
|
||||||
*/
|
*/
|
||||||
typedef struct _CoglFrameInfo CoglFrameInfo;
|
typedef struct _CoglFrameInfo CoglFrameInfo;
|
||||||
#define COGL_FRAME_INFO(X) ((CoglFrameInfo *)(X))
|
|
||||||
|
|
||||||
/**
|
#define COGL_TYPE_FRAME_INFO (cogl_frame_info_get_type ())
|
||||||
* cogl_frame_info_get_gtype:
|
|
||||||
*
|
|
||||||
* Returns: a #GType that can be used with the GLib type system.
|
|
||||||
*/
|
|
||||||
COGL_EXPORT
|
COGL_EXPORT
|
||||||
GType cogl_frame_info_get_gtype (void);
|
G_DECLARE_FINAL_TYPE (CoglFrameInfo,
|
||||||
|
cogl_frame_info,
|
||||||
/**
|
COGL,
|
||||||
* cogl_is_frame_info:
|
FRAME_INFO,
|
||||||
* @object: A #CoglObject pointer
|
GObject)
|
||||||
*
|
|
||||||
* Gets whether the given object references a #CoglFrameInfo.
|
|
||||||
*
|
|
||||||
* Return value: %TRUE if the object references a #CoglFrameInfo
|
|
||||||
* and %FALSE otherwise.
|
|
||||||
*/
|
|
||||||
COGL_EXPORT gboolean
|
|
||||||
cogl_is_frame_info (void *object);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_frame_info_get_frame_counter:
|
* cogl_frame_info_get_frame_counter:
|
||||||
|
@ -141,7 +141,7 @@ cogl_onscreen_dispose (GObject *object)
|
|||||||
_cogl_closure_list_disconnect_all (&priv->dirty_closures);
|
_cogl_closure_list_disconnect_all (&priv->dirty_closures);
|
||||||
|
|
||||||
while ((frame_info = g_queue_pop_tail (&priv->pending_frame_infos)))
|
while ((frame_info = g_queue_pop_tail (&priv->pending_frame_infos)))
|
||||||
cogl_object_unref (frame_info);
|
g_object_unref (frame_info);
|
||||||
g_queue_clear (&priv->pending_frame_infos);
|
g_queue_clear (&priv->pending_frame_infos);
|
||||||
|
|
||||||
G_OBJECT_CLASS (cogl_onscreen_parent_class)->dispose (object);
|
G_OBJECT_CLASS (cogl_onscreen_parent_class)->dispose (object);
|
||||||
@ -202,7 +202,7 @@ _cogl_dispatch_onscreen_cb (CoglContext *context)
|
|||||||
notify_event (onscreen, event->type, info);
|
notify_event (onscreen, event->type, info);
|
||||||
|
|
||||||
g_object_unref (onscreen);
|
g_object_unref (onscreen);
|
||||||
cogl_object_unref (info);
|
g_object_unref (info);
|
||||||
|
|
||||||
g_free (event);
|
g_free (event);
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ _cogl_onscreen_queue_event (CoglOnscreen *onscreen,
|
|||||||
CoglOnscreenEvent *event = g_new0 (CoglOnscreenEvent, 1);
|
CoglOnscreenEvent *event = g_new0 (CoglOnscreenEvent, 1);
|
||||||
|
|
||||||
event->onscreen = g_object_ref (onscreen);
|
event->onscreen = g_object_ref (onscreen);
|
||||||
event->info = cogl_object_ref (info);
|
event->info = g_object_ref (info);
|
||||||
event->type = type;
|
event->type = type;
|
||||||
|
|
||||||
_cogl_list_insert (ctx->onscreen_events_queue.prev, &event->link);
|
_cogl_list_insert (ctx->onscreen_events_queue.prev, &event->link);
|
||||||
@ -355,7 +355,7 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
|||||||
_cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info);
|
_cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info);
|
||||||
_cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info);
|
_cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info);
|
||||||
|
|
||||||
cogl_object_unref (info);
|
g_object_unref (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->frame_counter++;
|
priv->frame_counter++;
|
||||||
@ -415,7 +415,7 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen,
|
|||||||
_cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info);
|
_cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info);
|
||||||
_cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info);
|
_cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info);
|
||||||
|
|
||||||
cogl_object_unref (info);
|
g_object_unref (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->frame_counter++;
|
priv->frame_counter++;
|
||||||
|
@ -591,7 +591,7 @@ cogl_onscreen_glx_flush_notification (CoglOnscreen *onscreen)
|
|||||||
|
|
||||||
info = cogl_onscreen_pop_head_frame_info (onscreen);
|
info = cogl_onscreen_pop_head_frame_info (onscreen);
|
||||||
_cogl_onscreen_notify_complete (onscreen, info);
|
_cogl_onscreen_notify_complete (onscreen, info);
|
||||||
cogl_object_unref (info);
|
g_object_unref (info);
|
||||||
onscreen_glx->pending_complete_notify--;
|
onscreen_glx->pending_complete_notify--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -747,7 +747,7 @@ meta_stage_impl_scanout_view (MetaStageImpl *stage_impl,
|
|||||||
frame,
|
frame,
|
||||||
error))
|
error))
|
||||||
{
|
{
|
||||||
cogl_object_unref (frame_info);
|
g_object_unref (frame_info);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ meta_onscreen_native_notify_frame_complete (CoglOnscreen *onscreen)
|
|||||||
|
|
||||||
_cogl_onscreen_notify_frame_sync (onscreen, info);
|
_cogl_onscreen_notify_frame_sync (onscreen, info);
|
||||||
_cogl_onscreen_notify_complete (onscreen, info);
|
_cogl_onscreen_notify_complete (onscreen, info);
|
||||||
cogl_object_unref (info);
|
g_object_unref (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user