summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl/x11
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2010-05-27 00:38:30 +0200
committerJakob Bornecrantz <jakob@vmware.com>2010-06-06 12:29:28 +0100
commitf9d9574913c5edb92191ac3f5e8d011452427852 (patch)
treeabdab8c910f4c07e3e11b05bce997df3a9ae3ae3 /src/gallium/state_trackers/egl/x11
parent76aed4b070be8950fd8ea5caff59321885ff0a06 (diff)
gallium: Convert state trackers to drm driver interface
Diffstat (limited to 'src/gallium/state_trackers/egl/x11')
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c15
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.c30
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.h4
3 files changed, 16 insertions, 33 deletions
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 3f802dd713..0ce7c0be64 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -32,7 +32,7 @@
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#include "state_tracker/drm_api.h"
+#include "state_tracker/drm_driver.h"
#include "egllog.h"
#include "native_x11.h"
@@ -50,7 +50,6 @@ struct dri2_display {
struct native_event_handler *event_handler;
- struct drm_api *api;
struct x11_screen *xscr;
int xscr_number;
const char *dri_driver;
@@ -662,8 +661,6 @@ dri2_display_destroy(struct native_display *ndpy)
x11_screen_destroy(dri2dpy->xscr);
if (dri2dpy->own_dpy)
XCloseDisplay(dri2dpy->dpy);
- if (dri2dpy->api && dri2dpy->api->destroy)
- dri2dpy->api->destroy(dri2dpy->api);
FREE(dri2dpy);
}
@@ -695,7 +692,7 @@ static boolean
dri2_display_init_screen(struct native_display *ndpy)
{
struct dri2_display *dri2dpy = dri2_display(ndpy);
- const char *driver = dri2dpy->api->name;
+ const char *driver = driver_descriptor.name;
int fd;
if (!x11_screen_support(dri2dpy->xscr, X11_SCREEN_EXTENSION_DRI2) ||
@@ -709,7 +706,7 @@ dri2_display_init_screen(struct native_display *ndpy)
if (!dri2dpy->dri_driver || !driver ||
strcmp(dri2dpy->dri_driver, driver) != 0) {
_eglLog(_EGL_WARNING, "Driver mismatch: %s != %s",
- dri2dpy->dri_driver, dri2dpy->api->name);
+ dri2dpy->dri_driver, driver);
return FALSE;
}
@@ -718,7 +715,7 @@ dri2_display_init_screen(struct native_display *ndpy)
if (fd < 0)
return FALSE;
- dri2dpy->base.screen = dri2dpy->api->create_screen(dri2dpy->api, fd);
+ dri2dpy->base.screen = driver_descriptor.create_screen(fd);
if (!dri2dpy->base.screen) {
_eglLog(_EGL_WARNING, "failed to create DRM screen");
return FALSE;
@@ -742,8 +739,7 @@ dri2_display_hash_table_compare(void *key1, void *key2)
struct native_display *
x11_create_dri2_display(EGLNativeDisplayType dpy,
- struct native_event_handler *event_handler,
- struct drm_api *api)
+ struct native_event_handler *event_handler)
{
struct dri2_display *dri2dpy;
@@ -752,7 +748,6 @@ x11_create_dri2_display(EGLNativeDisplayType dpy,
return NULL;
dri2dpy->event_handler = event_handler;
- dri2dpy->api = api;
dri2dpy->dpy = dpy;
if (!dri2dpy->dpy) {
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c
index b6d51bbf9f..5d71778410 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.c
+++ b/src/gallium/state_trackers/egl/x11/native_x11.c
@@ -27,15 +27,14 @@
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_string.h"
-#include "state_tracker/drm_api.h"
#include "egllog.h"
#include "native_x11.h"
#include "x11_screen.h"
-#define X11_PROBE_MAGIC 0x11980BE /* "X11PROBE" */
+#include "state_tracker/drm_driver.h"
-static struct drm_api *api;
+#define X11_PROBE_MAGIC 0x11980BE /* "X11PROBE" */
static void
x11_probe_destroy(struct native_probe *nprobe)
@@ -96,15 +95,12 @@ native_get_probe_result(struct native_probe *nprobe)
if (!nprobe || nprobe->magic != X11_PROBE_MAGIC)
return NATIVE_PROBE_UNKNOWN;
- if (!api)
- api = drm_api_create();
-
/* this is a software driver */
- if (!api)
+ if (!driver_descriptor.create_screen)
return NATIVE_PROBE_SUPPORTED;
/* the display does not support DRI2 or the driver mismatches */
- if (!nprobe->data || strcmp(api->name, (const char *) nprobe->data) != 0)
+ if (!nprobe->data || strcmp(driver_descriptor.name, (const char *) nprobe->data) != 0)
return NATIVE_PROBE_FALLBACK;
return NATIVE_PROBE_EXACT;
@@ -115,13 +111,7 @@ native_get_name(void)
{
static char x11_name[32];
- if (!api)
- api = drm_api_create();
-
- if (api)
- util_snprintf(x11_name, sizeof(x11_name), "X11/%s", api->name);
- else
- util_snprintf(x11_name, sizeof(x11_name), "X11");
+ util_snprintf(x11_name, sizeof(x11_name), "X11/%s", driver_descriptor.name);
return x11_name;
}
@@ -133,12 +123,12 @@ native_create_display(EGLNativeDisplayType dpy,
struct native_display *ndpy = NULL;
boolean force_sw;
- if (!api)
- api = drm_api_create();
-
force_sw = debug_get_bool_option("EGL_SOFTWARE", FALSE);
- if (api && !force_sw) {
- ndpy = x11_create_dri2_display(dpy, event_handler, api);
+ if (!driver_descriptor.create_screen)
+ force_sw = TRUE;
+
+ if (!force_sw) {
+ ndpy = x11_create_dri2_display(dpy, event_handler);
}
if (!ndpy) {
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.h b/src/gallium/state_trackers/egl/x11/native_x11.h
index 1678403b45..e16da935c0 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.h
+++ b/src/gallium/state_trackers/egl/x11/native_x11.h
@@ -26,7 +26,6 @@
#ifndef _NATIVE_X11_H_
#define _NATIVE_X11_H_
-#include "state_tracker/drm_api.h"
#include "common/native.h"
struct native_display *
@@ -35,7 +34,6 @@ x11_create_ximage_display(EGLNativeDisplayType dpy,
struct native_display *
x11_create_dri2_display(EGLNativeDisplayType dpy,
- struct native_event_handler *event_handler,
- struct drm_api *api);
+ struct native_event_handler *event_handler);
#endif /* _NATIVE_X11_H_ */