#include "swrast/swrast.h"
#include "radeon_screen.h"
-#include "r200_context.h"
#include "radeon_ioctl.h"
#include "radeon_macros.h"
#include "radeon_reg.h"
-#include "r200_state.h"
+#include "radeon_state.h"
#include "r300_state.h"
#include "utils.h"
#include "vblank.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
-#define DRIVER_DATE "20040924"
+#define DRIVER_DATE "20060815"
/* Return various strings for glGetString().
switch (name) {
case GL_VENDOR:
- return (GLubyte *) "Tungsten Graphics, Inc.";
+ if (IS_R300_CLASS(radeon->radeonScreen))
+ return (GLubyte *) "DRI R300 Project";
+ else
+ return (GLubyte *) "Tungsten Graphics, Inc.";
case GL_RENDERER:
{
offset = driGetRendererString(buffer, chipname, DRIVER_DATE,
agp_mode);
+ if (IS_R300_CLASS(radeon->radeonScreen)) {
sprintf(&buffer[offset], " %sTCL",
+ (radeon->radeonScreen->chip_flags & RADEON_CHIPSET_TCL)
+ ? "" : "NO-");
+ } else {
+ sprintf(&buffer[offset], " %sTCL",
!(radeon->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)
? "" : "NO-");
+ }
return (GLubyte *) buffer;
}
}
}
-
-/* Return the width and height of the given buffer.
- */
-static void radeonGetBufferSize(GLframebuffer * buffer,
- GLuint * width, GLuint * height)
-{
- GET_CURRENT_CONTEXT(ctx);
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
-
- LOCK_HARDWARE(radeon);
- *width = radeon->dri.drawable->w;
- *height = radeon->dri.drawable->h;
- UNLOCK_HARDWARE(radeon);
-}
-
-
/* Initialize the driver's misc functions.
*/
static void radeonInitDriverFuncs(struct dd_function_table *functions)
{
- functions->GetBufferSize = radeonGetBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
functions->GetString = radeonGetString;
}
/* DRI fields */
radeon->dri.context = driContextPriv;
radeon->dri.screen = sPriv;
- radeon->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
+ radeon->dri.drawable = NULL;
+ radeon->dri.readable = NULL;
radeon->dri.hwContext = driContextPriv->hHWContext;
radeon->dri.hwLock = &sPriv->pSAREA->lock;
radeon->dri.fd = sPriv->fd;
- radeon->dri.drmMinor = sPriv->drmMinor;
+ radeon->dri.drmMinor = sPriv->drm_version.minor;
radeon->radeonScreen = screen;
radeon->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA +
fthrottle_mode = driQueryOptioni(&radeon->optionCache, "fthrottle_mode");
radeon->iw.irq_seq = -1;
radeon->irqsEmitted = 0;
- radeon->do_irqs = (radeon->dri.drmMinor >= 6 &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS &&
+ radeon->do_irqs = (fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS &&
radeon->radeonScreen->irq);
radeon->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
if (!radeon->do_irqs)
fprintf(stderr,
- "IRQ's not enabled, falling back to %s: %d %d %d\n",
+ "IRQ's not enabled, falling back to %s: %d %d\n",
radeon->do_usleeps ? "usleeps" : "busy waits",
- radeon->dri.drmMinor,
fthrottle_mode, radeon->radeonScreen->irq);
- radeon->vblank_flags = (radeon->radeonScreen->irq != 0)
- ? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ;
-
(*dri_interface->getUST) (&radeon->swap_ust);
return GL_TRUE;
*/
void radeonCleanupContext(radeonContextPtr radeon)
{
+ /* _mesa_destroy_context() might result in calls to functions that
+ * depend on the DriverCtx, so don't set it to NULL before.
+ *
+ * radeon->glCtx->DriverCtx = NULL;
+ */
+
/* free the Mesa context */
- radeon->glCtx->DriverCtx = NULL;
_mesa_destroy_context(radeon->glCtx);
if (radeon->state.scissor.pClipRects) {
radeon->glCtx);
if (radeon->dri.drawable != driDrawPriv) {
- driDrawableInitVBlank(driDrawPriv,
- radeon->vblank_flags);
+ if (driDrawPriv->swap_interval == (unsigned)-1) {
+ driDrawPriv->vblFlags =
+ (radeon->radeonScreen->irq != 0)
+ ? driGetDefaultVBlankFlags(&radeon->
+ optionCache)
+ : VBLANK_FLAG_NO_IRQ;
+
+ driDrawableInitVBlank(driDrawPriv);
+ }
+ }
+
+ radeon->dri.readable = driReadPriv;
+
+ if (radeon->dri.drawable != driDrawPriv ||
+ radeon->lastStamp != driDrawPriv->lastStamp) {
radeon->dri.drawable = driDrawPriv;
-
- r300UpdateWindow(radeon->glCtx);
+
+ radeonSetCliprects(radeon);
r300UpdateViewportOffset(radeon->glCtx);
-#if R200_MERGED
- if (IS_R200_CLASS(radeon->radeonScreen)) {
- r200UpdateWindow(radeon->glCtx);
- r200UpdateViewportOffset(radeon->glCtx);
- }
-#endif
}
_mesa_make_current(radeon->glCtx,
(GLframebuffer *) driReadPriv->
driverPrivate);
- if (!radeon->glCtx->Viewport.Width) {
- _mesa_set_viewport(radeon->glCtx, 0, 0,
- driDrawPriv->w, driDrawPriv->h);
- }
-
- _mesa_update_state(radeon->glCtx);
+ _mesa_update_state(radeon->glCtx);
-#if R200_MERGED
- if (IS_R200_CLASS(radeon->radeonScreen))
- r200ValidateState(radeon->glCtx);
-#endif
-
+ radeonUpdatePageFlipping(radeon);
} else {
if (RADEON_DEBUG & DEBUG_DRI)
fprintf(stderr, "%s ctx is null\n", __FUNCTION__);