**************************************************************************/
#include "radeon_common.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
+#include "util/driconf.h" /* for symbolic values of enum-type options */
#include "utils.h"
#include "drivers/common/meta.h"
#include "main/context.h"
#include "main/fbobject.h"
#include "main/renderbuffer.h"
#include "main/state.h"
-#include "main/simple_list.h"
+#include "util/simple_list.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
}
}
+const char *const radeonVendorString = "Mesa Project";
-/* Return various strings for glGetString().
+/* Return complete renderer string.
*/
-static const GLubyte *radeonGetString(struct gl_context * ctx, GLenum name)
+const char *radeonGetRendererString(radeonScreenPtr radeonScreen)
{
- radeonContextPtr radeon = RADEON_CONTEXT(ctx);
static char buffer[128];
+ char hardwarename[32];
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *) "VMware, Inc.";
+ GLuint agp_mode = (radeonScreen->card_type==RADEON_CARD_PCI) ? 0 :
+ radeonScreen->AGPMode;
- case GL_RENDERER:
- {
- unsigned offset;
- GLuint agp_mode = (radeon->radeonScreen->card_type==RADEON_CARD_PCI) ? 0 :
- radeon->radeonScreen->AGPMode;
- char hardwarename[32];
-
- sprintf(hardwarename, "%s (%s %04X)",
+ snprintf(hardwarename, sizeof(hardwarename), "%s (%s %04X)",
#if defined(RADEON_R100)
- "R100",
+ "R100",
#elif defined(RADEON_R200)
- "R200",
+ "R200",
#endif
- get_chip_family_name(radeon->radeonScreen->chip_family),
- radeon->radeonScreen->device_id);
+ get_chip_family_name(radeonScreen->chip_family),
+ radeonScreen->device_id);
- offset = driGetRendererString(buffer, hardwarename, agp_mode);
+ driGetRendererString(buffer, hardwarename, agp_mode);
- sprintf(&buffer[offset], " %sTCL",
- !(radeon->TclFallback & RADEON_TCL_FALLBACK_TCL_DISABLE)
- ? "" : "NO-");
+ strcat(buffer, " DRI2");
- strcat(buffer, " DRI2");
+ return buffer;
+}
- return (GLubyte *) buffer;
- }
+
+/* Return various strings for glGetString().
+ */
+static const GLubyte *radeonGetString(struct gl_context * ctx, GLenum name)
+{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+
+ switch (name) {
+ case GL_VENDOR:
+ return (GLubyte *) radeonVendorString;
+
+ case GL_RENDERER:
+ return (GLubyte *) radeonGetRendererString(radeon->radeonScreen);
default:
return NULL;
* including the Mesa context itself.
*/
GLboolean radeonInitContext(radeonContextPtr radeon,
+ gl_api api,
struct dd_function_table* functions,
const struct gl_config * glVisual,
__DRIcontext * driContextPriv,
else
shareCtx = NULL;
- if (!_mesa_initialize_context(&radeon->glCtx, API_OPENGL_COMPAT,
+ if (!_mesa_initialize_context(&radeon->glCtx, api,
glVisual, shareCtx,
functions))
return GL_FALSE;
_mesa_meta_init(ctx);
/* DRI fields */
- radeon->dri.context = driContextPriv;
- radeon->dri.screen = sPriv;
- radeon->dri.fd = sPriv->fd;
- radeon->dri.drmMinor = sPriv->drm_version.minor;
+ radeon->driContext = driContextPriv;
/* Setup IRQs */
fthrottle_mode = driQueryOptioni(&radeon->optionCache, "fthrottle_mode");
radeon->texture_depth = driQueryOptioni (&radeon->optionCache,
"texture_depth");
if (radeon->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
- radeon->texture_depth = ( glVisual->rgbBits > 16 ) ?
+ radeon->texture_depth = (glVisual == NULL || glVisual->rgbBits > 16) ?
DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
radeon->texture_row_align = 32;
radeon_init_dma(radeon);
+ /* _mesa_initialize_context calls _mesa_init_queryobj which
+ * initializes all of the counter sizes to 64. The counters on r100
+ * and r200 are only 32-bits for occlusion queries. Those are the
+ * only counters, so set the other sizes to zero.
+ */
+ radeon->glCtx.Const.QueryCounterBits.SamplesPassed = 32;
+
+ radeon->glCtx.Const.QueryCounterBits.TimeElapsed = 0;
+ radeon->glCtx.Const.QueryCounterBits.Timestamp = 0;
+ radeon->glCtx.Const.QueryCounterBits.PrimitivesGenerated = 0;
+ radeon->glCtx.Const.QueryCounterBits.PrimitivesWritten = 0;
+ radeon->glCtx.Const.QueryCounterBits.VerticesSubmitted = 0;
+ radeon->glCtx.Const.QueryCounterBits.PrimitivesSubmitted = 0;
+ radeon->glCtx.Const.QueryCounterBits.VsInvocations = 0;
+ radeon->glCtx.Const.QueryCounterBits.TessPatches = 0;
+ radeon->glCtx.Const.QueryCounterBits.TessInvocations = 0;
+ radeon->glCtx.Const.QueryCounterBits.GsInvocations = 0;
+ radeon->glCtx.Const.QueryCounterBits.GsPrimitives = 0;
+ radeon->glCtx.Const.QueryCounterBits.FsInvocations = 0;
+ radeon->glCtx.Const.QueryCounterBits.ComputeInvocations = 0;
+ radeon->glCtx.Const.QueryCounterBits.ClInPrimitives = 0;
+ radeon->glCtx.Const.QueryCounterBits.ClOutPrimitives = 0;
+
return GL_TRUE;
}
radeon_firevertices(radeon);
if (!is_empty_list(&radeon->dma.reserved)) {
- rcommonFlushCmdBuf( radeon, __FUNCTION__ );
+ rcommonFlushCmdBuf( radeon, __func__ );
}
radeonFreeDmaRegions(radeon);
radeonContextPtr radeon = (radeonContextPtr) driContextPriv->driverPrivate;
if (RADEON_DEBUG & RADEON_DRI)
- fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
+ fprintf(stderr, "%s ctx %p\n", __func__,
&radeon->glCtx);
/* Unset current context and dispath table */
*/
void radeon_prepare_render(radeonContextPtr radeon)
{
- __DRIcontext *driContext = radeon->dri.context;
+ __DRIcontext *driContext = radeon->driContext;
__DRIdrawable *drawable;
__DRIscreen *screen;
* that will happen next will probably dirty the front buffer. So
* mark it as dirty here.
*/
- if (radeon->is_front_buffer_rendering)
+ if (_mesa_is_front_buffer_drawing(radeon->glCtx.DrawBuffer))
radeon->front_buffer_dirty = GL_TRUE;
}
struct radeon_renderbuffer *stencil_rb;
i = 0;
- if ((front_only || radeon->is_front_buffer_rendering ||
- radeon->is_front_buffer_reading ||
- !draw->color_rb[1])
- && draw->color_rb[0]) {
+ if ((front_only || _mesa_is_front_buffer_drawing(&draw->base) ||
+ _mesa_is_front_buffer_reading(&draw->base) ||
+ !draw->color_rb[1])
+ && draw->color_rb[0]) {
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
attachments[i++] = radeon_bits_per_pixel(draw->color_rb[0]);
}
}
}
- buffers = (*screen->dri2.loader->getBuffersWithFormat)(drawable,
- &drawable->w,
- &drawable->h,
- attachments, i / 2,
- &count,
- drawable->loaderPrivate);
+ buffers = screen->dri2.loader->getBuffersWithFormat(drawable,
+ &drawable->w,
+ &drawable->h,
+ attachments, i / 2,
+ &count,
+ drawable->loaderPrivate);
} else if (screen->dri2.loader) {
i = 0;
if (draw->color_rb[0])
attachments[i++] = __DRI_BUFFER_STENCIL;
}
- buffers = (*screen->dri2.loader->getBuffers)(drawable,
- &drawable->w,
- &drawable->h,
- attachments, i,
- &count,
- drawable->loaderPrivate);
+ buffers = screen->dri2.loader->getBuffers(drawable,
+ &drawable->w,
+ &drawable->h,
+ attachments, i,
+ &count,
+ drawable->loaderPrivate);
}
if (buffers == NULL)
if (!driContextPriv) {
if (RADEON_DEBUG & RADEON_DRI)
- fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
+ fprintf(stderr, "%s ctx is null\n", __func__);
_mesa_make_current(NULL, NULL, NULL);
return GL_TRUE;
}
&(radeon_get_renderbuffer(drfb, BUFFER_DEPTH)->base.Base));
if (RADEON_DEBUG & RADEON_DRI)
- fprintf(stderr, "%s ctx %p dfb %p rfb %p\n", __FUNCTION__, &radeon->glCtx, drfb, readfb);
+ fprintf(stderr, "%s ctx %p dfb %p rfb %p\n", __func__, &radeon->glCtx, drfb, readfb);
if(driDrawPriv)
driUpdateFramebufferSize(&radeon->glCtx, driDrawPriv);
if (RADEON_DEBUG & RADEON_DRI)
- fprintf(stderr, "End %s\n", __FUNCTION__);
+ fprintf(stderr, "End %s\n", __func__);
return GL_TRUE;
}