mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 19:58:09 +02: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
|
* Set stride/cpp values
|
||||||
*/
|
*/
|
||||||
if (color_region) {
|
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_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
|
||||||
state->Buffer[I915_DESTREG_CBUFADDR1] =
|
state->Buffer[I915_DESTREG_CBUFADDR1] =
|
||||||
(BUF_3D_ID_COLOR_BACK |
|
(BUF_3D_ID_COLOR_BACK |
|
||||||
|
|
@ -471,6 +472,7 @@ i915_state_draw_region(struct intel_context *intel,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth_region) {
|
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_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
|
||||||
state->Buffer[I915_DESTREG_DBUFADDR1] =
|
state->Buffer[I915_DESTREG_DBUFADDR1] =
|
||||||
(BUF_3D_ID_DEPTH |
|
(BUF_3D_ID_DEPTH |
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,25 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
||||||
*/
|
*/
|
||||||
LOCK_HARDWARE(intel);
|
LOCK_HARDWARE(intel);
|
||||||
|
|
||||||
|
if (intel->revalidateDrawable) {
|
||||||
|
__DRIscreenPrivate *sPriv = intel->driScreen;
|
||||||
|
if (dPriv) {
|
||||||
|
DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dPriv && dPriv->numClipRects) {
|
if (dPriv && dPriv->numClipRects) {
|
||||||
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
|
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
|
||||||
const struct intel_region *frontRegion
|
const struct intel_region *frontRegion
|
||||||
= intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT);
|
= intelScreen->front_region;
|
||||||
const struct intel_region *backRegion
|
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 int nbox = dPriv->numClipRects;
|
||||||
const drm_clip_rect_t *pbox = dPriv->pClipRects;
|
const drm_clip_rect_t *pbox = dPriv->pClipRects;
|
||||||
const int pitch = frontRegion->pitch;
|
const int pitch = frontRegion->pitch;
|
||||||
|
const int srcpitch = backRegion->pitch;
|
||||||
const int cpp = frontRegion->cpp;
|
const int cpp = frontRegion->cpp;
|
||||||
int BR13, CMD;
|
int BR13, CMD;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -96,9 +106,12 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
||||||
ASSERT(intel_fb->Base.Name == 0); /* Not a user-created FBO */
|
ASSERT(intel_fb->Base.Name == 0); /* Not a user-created FBO */
|
||||||
ASSERT(frontRegion);
|
ASSERT(frontRegion);
|
||||||
ASSERT(backRegion);
|
ASSERT(backRegion);
|
||||||
ASSERT(frontRegion->pitch == backRegion->pitch);
|
// ASSERT(frontRegion->pitch == backRegion->pitch);
|
||||||
ASSERT(frontRegion->cpp == backRegion->cpp);
|
ASSERT(frontRegion->cpp == backRegion->cpp);
|
||||||
|
|
||||||
|
DBG("front pitch %d back pitch %d\n",
|
||||||
|
frontRegion->pitch, backRegion->pitch);
|
||||||
|
|
||||||
if (cpp == 2) {
|
if (cpp == 2) {
|
||||||
BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24);
|
BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24);
|
||||||
CMD = XY_SRC_COPY_BLT_CMD;
|
CMD = XY_SRC_COPY_BLT_CMD;
|
||||||
|
|
@ -111,6 +124,7 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
||||||
|
|
||||||
for (i = 0; i < nbox; i++, pbox++) {
|
for (i = 0; i < nbox; i++, pbox++) {
|
||||||
drm_clip_rect_t box;
|
drm_clip_rect_t box;
|
||||||
|
drm_clip_rect_t sbox;
|
||||||
|
|
||||||
if (pbox->x1 > pbox->x2 ||
|
if (pbox->x1 > pbox->x2 ||
|
||||||
pbox->y1 > pbox->y2 ||
|
pbox->y1 > pbox->y2 ||
|
||||||
|
|
@ -133,6 +147,14 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
||||||
continue;
|
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);
|
BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS);
|
||||||
OUT_BATCH(CMD);
|
OUT_BATCH(CMD);
|
||||||
OUT_BATCH(BR13);
|
OUT_BATCH(BR13);
|
||||||
|
|
@ -141,8 +163,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
||||||
|
|
||||||
OUT_RELOC(frontRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
|
OUT_RELOC(frontRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
|
||||||
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
|
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
|
||||||
OUT_BATCH((pbox->y1 << 16) | pbox->x1);
|
OUT_BATCH((sbox.y1 << 16) | sbox.x1);
|
||||||
OUT_BATCH(BR13 & 0xffff);
|
OUT_BATCH((srcpitch * cpp) & 0xffff);
|
||||||
OUT_RELOC(backRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
|
OUT_RELOC(backRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
|
||||||
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);
|
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);
|
||||||
|
|
||||||
|
|
@ -156,6 +178,12 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
||||||
}
|
}
|
||||||
|
|
||||||
UNLOCK_HARDWARE(intel);
|
UNLOCK_HARDWARE(intel);
|
||||||
|
|
||||||
|
if (intel->revalidateDrawable) {
|
||||||
|
intel->revalidateDrawable = GL_FALSE;
|
||||||
|
intelWindowMoved(intel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -409,9 +437,8 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask)
|
||||||
b = *box;
|
b = *box;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0)
|
DBG("clear %d,%d..%d,%d, mask %x\n",
|
||||||
_mesa_printf("clear %d,%d..%d,%d, mask %x\n",
|
b.x1, b.y1, b.x2, b.y2, mask);
|
||||||
b.x1, b.y1, b.x2, b.y2, mask);
|
|
||||||
|
|
||||||
/* Loop over all renderbuffers */
|
/* Loop over all renderbuffers */
|
||||||
for (buf = 0; buf < BUFFER_COUNT && clearMask; buf++) {
|
for (buf = 0; buf < BUFFER_COUNT && clearMask; buf++) {
|
||||||
|
|
|
||||||
|
|
@ -146,56 +146,29 @@ intelSetRenderbufferClipRects(struct intel_context *intel)
|
||||||
intel->drawY = 0;
|
intel->drawY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As above, but for rendering to front buffer of a window.
|
* As above, but for rendering private front/back buffer of a window.
|
||||||
* \sa intelSetRenderbufferClipRects
|
* \sa intelSetPrivbufClipRects
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
intelSetFrontClipRects(struct intel_context *intel)
|
intelSetPrivbufClipRects(struct intel_context *intel)
|
||||||
{
|
{
|
||||||
__DRIdrawablePrivate *dPriv = intel->driDrawable;
|
__DRIdrawablePrivate *dPriv = intel->driDrawable;
|
||||||
|
|
||||||
if (!dPriv)
|
if (!dPriv)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
intel->numClipRects = dPriv->numClipRects;
|
intel->fakeClipRect.x1 = 0;
|
||||||
intel->pClipRects = dPriv->pClipRects;
|
intel->fakeClipRect.y1 = 0;
|
||||||
intel->drawX = dPriv->x;
|
intel->fakeClipRect.x2 = dPriv->w;
|
||||||
intel->drawY = dPriv->y;
|
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.
|
* 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) {
|
if (!intel->ctx.DrawBuffer) {
|
||||||
/* when would this happen? -BP */
|
/* when would this happen? -BP */
|
||||||
intelSetFrontClipRects(intel);
|
intel->numClipRects = 0;
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) {
|
if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) {
|
||||||
drmI830Sarea *sarea = intel->sarea;
|
drmI830Sarea *sarea = intel->sarea;
|
||||||
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
|
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
|
||||||
|
|
@ -479,6 +435,7 @@ void
|
||||||
intelRotateWindow(struct intel_context *intel,
|
intelRotateWindow(struct intel_context *intel,
|
||||||
__DRIdrawablePrivate * dPriv, GLuint srcBuf)
|
__DRIdrawablePrivate * dPriv, GLuint srcBuf)
|
||||||
{
|
{
|
||||||
|
|
||||||
intelScreenPrivate *screen = intel->intelScreen;
|
intelScreenPrivate *screen = intel->intelScreen;
|
||||||
drm_clip_rect_t fullRect;
|
drm_clip_rect_t fullRect;
|
||||||
struct intel_framebuffer *intel_fb;
|
struct intel_framebuffer *intel_fb;
|
||||||
|
|
@ -909,7 +866,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
|
||||||
GLboolean missed_target;
|
GLboolean missed_target;
|
||||||
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
|
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
|
||||||
int64_t ust;
|
int64_t ust;
|
||||||
|
|
||||||
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
|
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
|
||||||
|
|
||||||
if (screen->current_rotation != 0 ||
|
if (screen->current_rotation != 0 ||
|
||||||
|
|
@ -953,10 +910,17 @@ intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
|
||||||
|
|
||||||
if (ctx->Visual.doubleBufferMode) {
|
if (ctx->Visual.doubleBufferMode) {
|
||||||
drm_clip_rect_t rect;
|
drm_clip_rect_t rect;
|
||||||
|
#if 1
|
||||||
rect.x1 = x + dPriv->x;
|
rect.x1 = x + dPriv->x;
|
||||||
rect.y1 = (dPriv->h - y - h) + dPriv->y;
|
rect.y1 = (dPriv->h - y - h) + dPriv->y;
|
||||||
rect.x2 = rect.x1 + w;
|
rect.x2 = rect.x1 + w;
|
||||||
rect.y2 = rect.y1 + h;
|
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 */
|
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
|
||||||
intelCopyBuffer(dPriv, &rect);
|
intelCopyBuffer(dPriv, &rect);
|
||||||
}
|
}
|
||||||
|
|
@ -991,7 +955,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
|
||||||
return;
|
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.
|
* many places within the driver.
|
||||||
*/
|
*/
|
||||||
if (ctx->NewState & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) {
|
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?
|
* How many color buffers are we drawing into?
|
||||||
*/
|
*/
|
||||||
if (fb->_NumColorDrawBuffers[0] != 1
|
if (fb->_NumColorDrawBuffers[0] != 1) {
|
||||||
#if 0
|
|
||||||
/* XXX FBO temporary - always use software rendering */
|
|
||||||
|| 1
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
/* writing to 0 or 2 or 4 color buffers */
|
/* writing to 0 or 2 or 4 color buffers */
|
||||||
/*_mesa_debug(ctx, "Software rendering\n");*/
|
/*_mesa_debug(ctx, "Software rendering\n");*/
|
||||||
FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE);
|
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.
|
* And set up cliprects.
|
||||||
*/
|
*/
|
||||||
if (fb->Name == 0) {
|
if (fb->Name == 0) {
|
||||||
|
intelSetPrivbufClipRects(intel);
|
||||||
/* drawing to window system buffer */
|
/* drawing to window system buffer */
|
||||||
if (front) {
|
if (front) {
|
||||||
intelSetFrontClipRects(intel);
|
|
||||||
colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
|
colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
intelSetBackClipRects(intel);
|
|
||||||
colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
|
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
|
* 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
|
* rotated screen. We generally need to do this when we get a glFlush
|
||||||
* or glFinish after drawing to the front color buffer.
|
* 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
|
static void
|
||||||
intelCheckFrontRotate(GLcontext * ctx)
|
intelCheckFrontUpdate(GLcontext * ctx)
|
||||||
{
|
{
|
||||||
struct intel_context *intel = intel_context(ctx);
|
struct intel_context *intel = intel_context(ctx);
|
||||||
if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] ==
|
if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] ==
|
||||||
BUFFER_BIT_FRONT_LEFT) {
|
BUFFER_BIT_FRONT_LEFT) {
|
||||||
intelScreenPrivate *screen = intel->intelScreen;
|
intelScreenPrivate *screen = intel->intelScreen;
|
||||||
|
__DRIdrawablePrivate *dPriv = intel->driDrawable;
|
||||||
if (screen->current_rotation != 0) {
|
if (screen->current_rotation != 0) {
|
||||||
__DRIdrawablePrivate *dPriv = intel->driDrawable;
|
|
||||||
intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
|
intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
intelCopyBuffer(dPriv, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,7 +316,7 @@ static void
|
||||||
intelglFlush(GLcontext * ctx)
|
intelglFlush(GLcontext * ctx)
|
||||||
{
|
{
|
||||||
intelFlush(ctx);
|
intelFlush(ctx);
|
||||||
intelCheckFrontRotate(ctx);
|
intelCheckFrontUpdate(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -326,7 +330,7 @@ intelFinish(GLcontext * ctx)
|
||||||
driFenceUnReference(intel->batch->last_fence);
|
driFenceUnReference(intel->batch->last_fence);
|
||||||
intel->batch->last_fence = NULL;
|
intel->batch->last_fence = NULL;
|
||||||
}
|
}
|
||||||
intelCheckFrontRotate(ctx);
|
intelCheckFrontUpdate(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -581,6 +585,13 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
|
||||||
__DRIdrawablePrivate * driReadPriv)
|
__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) {
|
if (driContextPriv) {
|
||||||
struct intel_context *intel =
|
struct intel_context *intel =
|
||||||
(struct intel_context *) driContextPriv->driverPrivate;
|
(struct intel_context *) driContextPriv->driverPrivate;
|
||||||
|
|
@ -588,6 +599,9 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
|
||||||
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
|
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
|
||||||
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->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! */
|
/* XXX FBO temporary fix-ups! */
|
||||||
/* if the renderbuffers don't have regions, init them from the context */
|
/* 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);
|
_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:
|
/* 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:
|
* checking must be done *after* this call:
|
||||||
*/
|
*/
|
||||||
if (dPriv)
|
if (dPriv)
|
||||||
DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
|
intel->revalidateDrawable = GL_TRUE;
|
||||||
|
// DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
|
||||||
|
|
||||||
if (sarea->width != intelScreen->width ||
|
if (sarea->width != intelScreen->width ||
|
||||||
sarea->height != intelScreen->height ||
|
sarea->height != intelScreen->height ||
|
||||||
|
|
@ -679,6 +695,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
|
||||||
intelUpdateScreenRotation(sPriv, sarea);
|
intelUpdateScreenRotation(sPriv, sarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (sarea->width != intel->width ||
|
if (sarea->width != intel->width ||
|
||||||
sarea->height != intel->height ||
|
sarea->height != intel->height ||
|
||||||
sarea->rotation != intel->current_rotation) {
|
sarea->rotation != intel->current_rotation) {
|
||||||
|
|
@ -721,13 +738,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
|
||||||
intel->height = sarea->height;
|
intel->height = sarea->height;
|
||||||
intel->current_rotation = sarea->rotation;
|
intel->current_rotation = sarea->rotation;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* Drawable changed?
|
|
||||||
*/
|
|
||||||
if (dPriv && intel->lastStamp != dPriv->lastStamp) {
|
|
||||||
intelWindowMoved(intel);
|
|
||||||
intel->lastStamp = dPriv->lastStamp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,7 @@ struct intel_context
|
||||||
GLuint numClipRects; /**< cliprects for drawing */
|
GLuint numClipRects; /**< cliprects for drawing */
|
||||||
drm_clip_rect_t *pClipRects;
|
drm_clip_rect_t *pClipRects;
|
||||||
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
|
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;
|
int perf_boxes;
|
||||||
|
|
||||||
|
|
@ -272,6 +273,7 @@ struct intel_context
|
||||||
drmI830Sarea *sarea;
|
drmI830Sarea *sarea;
|
||||||
|
|
||||||
GLuint lastStamp;
|
GLuint lastStamp;
|
||||||
|
GLuint revalidateDrawable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration cache
|
* Configuration cache
|
||||||
|
|
@ -353,7 +355,7 @@ __memcpy(void *to, const void *from, size_t n)
|
||||||
/* ================================================================
|
/* ================================================================
|
||||||
* Debugging:
|
* Debugging:
|
||||||
*/
|
*/
|
||||||
#define DO_DEBUG 0
|
#define DO_DEBUG 1
|
||||||
#if DO_DEBUG
|
#if DO_DEBUG
|
||||||
extern int INTEL_DEBUG;
|
extern int INTEL_DEBUG;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called via glRenderbufferStorageEXT() to set the format and allocate
|
* 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
|
static GLboolean
|
||||||
intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
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;
|
GLboolean softwareBuffer = GL_FALSE;
|
||||||
int cpp;
|
int cpp;
|
||||||
|
|
||||||
ASSERT(rb->Name != 0);
|
|
||||||
|
|
||||||
switch (internalFormat) {
|
switch (internalFormat) {
|
||||||
case GL_R3_G3_B2:
|
case GL_R3_G3_B2:
|
||||||
case GL_RGB4:
|
case GL_RGB4:
|
||||||
|
|
@ -257,7 +255,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_problem(ctx,
|
_mesa_problem(ctx,
|
||||||
"Unexpected format in intel_alloc_renderbuffer_storage");
|
"Unexpected format (%x) in intel_alloc_renderbuffer_storage", internalFormat);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -453,6 +451,29 @@ intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height,
|
||||||
return irb;
|
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.
|
* Create a new renderbuffer object.
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ intelMapScreenRegions(__DRIscreenPrivate * sPriv)
|
||||||
_mesa_warning(NULL, "no front buffer handle in intelMapScreenRegions!");
|
_mesa_warning(NULL, "no front buffer handle in intelMapScreenRegions!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (0)
|
if (0)
|
||||||
_mesa_printf("Back 0x%08x ", intelScreen->back.handle);
|
_mesa_printf("Back 0x%08x ", intelScreen->back.handle);
|
||||||
if (drmMap(sPriv->fd,
|
if (drmMap(sPriv->fd,
|
||||||
|
|
@ -119,6 +120,7 @@ intelMapScreenRegions(__DRIscreenPrivate * sPriv)
|
||||||
intelUnmapScreenRegions(intelScreen);
|
intelUnmapScreenRegions(intelScreen);
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
_mesa_printf("TEX 0x%08x ", intelScreen->tex.handle);
|
_mesa_printf("TEX 0x%08x ", intelScreen->tex.handle);
|
||||||
|
|
@ -156,7 +158,7 @@ intel_recreate_static(intelScreenPrivate *intelScreen,
|
||||||
}
|
}
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create intel_region structs to describe the static front,back,depth
|
/* Create intel_region structs to describe the static front,back,depth
|
||||||
* buffers created by the xserver.
|
* buffers created by the xserver.
|
||||||
|
|
@ -172,6 +174,7 @@ intel_recreate_static(intelScreenPrivate *intelScreen,
|
||||||
static void
|
static void
|
||||||
intel_recreate_static_regions(intelScreenPrivate *intelScreen)
|
intel_recreate_static_regions(intelScreenPrivate *intelScreen)
|
||||||
{
|
{
|
||||||
|
/* this is the real front buffer which is only used for blitting to */
|
||||||
intelScreen->front_region =
|
intelScreen->front_region =
|
||||||
intel_recreate_static(intelScreen,
|
intel_recreate_static(intelScreen,
|
||||||
intelScreen->front_region,
|
intelScreen->front_region,
|
||||||
|
|
@ -192,7 +195,7 @@ intel_recreate_static_regions(intelScreenPrivate *intelScreen)
|
||||||
intelScreen->rotated.pitch /
|
intelScreen->rotated.pitch /
|
||||||
intelScreen->cpp, intelScreen->height);
|
intelScreen->cpp, intelScreen->height);
|
||||||
|
|
||||||
|
#if 0
|
||||||
intelScreen->back_region =
|
intelScreen->back_region =
|
||||||
intel_recreate_static(intelScreen,
|
intel_recreate_static(intelScreen,
|
||||||
intelScreen->back_region,
|
intelScreen->back_region,
|
||||||
|
|
@ -226,6 +229,7 @@ intel_recreate_static_regions(intelScreenPrivate *intelScreen)
|
||||||
intelScreen->cpp,
|
intelScreen->cpp,
|
||||||
intelScreen->depth.pitch / intelScreen->cpp,
|
intelScreen->depth.pitch / intelScreen->cpp,
|
||||||
intelScreen->height);
|
intelScreen->height);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -382,7 +386,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
|
||||||
intelScreen->rotatedWidth = sarea->virtualX;
|
intelScreen->rotatedWidth = sarea->virtualX;
|
||||||
intelScreen->rotatedHeight = sarea->virtualY;
|
intelScreen->rotatedHeight = sarea->virtualY;
|
||||||
|
|
||||||
if (0)
|
if (1)
|
||||||
intelPrintSAREA(sarea);
|
intelPrintSAREA(sarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -600,6 +604,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
|
||||||
|
|
||||||
_mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
|
_mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* setup the hardware-based renderbuffers */
|
/* setup the hardware-based renderbuffers */
|
||||||
{
|
{
|
||||||
intel_fb->color_rb[0]
|
intel_fb->color_rb[0]
|
||||||
|
|
@ -640,7 +645,6 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
|
||||||
_mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
|
_mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
|
if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
|
||||||
/* combined depth/stencil buffer */
|
/* combined depth/stencil buffer */
|
||||||
struct intel_renderbuffer *depthStencilRb
|
struct intel_renderbuffer *depthStencilRb
|
||||||
|
|
@ -670,6 +674,50 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
|
||||||
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base);
|
_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 */
|
/* now add any/all software-based renderbuffers we may need */
|
||||||
_mesa_add_soft_renderbuffers(&intel_fb->Base,
|
_mesa_add_soft_renderbuffers(&intel_fb->Base,
|
||||||
GL_FALSE, /* never sw color */
|
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.
|
* context at screen creation. For now just use the current context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
/* GET_CURRENT_CONTEXT(ctx);
|
||||||
if (ctx == NULL) {
|
if (ctx == NULL) {
|
||||||
_mesa_problem(NULL, "No current context in intelScreenContext\n");
|
_mesa_problem(NULL, "No current context in intelScreenContext\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return intel_context(ctx);
|
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;
|
struct _DriBufferPool *staticPool;
|
||||||
unsigned int maxBatchSize;
|
unsigned int maxBatchSize;
|
||||||
GLboolean havePools;
|
GLboolean havePools;
|
||||||
|
struct intel_context *dummyctxptr;
|
||||||
} intelScreenPrivate;
|
} intelScreenPrivate;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,25 +205,17 @@ intelCalcViewport(GLcontext * ctx)
|
||||||
GLfloat *m = intel->ViewportMatrix.m;
|
GLfloat *m = intel->ViewportMatrix.m;
|
||||||
GLfloat yScale, yBias;
|
GLfloat yScale, yBias;
|
||||||
|
|
||||||
if (ctx->DrawBuffer->Name) {
|
struct intel_renderbuffer *irb
|
||||||
/* User created FBO */
|
|
||||||
struct intel_renderbuffer *irb
|
|
||||||
= intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]);
|
= intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]);
|
||||||
if (irb && !irb->RenderToTexture) {
|
if (irb && !irb->RenderToTexture) {
|
||||||
/* y=0=top */
|
/* y=0=top */
|
||||||
yScale = -1.0;
|
yScale = -1.0;
|
||||||
yBias = irb->Base.Height;
|
yBias = irb->Base.Height;
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* y=0=bottom */
|
|
||||||
yScale = 1.0;
|
|
||||||
yBias = 0.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* window buffer, y=0=top */
|
/* y=0=bottom */
|
||||||
yScale = -1.0;
|
yScale = 1.0;
|
||||||
yBias = (intel->driDrawable) ? intel->driDrawable->h : 0.0F;
|
yBias = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m[MAT_SX] = v[MAT_SX];
|
m[MAT_SX] = v[MAT_SX];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue