diff --git a/configs/default b/configs/default index cd998b5..8b16bcb 100644 --- a/configs/default +++ b/configs/default @@ -81,8 +81,8 @@ APP_LIB_DEPS = -lm # Installation directories (for make install) -INSTALL_DIR = /usr/local -DRI_DRIVER_INSTALL_DIR = /usr/X11R6/lib/modules/dri +INSTALL_DIR = /usr +DRI_DRIVER_INSTALL_DIR = /usr/lib64/dri # Where libGL will look for DRI hardware drivers DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) diff --git a/configs/linux b/configs/linux index 15700a1..b0b4bbe 100644 --- a/configs/linux +++ b/configs/linux @@ -20,7 +20,7 @@ DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ -D_BSD_SOURCE -D_GNU_SOURCE \ -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN -X11_INCLUDES = -I/usr/X11R6/include +X11_INCLUDES = -I/usr/include/X11 CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \ $(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math @@ -34,4 +34,4 @@ CXXFLAGS += -fno-strict-aliasing GLUT_CFLAGS = -fexceptions -EXTRA_LIB_PATH = -L/usr/X11R6/lib +EXTRA_LIB_PATH = -L/usr/lib64 diff --git a/configs/linux-dri-x86-64 b/configs/linux-dri-x86-64 index 821ab3e..ca7e67c 100644 --- a/configs/linux-dri-x86-64 +++ b/configs/linux-dri-x86-64 @@ -20,5 +20,5 @@ EXTRA_LIB_PATH=-L/usr/X11R6/lib64 # the new interface. i810 are missing because there is no x86-64 # system where they could *ever* be used. # -DRI_DIRS = i915tex i915 i965 mach64 mga r128 r200 radeon tdfx unichrome savage r300 +DRI_DIRS = i915 i965 mach64 mga r128 r200 radeon tdfx unichrome savage r300 diff --git a/src/egl/drivers/dri/egldri.c b/src/egl/drivers/dri/egldri.c index cab0be2..0d8d87b 100644 --- a/src/egl/drivers/dri/egldri.c +++ b/src/egl/drivers/dri/egldri.c @@ -104,6 +104,9 @@ _eglDRICreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, void *sharePriv; _EGLConfig *conf; __GLcontextModes visMode; + drm_context_t hHWContext; + __DRIscreenPrivate *psp; + _EGLContext *shareCtx; c = (driContext *) calloc(1, sizeof(*c)); if (!c) @@ -115,7 +118,7 @@ _eglDRICreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, } if (share_list != EGL_NO_CONTEXT) { - _EGLContext *shareCtx = _eglLookupContext(share_list); + shareCtx = _eglLookupContext(share_list); if (!shareCtx) { _eglError(EGL_BAD_CONTEXT, "eglCreateContext(share_list)"); return EGL_FALSE; @@ -131,8 +134,19 @@ _eglDRICreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, assert(conf); _eglConfigToContextModesRec(conf, &visMode); - c->driContext.private = disp->driScreen.createNewContext(disp, &visMode, - GLX_WINDOW_BIT, sharePriv, &c->driContext); + psp = (__DRIscreenPrivate *)disp->driScreen.private; + if (psp->fd) { + if (drmCreateContext(psp->fd, &hHWContext)) { + _eglLog(_EGL_WARNING, "drmCreateContext failed."); + return GL_FALSE; + } + shareCtx->hHWContext = hHWContext; + } + + c->driContext.private = + disp->driScreen.createNewContext(&disp->driScreen, &visMode, + GLX_WINDOW_BIT, sharePriv, + shareCtx->hHWContext, &c->driContext); if (!c->driContext.private) { free(c); return EGL_FALSE; @@ -149,8 +163,9 @@ static EGLBoolean _eglDRIMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context) { - driDisplay *disp = Lookup_driDisplay(dpy); driContext *ctx = Lookup_driContext(context); + driSurface *read_surf = Lookup_driSurface(read); + driSurface *draw_surf = Lookup_driSurface(draw); EGLBoolean b; b = _eglMakeCurrent(drv, dpy, draw, read, context); @@ -158,7 +173,8 @@ _eglDRIMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, return EGL_FALSE; if (ctx) { - ctx->driContext.bindContext(disp, 0, read, draw, &ctx->driContext); + ctx->driContext.bindContext(&ctx->driContext, &read_surf->drawable, + &draw_surf->drawable); } else { /* what's this??? */ @@ -220,12 +236,11 @@ _eglDRICreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, static EGLBoolean _eglDRIDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface) { - driDisplay *disp = Lookup_driDisplay(dpy); driSurface *fs = Lookup_driSurface(surface); _eglRemoveSurface(&fs->Base); - fs->drawable.destroyDrawable(disp, fs->drawable.private); + fs->drawable.destroyDrawable(&fs->drawable); if (fs->Base.IsBound) { fs->Base.DeletePending = EGL_TRUE; @@ -240,12 +255,11 @@ _eglDRIDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface) static EGLBoolean _eglDRIDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context) { - driDisplay *disp = Lookup_driDisplay(dpy); driContext *fc = Lookup_driContext(context); _eglRemoveContext(&fc->Base); - fc->driContext.destroyContext(disp, 0, fc->driContext.private); + fc->driContext.destroyContext(&fc->driContext); if (fc->Base.IsBound) { fc->Base.DeletePending = EGL_TRUE; @@ -268,6 +282,7 @@ _eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg, driDisplay *disp = Lookup_driDisplay(dpy); driSurface *surface; GLvisual visMode; + _EGLContext *ctx = _eglGetCurrentContext(); surface = (driSurface *) calloc(1, sizeof(*surface)); if (!surface) { @@ -283,7 +298,6 @@ _eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg, _eglSaveSurface(&surface->Base); - /* * XXX this is where we should allocate video memory for the surface! */ @@ -293,8 +307,10 @@ _eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg, _eglConfigToContextModesRec(config, &visMode); /* Create a new DRI drawable */ - if (!disp->driScreen.createNewDrawable(disp, &visMode, surface->Base.Handle, - &surface->drawable, GLX_WINDOW_BIT, + if (!disp->driScreen.createNewDrawable(&disp->driScreen, &visMode, + &surface->drawable, + ctx->hHWContext, + GLX_WINDOW_BIT, empty_attribute_list)) { _eglRemoveSurface(&surface->Base); free(surface); @@ -502,7 +518,7 @@ _eglDRISwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw) if (!_eglSwapBuffers(drv, dpy, draw)) return EGL_FALSE; - drawable->drawable.swapBuffers(NULL, drawable->drawable.private); + drawable->drawable.swapBuffers(&drawable->drawable); return EGL_TRUE; } diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h index 82bfde1..370357e 100644 --- a/src/egl/main/eglcontext.h +++ b/src/egl/main/eglcontext.h @@ -2,7 +2,8 @@ #ifndef EGLCONTEXT_INCLUDED #define EGLCONTEXT_INCLUDED - +#include +#include #include "egltypedefs.h" @@ -25,6 +26,8 @@ struct _egl_context #ifdef EGL_VERSION_1_2 EGLint ClientAPI; /* Either EGL_OPENGL_ES_API or EGL_OPENVG_API */ #endif /* EGL_VERSION_1_2 */ + + drm_context_t hHWContext; };