1
0
Fork 0

cogl/onscreen: Move direct scanout to CoglOnscreen class

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
Jonas Ådahl 2020-10-19 22:24:26 +02:00 committed by Robert Mader
parent f663567405
commit 0fdf6a6405
6 changed files with 24 additions and 25 deletions

View file

@ -30,6 +30,8 @@
#include "cogl-config.h"
#include <gio/gio.h>
#include "cogl-util.h"
#include "cogl-onscreen-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);
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_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;
g_queue_push_tail (&priv->pending_frame_infos, info);
winsys = _cogl_framebuffer_get_winsys (framebuffer);
if (!winsys->onscreen_direct_scanout (onscreen,
scanout,
info,
user_data,
error))
if (!klass->direct_scanout (onscreen,
scanout,
info,
user_data,
error))
{
g_queue_pop_tail (&priv->pending_frame_infos);
return FALSE;

View file

@ -47,6 +47,8 @@
G_BEGIN_DECLS
typedef struct _CoglScanout CoglScanout;
#define COGL_TYPE_ONSCREEN (cogl_onscreen_get_type ())
COGL_EXPORT
G_DECLARE_DERIVABLE_TYPE (CoglOnscreen, cogl_onscreen,
@ -72,6 +74,11 @@ struct _CoglOnscreenClass
CoglFrameInfo *info,
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 ())
@ -83,8 +90,6 @@ typedef enum _CoglScanoutError
COGL_SCANOUT_ERROR_INHIBITED,
} CoglScanoutError;
typedef struct _CoglScanout CoglScanout;
#ifdef COGL_HAS_X11
/**
* cogl_x11_onscreen_get_window_xid:

View file

@ -104,13 +104,6 @@ typedef struct _CoglWinsysVtable
void
(*context_deinit) (CoglContext *context);
gboolean
(*onscreen_direct_scanout) (CoglOnscreen *onscreen,
CoglScanout *scanout,
CoglFrameInfo *info,
gpointer user_data,
GError **error);
void
(*onscreen_set_visibility) (CoglOnscreen *onscreen,
gboolean visibility);

View file

@ -1177,7 +1177,7 @@ meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
return TRUE;
}
gboolean
static gboolean
meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
CoglScanout *scanout,
CoglFrameInfo *frame_info,
@ -2112,4 +2112,5 @@ meta_onscreen_native_class_init (MetaOnscreenNativeClass *klass)
onscreen_class->swap_buffers_with_damage =
meta_onscreen_native_swap_buffers_with_damage;
onscreen_class->direct_scanout = meta_onscreen_native_direct_scanout;
}

View file

@ -35,12 +35,6 @@ G_DECLARE_FINAL_TYPE (MetaOnscreenNative, meta_onscreen_native,
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,
ClutterFrame *frame);

View file

@ -940,8 +940,6 @@ get_native_cogl_winsys_vtable (CoglRenderer *cogl_renderer)
vtable.renderer_disconnect = meta_renderer_native_disconnect;
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_inited = TRUE;