dri/nouveau: Don't request a fake front unnecessarily.
This commit is contained in:
parent
39658f32ea
commit
bfc7518ab9
|
@ -183,6 +183,7 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
|
|||
GLcontext *ctx = dri_ctx->driverPrivate;
|
||||
__DRIscreen *screen = dri_ctx->driScreenPriv;
|
||||
struct gl_framebuffer *fb = draw->driverPrivate;
|
||||
struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
|
||||
unsigned int attachments[10];
|
||||
__DRIbuffer *buffers = NULL;
|
||||
int i = 0, count, ret;
|
||||
|
@ -191,7 +192,8 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
|
|||
return;
|
||||
draw->lastStamp = *draw->pStamp;
|
||||
|
||||
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
|
||||
if (nfb->need_front)
|
||||
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
|
||||
if (fb->Visual.doubleBufferMode)
|
||||
attachments[i++] = __DRI_BUFFER_BACK_LEFT;
|
||||
if (fb->Visual.haveDepthBuffer && fb->Visual.haveStencilBuffer)
|
||||
|
@ -327,6 +329,25 @@ nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode)
|
|||
FIRE_RING(context_chan(ctx));
|
||||
}
|
||||
|
||||
static void
|
||||
validate_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw,
|
||||
int *stamp)
|
||||
{
|
||||
struct gl_framebuffer *fb = draw->driverPrivate;
|
||||
struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
|
||||
GLboolean need_front =
|
||||
(fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT ||
|
||||
fb->_ColorReadBufferIndex == BUFFER_FRONT_LEFT);
|
||||
|
||||
if (nfb->need_front != need_front) {
|
||||
nfb->need_front = need_front;
|
||||
dri2InvalidateDrawable(draw);
|
||||
}
|
||||
|
||||
if (*draw->pStamp != *stamp)
|
||||
update_framebuffer(dri_ctx, draw, stamp);
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_validate_framebuffer(GLcontext *ctx)
|
||||
{
|
||||
|
@ -334,15 +355,13 @@ nouveau_validate_framebuffer(GLcontext *ctx)
|
|||
__DRIdrawable *dri_draw = dri_ctx->driDrawablePriv;
|
||||
__DRIdrawable *dri_read = dri_ctx->driReadablePriv;
|
||||
|
||||
if (ctx->DrawBuffer->Name == 0 &&
|
||||
dri_ctx->dri2.draw_stamp != *dri_draw->pStamp)
|
||||
update_framebuffer(dri_ctx, dri_draw,
|
||||
&dri_ctx->dri2.draw_stamp);
|
||||
if (ctx->DrawBuffer->Name == 0)
|
||||
validate_framebuffer(dri_ctx, dri_draw,
|
||||
&dri_ctx->dri2.draw_stamp);
|
||||
|
||||
if (ctx->ReadBuffer->Name == 0 && dri_draw != dri_read &&
|
||||
dri_ctx->dri2.read_stamp != *dri_read->pStamp)
|
||||
update_framebuffer(dri_ctx, dri_read,
|
||||
&dri_ctx->dri2.read_stamp);
|
||||
if (ctx->ReadBuffer->Name == 0)
|
||||
validate_framebuffer(dri_ctx, dri_read,
|
||||
&dri_ctx->dri2.read_stamp);
|
||||
|
||||
if (nouveau_next_dirty_state(ctx) >= 0) {
|
||||
nouveau_state_emit(ctx);
|
||||
|
|
|
@ -189,6 +189,7 @@ nouveau_framebuffer_dri_new(const GLvisual *visual)
|
|||
return NULL;
|
||||
|
||||
_mesa_initialize_window_framebuffer(&nfb->base, visual);
|
||||
nfb->need_front = !visual->doubleBufferMode;
|
||||
|
||||
return &nfb->base;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
struct nouveau_framebuffer {
|
||||
struct gl_framebuffer base;
|
||||
struct nouveau_bo *lma_bo;
|
||||
GLboolean need_front;
|
||||
};
|
||||
#define to_nouveau_framebuffer(x) ((struct nouveau_framebuffer *)(x))
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ nouveau_create_buffer(__DRIscreen *dri_screen,
|
|||
const __GLcontextModes *visual,
|
||||
GLboolean is_pixmap)
|
||||
{
|
||||
struct gl_renderbuffer *rb;
|
||||
struct gl_renderbuffer *rb;
|
||||
struct gl_framebuffer *fb;
|
||||
GLenum color_format;
|
||||
|
||||
|
|
|
@ -112,15 +112,10 @@ nouveau_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval)
|
|||
context_dirty(ctx, VIEWPORT);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_draw_buffer(GLcontext *ctx, GLenum buffer)
|
||||
{
|
||||
context_dirty(ctx, FRAMEBUFFER);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_draw_buffers(GLcontext *ctx, GLsizei n, const GLenum *buffers)
|
||||
{
|
||||
nouveau_validate_framebuffer(ctx);
|
||||
context_dirty(ctx, FRAMEBUFFER);
|
||||
}
|
||||
|
||||
|
@ -519,7 +514,6 @@ nouveau_state_init(GLcontext *ctx)
|
|||
ctx->Driver.DepthFunc = nouveau_depth_func;
|
||||
ctx->Driver.DepthMask = nouveau_depth_mask;
|
||||
ctx->Driver.DepthRange = nouveau_depth_range;
|
||||
ctx->Driver.DrawBuffer = nouveau_draw_buffer;
|
||||
ctx->Driver.DrawBuffers = nouveau_draw_buffers;
|
||||
ctx->Driver.Enable = nouveau_enable;
|
||||
ctx->Driver.Fogfv = nouveau_fog;
|
||||
|
|
Loading…
Reference in New Issue