mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-28 07:30:22 +01:00
Merge branch 'i915tex_privbuffers' into softpipe_0_1_branch
This commit is contained in:
commit
bb1b01616b
9 changed files with 183 additions and 114 deletions
|
|
@ -463,6 +463,7 @@ i915_state_draw_region(struct intel_context *intel,
|
|||
* Set stride/cpp values
|
||||
*/
|
||||
if (color_region) {
|
||||
// fprintf(stderr, "color pitch %d\n", color_region->pitch);
|
||||
state->Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
|
||||
state->Buffer[I915_DESTREG_CBUFADDR1] =
|
||||
(BUF_3D_ID_COLOR_BACK |
|
||||
|
|
@ -471,6 +472,7 @@ i915_state_draw_region(struct intel_context *intel,
|
|||
}
|
||||
|
||||
if (depth_region) {
|
||||
// fprintf(stderr, "depth pitch %d\n", depth_region->pitch);
|
||||
state->Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
|
||||
state->Buffer[I915_DESTREG_DBUFADDR1] =
|
||||
(BUF_3D_ID_DEPTH |
|
||||
|
|
|
|||
|
|
@ -79,15 +79,25 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
|||
*/
|
||||
LOCK_HARDWARE(intel);
|
||||
|
||||
if (intel->revalidateDrawable) {
|
||||
__DRIscreenPrivate *sPriv = intel->driScreen;
|
||||
if (dPriv) {
|
||||
DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
|
||||
}
|
||||
}
|
||||
|
||||
if (dPriv && dPriv->numClipRects) {
|
||||
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
|
||||
const struct intel_region *frontRegion
|
||||
= intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT);
|
||||
= intelScreen->front_region;
|
||||
const struct intel_region *backRegion
|
||||
= intel_get_rb_region(&intel_fb->Base, BUFFER_BACK_LEFT);
|
||||
= intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT ?
|
||||
intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT) :
|
||||
intel_get_rb_region(&intel_fb->Base, BUFFER_BACK_LEFT);
|
||||
const int nbox = dPriv->numClipRects;
|
||||
const drm_clip_rect_t *pbox = dPriv->pClipRects;
|
||||
const int pitch = frontRegion->pitch;
|
||||
const int srcpitch = backRegion->pitch;
|
||||
const int cpp = frontRegion->cpp;
|
||||
int BR13, CMD;
|
||||
int i;
|
||||
|
|
@ -96,9 +106,12 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
|||
ASSERT(intel_fb->Base.Name == 0); /* Not a user-created FBO */
|
||||
ASSERT(frontRegion);
|
||||
ASSERT(backRegion);
|
||||
ASSERT(frontRegion->pitch == backRegion->pitch);
|
||||
// ASSERT(frontRegion->pitch == backRegion->pitch);
|
||||
ASSERT(frontRegion->cpp == backRegion->cpp);
|
||||
|
||||
DBG("front pitch %d back pitch %d\n",
|
||||
frontRegion->pitch, backRegion->pitch);
|
||||
|
||||
if (cpp == 2) {
|
||||
BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24);
|
||||
CMD = XY_SRC_COPY_BLT_CMD;
|
||||
|
|
@ -111,6 +124,7 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
|||
|
||||
for (i = 0; i < nbox; i++, pbox++) {
|
||||
drm_clip_rect_t box;
|
||||
drm_clip_rect_t sbox;
|
||||
|
||||
if (pbox->x1 > pbox->x2 ||
|
||||
pbox->y1 > pbox->y2 ||
|
||||
|
|
@ -133,6 +147,14 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
|||
continue;
|
||||
}
|
||||
|
||||
DBG("box x1 x2 y1 y2 %d %d %d %d\n",
|
||||
box.x1, box.x2, box.y1, box.y2);
|
||||
|
||||
/* XXX should make sure only the minimum area based on
|
||||
old draw buffer and new front clip rects is copied */
|
||||
sbox.x1 = box.x1 - dPriv->x;
|
||||
sbox.y1 = box.y1 - dPriv->y;
|
||||
|
||||
BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS);
|
||||
OUT_BATCH(CMD);
|
||||
OUT_BATCH(BR13);
|
||||
|
|
@ -141,8 +163,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
|||
|
||||
OUT_RELOC(frontRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
|
||||
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
|
||||
OUT_BATCH((pbox->y1 << 16) | pbox->x1);
|
||||
OUT_BATCH(BR13 & 0xffff);
|
||||
OUT_BATCH((sbox.y1 << 16) | sbox.x1);
|
||||
OUT_BATCH((srcpitch * cpp) & 0xffff);
|
||||
OUT_RELOC(backRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
|
||||
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);
|
||||
|
||||
|
|
@ -156,6 +178,12 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
|||
}
|
||||
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
if (intel->revalidateDrawable) {
|
||||
intel->revalidateDrawable = GL_FALSE;
|
||||
intelWindowMoved(intel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -409,9 +437,8 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask)
|
|||
b = *box;
|
||||
}
|
||||
|
||||
if (0)
|
||||
_mesa_printf("clear %d,%d..%d,%d, mask %x\n",
|
||||
b.x1, b.y1, b.x2, b.y2, mask);
|
||||
DBG("clear %d,%d..%d,%d, mask %x\n",
|
||||
b.x1, b.y1, b.x2, b.y2, mask);
|
||||
|
||||
/* Loop over all renderbuffers */
|
||||
for (buf = 0; buf < BUFFER_COUNT && clearMask; buf++) {
|
||||
|
|
|
|||
|
|
@ -146,56 +146,29 @@ intelSetRenderbufferClipRects(struct intel_context *intel)
|
|||
intel->drawY = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* As above, but for rendering to front buffer of a window.
|
||||
* \sa intelSetRenderbufferClipRects
|
||||
* As above, but for rendering private front/back buffer of a window.
|
||||
* \sa intelSetPrivbufClipRects
|
||||
*/
|
||||
|
||||
static void
|
||||
intelSetFrontClipRects(struct intel_context *intel)
|
||||
intelSetPrivbufClipRects(struct intel_context *intel)
|
||||
{
|
||||
__DRIdrawablePrivate *dPriv = intel->driDrawable;
|
||||
|
||||
if (!dPriv)
|
||||
return;
|
||||
|
||||
intel->numClipRects = dPriv->numClipRects;
|
||||
intel->pClipRects = dPriv->pClipRects;
|
||||
intel->drawX = dPriv->x;
|
||||
intel->drawY = dPriv->y;
|
||||
intel->fakeClipRect.x1 = 0;
|
||||
intel->fakeClipRect.y1 = 0;
|
||||
intel->fakeClipRect.x2 = dPriv->w;
|
||||
intel->fakeClipRect.y2 = dPriv->h;
|
||||
intel->numClipRects = 1;
|
||||
intel->pClipRects = &intel->fakeClipRect;
|
||||
intel->drawX = 0;
|
||||
intel->drawY = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* As above, but for rendering to back buffer of a window.
|
||||
*/
|
||||
static void
|
||||
intelSetBackClipRects(struct intel_context *intel)
|
||||
{
|
||||
__DRIdrawablePrivate *dPriv = intel->driDrawable;
|
||||
struct intel_framebuffer *intel_fb;
|
||||
|
||||
if (!dPriv)
|
||||
return;
|
||||
|
||||
intel_fb = dPriv->driverPrivate;
|
||||
|
||||
if (intel_fb->pf_active || dPriv->numBackClipRects == 0) {
|
||||
/* use the front clip rects */
|
||||
intel->numClipRects = dPriv->numClipRects;
|
||||
intel->pClipRects = dPriv->pClipRects;
|
||||
intel->drawX = dPriv->x;
|
||||
intel->drawY = dPriv->y;
|
||||
}
|
||||
else {
|
||||
/* use the back clip rects */
|
||||
intel->numClipRects = dPriv->numBackClipRects;
|
||||
intel->pClipRects = dPriv->pBackClipRects;
|
||||
intel->drawX = dPriv->backX;
|
||||
intel->drawY = dPriv->backY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This will be called whenever the currently bound window is moved/resized.
|
||||
|
|
@ -210,27 +183,10 @@ intelWindowMoved(struct intel_context *intel)
|
|||
|
||||
if (!intel->ctx.DrawBuffer) {
|
||||
/* when would this happen? -BP */
|
||||
intelSetFrontClipRects(intel);
|
||||
}
|
||||
else if (intel->ctx.DrawBuffer->Name != 0) {
|
||||
/* drawing to user-created FBO - do nothing */
|
||||
/* Cliprects would be set from intelDrawBuffer() */
|
||||
}
|
||||
else {
|
||||
/* drawing to a window */
|
||||
switch (intel_fb->Base._ColorDrawBufferMask[0]) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
intelSetFrontClipRects(intel);
|
||||
break;
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
intelSetBackClipRects(intel);
|
||||
break;
|
||||
default:
|
||||
/* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
|
||||
intelSetFrontClipRects(intel);
|
||||
}
|
||||
intel->numClipRects = 0;
|
||||
}
|
||||
|
||||
|
||||
if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) {
|
||||
drmI830Sarea *sarea = intel->sarea;
|
||||
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
|
||||
|
|
@ -479,6 +435,7 @@ void
|
|||
intelRotateWindow(struct intel_context *intel,
|
||||
__DRIdrawablePrivate * dPriv, GLuint srcBuf)
|
||||
{
|
||||
|
||||
intelScreenPrivate *screen = intel->intelScreen;
|
||||
drm_clip_rect_t fullRect;
|
||||
struct intel_framebuffer *intel_fb;
|
||||
|
|
@ -909,7 +866,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
|
|||
GLboolean missed_target;
|
||||
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
|
||||
int64_t ust;
|
||||
|
||||
|
||||
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
|
||||
|
||||
if (screen->current_rotation != 0 ||
|
||||
|
|
@ -953,10 +910,17 @@ intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
|
|||
|
||||
if (ctx->Visual.doubleBufferMode) {
|
||||
drm_clip_rect_t rect;
|
||||
#if 1
|
||||
rect.x1 = x + dPriv->x;
|
||||
rect.y1 = (dPriv->h - y - h) + dPriv->y;
|
||||
rect.x2 = rect.x1 + w;
|
||||
rect.y2 = rect.y1 + h;
|
||||
#else
|
||||
rect.x1 = x;
|
||||
rect.y1 = dPriv->h - y;
|
||||
rect.x2 = rect.x1 + w;
|
||||
rect.y2 = rect.y1 + h;
|
||||
#endif
|
||||
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
|
||||
intelCopyBuffer(dPriv, &rect);
|
||||
}
|
||||
|
|
@ -991,7 +955,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Do this here, note core Mesa, since this function is called from
|
||||
/* Do this here, not core Mesa, since this function is called from
|
||||
* many places within the driver.
|
||||
*/
|
||||
if (ctx->NewState & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) {
|
||||
|
|
@ -1015,12 +979,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
|
|||
/*
|
||||
* How many color buffers are we drawing into?
|
||||
*/
|
||||
if (fb->_NumColorDrawBuffers[0] != 1
|
||||
#if 0
|
||||
/* XXX FBO temporary - always use software rendering */
|
||||
|| 1
|
||||
#endif
|
||||
) {
|
||||
if (fb->_NumColorDrawBuffers[0] != 1) {
|
||||
/* writing to 0 or 2 or 4 color buffers */
|
||||
/*_mesa_debug(ctx, "Software rendering\n");*/
|
||||
FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE);
|
||||
|
|
@ -1040,13 +999,12 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
|
|||
* And set up cliprects.
|
||||
*/
|
||||
if (fb->Name == 0) {
|
||||
intelSetPrivbufClipRects(intel);
|
||||
/* drawing to window system buffer */
|
||||
if (front) {
|
||||
intelSetFrontClipRects(intel);
|
||||
colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
|
||||
}
|
||||
else {
|
||||
intelSetBackClipRects(intel);
|
||||
colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,18 +289,22 @@ intelFlush(GLcontext * ctx)
|
|||
* Check if we need to rotate/warp the front color buffer to the
|
||||
* rotated screen. We generally need to do this when we get a glFlush
|
||||
* or glFinish after drawing to the front color buffer.
|
||||
* If no rotation, just copy the private fake front buffer to the real one.
|
||||
*/
|
||||
static void
|
||||
intelCheckFrontRotate(GLcontext * ctx)
|
||||
intelCheckFrontUpdate(GLcontext * ctx)
|
||||
{
|
||||
struct intel_context *intel = intel_context(ctx);
|
||||
if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] ==
|
||||
BUFFER_BIT_FRONT_LEFT) {
|
||||
intelScreenPrivate *screen = intel->intelScreen;
|
||||
__DRIdrawablePrivate *dPriv = intel->driDrawable;
|
||||
if (screen->current_rotation != 0) {
|
||||
__DRIdrawablePrivate *dPriv = intel->driDrawable;
|
||||
intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
|
||||
}
|
||||
else {
|
||||
intelCopyBuffer(dPriv, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +316,7 @@ static void
|
|||
intelglFlush(GLcontext * ctx)
|
||||
{
|
||||
intelFlush(ctx);
|
||||
intelCheckFrontRotate(ctx);
|
||||
intelCheckFrontUpdate(ctx);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -326,7 +330,7 @@ intelFinish(GLcontext * ctx)
|
|||
driFenceUnReference(intel->batch->last_fence);
|
||||
intel->batch->last_fence = NULL;
|
||||
}
|
||||
intelCheckFrontRotate(ctx);
|
||||
intelCheckFrontUpdate(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -581,6 +585,13 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
|
|||
__DRIdrawablePrivate * driReadPriv)
|
||||
{
|
||||
|
||||
#if 0
|
||||
if (driDrawPriv) {
|
||||
fprintf(stderr, "x %d, y %d, width %d, height %d\n",
|
||||
driDrawPriv->x, driDrawPriv->y, driDrawPriv->w, driDrawPriv->h);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (driContextPriv) {
|
||||
struct intel_context *intel =
|
||||
(struct intel_context *) driContextPriv->driverPrivate;
|
||||
|
|
@ -588,6 +599,9 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
|
|||
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
|
||||
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
|
||||
|
||||
/* this is a hack so we have a valid context when the region allocation
|
||||
is done. Need a per-screen context? */
|
||||
intel->intelScreen->dummyctxptr = intel;
|
||||
|
||||
/* XXX FBO temporary fix-ups! */
|
||||
/* if the renderbuffers don't have regions, init them from the context */
|
||||
|
|
@ -625,6 +639,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
|
|||
}
|
||||
|
||||
_mesa_make_current(&intel->ctx, &intel_fb->Base, readFb);
|
||||
intel->intelScreen->dummyctxptr = &intel->ctx;
|
||||
|
||||
/* The drawbuffer won't always be updated by _mesa_make_current:
|
||||
*/
|
||||
|
|
@ -670,7 +685,8 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
|
|||
* checking must be done *after* this call:
|
||||
*/
|
||||
if (dPriv)
|
||||
DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
|
||||
intel->revalidateDrawable = GL_TRUE;
|
||||
// DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
|
||||
|
||||
if (sarea->width != intelScreen->width ||
|
||||
sarea->height != intelScreen->height ||
|
||||
|
|
@ -679,6 +695,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
|
|||
intelUpdateScreenRotation(sPriv, sarea);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (sarea->width != intel->width ||
|
||||
sarea->height != intel->height ||
|
||||
sarea->rotation != intel->current_rotation) {
|
||||
|
|
@ -721,13 +738,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
|
|||
intel->height = sarea->height;
|
||||
intel->current_rotation = sarea->rotation;
|
||||
}
|
||||
|
||||
/* Drawable changed?
|
||||
*/
|
||||
if (dPriv && intel->lastStamp != dPriv->lastStamp) {
|
||||
intelWindowMoved(intel);
|
||||
intel->lastStamp = dPriv->lastStamp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@ struct intel_context
|
|||
GLuint numClipRects; /**< cliprects for drawing */
|
||||
drm_clip_rect_t *pClipRects;
|
||||
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
|
||||
drm_clip_rect_t fakeClipRect; /**< cliprect for priv back/fake front buffers rendering */
|
||||
|
||||
int perf_boxes;
|
||||
|
||||
|
|
@ -272,6 +273,7 @@ struct intel_context
|
|||
drmI830Sarea *sarea;
|
||||
|
||||
GLuint lastStamp;
|
||||
GLuint revalidateDrawable;
|
||||
|
||||
/**
|
||||
* Configuration cache
|
||||
|
|
@ -353,7 +355,7 @@ __memcpy(void *to, const void *from, size_t n)
|
|||
/* ================================================================
|
||||
* Debugging:
|
||||
*/
|
||||
#define DO_DEBUG 0
|
||||
#define DO_DEBUG 1
|
||||
#if DO_DEBUG
|
||||
extern int INTEL_DEBUG;
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb,
|
|||
|
||||
/**
|
||||
* Called via glRenderbufferStorageEXT() to set the format and allocate
|
||||
* storage for a user-created renderbuffer.
|
||||
* storage for a user-created (or priv buffer) renderbuffer.
|
||||
*/
|
||||
static GLboolean
|
||||
intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||
|
|
@ -188,8 +188,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
|||
GLboolean softwareBuffer = GL_FALSE;
|
||||
int cpp;
|
||||
|
||||
ASSERT(rb->Name != 0);
|
||||
|
||||
switch (internalFormat) {
|
||||
case GL_R3_G3_B2:
|
||||
case GL_RGB4:
|
||||
|
|
@ -257,7 +255,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
|||
break;
|
||||
default:
|
||||
_mesa_problem(ctx,
|
||||
"Unexpected format in intel_alloc_renderbuffer_storage");
|
||||
"Unexpected format (%x) in intel_alloc_renderbuffer_storage", internalFormat);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -453,6 +451,29 @@ intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height,
|
|||
return irb;
|
||||
}
|
||||
|
||||
struct gl_renderbuffer *
|
||||
intel_new_renderbuffer_fb(GLcontext * ctx, GLuint intFormat)
|
||||
{
|
||||
struct intel_renderbuffer *irb;
|
||||
|
||||
irb = CALLOC_STRUCT(intel_renderbuffer);
|
||||
if (!irb) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_mesa_init_renderbuffer(&irb->Base, 0);
|
||||
irb->Base.ClassID = INTEL_RB_CLASS;
|
||||
irb->Base.InternalFormat = intFormat;
|
||||
|
||||
/* intel-specific methods */
|
||||
irb->Base.Delete = intel_delete_renderbuffer;
|
||||
irb->Base.AllocStorage = intel_alloc_renderbuffer_storage;
|
||||
irb->Base.GetPointer = intel_get_pointer;
|
||||
/* span routines set in alloc_storage function */
|
||||
|
||||
return &irb->Base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new renderbuffer object.
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ intelMapScreenRegions(__DRIscreenPrivate * sPriv)
|
|||
_mesa_warning(NULL, "no front buffer handle in intelMapScreenRegions!");
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (0)
|
||||
_mesa_printf("Back 0x%08x ", intelScreen->back.handle);
|
||||
if (drmMap(sPriv->fd,
|
||||
|
|
@ -119,6 +120,7 @@ intelMapScreenRegions(__DRIscreenPrivate * sPriv)
|
|||
intelUnmapScreenRegions(intelScreen);
|
||||
return GL_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
_mesa_printf("TEX 0x%08x ", intelScreen->tex.handle);
|
||||
|
|
@ -156,7 +158,7 @@ intel_recreate_static(intelScreenPrivate *intelScreen,
|
|||
}
|
||||
return region;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Create intel_region structs to describe the static front,back,depth
|
||||
* buffers created by the xserver.
|
||||
|
|
@ -172,6 +174,7 @@ intel_recreate_static(intelScreenPrivate *intelScreen,
|
|||
static void
|
||||
intel_recreate_static_regions(intelScreenPrivate *intelScreen)
|
||||
{
|
||||
/* this is the real front buffer which is only used for blitting to */
|
||||
intelScreen->front_region =
|
||||
intel_recreate_static(intelScreen,
|
||||
intelScreen->front_region,
|
||||
|
|
@ -192,7 +195,7 @@ intel_recreate_static_regions(intelScreenPrivate *intelScreen)
|
|||
intelScreen->rotated.pitch /
|
||||
intelScreen->cpp, intelScreen->height);
|
||||
|
||||
|
||||
#if 0
|
||||
intelScreen->back_region =
|
||||
intel_recreate_static(intelScreen,
|
||||
intelScreen->back_region,
|
||||
|
|
@ -226,6 +229,7 @@ intel_recreate_static_regions(intelScreenPrivate *intelScreen)
|
|||
intelScreen->cpp,
|
||||
intelScreen->depth.pitch / intelScreen->cpp,
|
||||
intelScreen->height);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -382,7 +386,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
|
|||
intelScreen->rotatedWidth = sarea->virtualX;
|
||||
intelScreen->rotatedHeight = sarea->virtualY;
|
||||
|
||||
if (0)
|
||||
if (1)
|
||||
intelPrintSAREA(sarea);
|
||||
}
|
||||
|
||||
|
|
@ -600,6 +604,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
|
|||
|
||||
_mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
|
||||
|
||||
#if 0
|
||||
/* setup the hardware-based renderbuffers */
|
||||
{
|
||||
intel_fb->color_rb[0]
|
||||
|
|
@ -640,7 +645,6 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
|
|||
_mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
|
||||
}
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
|
||||
/* combined depth/stencil buffer */
|
||||
struct intel_renderbuffer *depthStencilRb
|
||||
|
|
@ -670,6 +674,50 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
|
|||
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
/* fake frontbuffer */
|
||||
/* XXX allocation should only happen in the unusual case
|
||||
it's actually needed */
|
||||
intel_fb->color_rb[0]
|
||||
= intel_new_renderbuffer_fb(NULL, rgbFormat);
|
||||
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT,
|
||||
&intel_fb->color_rb[0]->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
intel_fb->color_rb[1]
|
||||
= intel_new_renderbuffer_fb(NULL, rgbFormat);
|
||||
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT,
|
||||
&intel_fb->color_rb[1]->Base);
|
||||
|
||||
if (screen->third.handle) {
|
||||
struct gl_renderbuffer *tmp_rb = NULL;
|
||||
|
||||
intel_fb->color_rb[2]
|
||||
= intel_new_renderbuffer_fb(NULL, rgbFormat);
|
||||
_mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
|
||||
}
|
||||
}
|
||||
if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
|
||||
/* combined depth/stencil buffer */
|
||||
struct intel_renderbuffer *depthStencilRb
|
||||
= intel_new_renderbuffer_fb(NULL, GL_DEPTH24_STENCIL8_EXT);
|
||||
/* note: bind RB to two attachment points */
|
||||
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH,
|
||||
&depthStencilRb->Base);
|
||||
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_STENCIL,
|
||||
&depthStencilRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 16) {
|
||||
/* just 16-bit depth buffer, no hw stencil */
|
||||
struct intel_renderbuffer *depthRb
|
||||
= intel_new_renderbuffer_fb(NULL, GL_DEPTH_COMPONENT16);
|
||||
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* now add any/all software-based renderbuffers we may need */
|
||||
_mesa_add_soft_renderbuffers(&intel_fb->Base,
|
||||
GL_FALSE, /* never sw color */
|
||||
|
|
@ -939,11 +987,18 @@ struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen)
|
|||
* context at screen creation. For now just use the current context.
|
||||
*/
|
||||
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
/* GET_CURRENT_CONTEXT(ctx);
|
||||
if (ctx == NULL) {
|
||||
_mesa_problem(NULL, "No current context in intelScreenContext\n");
|
||||
return NULL;
|
||||
}
|
||||
return intel_context(ctx);
|
||||
*/
|
||||
if (intelScreen->dummyctxptr == NULL) {
|
||||
_mesa_problem(NULL, "No current context in intelScreenContext\n");
|
||||
return NULL;
|
||||
}
|
||||
return intelScreen->dummyctxptr;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ typedef struct
|
|||
struct _DriBufferPool *staticPool;
|
||||
unsigned int maxBatchSize;
|
||||
GLboolean havePools;
|
||||
struct intel_context *dummyctxptr;
|
||||
} intelScreenPrivate;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -205,25 +205,17 @@ intelCalcViewport(GLcontext * ctx)
|
|||
GLfloat *m = intel->ViewportMatrix.m;
|
||||
GLfloat yScale, yBias;
|
||||
|
||||
if (ctx->DrawBuffer->Name) {
|
||||
/* User created FBO */
|
||||
struct intel_renderbuffer *irb
|
||||
struct intel_renderbuffer *irb
|
||||
= intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]);
|
||||
if (irb && !irb->RenderToTexture) {
|
||||
/* y=0=top */
|
||||
yScale = -1.0;
|
||||
yBias = irb->Base.Height;
|
||||
}
|
||||
else {
|
||||
/* y=0=bottom */
|
||||
yScale = 1.0;
|
||||
yBias = 0.0;
|
||||
}
|
||||
if (irb && !irb->RenderToTexture) {
|
||||
/* y=0=top */
|
||||
yScale = -1.0;
|
||||
yBias = irb->Base.Height;
|
||||
}
|
||||
else {
|
||||
/* window buffer, y=0=top */
|
||||
yScale = -1.0;
|
||||
yBias = (intel->driDrawable) ? intel->driDrawable->h : 0.0F;
|
||||
/* y=0=bottom */
|
||||
yScale = 1.0;
|
||||
yBias = 0.0;
|
||||
}
|
||||
|
||||
m[MAT_SX] = v[MAT_SX];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue