#include "r300_state.h"
#include "r300_program.h"
#include "radeon_reg.h"
+#include "r300_emit.h"
#include "vblank.h"
static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
{
GLcontext* ctx = r300->radeon.glCtx;
+ r300ContextPtr rmesa=r300;
__DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
int i;
GLuint cboffset, cbpitch;
- drm_r300_cmd_header_t* cmd;
+ drm_r300_cmd_header_t* cmd2;
+ LOCAL_VARS;
- if (RADEON_DEBUG & DEBUG_IOCTL)
+ if (1 || RADEON_DEBUG & DEBUG_IOCTL)
fprintf(stderr, "%s: %s buffer (%i,%i %ix%i)\n",
__FUNCTION__, buffer ? "back" : "front",
dPriv->x, dPriv->y, dPriv->w, dPriv->h);
}
/* Make sure we have enough space */
- r300EnsureCmdBufSpace(r300, r300->hw.max_state_size + 9, __FUNCTION__);
-
+ r300EnsureCmdBufSpace(r300, r300->hw.max_state_size + 9+8, __FUNCTION__);
+
+ /* needed before starting 3d operation .. */
+ reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
+ e32(0x0000000a);
+
+ reg_start(0x4f18,0);
+ e32(0x00000003);
+
r300EmitState(r300);
- cmd = (drm_r300_cmd_header_t*)r300AllocCmdBuf(r300, 9, __FUNCTION__);
- cmd[0].packet3.cmd_type = R300_CMD_PACKET3;
- cmd[0].packet3.packet = R300_CMD_PACKET3_CLEAR;
- cmd[1].u = r300PackFloat32(dPriv->w / 2.0);
- cmd[2].u = r300PackFloat32(dPriv->h / 2.0);
- cmd[3].u = r300PackFloat32(ctx->Depth.Clear);
- cmd[4].u = r300PackFloat32(1.0);
- cmd[5].u = r300PackFloat32(ctx->Color.ClearColor[0]);
- cmd[6].u = r300PackFloat32(ctx->Color.ClearColor[1]);
- cmd[7].u = r300PackFloat32(ctx->Color.ClearColor[2]);
- cmd[8].u = r300PackFloat32(ctx->Color.ClearColor[3]);
+ cmd2 = (drm_r300_cmd_header_t*)r300AllocCmdBuf(r300, 9, __FUNCTION__);
+ cmd2[0].packet3.cmd_type = R300_CMD_PACKET3;
+ cmd2[0].packet3.packet = R300_CMD_PACKET3_CLEAR;
+ cmd2[1].u = r300PackFloat32(dPriv->w / 2.0);
+ cmd2[2].u = r300PackFloat32(dPriv->h / 2.0);
+ cmd2[3].u = r300PackFloat32(ctx->Depth.Clear);
+ cmd2[4].u = r300PackFloat32(1.0);
+ cmd2[5].u = r300PackFloat32(ctx->Color.ClearColor[0]);
+ cmd2[6].u = r300PackFloat32(ctx->Color.ClearColor[1]);
+ cmd2[7].u = r300PackFloat32(ctx->Color.ClearColor[2]);
+ cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]);
+
+ /* This sequence is required after any 3d drawing packet
+ I suspect it work arounds a bug (or deficiency) in hardware */
+
+ reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0);
+ e32(0x0000000a);
+
+ reg_start(0x4f18,0);
+ e32(0x00000003);
+
}
return;
}
/* A packet cannot have more than 16383 data words.. */
- if(((end-start)*8+4*rmesa->state.texture.tc_count)>16380){
+ if(((end-start)*4*rmesa->state.aos_count)>16380){
fprintf(stderr, "%s:%s: Too many vertices to paint. Fix me !\n");
return;
}
FALLBACK_IF(ctx->Point.PointSprite); // GL_POINT_SPRITE_NV
FALLBACK_IF(ctx->Polygon.OffsetPoint); // GL_POLYGON_OFFSET_POINT
FALLBACK_IF(ctx->Polygon.OffsetLine); // GL_POLYGON_OFFSET_LINE
- FALLBACK_IF(ctx->Polygon.OffsetFill); // GL_POLYGON_OFFSET_FILL
+ //FALLBACK_IF(ctx->Polygon.OffsetFill); // GL_POLYGON_OFFSET_FILL
+ if(ctx->Polygon.OffsetFill)WARN_ONCE("Polygon.OffsetFill not implemented, ignoring\n");
FALLBACK_IF(ctx->Polygon.SmoothFlag); // GL_POLYGON_SMOOTH
FALLBACK_IF(ctx->Polygon.StippleFlag); // GL_POLYGON_STIPPLE
//FALLBACK_IF(ctx->Stencil.Enabled); // GL_STENCIL_TEST
tex.image->width /=4;
#endif
+ #if 0
+ sleep(1);
+
+ fprintf(stderr, "*** Uploading texture\n");
+ fprintf(stderr, " offset=0x%08x\n", offset);
+ fprintf(stderr, " image width=%d height=%d\n",
+ imageWidth, imageHeight);
+ fprintf(stderr, " blit width=%d height=%d data=%p\n",
+ t->image[face][hwlevel].width,
+ t->image[face][hwlevel].height,
+ t->image[face][hwlevel].data);
+ #endif
+
LOCK_HARDWARE(&rmesa->radeon);
do {
ret = drmCommandWriteRead(rmesa->radeon.dri.fd, DRM_RADEON_TEXTURE,