summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-05-15 19:26:53 +0200
committerChristian König <[email protected]>2011-05-15 19:26:53 +0200
commit828540e491d88b9b6217e6568873a78462919ae8 (patch)
treec952145c1188cdf6b9c56902f8f5c189e090c278 /src/egl
parent3db6514357a7c634045ae7bc7bba7d7dbf9d58c5 (diff)
parentbd5b7a6f7113da38a2c1f07a4a71e9993666a567 (diff)
Merge remote-tracking branch 'origin/master' into pipe-video
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/Makefile11
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c23
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h14
-rw-r--r--src/egl/drivers/dri2/platform_drm.c14
-rw-r--r--src/egl/drivers/dri2/platform_x11.c2
-rw-r--r--src/egl/main/Makefile6
-rw-r--r--src/egl/main/eglapi.c2
7 files changed, 48 insertions, 24 deletions
diff --git a/src/egl/drivers/dri2/Makefile b/src/egl/drivers/dri2/Makefile
index 4783975852a..447babd6747 100644
--- a/src/egl/drivers/dri2/Makefile
+++ b/src/egl/drivers/dri2/Makefile
@@ -4,18 +4,17 @@ TOP = ../../../..
include $(TOP)/configs/current
EGL_DRIVER = egl_dri2
-EGL_SOURCES = egl_dri2.c platform_x11.c platform_drm.c
+EGL_SOURCES = egl_dri2.c platform_drm.c
EGL_INCLUDES = \
-I$(TOP)/include \
-I$(TOP)/src/egl/main \
-I$(TOP)/src/mapi \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
- $(XCB_DRI2_CFLAGS) \
$(LIBUDEV_CFLAGS) \
$(LIBDRM_CFLAGS)
-EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
+EGL_LIBS = $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
EGL_CFLAGS = -D_EGL_MAIN=_eglBuiltInDriverDRI2
EGL_BUILTIN = true
@@ -24,6 +23,12 @@ ifeq ($(SHARED_GLAPI),1)
EGL_CFLAGS += -DHAVE_SHARED_GLAPI
endif
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+EGL_SOURCES += platform_x11.c
+EGL_INCLUDES += -DHAVE_X11_PLATFORM $(XCB_DRI2_CFLAGS)
+EGL_LIBS += $(XCB_DRI2_LIBS)
+endif
+
ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
EGL_SOURCES += platform_wayland.c
EGL_INCLUDES += -DHAVE_WAYLAND_PLATFORM $(WAYLAND_CFLAGS) \
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index afab679bff6..ea8c8fba8c0 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -200,13 +200,10 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
else if (!double_buffer && !conf->dri_single_config)
conf->dri_single_config = dri_config;
else
- /* a similar config type is already added
- * => attach it as new config
- */
- num_configs = 0;
+ /* a similar config type is already added (unlikely) => discard */
+ return NULL;
}
-
- if (num_configs == 0) {
+ else if (num_configs == 0) {
conf = malloc(sizeof *conf);
if (conf == NULL)
return NULL;
@@ -224,6 +221,10 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
_eglLinkConfig(&conf->base);
}
+ else {
+ assert(0);
+ return NULL;
+ }
conf->base.SurfaceType |= surface_type & (!double_buffer ? EGL_PIXMAP_BIT:
(EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT));
@@ -487,10 +488,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
return EGL_FALSE;
switch (disp->Platform) {
+#ifdef HAVE_X11_PLATFORM
case _EGL_PLATFORM_X11:
if (disp->Options.TestOnly)
return EGL_TRUE;
return dri2_initialize_x11(drv, disp);
+#endif
#ifdef HAVE_LIBUDEV
case _EGL_PLATFORM_DRM:
@@ -525,8 +528,10 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
if (dri2_dpy->fd)
close(dri2_dpy->fd);
dlclose(dri2_dpy->driver);
+#ifdef HAVE_X11_PLATFORM
if (disp->PlatformDisplay == NULL)
xcb_disconnect(dri2_dpy->conn);
+#endif
free(dri2_dpy);
disp->DriverData = NULL;
@@ -835,7 +840,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
struct dri2_egl_image *dri2_img;
- GLuint renderbuffer = (GLuint) buffer;
+ GLuint renderbuffer = (GLuint) (uintptr_t) buffer;
if (renderbuffer == 0) {
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
@@ -870,7 +875,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
(void) ctx;
- name = (EGLint) buffer;
+ name = (EGLint) (uintptr_t) buffer;
err = _eglParseImageAttribList(&attrs, disp, attr_list);
if (err != EGL_SUCCESS)
@@ -922,6 +927,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
return &dri2_img->base;
}
+#ifdef HAVE_WAYLAND_PLATFORM
static _EGLImage *
dri2_reference_drm_image(_EGLDisplay *disp, _EGLContext *ctx,
__DRIimage *dri_image, EGLint width, EGLint height)
@@ -948,7 +954,6 @@ dri2_reference_drm_image(_EGLDisplay *disp, _EGLContext *ctx,
attr_list);
}
-#ifdef HAVE_WAYLAND_PLATFORM
static _EGLImage *
dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer _buffer,
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 99f990ac688..efcb366568e 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -28,10 +28,12 @@
#ifndef EGL_DRI2_INCLUDED
#define EGL_DRI2_INCLUDED
+#ifdef HAVE_X11_PLATFORM
#include <xcb/xcb.h>
#include <xcb/dri2.h>
#include <xcb/xfixes.h>
#include <X11/Xlib-xcb.h>
+#endif
#ifdef HAVE_WAYLAND_PLATFORM
#include <wayland-client.h>
@@ -64,7 +66,6 @@ struct dri2_egl_driver
struct dri2_egl_display
{
- xcb_connection_t *conn;
int dri2_major;
int dri2_minor;
__DRIscreen *dri_screen;
@@ -84,6 +85,11 @@ struct dri2_egl_display
__DRIdri2LoaderExtension dri2_loader_extension;
__DRIswrastLoaderExtension swrast_loader_extension;
const __DRIextension *extensions[3];
+
+#ifdef HAVE_X11_PLATFORM
+ xcb_connection_t *conn;
+#endif
+
#ifdef HAVE_WAYLAND_PLATFORM
struct wl_display *wl_dpy;
struct wl_drm *wl_server_drm;
@@ -120,17 +126,19 @@ struct dri2_egl_surface
{
_EGLSurface base;
__DRIdrawable *dri_drawable;
- xcb_drawable_t drawable;
__DRIbuffer buffers[5];
int buffer_count;
- xcb_xfixes_region_t region;
int have_fake_front;
int swap_interval;
+#ifdef HAVE_X11_PLATFORM
+ xcb_drawable_t drawable;
+ xcb_xfixes_region_t region;
int depth;
int bytes_per_pixel;
xcb_gcontext_t gc;
xcb_gcontext_t swapgc;
+#endif
enum dri2_surface_type type;
#ifdef HAVE_WAYLAND_PLATFORM
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 68912e36732..9811b280299 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -581,7 +581,8 @@ dri2_get_device_name(int fd)
struct udev *udev;
struct udev_device *device;
struct stat buf;
- char *device_name;
+ const char *const_device_name;
+ char *device_name = NULL;
udev = udev_new();
if (fstat(fd, &buf) < 0) {
@@ -596,10 +597,11 @@ dri2_get_device_name(int fd)
goto out;
}
- device_name = udev_device_get_devnode(device);
- if (!device_name)
- goto out;
- device_name = strdup(device_name);
+ const_device_name = udev_device_get_devnode(device);
+ if (!const_device_name) {
+ goto out;
+ }
+ device_name = strdup(const_device_name);
out:
udev_device_unref(device);
@@ -690,7 +692,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
memset(dri2_dpy, 0, sizeof *dri2_dpy);
disp->DriverData = (void *) dri2_dpy;
- dri2_dpy->fd = (int) disp->PlatformDisplay;
+ dri2_dpy->fd = (int) (intptr_t) disp->PlatformDisplay;
dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
if (dri2_dpy->driver_name == NULL)
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 5d4ac6ae948..2e26ff00b67 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
(void) ctx;
- drawable = (xcb_drawable_t) buffer;
+ drawable = (xcb_drawable_t) (uintptr_t) buffer;
xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
buffers_cookie =
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 820788d696b..cb8f0551293 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -58,11 +58,15 @@ LOCAL_LIBS =
ifeq ($(filter dri2, $(EGL_DRIVERS_DIRS)),dri2)
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2
LOCAL_LIBS += $(TOP)/src/egl/drivers/dri2/libegl_dri2.a
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+EGL_LIB_DEPS += $(XCB_DRI2_LIBS)
+endif
ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
LOCAL_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
endif
-EGL_LIB_DEPS += $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB) $(WAYLAND_LIBS)
+EGL_LIB_DEPS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB) $(WAYLAND_LIBS)
endif
+
ifeq ($(filter glx, $(EGL_DRIVERS_DIRS)),glx)
LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX
LOCAL_LIBS += $(TOP)/src/egl/drivers/glx/libegl_glx.a
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 336ec23da5a..bdfdcb3817d 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
EGLDisplay EGLAPIENTRY
eglGetDRMDisplayMESA(int fd)
{
- _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
+ _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (intptr_t) fd);
return _eglGetDisplayHandle(dpy);
}