summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/egl.html19
-rw-r--r--src/egl/drivers/xdri/Makefile28
-rw-r--r--src/egl/drivers/xdri/driinit.c85
-rw-r--r--src/egl/drivers/xdri/driinit.h9
-rw-r--r--src/egl/drivers/xdri/egl_xdri.c625
-rw-r--r--src/gallium/state_trackers/egl/Makefile4
-rw-r--r--src/gallium/state_trackers/egl/x11/glxinit.c (renamed from src/egl/drivers/xdri/glxinit.c)0
-rw-r--r--src/gallium/state_trackers/egl/x11/glxinit.h (renamed from src/egl/drivers/xdri/glxinit.h)0
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c2
9 files changed, 9 insertions, 763 deletions
diff --git a/docs/egl.html b/docs/egl.html
index 30cbe0eaed..cdfae044a8 100644
--- a/docs/egl.html
+++ b/docs/egl.html
@@ -206,25 +206,20 @@ It is accelerated when the GLX is. As such, it cannot provide functions that
is not available in GLX or GLX extensions.</p>
</li>
-<li><code>egl_xdri</code>
+<li><code>egl_dri2</code>
<p>This driver supports the X Window System as its window system. It functions
-as a DRI driver loader and can load DRI/DRI2/DRISW drivers. Unlike
-<code>egl_glx</code>, it has no dependency on <code>libGL</code>. It talks to
-the X server directly using DRI or DRI2 protocols. It also talks minimal GLX
-protocol for things like available visuals or fbconfigs. With direct access to
-the DRI drivers, it has the potential to support more EGL functions that are
-not possible with <code>egl_glx</code>.</p>
+as a DRI2 driver loader. Unlike <code>egl_glx</code>, it has no dependency on
+<code>libGL</code>. It talks to the X server directly using DRI2 protocol.</p>
</li>
<li><code>egl_dri</code>
<p>This driver lacks maintenance and does <em>not</em> build. It is similiar
-to <code>egl_xdri</code> in that it functions as a DRI driver loader. But
-unlike <code>egl_xdri</code>, it supports Linux framebuffer devices as its
-window system and supports EGL_MESA_screen_surface extension. It loads only
-DRI1 drivers. As DRI1 drivers is phasing out, it might be better to rewrite
-the driver to support KMS and DRI2.</p>
+to <code>egl_dri2</code> in that it functions as a DRI(1) driver loader. But
+unlike <code>egl_dri2</code>, it supports Linux framebuffer devices as its
+window system and supports EGL_MESA_screen_surface extension. As DRI1 drivers
+are phasing out, it might eventually be replaced by <code>egl_dri2</code>.</p>
</li>
</ul>
diff --git a/src/egl/drivers/xdri/Makefile b/src/egl/drivers/xdri/Makefile
deleted file mode 100644
index 9120620dc5..0000000000
--- a/src/egl/drivers/xdri/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-# src/egl/drivers/xdri/Makefile
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER = egl_xdri.so
-
-# steal sources from GLX
-GLX_SOURCES = dri_common.c XF86dri.c dri2.c dri2_glx.c dri_glx.c drisw_glx.c
-GLX_SOURCES := $(addprefix ../../../glx/x11/,$(GLX_SOURCES))
-GLX_INCLUDES = \
- $(shell pkg-config --cflags-only-I libdrm) \
- -I$(TOP)/include/GL/internal \
- -I$(TOP)/src/glx/x11 \
- -I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/mesa
-GLX_CFLAGS = -DGLX_DIRECT_RENDERING
-
-EGL_SOURCES = egl_xdri.c glxinit.c driinit.c $(GLX_SOURCES)
-EGL_INCLUDES = \
- -I$(TOP)/include \
- -I$(TOP)/src/egl/main \
- $(GLX_INCLUDES)
-
-EGL_CFLAGS = $(GLX_CFLAGS)
-EGL_LIBS = -lX11 -lGL
-
-include ../Makefile.template
diff --git a/src/egl/drivers/xdri/driinit.c b/src/egl/drivers/xdri/driinit.c
deleted file mode 100644
index 3e54f0bd4d..0000000000
--- a/src/egl/drivers/xdri/driinit.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * DRI initialization. The DRI loaders are defined in src/glx/x11/.
- */
-
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include "glxclient.h"
-#include "driinit.h"
-
-/* for __DRI_SYSTEM_TIME extension */
-_X_HIDDEN int
-__glXGetUST(int64_t * ust)
-{
- struct timeval tv;
-
- if (ust == NULL) {
- return -EFAULT;
- }
-
- if (gettimeofday(&tv, NULL) == 0) {
- ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
- return 0;
- }
- else {
- return -errno;
- }
-}
-
-_X_HIDDEN GLboolean
-__driGetMscRateOML(__DRIdrawable * draw,
- int32_t * numerator, int32_t * denominator, void *private)
-{
- return GL_FALSE;
-}
-
-/* ignore glx extensions */
-_X_HIDDEN void
-__glXEnableDirectExtension(__GLXscreenConfigs * psc, const char *name)
-{
-}
-
-_X_HIDDEN __GLXDRIdisplay *
-__driCreateDisplay(__GLXdisplayPrivate *dpyPriv, int *version)
-{
- __GLXDRIdisplay *driDisplay = NULL;
- int ver = 0;
- char *env;
- int force_sw;
-
- env = getenv("EGL_SOFTWARE");
- force_sw = (env && *env != '0');
-
- /* try DRI2 first */
- if (!force_sw) {
- driDisplay = dri2CreateDisplay(dpyPriv->dpy);
- if (driDisplay) {
- /* fill in the required field */
- dpyPriv->dri2Display = driDisplay;
- ver = 2;
- }
- }
-
- /* and then DRI */
- if (!force_sw && !driDisplay) {
- driDisplay = driCreateDisplay(dpyPriv->dpy);
- if (driDisplay) {
- dpyPriv->driDisplay = driDisplay;
- ver = 1;
- }
- }
-
- /* and then DRISW */
- if (!driDisplay) {
- driDisplay = driswCreateDisplay(dpyPriv->dpy);
- if (driDisplay) {
- dpyPriv->driDisplay = driDisplay;
- ver = 0;
- }
- }
-
- if (version)
- *version = ver;
- return driDisplay;
-}
diff --git a/src/egl/drivers/xdri/driinit.h b/src/egl/drivers/xdri/driinit.h
deleted file mode 100644
index 6ea05cebef..0000000000
--- a/src/egl/drivers/xdri/driinit.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef DRIINIT_INCLUDED
-#define DRIINIT_INCLUDED
-
-#include "glxclient.h"
-
-extern __GLXDRIdisplay *
-__driCreateDisplay(__GLXdisplayPrivate *dpyPriv, int *version);
-
-#endif /* DRIINIT_INCLUDED */
diff --git a/src/egl/drivers/xdri/egl_xdri.c b/src/egl/drivers/xdri/egl_xdri.c
deleted file mode 100644
index 555473c00a..0000000000
--- a/src/egl/drivers/xdri/egl_xdri.c
+++ /dev/null
@@ -1,625 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-/**
- * Code to interface a DRI driver to libEGL.
- * Note that unlike previous DRI/EGL interfaces, this one is meant to
- * be used _with_ X. Applications will use eglCreateWindowSurface()
- * to render into X-created windows.
- *
- * This is an EGL driver that, in turn, loads a regular DRI driver.
- * There are some dependencies on code in libGL, but those could be
- * removed with some effort.
- *
- * Authors: Brian Paul
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <X11/Xlib.h>
-
-#include "glxinit.h"
-#include "driinit.h"
-#include "glapi/glapi.h" /* for glapi functions */
-
-#include "eglconfig.h"
-#include "eglconfigutil.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglcurrent.h"
-#include "egllog.h"
-#include "eglsurface.h"
-
-#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
-
-/** subclass of _EGLDriver */
-struct xdri_egl_driver
-{
- _EGLDriver Base; /**< base class */
- void (*FlushCurrentContext)(void);
-};
-
-
-/** driver data of _EGLDisplay */
-struct xdri_egl_display
-{
- Display *dpy;
- __GLXdisplayPrivate *dpyPriv;
- __GLXDRIdisplay *driDisplay;
- int driVersion;
-
- __GLXscreenConfigs *psc;
- EGLint scr;
-};
-
-
-/** subclass of _EGLContext */
-struct xdri_egl_context
-{
- _EGLContext Base; /**< base class */
-
- /* just enough info to create dri contexts */
- GLXContext dummy_gc;
-
- __GLXDRIcontext *driContext;
-};
-
-
-/** subclass of _EGLSurface */
-struct xdri_egl_surface
-{
- _EGLSurface Base; /**< base class */
-
- Drawable drawable;
- __GLXDRIdrawable *driDrawable;
-};
-
-
-/** subclass of _EGLConfig */
-struct xdri_egl_config
-{
- _EGLConfig Base; /**< base class */
-
- const __GLcontextModes *mode; /**< corresponding GLX mode */
- EGLint window_render_buffer;
-};
-
-
-
-/* standard typecasts */
-_EGL_DRIVER_STANDARD_TYPECASTS(xdri_egl)
-
-#define lookup_display(dpy) xdri_egl_display(dpy)
-#define lookup_context(ctx) xdri_egl_context(ctx)
-#define lookup_surface(surf) xdri_egl_surface(surf)
-#define lookup_config(conf) xdri_egl_config(conf)
-
-
-/** Get size of given window */
-static Status
-get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height)
-{
- Window root;
- Status stat;
- int xpos, ypos;
- unsigned int w, h, bw, depth;
- stat = XGetGeometry(dpy, d, &root, &xpos, &ypos, &w, &h, &bw, &depth);
- *width = w;
- *height = h;
- return stat;
-}
-
-
-static EGLBoolean
-convert_config(_EGLConfig *conf, EGLint id, const __GLcontextModes *m)
-{
- EGLint val;
-
- if (!_eglConfigFromContextModesRec(conf, m, EGL_OPENGL_BIT, EGL_OPENGL_BIT))
- return EGL_FALSE;
-
- if (m->doubleBufferMode) {
- /* pixmap and pbuffer surfaces are always single-buffered */
- val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
- val &= ~(EGL_PIXMAP_BIT | EGL_PBUFFER_BIT);
- SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, val);
- }
- else {
- /* EGL requires OpenGL ES context to be double-buffered */
- val = GET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE);
- val &= ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT);
- SET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE, val);
- }
- /* skip "empty" config */
- if (!val)
- return EGL_FALSE;
-
- val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
- if (!(val & EGL_PBUFFER_BIT)) {
- /* bind-to-texture cannot be EGL_TRUE without pbuffer bit */
- SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB, EGL_FALSE);
- SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA, EGL_FALSE);
- }
-
- /* EGL_NATIVE_RENDERABLE is a boolean */
- val = GET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE);
- if (val != EGL_TRUE)
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE, EGL_FALSE);
-
- return _eglValidateConfig(conf, EGL_FALSE);
-}
-
-
-/**
- * Produce a set of EGL configs.
- */
-static EGLint
-create_configs(_EGLDisplay *disp, const __GLcontextModes *m, EGLint first_id)
-{
- struct xdri_egl_display *xdri_dpy = lookup_display(disp);
- int id = first_id;
-
- for (; m; m = m->next) {
- struct xdri_egl_config *xdri_conf;
- _EGLConfig conf;
- EGLint rb;
-
- _eglInitConfig(&conf, disp, id);
- if (!convert_config(&conf, id, m))
- continue;
- if (m->doubleBufferMode) {
- rb = EGL_BACK_BUFFER;
- }
- else {
- /* ignore single-buffered mode for DRISW */
- if (xdri_dpy->driVersion == 0)
- continue;
- rb = EGL_SINGLE_BUFFER;
- }
-
- xdri_conf = CALLOC_STRUCT(xdri_egl_config);
- if (xdri_conf) {
- memcpy(&xdri_conf->Base, &conf, sizeof(conf));
- xdri_conf->mode = m;
- xdri_conf->window_render_buffer = rb;
- _eglAddConfig(disp, &xdri_conf->Base);
- id++;
- }
- }
-
- return id;
-}
-
-
-/**
- * Called via eglInitialize(), xdri_dpy->API.Initialize().
- */
-static EGLBoolean
-xdri_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy,
- EGLint *minor, EGLint *major)
-{
- struct xdri_egl_display *xdri_dpy;
- __GLXdisplayPrivate *dpyPriv;
- __GLXDRIdisplay *driDisplay;
- __GLXscreenConfigs *psc;
- EGLint first_id = 1;
- int scr;
-
- xdri_dpy = CALLOC_STRUCT(xdri_egl_display);
- if (!xdri_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
-
- xdri_dpy->dpy = (Display *) dpy->NativeDisplay;
- if (!xdri_dpy->dpy) {
- xdri_dpy->dpy = XOpenDisplay(NULL);
- if (!xdri_dpy->dpy) {
- free(xdri_dpy);
- return _eglError(EGL_NOT_INITIALIZED, "eglInitialize");
- }
- }
-
- dpyPriv = __glXInitialize(xdri_dpy->dpy);
- if (!dpyPriv) {
- _eglLog(_EGL_WARNING, "failed to create GLX display");
- free(xdri_dpy);
- return _eglError(EGL_NOT_INITIALIZED, "eglInitialize");
- }
-
- driDisplay = __driCreateDisplay(dpyPriv, &xdri_dpy->driVersion);
- if (!driDisplay) {
- _eglLog(_EGL_WARNING, "failed to create DRI display");
- free(xdri_dpy);
- return _eglError(EGL_NOT_INITIALIZED, "eglInitialize");
- }
-
- scr = DefaultScreen(xdri_dpy->dpy);
- psc = &dpyPriv->screenConfigs[scr];
-
- xdri_dpy->dpyPriv = dpyPriv;
- xdri_dpy->driDisplay = driDisplay;
- xdri_dpy->psc = psc;
- xdri_dpy->scr = scr;
-
- psc->driScreen = driDisplay->createScreen(psc, scr, dpyPriv);
- if (!psc->driScreen) {
- _eglLog(_EGL_WARNING, "failed to create DRI screen #%d", scr);
- free(xdri_dpy);
- return _eglError(EGL_NOT_INITIALIZED, "eglInitialize");
- }
-
- dpy->DriverData = xdri_dpy;
- dpy->ClientAPIsMask = EGL_OPENGL_BIT;
-
- /* add visuals and fbconfigs */
- first_id = create_configs(dpy, psc->visuals, first_id);
- create_configs(dpy, psc->configs, first_id);
-
- /* we're supporting EGL 1.4 */
- *minor = 1;
- *major = 4;
-
- return EGL_TRUE;
-}
-
-
-/**
- * Called via eglTerminate(), drv->API.Terminate().
- */
-static EGLBoolean
-xdri_eglTerminate(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
- __GLXscreenConfigs *psc;
-
- _eglReleaseDisplayResources(drv, dpy);
- _eglCleanupDisplay(dpy);
-
- psc = xdri_dpy->psc;
- if (psc->driver_configs) {
- unsigned int i;
- for (i = 0; psc->driver_configs[i]; i++)
- free((__DRIconfig *) psc->driver_configs[i]);
- free(psc->driver_configs);
- psc->driver_configs = NULL;
- }
- if (psc->driScreen) {
- psc->driScreen->destroyScreen(psc);
- free(psc->driScreen);
- psc->driScreen = NULL;
- }
-
- xdri_dpy->driDisplay->destroyDisplay(xdri_dpy->driDisplay);
-
- free(xdri_dpy);
- dpy->DriverData = NULL;
-
- return EGL_TRUE;
-}
-
-
-/*
- * Called from eglGetProcAddress() via drv->API.GetProcAddress().
- */
-static _EGLProc
-xdri_eglGetProcAddress(_EGLDriver *drv, const char *procname)
-{
- /* the symbol is defined in libGL.so */
- return (_EGLProc) _glapi_get_proc_address(procname);
-}
-
-
-/**
- * Called via eglCreateContext(), drv->API.CreateContext().
- */
-static _EGLContext *
-xdri_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- _EGLContext *share_list, const EGLint *attrib_list)
-{
- struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
- struct xdri_egl_config *xdri_config = lookup_config(conf);
- struct xdri_egl_context *shared = lookup_context(share_list);
- __GLXscreenConfigs *psc = xdri_dpy->psc;
- int renderType = GLX_RGBA_BIT;
- struct xdri_egl_context *xdri_ctx;
-
- xdri_ctx = CALLOC_STRUCT(xdri_egl_context);
- if (!xdri_ctx) {
- _eglError(EGL_BAD_ALLOC, "eglCreateContext");
- return NULL;
- }
-
- xdri_ctx->dummy_gc = CALLOC_STRUCT(__GLXcontextRec);
- if (!xdri_ctx->dummy_gc) {
- _eglError(EGL_BAD_ALLOC, "eglCreateContext");
- free(xdri_ctx);
- return NULL;
- }
-
- if (!_eglInitContext(&xdri_ctx->Base, dpy, &xdri_config->Base, attrib_list)) {
- free(xdri_ctx->dummy_gc);
- free(xdri_ctx);
- return NULL;
- }
-
- /* the config decides the render buffer for the context */
- xdri_ctx->Base.WindowRenderBuffer = xdri_config->window_render_buffer;
-
- xdri_ctx->driContext =
- psc->driScreen->createContext(psc,
- xdri_config->mode,
- xdri_ctx->dummy_gc,
- (shared) ? shared->dummy_gc : NULL,
- renderType);
- if (!xdri_ctx->driContext) {
- free(xdri_ctx->dummy_gc);
- free(xdri_ctx);
- return NULL;
- }
-
- /* fill in the required field */
- xdri_ctx->dummy_gc->driContext = xdri_ctx->driContext;
-
- return &xdri_ctx->Base;
-}
-
-
-/**
- * Destroy a context.
- */
-static void
-destroy_context(_EGLDisplay *dpy, _EGLContext *ctx)
-{
- struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
- struct xdri_egl_context *xdri_ctx = lookup_context(ctx);
-
- /* FIXME a context might live longer than its display */
- if (!dpy->Initialized)
- _eglLog(_EGL_FATAL, "destroy a context with an unitialized display");
-
- xdri_ctx->driContext->destroyContext(xdri_ctx->driContext,
- xdri_dpy->psc, xdri_dpy->dpy);
- free(xdri_ctx->dummy_gc);
- free(xdri_ctx);
-}
-
-
-/**
- * Destroy a surface.
- */
-static void
-destroy_surface(_EGLDisplay *dpy, _EGLSurface *surf)
-{
- struct xdri_egl_surface *xdri_surf = lookup_surface(surf);
-
- if (!dpy->Initialized)
- _eglLog(_EGL_FATAL, "destroy a surface with an unitialized display");
-
- xdri_surf->driDrawable->destroyDrawable(xdri_surf->driDrawable);
- free(xdri_surf);
-}
-
-
-static EGLBoolean
-xdri_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
-{
- if (!_eglIsContextBound(ctx))
- destroy_context(dpy, ctx);
- return EGL_TRUE;
-}
-
-
-/**
- * Called via eglMakeCurrent(), drv->API.MakeCurrent().
- */
-static EGLBoolean
-xdri_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *d,
- _EGLSurface *r, _EGLContext *context)
-{
- struct xdri_egl_driver *xdri_driver = xdri_egl_driver(drv);
- struct xdri_egl_context *xdri_ctx = lookup_context(context);
- struct xdri_egl_surface *draw = lookup_surface(d);
- struct xdri_egl_surface *read = lookup_surface(r);
-
- /* bind the new context and return the "orphaned" one */
- if (!_eglBindContext(&context, &d, &r))
- return EGL_FALSE;
-
- /* flush before context switch */
- if (context && xdri_driver->FlushCurrentContext)
- xdri_driver->FlushCurrentContext();
-
- /* the symbol is defined in libGL.so */
- _glapi_check_multithread();
-
- if (xdri_ctx) {
- if (!xdri_ctx->driContext->bindContext(xdri_ctx->driContext,
- draw->driDrawable,
- read->driDrawable)) {
- return EGL_FALSE;
- }
- }
- else if (context) {
- xdri_ctx = lookup_context(context);
- xdri_ctx->driContext->unbindContext(xdri_ctx->driContext);
- }
-
- if (context && !_eglIsContextLinked(context))
- destroy_context(dpy, context);
- if (d && !_eglIsSurfaceLinked(d))
- destroy_surface(dpy, d);
- if (r && r != d && !_eglIsSurfaceLinked(r))
- destroy_surface(dpy, r);
-
- return EGL_TRUE;
-}
-
-
-/**
- * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
- */
-static _EGLSurface *
-xdri_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- EGLNativeWindowType window,
- const EGLint *attrib_list)
-{
- struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
- struct xdri_egl_config *xdri_config = lookup_config(conf);
- struct xdri_egl_surface *xdri_surf;
- uint width, height;
-
- xdri_surf = CALLOC_STRUCT(xdri_egl_surface);
- if (!xdri_surf) {
- _eglError(EGL_BAD_ALLOC, "eglCreateWindowSurface");
- return NULL;
- }
-
- if (!_eglInitSurface(&xdri_surf->Base, dpy, EGL_WINDOW_BIT,
- &xdri_config->Base, attrib_list)) {
- free(xdri_surf);
- return NULL;
- }
-
- xdri_surf->driDrawable =
- xdri_dpy->psc->driScreen->createDrawable(xdri_dpy->psc,
- (XID) window,
- (GLXDrawable) window,
- xdri_config->mode);
- if (!xdri_surf->driDrawable) {
- free(xdri_surf);
- return NULL;
- }
-
- xdri_surf->drawable = (Drawable) window;
-
- get_drawable_size(xdri_dpy->dpy, window, &width, &height);
- xdri_surf->Base.Width = width;
- xdri_surf->Base.Height = height;
-
- return &xdri_surf->Base;
-}
-
-
-/**
- * Called via eglCreatePbufferSurface(), drv->API.CreatePbufferSurface().
- */
-static _EGLSurface *
-xdri_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- const EGLint *attrib_list)
-{
- return NULL;
-}
-
-
-
-static EGLBoolean
-xdri_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface)
-{
- if (!_eglIsSurfaceBound(surface))
- destroy_surface(dpy, surface);
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-xdri_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
- EGLint buffer)
-{
- return EGL_FALSE;
-}
-
-
-static EGLBoolean
-xdri_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
- EGLint buffer)
-{
- return EGL_FALSE;
-}
-
-
-static EGLBoolean
-xdri_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
-{
- struct xdri_egl_driver *xdri_driver = xdri_egl_driver(drv);
- struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
- struct xdri_egl_surface *xdri_surf = lookup_surface(draw);
-
- /* swapBuffers does not flush commands */
- if (draw->CurrentContext && xdri_driver->FlushCurrentContext)
- xdri_driver->FlushCurrentContext();
-
- xdri_dpy->psc->driScreen->swapBuffers(xdri_surf->driDrawable, 0, 0, 0);
-
- return EGL_TRUE;
-}
-
-
-static void
-xdri_Unload(_EGLDriver *drv)
-{
- struct xdri_egl_driver *xdri_drv = xdri_egl_driver(drv);
- free(xdri_drv);
-}
-
-
-/**
- * This is the main entrypoint into the driver, called by libEGL.
- * Create a new _EGLDriver object and init its dispatch table.
- */
-_EGLDriver *
-_eglMain(const char *args)
-{
- struct xdri_egl_driver *xdri_drv = CALLOC_STRUCT(xdri_egl_driver);
- if (!xdri_drv)
- return NULL;
-
- _eglInitDriverFallbacks(&xdri_drv->Base);
- xdri_drv->Base.API.Initialize = xdri_eglInitialize;
- xdri_drv->Base.API.Terminate = xdri_eglTerminate;
-
- xdri_drv->Base.API.GetProcAddress = xdri_eglGetProcAddress;
-
- xdri_drv->Base.API.CreateContext = xdri_eglCreateContext;
- xdri_drv->Base.API.DestroyContext = xdri_eglDestroyContext;
- xdri_drv->Base.API.MakeCurrent = xdri_eglMakeCurrent;
- xdri_drv->Base.API.CreateWindowSurface = xdri_eglCreateWindowSurface;
- xdri_drv->Base.API.CreatePbufferSurface = xdri_eglCreatePbufferSurface;
- xdri_drv->Base.API.DestroySurface = xdri_eglDestroySurface;
- xdri_drv->Base.API.BindTexImage = xdri_eglBindTexImage;
- xdri_drv->Base.API.ReleaseTexImage = xdri_eglReleaseTexImage;
- xdri_drv->Base.API.SwapBuffers = xdri_eglSwapBuffers;
-
- xdri_drv->Base.Name = "X/DRI";
- xdri_drv->Base.Unload = xdri_Unload;
-
- /* we need a way to flush commands */
- xdri_drv->FlushCurrentContext =
- (void (*)(void)) xdri_eglGetProcAddress(&xdri_drv->Base, "glFlush");
-
- return &xdri_drv->Base;
-}
diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
index b696f2fae9..2863320a48 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -15,13 +15,11 @@ common_OBJECTS = $(common_SOURCES:.c=.o)
x11_INCLUDES = \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/glx/x11 \
- -I$(TOP)/src/egl/drivers/xdri \
-I$(TOP)/src/mesa \
$(shell pkg-config --cflags-only-I libdrm)
x11_SOURCES = $(wildcard x11/*.c) \
- $(TOP)/src/glx/x11/dri2.c \
- $(TOP)/src/egl/drivers/xdri/glxinit.c
+ $(TOP)/src/glx/x11/dri2.c
x11_OBJECTS = $(x11_SOURCES:.c=.o)
diff --git a/src/egl/drivers/xdri/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c
index ba6132788a..ba6132788a 100644
--- a/src/egl/drivers/xdri/glxinit.c
+++ b/src/gallium/state_trackers/egl/x11/glxinit.c
diff --git a/src/egl/drivers/xdri/glxinit.h b/src/gallium/state_trackers/egl/x11/glxinit.h
index 1cc7c460fe..1cc7c460fe 100644
--- a/src/egl/drivers/xdri/glxinit.h
+++ b/src/gallium/state_trackers/egl/x11/glxinit.h
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index 76ce45ee57..d72bfc99d3 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -43,7 +43,7 @@ struct x11_screen {
int number;
/*
- * This is used to fetch GLX visuals/fbconfigs. It uses code from egl_xdri.
+ * This is used to fetch GLX visuals/fbconfigs. It steals code from GLX.
* It might be better to rewrite the part in Xlib or XCB.
*/
__GLXdisplayPrivate *glx_dpy;