Remove CoglXlibDisplay

CoglXlibDisplay just contained one member called dummy_xwin. This was
not shared outside of the respective winsys's so I don't think it
really makes sense to have a separate shared struct for it. It seems
more like an implementation detail that is specific to the winsys
because for example it may be that the EGL winsys could use the
surfaceless extension and not bother with a dummy window. This will
also make it easier to factor out the Xlib-specific data in
CoglDisplayEGL to the platform data.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2011-12-12 13:46:45 +00:00
parent a8f84af776
commit 7f74712a79
6 changed files with 14 additions and 60 deletions

View File

@ -351,7 +351,6 @@ cogl_sources_c += \
$(srcdir)/cogl-x11-renderer-private.h \ $(srcdir)/cogl-x11-renderer-private.h \
$(srcdir)/cogl-xlib-renderer-private.h \ $(srcdir)/cogl-xlib-renderer-private.h \
$(srcdir)/cogl-xlib-renderer.c \ $(srcdir)/cogl-xlib-renderer.c \
$(srcdir)/cogl-xlib-display-private.h \
$(srcdir)/cogl-xlib.c \ $(srcdir)/cogl-xlib.c \
$(srcdir)/cogl-xlib-private.h \ $(srcdir)/cogl-xlib-private.h \
$(srcdir)/winsys/cogl-texture-pixmap-x11.c \ $(srcdir)/winsys/cogl-texture-pixmap-x11.c \

View File

@ -26,7 +26,6 @@
#define __COGL_DISPLAY_GLX_PRIVATE_H #define __COGL_DISPLAY_GLX_PRIVATE_H
#include "cogl-object-private.h" #include "cogl-object-private.h"
#include "cogl-xlib-display-private.h"
typedef struct _CoglGLXCachedConfig typedef struct _CoglGLXCachedConfig
{ {
@ -41,8 +40,6 @@ typedef struct _CoglGLXCachedConfig
typedef struct _CoglGLXDisplay typedef struct _CoglGLXDisplay
{ {
CoglXlibDisplay _parent;
CoglGLXCachedConfig glx_cached_configs[COGL_GLX_N_CACHED_CONFIGS]; CoglGLXCachedConfig glx_cached_configs[COGL_GLX_N_CACHED_CONFIGS];
gboolean found_fbconfig; gboolean found_fbconfig;
@ -52,6 +49,7 @@ typedef struct _CoglGLXDisplay
/* Single context for all wins */ /* Single context for all wins */
GLXContext glx_context; GLXContext glx_context;
GLXWindow dummy_glxwin; GLXWindow dummy_glxwin;
Window dummy_xwin;
} CoglGLXDisplay; } CoglGLXDisplay;
#endif /* __COGL_DISPLAY_GLX_PRIVATE_H */ #endif /* __COGL_DISPLAY_GLX_PRIVATE_H */

View File

@ -1,35 +0,0 @@
/*
* 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_DISPLAY_XLIB_PRIVATE_H
#define __COGL_DISPLAY_XLIB_PRIVATE_H
#include <X11/Xlib.h>
typedef struct _CoglXlibDisplay
{
Window dummy_xwin;
} CoglXlibDisplay;
#endif /* __COGL_DISPLAY_XLIB_PRIVATE_H */

View File

@ -30,7 +30,6 @@
#include "cogl-context-private.h" #include "cogl-context-private.h"
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
#include "cogl-xlib-renderer-private.h" #include "cogl-xlib-renderer-private.h"
#include "cogl-xlib-display-private.h"
#endif #endif
#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT #ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT
#include <wayland-client.h> #include <wayland-client.h>
@ -106,7 +105,7 @@ typedef struct _CoglRendererEGL
typedef struct _CoglDisplayEGL typedef struct _CoglDisplayEGL
{ {
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
CoglXlibDisplay _parent; Window dummy_xwin;
#endif #endif
EGLContext egl_context; EGLContext egl_context;

View File

@ -42,7 +42,6 @@
#include "cogl-onscreen-template-private.h" #include "cogl-onscreen-template-private.h"
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
#include "cogl-xlib-renderer-private.h" #include "cogl-xlib-renderer-private.h"
#include "cogl-xlib-display-private.h"
#include "cogl-xlib-renderer.h" #include "cogl-xlib-renderer.h"
#endif #endif
@ -571,7 +570,6 @@ try_create_context (CoglDisplay *display,
CoglRenderer *renderer = display->renderer; CoglRenderer *renderer = display->renderer;
CoglDisplayEGL *egl_display = display->winsys; CoglDisplayEGL *egl_display = display->winsys;
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
CoglXlibDisplay *xlib_display = display->winsys;
CoglXlibRenderer *xlib_renderer = CoglXlibRenderer *xlib_renderer =
_cogl_xlib_renderer_get_data (renderer); _cogl_xlib_renderer_get_data (renderer);
#endif #endif
@ -659,7 +657,7 @@ try_create_context (CoglDisplay *display,
AllocNone); AllocNone);
attrs.border_pixel = 0; attrs.border_pixel = 0;
xlib_display->dummy_xwin = egl_display->dummy_xwin =
XCreateWindow (xlib_renderer->xdpy, XCreateWindow (xlib_renderer->xdpy,
DefaultRootWindow (xlib_renderer->xdpy), DefaultRootWindow (xlib_renderer->xdpy),
-100, -100, 1, 1, -100, -100, 1, 1,
@ -677,7 +675,7 @@ try_create_context (CoglDisplay *display,
egl_display->dummy_surface = egl_display->dummy_surface =
eglCreateWindowSurface (edpy, eglCreateWindowSurface (edpy,
egl_display->egl_config, egl_display->egl_config,
(NativeWindowType) xlib_display->dummy_xwin, (NativeWindowType) egl_display->dummy_xwin,
NULL); NULL);
if (egl_display->dummy_surface == EGL_NO_SURFACE) if (egl_display->dummy_surface == EGL_NO_SURFACE)
@ -882,7 +880,6 @@ cleanup_context (CoglDisplay *display)
CoglDisplayEGL *egl_display = display->winsys; CoglDisplayEGL *egl_display = display->winsys;
CoglRendererEGL *egl_renderer = renderer->winsys; CoglRendererEGL *egl_renderer = renderer->winsys;
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
CoglXlibDisplay *xlib_display = display->winsys;
CoglXlibRenderer *xlib_renderer = CoglXlibRenderer *xlib_renderer =
_cogl_xlib_renderer_get_data (renderer); _cogl_xlib_renderer_get_data (renderer);
#endif #endif
@ -924,10 +921,10 @@ cleanup_context (CoglDisplay *display)
egl_display->dummy_surface = EGL_NO_SURFACE; egl_display->dummy_surface = EGL_NO_SURFACE;
} }
if (xlib_display->dummy_xwin) if (egl_display->dummy_xwin)
{ {
XDestroyWindow (xlib_renderer->xdpy, xlib_display->dummy_xwin); XDestroyWindow (xlib_renderer->xdpy, egl_display->dummy_xwin);
xlib_display->dummy_xwin = None; egl_display->dummy_xwin = None;
} }
break; break;
#endif #endif

View File

@ -39,7 +39,6 @@
#include "cogl-renderer-private.h" #include "cogl-renderer-private.h"
#include "cogl-glx-renderer-private.h" #include "cogl-glx-renderer-private.h"
#include "cogl-onscreen-template-private.h" #include "cogl-onscreen-template-private.h"
#include "cogl-xlib-display-private.h"
#include "cogl-glx-display-private.h" #include "cogl-glx-display-private.h"
#include "cogl-private.h" #include "cogl-private.h"
#include "cogl-texture-2d-private.h" #include "cogl-texture-2d-private.h"
@ -583,7 +582,6 @@ static gboolean
create_context (CoglDisplay *display, GError **error) create_context (CoglDisplay *display, GError **error)
{ {
CoglGLXDisplay *glx_display = display->winsys; CoglGLXDisplay *glx_display = display->winsys;
CoglXlibDisplay *xlib_display = display->winsys;
CoglXlibRenderer *xlib_renderer = CoglXlibRenderer *xlib_renderer =
_cogl_xlib_renderer_get_data (display->renderer); _cogl_xlib_renderer_get_data (display->renderer);
CoglGLXRenderer *glx_renderer = display->renderer->winsys; CoglGLXRenderer *glx_renderer = display->renderer->winsys;
@ -661,7 +659,7 @@ create_context (CoglDisplay *display, GError **error)
AllocNone); AllocNone);
attrs.border_pixel = 0; attrs.border_pixel = 0;
xlib_display->dummy_xwin = glx_display->dummy_xwin =
XCreateWindow (xlib_renderer->xdpy, XCreateWindow (xlib_renderer->xdpy,
DefaultRootWindow (xlib_renderer->xdpy), DefaultRootWindow (xlib_renderer->xdpy),
-100, -100, 1, 1, -100, -100, 1, 1,
@ -680,14 +678,14 @@ create_context (CoglDisplay *display, GError **error)
glx_display->dummy_glxwin = glx_display->dummy_glxwin =
glx_renderer->glXCreateWindow (xlib_renderer->xdpy, glx_renderer->glXCreateWindow (xlib_renderer->xdpy,
config, config,
xlib_display->dummy_xwin, glx_display->dummy_xwin,
NULL); NULL);
} }
if (glx_display->dummy_glxwin) if (glx_display->dummy_glxwin)
dummy_drawable = glx_display->dummy_glxwin; dummy_drawable = glx_display->dummy_glxwin;
else else
dummy_drawable = xlib_display->dummy_xwin; dummy_drawable = glx_display->dummy_xwin;
COGL_NOTE (WINSYS, "Selecting dummy 0x%x for the GLX context", COGL_NOTE (WINSYS, "Selecting dummy 0x%x for the GLX context",
(unsigned int) dummy_drawable); (unsigned int) dummy_drawable);
@ -714,7 +712,6 @@ static void
_cogl_winsys_display_destroy (CoglDisplay *display) _cogl_winsys_display_destroy (CoglDisplay *display)
{ {
CoglGLXDisplay *glx_display = display->winsys; CoglGLXDisplay *glx_display = display->winsys;
CoglXlibDisplay *xlib_display = display->winsys;
CoglXlibRenderer *xlib_renderer = CoglXlibRenderer *xlib_renderer =
_cogl_xlib_renderer_get_data (display->renderer); _cogl_xlib_renderer_get_data (display->renderer);
CoglGLXRenderer *glx_renderer = display->renderer->winsys; CoglGLXRenderer *glx_renderer = display->renderer->winsys;
@ -737,10 +734,10 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
glx_display->dummy_glxwin = None; glx_display->dummy_glxwin = None;
} }
if (xlib_display->dummy_xwin) if (glx_display->dummy_xwin)
{ {
XDestroyWindow (xlib_renderer->xdpy, xlib_display->dummy_xwin); XDestroyWindow (xlib_renderer->xdpy, glx_display->dummy_xwin);
xlib_display->dummy_xwin = None; glx_display->dummy_xwin = None;
} }
g_slice_free (CoglGLXDisplay, display->winsys); g_slice_free (CoglGLXDisplay, display->winsys);
@ -1028,7 +1025,6 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
{ {
CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context;
CoglContextGLX *glx_context = context->winsys; CoglContextGLX *glx_context = context->winsys;
CoglXlibDisplay *xlib_display = context->display->winsys;
CoglGLXDisplay *glx_display = context->display->winsys; CoglGLXDisplay *glx_display = context->display->winsys;
CoglXlibRenderer *xlib_renderer = CoglXlibRenderer *xlib_renderer =
_cogl_xlib_renderer_get_data (context->display->renderer); _cogl_xlib_renderer_get_data (context->display->renderer);
@ -1042,7 +1038,7 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
{ {
drawable = drawable =
glx_display->dummy_glxwin ? glx_display->dummy_glxwin ?
glx_display->dummy_glxwin : xlib_display->dummy_xwin; glx_display->dummy_glxwin : glx_display->dummy_xwin;
if (glx_context->current_drawable == drawable) if (glx_context->current_drawable == drawable)
return; return;