1
0
Fork 0

Add a separate winsys vtable for each EGL platform

Instead of just having an "EGL" renderer, there is now a separate
winsys for each platform. Currently they just directly copy the vtable
for the EGL platform so it is still only possible to have one EGL
platform compiled into Cogl. However the intention is that the
winsys-specific code for each platform will be moved into override
functions in the corresponding platform winsys.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2011-12-08 17:24:40 +00:00
parent 590e1c46f0
commit a1e1527b69
16 changed files with 593 additions and 9 deletions

View file

@ -376,11 +376,36 @@ endif
if SUPPORT_EGL_PLATFORM_WAYLAND
cogl_public_h += \
$(srcdir)/cogl-wayland-renderer.h
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl-wayland.c \
$(srcdir)/winsys/cogl-winsys-egl-wayland-private.h
endif
if SUPPORT_EGL_PLATFORM_KMS
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-kms.c \
$(srcdir)/winsys/cogl-winsys-kms.h
$(srcdir)/winsys/cogl-winsys-kms.h \
$(srcdir)/winsys/cogl-winsys-egl-kms.c \
$(srcdir)/winsys/cogl-winsys-egl-kms-private.h
endif
if SUPPORT_EGL_PLATFORM_POWERVR_X11
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl-x11.c \
$(srcdir)/winsys/cogl-winsys-egl-x11-private.h
endif
if SUPPORT_EGL_PLATFORM_POWERVR_NULL
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl-null.c \
$(srcdir)/winsys/cogl-winsys-egl-null-private.h
endif
if SUPPORT_EGL_PLATFORM_GDL
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl-gdl.c \
$(srcdir)/winsys/cogl-winsys-egl-gdl-private.h
endif
if SUPPORT_EGL_PLATFORM_ANDROID
cogl_sources_c += \
$(srcdir)/winsys/cogl-winsys-egl-android.c \
$(srcdir)/winsys/cogl-winsys-egl-android-private.h
endif
if SUPPORT_EGL
cogl_sources_c += \

View file

@ -43,11 +43,27 @@
#include "cogl-display-private.h"
#include "cogl-winsys-private.h"
#include "cogl-winsys-stub-private.h"
#ifdef COGL_HAS_EGL_SUPPORT
#include "cogl-winsys-egl-private.h"
#endif
#include "cogl-config-private.h"
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
#include "cogl-winsys-egl-x11-private.h"
#endif
#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT
#include "cogl-winsys-egl-wayland-private.h"
#endif
#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT
#include "cogl-winsys-egl-kms-private.h"
#endif
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
#include "cogl-winsys-egl-gdl-private.h"
#endif
#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT
#include "cogl-winsys-egl-android-private.h"
#endif
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT
#include "cogl-winsys-egl-null-private.h"
#endif
#if COGL_HAS_XLIB_SUPPORT
#include "cogl-xlib-renderer.h"
#endif
@ -66,8 +82,23 @@ static CoglWinsysVtableGetter _cogl_winsys_vtable_getters[] =
#ifdef COGL_HAS_GLX_SUPPORT
_cogl_winsys_glx_get_vtable,
#endif
#ifdef COGL_HAS_EGL_SUPPORT
_cogl_winsys_egl_get_vtable,
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
_cogl_winsys_egl_x11_get_vtable,
#endif
#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT
_cogl_winsys_egl_wayland_get_vtable,
#endif
#ifdef COGL_HAS_EGL_PLATFORM_KMS_SUPPORT
_cogl_winsys_egl_kms_get_vtable,
#endif
#ifdef COGL_HAS_EGL_PLATFORM_GDL_SUPPORT
_cogl_winsys_egl_gdl_get_vtable,
#endif
#ifdef COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT
_cogl_winsys_egl_android_get_vtable,
#endif
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT
_cogl_winsys_egl_null_get_vtable,
#endif
#ifdef COGL_HAS_WGL_SUPPORT
_cogl_winsys_wgl_get_vtable,

View file

@ -77,7 +77,12 @@ typedef enum
COGL_WINSYS_ID_ANY,
COGL_WINSYS_ID_STUB,
COGL_WINSYS_ID_GLX,
COGL_WINSYS_ID_EGL,
COGL_WINSYS_ID_EGL_X11,
COGL_WINSYS_ID_EGL_NULL,
COGL_WINSYS_ID_EGL_GDL,
COGL_WINSYS_ID_EGL_WAYLAND,
COGL_WINSYS_ID_EGL_KMS,
COGL_WINSYS_ID_EGL_ANDROID,
COGL_WINSYS_ID_WGL
} CoglWinsysID;

View file

@ -0,0 +1,32 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#ifndef __COGL_WINSYS_EGL_ANDROID_PRIVATE_H
#define __COGL_WINSYS_EGL_ANDROID_PRIVATE_H
#include "cogl-winsys-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_android_get_vtable (void);
#endif /* __COGL_WINSYS_EGL_ANDROID_PRIVATE_H */

View file

@ -0,0 +1,55 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
* Neil Roberts <neil@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-winsys-egl-android-private.h"
#include "cogl-winsys-egl-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_android_get_vtable (void)
{
static gboolean vtable_inited = FALSE;
static CoglWinsysVtable vtable;
if (!vtable_inited)
{
/* The EGL_ANDROID winsys is a subclass of the EGL winsys so we
start by copying its vtable */
vtable = *_cogl_winsys_egl_get_vtable ();
vtable.id = COGL_WINSYS_ID_EGL_ANDROID;
vtable.name = "EGL_ANDROID";
vtable_inited = TRUE;
}
return &vtable;
}

View file

@ -0,0 +1,32 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#ifndef __COGL_WINSYS_EGL_GDL_PRIVATE_H
#define __COGL_WINSYS_EGL_GDL_PRIVATE_H
#include "cogl-winsys-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_gdl_get_vtable (void);
#endif /* __COGL_WINSYS_EGL_GDL_PRIVATE_H */

View file

@ -0,0 +1,55 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
* Neil Roberts <neil@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-winsys-egl-gdl-private.h"
#include "cogl-winsys-egl-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_gdl_get_vtable (void)
{
static gboolean vtable_inited = FALSE;
static CoglWinsysVtable vtable;
if (!vtable_inited)
{
/* The EGL_GDL winsys is a subclass of the EGL winsys so we
start by copying its vtable */
vtable = *_cogl_winsys_egl_get_vtable ();
vtable.id = COGL_WINSYS_ID_EGL_GDL;
vtable.name = "EGL_GDL";
vtable_inited = TRUE;
}
return &vtable;
}

View file

@ -0,0 +1,32 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#ifndef __COGL_WINSYS_EGL_KMS_PRIVATE_H
#define __COGL_WINSYS_EGL_KMS_PRIVATE_H
#include "cogl-winsys-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_kms_get_vtable (void);
#endif /* __COGL_WINSYS_EGL_KMS_PRIVATE_H */

View file

@ -0,0 +1,55 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
* Neil Roberts <neil@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-winsys-egl-kms-private.h"
#include "cogl-winsys-egl-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_kms_get_vtable (void)
{
static gboolean vtable_inited = FALSE;
static CoglWinsysVtable vtable;
if (!vtable_inited)
{
/* The EGL_KMS winsys is a subclass of the EGL winsys so we
start by copying its vtable */
vtable = *_cogl_winsys_egl_get_vtable ();
vtable.id = COGL_WINSYS_ID_EGL_KMS;
vtable.name = "EGL_KMS";
vtable_inited = TRUE;
}
return &vtable;
}

View file

@ -0,0 +1,32 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#ifndef __COGL_WINSYS_EGL_NULL_PRIVATE_H
#define __COGL_WINSYS_EGL_NULL_PRIVATE_H
#include "cogl-winsys-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_null_get_vtable (void);
#endif /* __COGL_WINSYS_EGL_NULL_PRIVATE_H */

View file

@ -0,0 +1,55 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
* Neil Roberts <neil@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-winsys-egl-null-private.h"
#include "cogl-winsys-egl-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_null_get_vtable (void)
{
static gboolean vtable_inited = FALSE;
static CoglWinsysVtable vtable;
if (!vtable_inited)
{
/* The EGL_NULL winsys is a subclass of the EGL winsys so we
start by copying its vtable */
vtable = *_cogl_winsys_egl_get_vtable ();
vtable.id = COGL_WINSYS_ID_EGL_NULL;
vtable.name = "EGL_NULL";
vtable_inited = TRUE;
}
return &vtable;
}

View file

@ -0,0 +1,32 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#ifndef __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H
#define __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H
#include "cogl-winsys-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_wayland_get_vtable (void);
#endif /* __COGL_WINSYS_EGL_WAYLAND_PRIVATE_H */

View file

@ -0,0 +1,55 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
* Neil Roberts <neil@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-winsys-egl-wayland-private.h"
#include "cogl-winsys-egl-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_wayland_get_vtable (void)
{
static gboolean vtable_inited = FALSE;
static CoglWinsysVtable vtable;
if (!vtable_inited)
{
/* The EGL_WAYLAND winsys is a subclass of the EGL winsys so we
start by copying its vtable */
vtable = *_cogl_winsys_egl_get_vtable ();
vtable.id = COGL_WINSYS_ID_EGL_WAYLAND;
vtable.name = "EGL_WAYLAND";
vtable_inited = TRUE;
}
return &vtable;
}

View file

@ -0,0 +1,32 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#ifndef __COGL_WINSYS_EGL_X11_PRIVATE_H
#define __COGL_WINSYS_EGL_X11_PRIVATE_H
#include "cogl-winsys-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_x11_get_vtable (void);
#endif /* __COGL_WINSYS_EGL_X11_PRIVATE_H */

View file

@ -0,0 +1,55 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
* Neil Roberts <neil@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-winsys-egl-x11-private.h"
#include "cogl-winsys-egl-private.h"
const CoglWinsysVtable *
_cogl_winsys_egl_x11_get_vtable (void)
{
static gboolean vtable_inited = FALSE;
static CoglWinsysVtable vtable;
if (!vtable_inited)
{
/* The EGL_X11 winsys is a subclass of the EGL winsys so we
start by copying its vtable */
vtable = *_cogl_winsys_egl_get_vtable ();
vtable.id = COGL_WINSYS_ID_EGL_X11;
vtable.name = "EGL_X11";
vtable_inited = TRUE;
}
return &vtable;
}

View file

@ -1774,8 +1774,9 @@ _cogl_winsys_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
static CoglWinsysVtable _cogl_winsys_vtable =
{
.id = COGL_WINSYS_ID_EGL,
.name = "EGL",
/* This winsys is only used as a base for the EGL-platform
winsys's so it does not have an ID or a name */
.renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address,
.renderer_connect = _cogl_winsys_renderer_connect,
.renderer_disconnect = _cogl_winsys_renderer_disconnect,