misc updates, clean-ups, remove dependency on mtypes.h

This commit is contained in:
Brian Paul 2008-05-27 16:49:11 -06:00
parent 6052af172f
commit 07e92b1742
3 changed files with 23 additions and 15 deletions

View File

@ -55,7 +55,7 @@ depend: $(SOURCES) $(HEADERS)
@ rm -f depend @ rm -f depend
@ touch depend @ touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
$(SOURCES) $(HEADERS) > /dev/null $(SOURCES) $(HEADERS) >/dev/null 2>/dev/null
include depend include depend
# DO NOT DELETE # DO NOT DELETE

View File

@ -32,7 +32,7 @@
#include "egldri.h" #include "egldri.h"
const char *sysfs = "/sys/class"; const char *sysfs = "/sys/class";
#define None 0
static const int empty_attribute_list[1] = { None }; static const int empty_attribute_list[1] = { None };
@ -62,10 +62,11 @@ _eglMain(_EGLDisplay *dpy)
if (strncmp(&dirent->d_name[0], "card", 4) != 0) if (strncmp(&dirent->d_name[0], "card", 4) != 0)
continue; continue;
if (strcmp(&dirent->d_name[4], &dpy->Name[1]) != 0) if (strcmp(&dirent->d_name[4], &dpy->DriverName[1]) != 0)
continue; continue;
snprintf(path, sizeof(path), "%s/drm/card%s/dri_library_name", sysfs, &dpy->Name[1]); snprintf(path, sizeof(path), "%s/drm/card%s/dri_library_name",
sysfs, &dpy->DriverName[1]);
_eglLog(_EGL_INFO, "Opening %s", path); _eglLog(_EGL_INFO, "Opening %s", path);
#if 1 #if 1
file = fopen(path, "r"); file = fopen(path, "r");
@ -141,7 +142,7 @@ _eglDRICreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
/* generate handle and insert into hash table */ /* generate handle and insert into hash table */
_eglSaveContext(&c->Base); _eglSaveContext(&c->Base);
return c->Base.Handle; return _eglGetContextHandle(&c->Base);
} }
@ -152,13 +153,15 @@ _eglDRIMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw,
driDisplay *disp = Lookup_driDisplay(dpy); driDisplay *disp = Lookup_driDisplay(dpy);
driContext *ctx = Lookup_driContext(context); driContext *ctx = Lookup_driContext(context);
EGLBoolean b; EGLBoolean b;
__DRIid drawBuf = (__DRIid) draw;
__DRIid readBuf = (__DRIid) read;
b = _eglMakeCurrent(drv, dpy, draw, read, context); b = _eglMakeCurrent(drv, dpy, draw, read, context);
if (!b) if (!b)
return EGL_FALSE; return EGL_FALSE;
if (ctx) { if (ctx) {
ctx->driContext.bindContext(disp, 0, read, draw, &ctx->driContext); ctx->driContext.bindContext(disp, 0, drawBuf, readBuf, &ctx->driContext);
} }
else { else {
/* what's this??? */ /* what's this??? */
@ -190,7 +193,7 @@ _eglDRICreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
#if 0 #if 0
GLcontext *ctx = NULL; /* this _should_ be OK */ GLcontext *ctx = NULL; /* this _should_ be OK */
#endif #endif
GLvisual visMode; __GLcontextModes visMode;
_EGLConfig *conf = _eglLookupConfig(drv, dpy, config); _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
assert(conf); /* bad config should be caught earlier */ assert(conf); /* bad config should be caught earlier */
_eglConfigToContextModesRec(conf, &visMode); _eglConfigToContextModesRec(conf, &visMode);
@ -267,7 +270,8 @@ _eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
_EGLConfig *config = _eglLookupConfig(drv, dpy, cfg); _EGLConfig *config = _eglLookupConfig(drv, dpy, cfg);
driDisplay *disp = Lookup_driDisplay(dpy); driDisplay *disp = Lookup_driDisplay(dpy);
driSurface *surface; driSurface *surface;
GLvisual visMode; __GLcontextModes visMode;
__DRIid drawBuf;
surface = (driSurface *) calloc(1, sizeof(*surface)); surface = (driSurface *) calloc(1, sizeof(*surface));
if (!surface) { if (!surface) {
@ -292,8 +296,10 @@ _eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
/* convert EGLConfig to GLvisual */ /* convert EGLConfig to GLvisual */
_eglConfigToContextModesRec(config, &visMode); _eglConfigToContextModesRec(config, &visMode);
drawBuf = (__DRIid) _eglGetSurfaceHandle(&surface->Base);
/* Create a new DRI drawable */ /* Create a new DRI drawable */
if (!disp->driScreen.createNewDrawable(disp, &visMode, surface->Base.Handle, if (!disp->driScreen.createNewDrawable(disp, &visMode, drawBuf,
&surface->drawable, GLX_WINDOW_BIT, &surface->drawable, GLX_WINDOW_BIT,
empty_attribute_list)) { empty_attribute_list)) {
_eglRemoveSurface(&surface->Base); _eglRemoveSurface(&surface->Base);
@ -715,7 +721,7 @@ __eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable,
{ {
__DRIscreen *pDRIScreen; __DRIscreen *pDRIScreen;
__DRIscreenPrivate *psp; __DRIscreenPrivate *psp;
driSurface *surf = Lookup_driSurface(drawable); driSurface *surf = Lookup_driSurface((EGLSurface) drawable);
pDRIScreen = __eglFindDRIScreen(ndpy, screen); pDRIScreen = __eglFindDRIScreen(ndpy, screen);
@ -1088,13 +1094,13 @@ _eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy,
*/ */
display = calloc(1, sizeof(*display)); display = calloc(1, sizeof(*display));
display->Base = *disp; display->Base = *disp;
_eglHashInsert(_eglGlobal.Displays, disp->Handle, display); _eglSaveDisplay(&display->Base);
free(disp); free(disp);
*major = 1; *major = 1;
*minor = 0; *minor = 0;
sscanf(&disp->Name[1], "%d", &display->minor); sscanf(&disp->DriverName[1], "%d", &display->minor);
drv->Initialized = EGL_TRUE; drv->Initialized = EGL_TRUE;
return EGL_TRUE; return EGL_TRUE;

View File

@ -1,11 +1,13 @@
#ifndef EGLDRI_INCLUDED #ifndef EGLDRI_INCLUDED
#define EGLDRI_INCLUDED #define EGLDRI_INCLUDED
#include <stdlib.h>
#include <string.h>
#include "egldisplay.h" #include "egldisplay.h"
#include "eglscreen.h" #include "eglscreen.h"
#include "eglsurface.h" #include "eglsurface.h"
#include "eglcontext.h" #include "eglcontext.h"
#include "mtypes.h"
#include "dri_util.h" #include "dri_util.h"
#include "drm_sarea.h" #include "drm_sarea.h"
@ -14,7 +16,7 @@
*/ */
typedef struct dri_display typedef struct dri_display
{ {
_EGLDisplay Base; /* base class/object */ _EGLDisplay Base; /**< base class */
void *pFB; void *pFB;
int drmFD; /**< \brief DRM device file descriptor */ int drmFD; /**< \brief DRM device file descriptor */
int minor; int minor;
@ -32,7 +34,7 @@ typedef struct dri_display
unsigned long FBStart; /**< \brief physical address of the framebuffer */ unsigned long FBStart; /**< \brief physical address of the framebuffer */
void *driverClientMsg; void *driverClientMsg;
int driverClientMsgSize; int driverClientMsgSize;
int chipset; unsigned chipset;
void *driverPrivate; void *driverPrivate;
drm_magic_t magic; drm_magic_t magic;