mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
cogl/onscreen: Move direct scanout to CoglOnscreen class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
parent
f663567405
commit
0fdf6a6405
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "cogl-config.h"
|
#include "cogl-config.h"
|
||||||
|
|
||||||
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#include "cogl-util.h"
|
#include "cogl-util.h"
|
||||||
#include "cogl-onscreen-private.h"
|
#include "cogl-onscreen-private.h"
|
||||||
#include "cogl-frame-info-private.h"
|
#include "cogl-frame-info-private.h"
|
||||||
@ -442,20 +444,26 @@ cogl_onscreen_direct_scanout (CoglOnscreen *onscreen,
|
|||||||
{
|
{
|
||||||
CoglOnscreenPrivate *priv = cogl_onscreen_get_instance_private (onscreen);
|
CoglOnscreenPrivate *priv = cogl_onscreen_get_instance_private (onscreen);
|
||||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||||
const CoglWinsysVtable *winsys;
|
CoglOnscreenClass *klass = COGL_ONSCREEN_GET_CLASS (onscreen);
|
||||||
|
|
||||||
g_warn_if_fail (COGL_IS_ONSCREEN (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_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT));
|
||||||
|
|
||||||
|
if (!klass->direct_scanout)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
"Direct scanout not supported");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
info->frame_counter = priv->frame_counter;
|
info->frame_counter = priv->frame_counter;
|
||||||
g_queue_push_tail (&priv->pending_frame_infos, info);
|
g_queue_push_tail (&priv->pending_frame_infos, info);
|
||||||
|
|
||||||
winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
if (!klass->direct_scanout (onscreen,
|
||||||
if (!winsys->onscreen_direct_scanout (onscreen,
|
scanout,
|
||||||
scanout,
|
info,
|
||||||
info,
|
user_data,
|
||||||
user_data,
|
error))
|
||||||
error))
|
|
||||||
{
|
{
|
||||||
g_queue_pop_tail (&priv->pending_frame_infos);
|
g_queue_pop_tail (&priv->pending_frame_infos);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _CoglScanout CoglScanout;
|
||||||
|
|
||||||
#define COGL_TYPE_ONSCREEN (cogl_onscreen_get_type ())
|
#define COGL_TYPE_ONSCREEN (cogl_onscreen_get_type ())
|
||||||
COGL_EXPORT
|
COGL_EXPORT
|
||||||
G_DECLARE_DERIVABLE_TYPE (CoglOnscreen, cogl_onscreen,
|
G_DECLARE_DERIVABLE_TYPE (CoglOnscreen, cogl_onscreen,
|
||||||
@ -72,6 +74,11 @@ struct _CoglOnscreenClass
|
|||||||
CoglFrameInfo *info,
|
CoglFrameInfo *info,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
gboolean (* direct_scanout) (CoglOnscreen *onscreen,
|
||||||
|
CoglScanout *scanout,
|
||||||
|
CoglFrameInfo *info,
|
||||||
|
gpointer user_data,
|
||||||
|
GError **error);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define COGL_SCANOUT_ERROR (cogl_scanout_error_quark ())
|
#define COGL_SCANOUT_ERROR (cogl_scanout_error_quark ())
|
||||||
@ -83,8 +90,6 @@ typedef enum _CoglScanoutError
|
|||||||
COGL_SCANOUT_ERROR_INHIBITED,
|
COGL_SCANOUT_ERROR_INHIBITED,
|
||||||
} CoglScanoutError;
|
} CoglScanoutError;
|
||||||
|
|
||||||
typedef struct _CoglScanout CoglScanout;
|
|
||||||
|
|
||||||
#ifdef COGL_HAS_X11
|
#ifdef COGL_HAS_X11
|
||||||
/**
|
/**
|
||||||
* cogl_x11_onscreen_get_window_xid:
|
* cogl_x11_onscreen_get_window_xid:
|
||||||
|
@ -104,13 +104,6 @@ typedef struct _CoglWinsysVtable
|
|||||||
void
|
void
|
||||||
(*context_deinit) (CoglContext *context);
|
(*context_deinit) (CoglContext *context);
|
||||||
|
|
||||||
gboolean
|
|
||||||
(*onscreen_direct_scanout) (CoglOnscreen *onscreen,
|
|
||||||
CoglScanout *scanout,
|
|
||||||
CoglFrameInfo *info,
|
|
||||||
gpointer user_data,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
(*onscreen_set_visibility) (CoglOnscreen *onscreen,
|
(*onscreen_set_visibility) (CoglOnscreen *onscreen,
|
||||||
gboolean visibility);
|
gboolean visibility);
|
||||||
|
@ -1177,7 +1177,7 @@ meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
static gboolean
|
||||||
meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
||||||
CoglScanout *scanout,
|
CoglScanout *scanout,
|
||||||
CoglFrameInfo *frame_info,
|
CoglFrameInfo *frame_info,
|
||||||
@ -2112,4 +2112,5 @@ meta_onscreen_native_class_init (MetaOnscreenNativeClass *klass)
|
|||||||
|
|
||||||
onscreen_class->swap_buffers_with_damage =
|
onscreen_class->swap_buffers_with_damage =
|
||||||
meta_onscreen_native_swap_buffers_with_damage;
|
meta_onscreen_native_swap_buffers_with_damage;
|
||||||
|
onscreen_class->direct_scanout = meta_onscreen_native_direct_scanout;
|
||||||
}
|
}
|
||||||
|
@ -35,12 +35,6 @@ G_DECLARE_FINAL_TYPE (MetaOnscreenNative, meta_onscreen_native,
|
|||||||
|
|
||||||
void meta_renderer_native_release_onscreen (CoglOnscreen *onscreen);
|
void meta_renderer_native_release_onscreen (CoglOnscreen *onscreen);
|
||||||
|
|
||||||
gboolean meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
|
||||||
CoglScanout *scanout,
|
|
||||||
CoglFrameInfo *frame_info,
|
|
||||||
gpointer user_data,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
void meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
|
void meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
|
||||||
ClutterFrame *frame);
|
ClutterFrame *frame);
|
||||||
|
|
||||||
|
@ -940,8 +940,6 @@ get_native_cogl_winsys_vtable (CoglRenderer *cogl_renderer)
|
|||||||
vtable.renderer_disconnect = meta_renderer_native_disconnect;
|
vtable.renderer_disconnect = meta_renderer_native_disconnect;
|
||||||
vtable.renderer_create_dma_buf = meta_renderer_native_create_dma_buf;
|
vtable.renderer_create_dma_buf = meta_renderer_native_create_dma_buf;
|
||||||
|
|
||||||
vtable.onscreen_direct_scanout = meta_onscreen_native_direct_scanout;
|
|
||||||
|
|
||||||
vtable.context_get_clock_time = meta_renderer_native_get_clock_time;
|
vtable.context_get_clock_time = meta_renderer_native_get_clock_time;
|
||||||
|
|
||||||
vtable_inited = TRUE;
|
vtable_inited = TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user