summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2010-03-11 14:20:50 +0100
committerLuc Verhaegen <libv@skynet.be>2010-03-11 14:20:50 +0100
commit080ca4ab86fc2736e8c901d3805d198e87217940 (patch)
tree7378dc846636bcfba0608ad726837d098fe09e1d
parentbf6a158b95d810d06344b4ca9395e4ebbca8bda9 (diff)
Import unichrome dri driver from mesa 7.1.0.7.2.07.1.0
-rw-r--r--configure.ac6
-rw-r--r--src/via_context.c87
-rw-r--r--src/via_context.h4
-rw-r--r--src/via_ioctl.c22
-rw-r--r--src/via_ioctl.h8
-rw-r--r--src/via_screen.c180
-rw-r--r--src/via_screen.h2
-rw-r--r--src/via_span.c5
-rw-r--r--src/via_state.c17
-rw-r--r--src/via_tex.c4
10 files changed, 149 insertions, 186 deletions
diff --git a/configure.ac b/configure.ac
index 4ce1052..9155593 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script
AC_PREREQ(2.57)
-AC_INIT([mesa-dri-unichrome], 7.0.3, [], mesa-dri-unichrome)
+AC_INIT([mesa-dri-unichrome], 7.1.0, [], mesa-dri-unichrome)
AM_INIT_AUTOMAKE([dist-bzip2])
@@ -16,8 +16,8 @@ AC_PROG_CC
AC_HEADER_STDC
PKG_CHECK_MODULES([DRM], [libdrm >= 2.3.0])
-PKG_CHECK_MODULES([DRI], [libmesadri >= 7.0.3 libmesadri < 7.1.0
- libmesadricommon >= 7.0.3 libmesadricommon < 7.1.0])
+PKG_CHECK_MODULES([DRI], [libmesadri >= 7.1.0 libmesadri < 7.3.0
+ libmesadricommon >= 7.1.0 libmesadricommon < 7.3.0])
AC_OUTPUT([
Makefile
diff --git a/src/via_context.c b/src/via_context.c
index 7c73877..ed7001d 100644
--- a/src/via_context.c
+++ b/src/via_context.c
@@ -123,7 +123,7 @@ static const GLubyte *viaGetString(GLcontext *ctx, GLenum name)
*
* \returns A pixel width that meets the alignment requirements.
*/
-static __inline__ unsigned
+static INLINE unsigned
buffer_align( unsigned width )
{
return (width + 0x0f) & ~0x0f;
@@ -601,9 +601,6 @@ viaCreateContext(const __GLcontextModes *visual,
_tnl_allow_pixel_fog(ctx, GL_FALSE);
_tnl_allow_vertex_fog(ctx, GL_TRUE);
-/* vmesa->display = dpy; */
- vmesa->display = sPriv->display;
-
vmesa->hHWContext = driContextPriv->hHWContext;
vmesa->driFd = sPriv->fd;
vmesa->driHwLock = &sPriv->pSAREA->lock;
@@ -661,14 +658,10 @@ viaCreateContext(const __GLcontextModes *visual,
driQueryOptionb(&vmesa->optionCache, "no_rast"))
FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1);
- vmesa->vblank_flags =
- vmesa->viaScreen->irqEnabled ?
- driGetDefaultVBlankFlags(&vmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
if (getenv("VIA_PAGEFLIP"))
vmesa->allowPageFlip = 1;
- (*dri_interface->getUST)( &vmesa->swap_ust );
+ (*sPriv->systemTime->getUST)( &vmesa->swap_ust );
vmesa->regMMIOBase = (GLuint *)((unsigned long)viaScreen->reg);
@@ -686,46 +679,48 @@ void
viaDestroyContext(__DRIcontextPrivate *driContextPriv)
{
GET_CURRENT_CONTEXT(ctx);
- struct via_context *vmesa =
+ struct via_context *vmesa =
(struct via_context *)driContextPriv->driverPrivate;
struct via_context *current = ctx ? VIA_CONTEXT(ctx) : NULL;
+
assert(vmesa); /* should never be null */
+ if (vmesa->driDrawable) {
+ viaWaitIdle(vmesa, GL_FALSE);
+
+ if (vmesa->doPageFlip) {
+ LOCK_HARDWARE(vmesa);
+ if (vmesa->pfCurrentOffset != 0) {
+ fprintf(stderr, "%s - reset pf\n", __FUNCTION__);
+ viaResetPageFlippingLocked(vmesa);
+ }
+ UNLOCK_HARDWARE(vmesa);
+ }
+ }
+
/* check if we're deleting the currently bound context */
if (vmesa == current) {
VIA_FLUSH_DMA(vmesa);
_mesa_make_current(NULL, NULL, NULL);
}
- if (vmesa) {
- viaWaitIdle(vmesa, GL_FALSE);
- if (vmesa->doPageFlip) {
- LOCK_HARDWARE(vmesa);
- if (vmesa->pfCurrentOffset != 0) {
- fprintf(stderr, "%s - reset pf\n", __FUNCTION__);
- viaResetPageFlippingLocked(vmesa);
- }
- UNLOCK_HARDWARE(vmesa);
- }
-
- _swsetup_DestroyContext(vmesa->glCtx);
- _tnl_DestroyContext(vmesa->glCtx);
- _vbo_DestroyContext(vmesa->glCtx);
- _swrast_DestroyContext(vmesa->glCtx);
- /* free the Mesa context */
- _mesa_destroy_context(vmesa->glCtx);
- /* release our data */
- FreeBuffer(vmesa);
+ _swsetup_DestroyContext(vmesa->glCtx);
+ _tnl_DestroyContext(vmesa->glCtx);
+ _vbo_DestroyContext(vmesa->glCtx);
+ _swrast_DestroyContext(vmesa->glCtx);
+ /* free the Mesa context */
+ _mesa_destroy_context(vmesa->glCtx);
+ /* release our data */
+ FreeBuffer(vmesa);
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_AGP]));
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_VIDEO]));
- assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM]));
- assert (is_empty_list(&vmesa->freed_tex_buffers));
+ assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_AGP]));
+ assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_VIDEO]));
+ assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM]));
+ assert (is_empty_list(&vmesa->freed_tex_buffers));
- driDestroyOptionCache(&vmesa->optionCache);
+ driDestroyOptionCache(&vmesa->optionCache);
- FREE(vmesa);
- }
+ FREE(vmesa);
}
@@ -743,8 +738,8 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
draw_buffer = (struct via_renderbuffer *) drawable->driverPrivate;
read_buffer = (struct via_renderbuffer *) readable->driverPrivate;
- switch (vmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_BACK_LEFT:
+ switch (vmesa->glCtx->DrawBuffer->_ColorDrawBufferIndexes[0]) {
+ case BUFFER_BACK_LEFT:
if (drawable->numBackClipRects == 0) {
vmesa->numClipRects = drawable->numClipRects;
vmesa->pClipRects = drawable->pClipRects;
@@ -754,7 +749,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
vmesa->pClipRects = drawable->pBackClipRects;
}
break;
- case BUFFER_BIT_FRONT_LEFT:
+ case BUFFER_FRONT_LEFT:
vmesa->numClipRects = drawable->numClipRects;
vmesa->pClipRects = drawable->pClipRects;
break;
@@ -840,13 +835,17 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate;
readBuffer = (GLframebuffer *)driReadPriv->driverPrivate;
- if (vmesa->driDrawable != driDrawPriv) {
- driDrawableInitVBlank(driDrawPriv, vmesa->vblank_flags,
- &vmesa->vbl_seq);
- }
-
if ((vmesa->driDrawable != driDrawPriv)
|| (vmesa->driReadable != driReadPriv)) {
+ if (driDrawPriv->swap_interval == (unsigned)-1) {
+ driDrawPriv->vblFlags =
+ vmesa->viaScreen->irqEnabled ?
+ driGetDefaultVBlankFlags(&vmesa->optionCache) :
+ VBLANK_FLAG_NO_IRQ;
+
+ driDrawableInitVBlank(driDrawPriv);
+ }
+
vmesa->driDrawable = driDrawPriv;
vmesa->driReadable = driReadPriv;
diff --git a/src/via_context.h b/src/via_context.h
index fecd278..acd6f2e 100644
--- a/src/via_context.h
+++ b/src/via_context.h
@@ -289,7 +289,6 @@ struct via_context {
drm_context_t hHWContext;
drm_hw_lock_t *driHwLock;
int driFd;
- __DRInativeDisplay *display;
/**
* DRI drawable bound to this context for drawing.
@@ -322,9 +321,6 @@ struct via_context {
*/
driOptionCache optionCache;
- GLuint vblank_flags;
- GLuint vbl_seq;
-
int64_t swap_ust;
int64_t swap_missed_ust;
diff --git a/src/via_ioctl.c b/src/via_ioctl.c
index 4a733fb..482a1a6 100644
--- a/src/via_ioctl.c
+++ b/src/via_ioctl.c
@@ -507,11 +507,12 @@ void viaWaitIdleLocked( struct via_context *vmesa, GLboolean light )
* except that WAIT_IDLE() will spin the CPU polling, while this is
* IRQ driven.
*/
-static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv,
+static void viaWaitIdleVBlank( __DRIdrawablePrivate *dPriv,
struct via_context *vmesa,
GLuint value )
{
GLboolean missed_target;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
VIA_FLUSH_DMA(vmesa);
@@ -523,11 +524,10 @@ static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv,
vmesa->thrashing)
viaSwapOutWork(vmesa);
- driWaitForVBlank( dPriv, & vmesa->vbl_seq,
- vmesa->vblank_flags, & missed_target );
+ driWaitForVBlank( dPriv, & missed_target );
if ( missed_target ) {
vmesa->swap_missed_count++;
- (*dri_interface->getUST)( &vmesa->swap_missed_ust );
+ (*psp->systemTime->getUST)( &vmesa->swap_missed_ust );
}
}
while (!viaCheckBreadcrumb(vmesa, value));
@@ -591,10 +591,11 @@ void viaResetPageFlippingLocked(struct via_context *vmesa)
/*
* Copy the back buffer to the front buffer.
*/
-void viaCopyBuffer(const __DRIdrawablePrivate *dPriv)
+void viaCopyBuffer(__DRIdrawablePrivate *dPriv)
{
struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
if (VIA_DEBUG & DEBUG_IOCTL)
fprintf(stderr,
@@ -607,7 +608,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv)
VIA_FLUSH_DMA(vmesa);
- if (vmesa->vblank_flags == VBLANK_FLAG_SYNC &&
+ if (dPriv->vblFlags == VBLANK_FLAG_SYNC &&
vmesa->lastBreadcrumbWrite > 1)
viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite-1);
else
@@ -630,18 +631,19 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv)
viaEmitBreadcrumbLocked(vmesa);
UNLOCK_HARDWARE(vmesa);
- (*dri_interface->getUST)( &vmesa->swap_ust );
+ (*psp->systemTime->getUST)( &vmesa->swap_ust );
}
-void viaPageFlip(const __DRIdrawablePrivate *dPriv)
+void viaPageFlip(__DRIdrawablePrivate *dPriv)
{
struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate;
struct via_renderbuffer buffer_tmp;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
VIA_FLUSH_DMA(vmesa);
- if (vmesa->vblank_flags == VBLANK_FLAG_SYNC &&
+ if (dPriv->vblFlags == VBLANK_FLAG_SYNC &&
vmesa->lastBreadcrumbWrite > 1)
viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite - 1);
else
@@ -654,7 +656,7 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv)
viaEmitBreadcrumbLocked(vmesa);
UNLOCK_HARDWARE(vmesa);
- (*dri_interface->getUST)( &vmesa->swap_ust );
+ (*psp->systemTime->getUST)( &vmesa->swap_ust );
/* KW: FIXME: When buffers are freed, could free frontbuffer by
diff --git a/src/via_ioctl.h b/src/via_ioctl.h
index a81b427..14a833a 100644
--- a/src/via_ioctl.h
+++ b/src/via_ioctl.h
@@ -33,8 +33,8 @@ void viaFlushDma(struct via_context *vmesa);
void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags);
void viaInitIoctlFuncs(GLcontext *ctx);
-void viaCopyBuffer(const __DRIdrawablePrivate *dpriv);
-void viaPageFlip(const __DRIdrawablePrivate *dpriv);
+void viaCopyBuffer(__DRIdrawablePrivate *dpriv);
+void viaPageFlip(__DRIdrawablePrivate *dpriv);
void viaCheckDma(struct via_context *vmesa, GLuint bytes);
void viaResetPageFlippingLocked(struct via_context *vmesa);
void viaWaitIdle(struct via_context *vmesa, GLboolean light);
@@ -58,7 +58,7 @@ void viaEmitBreadcrumb( struct via_context *vmesa );
void viaWrapPrimitive( struct via_context *vmesa );
-static __inline__ GLuint *viaAllocDma(struct via_context *vmesa, int bytes)
+static INLINE GLuint *viaAllocDma(struct via_context *vmesa, int bytes)
{
if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) {
viaFlushDma(vmesa);
@@ -72,7 +72,7 @@ static __inline__ GLuint *viaAllocDma(struct via_context *vmesa, int bytes)
}
-static GLuint __inline__ *viaExtendPrimitive(struct via_context *vmesa, int bytes)
+static GLuint INLINE *viaExtendPrimitive(struct via_context *vmesa, int bytes)
{
if (vmesa->dmaLow + bytes > VIA_DMA_HIGHWATER) {
viaWrapPrimitive(vmesa);
diff --git a/src/via_screen.c b/src/via_screen.c
index 90f76be..3648710 100644
--- a/src/via_screen.c
+++ b/src/via_screen.c
@@ -24,8 +24,8 @@
#include <stdio.h>
-#include "utils.h"
#include "dri_util.h"
+#include "utils.h"
#include "glheader.h"
#include "context.h"
#include "framebuffer.h"
@@ -48,7 +48,7 @@
#include "xmlpool.h"
-const char __driConfigOptions[] =
+PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
@@ -64,8 +64,6 @@ static const GLuint __driNConfigOptions = 3;
extern const struct dri_extension card_extensions[];
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
static drmBufMapPtr via_create_empty_buffers(void)
{
drmBufMapPtr retval;
@@ -98,9 +96,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
{
viaScreenPrivate *viaScreen;
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
+ int i;
if (sPriv->devPrivSize != sizeof(VIADRIRec)) {
fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n");
@@ -175,17 +171,17 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset;
- if ( glx_enable_extension != NULL ) {
- if ( viaScreen->irqEnabled ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
+ i = 0;
+ viaScreen->extensions[i++] = &driFrameTrackingExtension.base;
+ viaScreen->extensions[i++] = &driReadDrawableExtension;
+ if ( viaScreen->irqEnabled ) {
+ viaScreen->extensions[i++] = &driSwapControlExtension.base;
+ viaScreen->extensions[i++] = &driMediaStreamCounterExtension.base;
}
+ viaScreen->extensions[i++] = NULL;
+ sPriv->extensions = viaScreen->extensions;
+
return GL_TRUE;
}
@@ -323,32 +319,11 @@ viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
_mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
-
-
-static struct __DriverAPIRec viaAPI = {
- .InitDriver = viaInitDriver,
- .DestroyScreen = viaDestroyScreen,
- .CreateContext = viaCreateContext,
- .DestroyContext = viaDestroyContext,
- .CreateBuffer = viaCreateBuffer,
- .DestroyBuffer = viaDestroyBuffer,
- .SwapBuffers = viaSwapBuffers,
- .MakeCurrent = viaMakeCurrent,
- .UnbindContext = viaUnbindContext,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *
-viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer )
+static const __DRIconfig **
+viaFillInModes( __DRIscreenPrivate *psp,
+ unsigned pixel_bits, GLboolean have_back_buffer )
{
- __GLcontextModes * modes;
- __GLcontextModes * m;
- unsigned num_modes;
+ __DRIconfig **configs;
const unsigned back_buffer_factor = (have_back_buffer) ? 2 : 1;
GLenum fb_format;
GLenum fb_type;
@@ -369,9 +344,6 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer )
static const u_int8_t stencil_bits_array[4] = { 0, 0, 8, 0 };
const unsigned depth_buffer_factor = 3;
-
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
if ( pixel_bits == 16 ) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
@@ -381,94 +353,61 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer )
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
- modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array,
- depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
+ configs = driCreateConfigs(fb_format, fb_type,
+ depth_bits_array, stencil_bits_array,
+ depth_buffer_factor, back_buffer_modes,
+ back_buffer_factor);
+ if (configs == NULL) {
+ fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
+ __LINE__);
return NULL;
}
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array,
- depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_DIRECT_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
- return NULL;
- }
-
- return modes;
+ return (const __DRIconfig **) configs;
}
/**
- * This is the bootstrap function for the driver. libGL supplies all of the
- * requisite information about the system, and the driver initializes itself.
- * This routine also fills in the linked list pointed to by \c driver_modes
- * with the \c __GLcontextModes that the driver can support for windows or
- * pbuffers.
+ * This is the driver specific part of the createNewScreen entry point.
*
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
- * failure.
+ * \todo maybe fold this into intelInitDriver
+ *
+ * \return the __GLcontextModes supported by this driver
*/
-PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
- __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
+static const __DRIconfig **
+viaInitScreen(__DRIscreenPrivate *psp)
{
- __DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { VIA_DRIDDX_VERSION_MAJOR,
VIA_DRIDDX_VERSION_MINOR,
VIA_DRIDDX_VERSION_PATCH };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 2, 3, 0 };
static const char *driver_name = "Unichrome";
-
- dri_interface = interface;
+ VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv;
if ( ! driCheckDriDdxDrmVersions2( driver_name,
- dri_version, & dri_expected,
- ddx_version, & ddx_expected,
- drm_version, & drm_expected) ) {
+ &psp->dri_version, & dri_expected,
+ &psp->ddx_version, & ddx_expected,
+ &psp->drm_version, & drm_expected) )
return NULL;
- }
-
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
- ddx_version, dri_version, drm_version,
- frame_buffer, pSAREA, fd,
- internal_api_version, &viaAPI);
- if ( psp != NULL ) {
- VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv;
- *driver_modes = viaFillInModes( dri_priv->bytesPerPixel * 8,
- GL_TRUE );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
- return (void *) psp;
+ /* Calling driInitExtensions here, with a NULL context pointer,
+ * does not actually enable the extensions. It just makes sure
+ * that all the dispatch offsets for all the extensions that
+ * *might* be enables are known. This is needed because the
+ * dispatch offsets need to be known when _mesa_context_create is
+ * called, but we can't enable the extensions until we have a
+ * context pointer.
+ *
+ * Hello chicken. Hello egg. How are you two today?
+ */
+ driInitExtensions( NULL, card_extensions, GL_FALSE );
+
+ if (!viaInitDriver(psp))
+ return NULL;
+
+ return viaFillInModes( psp, dri_priv->bytesPerPixel * 8, GL_TRUE );
+
}
@@ -497,3 +436,20 @@ getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
return 0;
}
+
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = viaInitScreen,
+ .DestroyScreen = viaDestroyScreen,
+ .CreateContext = viaCreateContext,
+ .DestroyContext = viaDestroyContext,
+ .CreateBuffer = viaCreateBuffer,
+ .DestroyBuffer = viaDestroyBuffer,
+ .SwapBuffers = viaSwapBuffers,
+ .MakeCurrent = viaMakeCurrent,
+ .UnbindContext = viaUnbindContext,
+ .GetSwapInfo = getSwapInfo,
+ .GetDrawableMSC = driDrawableGetMSC32,
+ .WaitForMSC = driWaitForMSC32,
+ .WaitForSBC = NULL,
+ .SwapBuffersMSC = NULL
+};
diff --git a/src/via_screen.h b/src/via_screen.h
index 84aa5ae..c3ef722 100644
--- a/src/via_screen.h
+++ b/src/via_screen.h
@@ -70,6 +70,8 @@ typedef struct {
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
+
+ const __DRIextension *extensions[5];
} viaScreenPrivate;
diff --git a/src/via_span.c b/src/via_span.c
index 3a16dad..15e29c5 100644
--- a/src/via_span.c
+++ b/src/via_span.c
@@ -86,6 +86,7 @@
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
+#define VALUE_TYPE GLushort
#define WRITE_DEPTH(_x, _y, d) \
*(GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch) = d;
@@ -98,6 +99,8 @@
/* 32 bit depthbuffer functions.
*/
+#define VALUE_TYPE GLuint
+
#define WRITE_DEPTH(_x, _y, d) \
*(GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch) = d;
@@ -111,6 +114,8 @@
/* 24/8 bit interleaved depth/stencil functions
*/
+#define VALUE_TYPE GLuint
+
#define WRITE_DEPTH( _x, _y, d ) { \
GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch); \
tmp &= 0x000000ff; \
diff --git a/src/via_state.c b/src/via_state.c
index bccdbe9..645c58a 100644
--- a/src/via_state.c
+++ b/src/via_state.c
@@ -511,9 +511,9 @@ void viaEmitState(struct via_context *vmesa)
}
-static __inline__ GLuint viaPackColor(GLuint bpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
+static INLINE GLuint viaPackColor(GLuint bpp,
+ GLubyte r, GLubyte g,
+ GLubyte b, GLubyte a)
{
switch (bpp) {
case 16:
@@ -656,13 +656,18 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
if (!ctx->DrawBuffer)
return;
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
+ if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
+ FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_TRUE);
+ return;
+ }
+
+ switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) {
+ case BUFFER_FRONT_LEFT:
VIA_FLUSH_DMA(vmesa);
vmesa->drawBuffer = &vmesa->front;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
break;
- case BUFFER_BIT_BACK_LEFT:
+ case BUFFER_BACK_LEFT:
VIA_FLUSH_DMA(vmesa);
vmesa->drawBuffer = &vmesa->back;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
diff --git a/src/via_tex.c b/src/via_tex.c
index 0261a3f..15f15a8 100644
--- a/src/via_tex.c
+++ b/src/via_tex.c
@@ -820,9 +820,7 @@ static void viaTexImage(GLcontext *ctx,
/* GL_SGIS_generate_mipmap */
if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- _mesa_generate_mipmap(ctx, target,
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
- texObj);
+ _mesa_generate_mipmap(ctx, target, texObj);
}
_mesa_unmap_teximage_pbo(ctx, packing);