#include "drivers/common/meta.h"
#include "main/context.h"
#include "main/framebuffer.h"
+#include "main/fbobject.h"
#include "main/renderbuffer.h"
#include "main/state.h"
#include "main/simple_list.h"
static const char* get_chip_family_name(int chip_family)
{
switch(chip_family) {
+#if defined(RADEON_R100)
case CHIP_FAMILY_R100: return "R100";
case CHIP_FAMILY_RV100: return "RV100";
case CHIP_FAMILY_RS100: return "RS100";
case CHIP_FAMILY_RV200: return "RV200";
case CHIP_FAMILY_RS200: return "RS200";
+#elif defined(RADEON_R200)
case CHIP_FAMILY_R200: return "R200";
case CHIP_FAMILY_RV250: return "RV250";
case CHIP_FAMILY_RS300: return "RS300";
case CHIP_FAMILY_RV280: return "RV280";
- case CHIP_FAMILY_R300: return "R300";
- case CHIP_FAMILY_R350: return "R350";
- case CHIP_FAMILY_RV350: return "RV350";
- case CHIP_FAMILY_RV380: return "RV380";
- case CHIP_FAMILY_R420: return "R420";
- case CHIP_FAMILY_RV410: return "RV410";
- case CHIP_FAMILY_RS400: return "RS400";
- case CHIP_FAMILY_RS600: return "RS600";
- case CHIP_FAMILY_RS690: return "RS690";
- case CHIP_FAMILY_RS740: return "RS740";
- case CHIP_FAMILY_RV515: return "RV515";
- case CHIP_FAMILY_R520: return "R520";
- case CHIP_FAMILY_RV530: return "RV530";
- case CHIP_FAMILY_R580: return "R580";
- case CHIP_FAMILY_RV560: return "RV560";
- case CHIP_FAMILY_RV570: return "RV570";
- case CHIP_FAMILY_R600: return "R600";
- case CHIP_FAMILY_RV610: return "RV610";
- case CHIP_FAMILY_RV630: return "RV630";
- case CHIP_FAMILY_RV670: return "RV670";
- case CHIP_FAMILY_RV620: return "RV620";
- case CHIP_FAMILY_RV635: return "RV635";
- case CHIP_FAMILY_RS780: return "RS780";
- case CHIP_FAMILY_RS880: return "RS880";
- case CHIP_FAMILY_RV770: return "RV770";
- case CHIP_FAMILY_RV730: return "RV730";
- case CHIP_FAMILY_RV710: return "RV710";
- case CHIP_FAMILY_RV740: return "RV740";
- case CHIP_FAMILY_CEDAR: return "CEDAR";
- case CHIP_FAMILY_REDWOOD: return "REDWOOD";
- case CHIP_FAMILY_JUNIPER: return "JUNIPER";
- case CHIP_FAMILY_CYPRESS: return "CYPRESS";
- case CHIP_FAMILY_HEMLOCK: return "HEMLOCK";
- case CHIP_FAMILY_PALM: return "PALM";
- case CHIP_FAMILY_SUMO: return "SUMO";
- case CHIP_FAMILY_SUMO2: return "SUMO2";
- case CHIP_FAMILY_BARTS: return "BARTS";
- case CHIP_FAMILY_TURKS: return "TURKS";
- case CHIP_FAMILY_CAICOS: return "CAICOS";
+#endif
default: return "unknown";
}
}
unsigned offset;
GLuint agp_mode = (radeon->radeonScreen->card_type==RADEON_CARD_PCI) ? 0 :
radeon->radeonScreen->AGPMode;
- const char* chipclass;
char hardwarename[32];
- if (IS_R200_CLASS(radeon->radeonScreen))
- chipclass = "R200";
- else
- chipclass = "R100";
-
sprintf(hardwarename, "%s (%s %04X)",
- chipclass,
+#if defined(RADEON_R100)
+ "R100",
+#elif defined(RADEON_R200)
+ "R200",
+#endif
get_chip_family_name(radeon->radeonScreen->chip_family),
radeon->radeonScreen->device_id);
void *sharedContextPrivate)
{
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
- radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
+ radeonScreenPtr screen = (radeonScreenPtr) (sPriv->driverPrivate);
struct gl_context* ctx;
struct gl_context* shareCtx;
int fthrottle_mode;
radeon->texture_depth = ( glVisual->rgbBits > 16 ) ?
DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
- if (IS_R200_CLASS(radeon->radeonScreen) ||
- IS_R100_CLASS(radeon->radeonScreen)) {
- radeon->texture_row_align = 32;
- radeon->texture_rect_row_align = 64;
- radeon->texture_compressed_row_align = 32;
- }
+ radeon->texture_row_align = 32;
+ radeon->texture_rect_row_align = 64;
+ radeon->texture_compressed_row_align = 32;
radeon_init_dma(radeon);
/**
* Cleanup common context fields.
- * Called by r200DestroyContext/r300DestroyContext
+ * Called by r200DestroyContext
*/
void radeonDestroyContext(__DRIcontext *driContextPriv )
{
static unsigned
radeon_bits_per_pixel(const struct radeon_renderbuffer *rb)
{
- return _mesa_get_format_bytes(rb->base.Format) * 8;
+ return _mesa_get_format_bytes(rb->base.Base.Format) * 8;
}
/*
rb->cpp = buffers[i].cpp;
rb->pitch = buffers[i].pitch;
- rb->base.Width = drawable->w;
- rb->base.Height = drawable->h;
+ rb->base.Base.Width = drawable->w;
+ rb->base.Base.Height = drawable->h;
rb->has_surface = 0;
if (buffers[i].attachment == __DRI_BUFFER_STENCIL && depth_bo) {
}
ret = radeon_bo_get_tiling(bo, &tiling_flags, &pitch);
- if (tiling_flags & RADEON_TILING_MACRO)
- bo->flags |= RADEON_BO_FLAGS_MACRO_TILE;
- if (tiling_flags & RADEON_TILING_MICRO)
- bo->flags |= RADEON_BO_FLAGS_MICRO_TILE;
-
+ if (ret) {
+ fprintf(stderr,
+ "failed to get tiling for %s %d\n",
+ regname, buffers[i].name);
+ radeon_bo_unref(bo);
+ bo = NULL;
+ continue;
+ } else {
+ if (tiling_flags & RADEON_TILING_MACRO)
+ bo->flags |= RADEON_BO_FLAGS_MACRO_TILE;
+ if (tiling_flags & RADEON_TILING_MICRO)
+ bo->flags |= RADEON_BO_FLAGS_MICRO_TILE;
+ }
}
if (buffers[i].attachment == __DRI_BUFFER_DEPTH) {
__DRIdrawable * driReadPriv)
{
radeonContextPtr radeon;
+ GET_CURRENT_CONTEXT(curCtx);
struct gl_framebuffer *drfb, *readfb;
+ if (driContextPriv)
+ radeon = (radeonContextPtr)driContextPriv->driverPrivate;
+ else
+ radeon = NULL;
+ /* According to the glXMakeCurrent() man page: "Pending commands to
+ * the previous context, if any, are flushed before it is released."
+ * But only flush if we're actually changing contexts.
+ */
+
+ if ((radeonContextPtr)curCtx && (radeonContextPtr)curCtx != radeon) {
+ _mesa_flush(curCtx);
+ }
+
if (!driContextPriv) {
if (RADEON_DEBUG & RADEON_DRI)
fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
return GL_TRUE;
}
- radeon = (radeonContextPtr) driContextPriv->driverPrivate;
-
if(driDrawPriv == NULL && driReadPriv == NULL) {
drfb = _mesa_create_framebuffer(&radeon->glCtx->Visual);
readfb = drfb;
if (driDrawPriv != driReadPriv)
radeon_update_renderbuffers(driContextPriv, driReadPriv, GL_FALSE);
_mesa_reference_renderbuffer(&radeon->state.color.rb,
- &(radeon_get_renderbuffer(drfb, BUFFER_BACK_LEFT)->base));
+ &(radeon_get_renderbuffer(drfb, BUFFER_BACK_LEFT)->base.Base));
_mesa_reference_renderbuffer(&radeon->state.depth.rb,
- &(radeon_get_renderbuffer(drfb, BUFFER_DEPTH)->base));
+ &(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);