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-xlib-renderer-private.h \
$(srcdir)/cogl-xlib-renderer.c \
$(srcdir)/cogl-xlib-display-private.h \
$(srcdir)/cogl-xlib.c \
$(srcdir)/cogl-xlib-private.h \
$(srcdir)/winsys/cogl-texture-pixmap-x11.c \

View File

@ -26,7 +26,6 @@
#define __COGL_DISPLAY_GLX_PRIVATE_H
#include "cogl-object-private.h"
#include "cogl-xlib-display-private.h"
typedef struct _CoglGLXCachedConfig
{
@ -41,8 +40,6 @@ typedef struct _CoglGLXCachedConfig
typedef struct _CoglGLXDisplay
{
CoglXlibDisplay _parent;
CoglGLXCachedConfig glx_cached_configs[COGL_GLX_N_CACHED_CONFIGS];
gboolean found_fbconfig;
@ -52,6 +49,7 @@ typedef struct _CoglGLXDisplay
/* Single context for all wins */
GLXContext glx_context;
GLXWindow dummy_glxwin;
Window dummy_xwin;
} CoglGLXDisplay;
#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"
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
#include "cogl-xlib-renderer-private.h"
#include "cogl-xlib-display-private.h"
#endif
#ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT
#include <wayland-client.h>
@ -106,7 +105,7 @@ typedef struct _CoglRendererEGL
typedef struct _CoglDisplayEGL
{
#ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
CoglXlibDisplay _parent;
Window dummy_xwin;
#endif
EGLContext egl_context;

View File

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

View File

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