mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
fix page flipping breakage
This commit is contained in:
parent
98e92d261b
commit
da84f0b642
4 changed files with 27 additions and 92 deletions
|
|
@ -49,9 +49,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "r200_sanity.h"
|
||||
#include "radeon_reg.h"
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
#include "vblank.h"
|
||||
|
||||
|
||||
#define R200_TIMEOUT 512
|
||||
#define R200_IDLE_RETRY 16
|
||||
|
||||
|
|
@ -573,6 +573,13 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv )
|
|||
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
|
||||
}
|
||||
#else
|
||||
/* Get ready for drawing next frame. Update the renderbuffers'
|
||||
* flippedOffset/Pitch fields so we draw into the right place.
|
||||
*/
|
||||
driFlipRenderbuffers(rmesa->glCtx->WinSysDrawBuffer,
|
||||
rmesa->sarea->pfCurrentPage);
|
||||
|
||||
|
||||
r200UpdateDrawBuffer(rmesa->glCtx);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,15 +32,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "r200_context.h"
|
||||
#include "r200_lock.h"
|
||||
#include "r200_tex.h"
|
||||
#include "r200_state.h"
|
||||
#include "r200_ioctl.h"
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
|
||||
#if DEBUG_LOCKING
|
||||
char *prevLockFile = NULL;
|
||||
int prevLockLine = 0;
|
||||
|
|
@ -51,62 +52,10 @@ int prevLockLine = 0;
|
|||
static void
|
||||
r200UpdatePageFlipping( r200ContextPtr rmesa )
|
||||
{
|
||||
#if 000
|
||||
int use_back;
|
||||
rmesa->doPageFlip = rmesa->sarea->pfState;
|
||||
|
||||
use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
|
||||
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
|
||||
|
||||
if (use_back) {
|
||||
rmesa->state.color.drawOffset = rmesa->r200Screen->backOffset;
|
||||
rmesa->state.color.drawPitch = rmesa->r200Screen->backPitch;
|
||||
} else {
|
||||
rmesa->state.color.drawOffset = rmesa->r200Screen->frontOffset;
|
||||
rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
|
||||
if (!rmesa->doPageFlip) {
|
||||
driFlipRenderbuffers(rmesa->glCtx->WinSysDrawBuffer, GL_FALSE);
|
||||
}
|
||||
|
||||
R200_STATECHANGE( rmesa, ctx );
|
||||
rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] = rmesa->state.color.drawOffset
|
||||
+ rmesa->r200Screen->fbLocation;
|
||||
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = rmesa->state.color.drawPitch;
|
||||
#else
|
||||
if (rmesa->doPageFlip != rmesa->sarea->pfState
|
||||
|| rmesa->sarea->pfState) {
|
||||
/* If page flipping is on, or we're turning it on/off now we need
|
||||
* to update the flipped buffer info.
|
||||
*/
|
||||
struct gl_framebuffer *fb = rmesa->glCtx->WinSysDrawBuffer;
|
||||
driRenderbuffer *front_drb
|
||||
= (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
|
||||
driRenderbuffer *back_drb
|
||||
= (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
|
||||
|
||||
if (rmesa->sarea->pfState && rmesa->sarea->pfCurrentPage == 1) {
|
||||
/* flipped buffers */
|
||||
front_drb->flippedOffset = back_drb->offset;
|
||||
front_drb->flippedPitch = back_drb->pitch;
|
||||
back_drb->flippedOffset = front_drb->offset;
|
||||
back_drb->flippedPitch = front_drb->pitch;
|
||||
}
|
||||
else {
|
||||
/* unflipped buffers */
|
||||
front_drb->flippedOffset = front_drb->offset;
|
||||
front_drb->flippedPitch = front_drb->pitch;
|
||||
if (back_drb) {
|
||||
/* back buffer is non-existant when single buffered */
|
||||
back_drb->flippedOffset = back_drb->offset;
|
||||
back_drb->flippedPitch = back_drb->pitch;
|
||||
}
|
||||
}
|
||||
|
||||
/* update local state */
|
||||
rmesa->doPageFlip = rmesa->sarea->pfState;
|
||||
|
||||
/* set hw.ctx.cmd state here */
|
||||
r200UpdateDrawBuffer(rmesa->glCtx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define STANDALONE_MMIO
|
||||
#include "radeon_macros.h" /* for INREG() */
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
#include "vblank.h"
|
||||
|
||||
#define RADEON_TIMEOUT 512
|
||||
|
|
@ -999,6 +1000,12 @@ void radeonPageFlip( const __DRIdrawablePrivate *dPriv )
|
|||
rmesa->swap_count++;
|
||||
(void) (*dri_interface->getUST)( & rmesa->swap_ust );
|
||||
|
||||
/* Get ready for drawing next frame. Update the renderbuffers'
|
||||
* flippedOffset/Pitch fields so we draw into the right place.
|
||||
*/
|
||||
driFlipRenderbuffers(rmesa->glCtx->WinSysDrawBuffer,
|
||||
rmesa->sarea->pfCurrentPage);
|
||||
|
||||
radeonUpdateDrawBuffer(rmesa->glCtx);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "radeon_tex.h"
|
||||
#include "radeon_state.h"
|
||||
#include "radeon_ioctl.h"
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
|
||||
#if DEBUG_LOCKING
|
||||
char *prevLockFile = NULL;
|
||||
int prevLockLine = 0;
|
||||
|
|
@ -52,40 +54,9 @@ int prevLockLine = 0;
|
|||
static void
|
||||
radeonUpdatePageFlipping( radeonContextPtr rmesa )
|
||||
{
|
||||
if (rmesa->doPageFlip != rmesa->sarea->pfState
|
||||
|| rmesa->sarea->pfState) {
|
||||
/* If page flipping is on, re we're turning it on/off now we need
|
||||
* to update the flipped buffer info.
|
||||
*/
|
||||
struct gl_framebuffer *fb = rmesa->glCtx->WinSysDrawBuffer;
|
||||
driRenderbuffer *front_drb
|
||||
= (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
|
||||
driRenderbuffer *back_drb
|
||||
= (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
|
||||
|
||||
if (rmesa->sarea->pfState && rmesa->sarea->pfCurrentPage == 1) {
|
||||
/* flipped buffers */
|
||||
front_drb->flippedOffset = back_drb->offset;
|
||||
front_drb->flippedPitch = back_drb->pitch;
|
||||
back_drb->flippedOffset = front_drb->offset;
|
||||
back_drb->flippedPitch = front_drb->pitch;
|
||||
}
|
||||
else {
|
||||
/* unflipped buffers */
|
||||
front_drb->flippedOffset = front_drb->offset;
|
||||
front_drb->flippedPitch = front_drb->pitch;
|
||||
if (back_drb) {
|
||||
/* back buffer is non-existant when single buffered */
|
||||
back_drb->flippedOffset = back_drb->offset;
|
||||
back_drb->flippedPitch = back_drb->pitch;
|
||||
}
|
||||
}
|
||||
|
||||
/* update local state */
|
||||
rmesa->doPageFlip = rmesa->sarea->pfState;
|
||||
|
||||
/* set hw.ctx.cmd state here */
|
||||
radeonUpdateDrawBuffer(rmesa->glCtx);
|
||||
rmesa->doPageFlip = rmesa->sarea->pfState;
|
||||
if (!rmesa->doPageFlip) {
|
||||
driFlipRenderbuffers(rmesa->glCtx->WinSysDrawBuffer, GL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +88,6 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
|
|||
*/
|
||||
DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
|
||||
|
||||
|
||||
if ( rmesa->lastStamp != dPriv->lastStamp ) {
|
||||
radeonUpdatePageFlipping( rmesa );
|
||||
if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
|
||||
|
|
@ -132,7 +102,9 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
|
|||
if (rmesa->sarea->tiling_enabled) {
|
||||
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= RADEON_COLOR_TILE_ENABLE;
|
||||
}
|
||||
else rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] &= ~RADEON_COLOR_TILE_ENABLE;
|
||||
else {
|
||||
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] &= ~RADEON_COLOR_TILE_ENABLE;
|
||||
}
|
||||
|
||||
if ( sarea->ctx_owner != rmesa->dri.hwContext ) {
|
||||
int i;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue