#include "via_dri.h"
#include "GL/internal/dri_interface.h"
+#include "drirenderbuffer.h"
-/* Radeon configuration
- */
#include "xmlpool.h"
const char __driConfigOptions[] =
DRI_CONF_BEGIN
DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_SECTION_END
+ DRI_CONF_SECTION_QUALITY
+ DRI_CONF_EXCESS_MIPMAP(false)
+ DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST(false)
DRI_CONF_SECTION_END
viaScreen->fbOffset = 0;
viaScreen->fbSize = gDRIPriv->fbSize;
viaScreen->irqEnabled = gDRIPriv->irqEnabled;
- viaScreen->irqEnabled = 1;
if (VIA_DEBUG & DEBUG_DRI) {
fprintf(stderr, "deviceID = %08x\n", viaScreen->deviceID);
if (drmMap(sPriv->fd,
gDRIPriv->regs.handle,
gDRIPriv->regs.size,
- (drmAddress *)&viaScreen->reg) != 0) {
+ &viaScreen->reg) != 0) {
FREE(viaScreen);
sPriv->private = NULL;
__driUtilMessage("viaInitDriver: drmMap regs failed");
gDRIPriv->agp.handle,
gDRIPriv->agp.size,
(drmAddress *)&viaScreen->agpLinearStart) != 0) {
+ drmUnmap(viaScreen->reg, gDRIPriv->regs.size);
FREE(viaScreen);
- drmUnmap(viaScreen->reg, gDRIPriv->agp.size);
sPriv->private = NULL;
__driUtilMessage("viaInitDriver: drmMap agp failed");
return GL_FALSE;
- }
- viaScreen->agpBase = (GLuint *)gDRIPriv->agp.handle;
+ }
+
+ viaScreen->agpBase = drmAgpBase(sPriv->fd);
} else
viaScreen->agpLinearStart = 0;
(*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" );
}
via_free_empty_buffers(viaScreen->bufs);
+ driDestroyOptionInfo(&viaScreen->optionCache);
+
FREE(viaScreen);
sPriv->private = NULL;
}
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24);
-
+ GLboolean swAccum = mesaVis->accumRedBits > 0;
if (isPixmap) {
/* KW: This needs work, disabled for now:
return GL_FALSE;
}
else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer(mesaVis,
- GL_FALSE, /* software depth buffer? */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE /* s/w alpha planes */);
-#else
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
+ /* The front color, back color and depth renderbuffers are
+ * set up later in calculate_buffer_parameters().
+ * Only create/connect software-based buffers here.
+ */
+
+#if 000
+ /* This code _should_ be put to use. We have to move the
+ * viaRenderbuffer members out of the via_context structure.
+ * Those members should just be the renderbuffers hanging off the
+ * gl_framebuffer object.
+ */
/* XXX check/fix the offset/pitch parameters! */
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, screen->bytesPerPixel,
- 0, screen->width);
+ = driNewRenderbuffer(GL_RGBA, NULL,
+ screen->bytesPerPixel,
+ 0, screen->width, driDrawPriv);
viaSetSpanFunctions(frontRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
}
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, screen->bytesPerPixel,
- 0, screen->width);
+ = driNewRenderbuffer(GL_RGBA, NULL,
+ screen->bytesPerPixel,
+ 0, screen->width, driDrawPriv);
viaSetSpanFunctions(backRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
}
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->bytesPerPixel,
- 0, screen->width);
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL,
+ screen->bytesPerPixel,
+ 0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->bytesPerPixel,
- 0, screen->width);
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL,
+ screen->bytesPerPixel,
+ 0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}
else if (mesaVis->depthBits == 32) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->bytesPerPixel,
- 0, screen->width);
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT32, NULL,
+ screen->bytesPerPixel,
+ 0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->bytesPerPixel,
- 0, screen->width);
+ = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL,
+ screen->bytesPerPixel,
+ 0, screen->width, driDrawPriv);
viaSetSpanFunctions(stencilRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
}
+#endif
_mesa_add_soft_renderbuffers(fb,
GL_FALSE, /* color */
GL_FALSE, /* depth */
swStencil,
- mesaVis->accumRedBits > 0,
+ swAccum,
GL_FALSE, /* alpha */
GL_FALSE /* aux */);
driDrawPriv->driverPrivate = (void *) fb;
-#endif
- return (driDrawPriv->driverPrivate != NULL);
+
+ return (driDrawPriv->driverPrivate != NULL);
}
}
static void
viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *)(driDrawPriv->driverPrivate));
+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
/* The 32-bit depth-buffer mode isn't supported yet, so don't actually
* enable it.
*/
- static const u_int8_t depth_bits_array[4] = { 0, 16, 24, 32 };
- static const u_int8_t stencil_bits_array[4] = { 0, 0, 8, 0 };
+ static const uint8_t depth_bits_array[4] = { 0, 16, 24, 32 };
+ static const uint8_t stencil_bits_array[4] = { 0, 0, 8, 0 };
const unsigned depth_buffer_factor = 3;
{
__DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 4, 0, 0 };
+ 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;
- if ( ! driCheckDriDdxDrmVersions2( "Unichrome",
+ if ( ! driCheckDriDdxDrmVersions2( driver_name,
dri_version, & dri_expected,
ddx_version, & ddx_expected,
- drm_version, & drm_expected ) ) {
+ drm_version, & drm_expected) ) {
return NULL;
}
driInitExtensions( NULL, card_extensions, GL_FALSE );
}
- fprintf(stderr, "%s - succeeded\n", __FUNCTION__);
return (void *) psp;
}