On Fri, May 1, 2009 at 1:14 PM, Joel Bosveld <joel.bosv...@gmail.com> wrote:
> I have copied the changes from intel (to radeon) regarding
> DRI2GetBuffersWithFormat. Patches for the ddx and mesa are attached. It
> requires the xserver patch here
> http://lists.x.org/archives/xorg-devel/2009-April/000779.html, as
> otherwise I am getting white borders with compiz.
>
> Together with the previous patches I sent, they should make radeon and dri2
> work with master xserver. My test (compiz and glxgears) with new mesa, ddx,
> but old xserver and dri2proto seemed to work fine as well (with the
> exception of openarena locking up, but that was also happening with an older
> server and none of my patches).
>
> It needs 2 commits from master than radeon-rewrite doesn't have:
> 532716049249b4b8905ead7127c9aa2bcfc3f67e
> 7a95e4dd7d8377c964fe2ea79acb93fe612d8d0f
>
>
There seems to be something wrong with these patches, they was working
before, and now they aren't. I'll have more of a look later on to see what
changed. Sorry for the noise.
>
>
> On Sat, Apr 25, 2009 at 11:48 AM, Joel Bosveld <joel.bosv...@gmail.com>wrote:
>
>> This fixes rendering when using dri2 (so, that means, radeon-rewrite and
>> radeon-gem-cs) and a near-master xserver (the front-buffer changes). It is
>> mostly just copied from the changes to intel.
>>
>> One patch is for mesa, and the other for the ddx:
>>
>> From 9e028a11b69361f82a3d578a2a3c14b3d7fc15fd Mon Sep 17 00:00:00 2001
>> From: Joel Bosveld <joel.bosv...@gmail.com>
>> Date: Sat, 25 Apr 2009 08:20:03 +0800
>> Subject: [PATCH] radeon: fix front-buffer rendering
>>
>> ---
>> src/mesa/drivers/dri/radeon/radeon_common.c | 27
>> ++++++++++++++++++++
>> .../drivers/dri/radeon/radeon_common_context.c | 4 +++
>> .../drivers/dri/radeon/radeon_common_context.h | 16 +++++++++++
>> 3 files changed, 47 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c
>> b/src/mesa/drivers/dri/radeon/radeon_common.c
>> index dc281ee..9e5ea9d 100644
>> --- a/src/mesa/drivers/dri/radeon/radeon_common.c
>> +++ b/src/mesa/drivers/dri/radeon/radeon_common.c
>> @@ -677,6 +677,7 @@ void radeon_draw_buffer(GLcontext *ctx, struct
>> gl_framebuffer *fb)
>> if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
>> rrbColor =
>> radeon_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
>> radeon->front_cliprects = GL_TRUE;
>> + radeon->front_buffer_dirty = GL_TRUE;
>> } else {
>> rrbColor =
>> radeon_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
>> radeon->front_cliprects = GL_FALSE;
>> @@ -792,6 +793,12 @@ void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
>> if (RADEON_DEBUG & DEBUG_DRI)
>> fprintf(stderr, "%s %s\n", __FUNCTION__,
>> _mesa_lookup_enum_by_nr( mode ));
>> +
>> + if (ctx->DrawBuffer->Name == 0) {
>> + radeonContextPtr radeon = RADEON_CONTEXT(ctx);
>> +
>> + radeon->is_front_buffer_rendering = (mode == GL_FRONT_LEFT);
>> + }
>>
>> radeon_draw_buffer(ctx, ctx->DrawBuffer);
>> }
>> @@ -1005,6 +1012,26 @@ void radeonFlush(GLcontext *ctx)
>>
>> if (radeon->cmdbuf.cs->cdw)
>> rcommonFlushCmdBuf(radeon, __FUNCTION__);
>> +
>> + if ((ctx->DrawBuffer->Name == 0) && radeon->front_buffer_dirty) {
>> + __DRIscreen *const screen = radeon->radeonScreen->driScreen;
>> +
>> + if (screen->dri2.loader && (screen->dri2.loader->base.version >=
>> 2)
>> + && (screen->dri2.loader->flushFrontBuffer != NULL)) {
>> +
>> (*screen->dri2.loader->flushFrontBuffer)(radeon->dri.drawable,
>> + radeon->dri.drawable->loaderPrivate);
>> +
>> + /* Only clear the dirty bit if front-buffer rendering is no
>> longer
>> + * enabled. This is done so that the dirty bit can only be
>> set in
>> + * glDrawBuffer. Otherwise the dirty bit would have to be
>> set at
>> + * each of N places that do rendering. This has worse
>> performances,
>> + * but it is much easier to get correct.
>> + */
>> + if (radeon->is_front_buffer_rendering) {
>> + radeon->front_buffer_dirty = GL_FALSE;
>> + }
>> + }
>> + }
>> }
>>
>> /* Make sure all commands have been sent to the hardware and have
>> diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c
>> b/src/mesa/drivers/dri/radeon/radeon_common_context.c
>> index ba74c97..cfdf52c 100644
>> --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
>> +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
>> @@ -464,6 +464,10 @@ radeon_update_renderbuffers(__DRIcontext *context,
>> __DRIdrawable *drawable)
>> rb = draw->color_rb[0];
>> regname = "dri2 front buffer";
>> break;
>> + case __DRI_BUFFER_FAKE_FRONT_LEFT:
>> + rb = draw->color_rb[0];
>> + regname = "dri2 fake front buffer";
>> + break;
>> case __DRI_BUFFER_BACK_LEFT:
>> rb = draw->color_rb[1];
>> regname = "dri2 back buffer";
>> diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h
>> b/src/mesa/drivers/dri/radeon/radeon_common_context.h
>> index d32e5af..0307c63 100644
>> --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
>> +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
>> @@ -462,6 +462,22 @@ struct radeon_context {
>> GLboolean constant_cliprect; /* use for FBO or DRI2 rendering */
>> GLboolean front_cliprects;
>>
>> + /**
>> + * Set if rendering has occured to the drawable's front buffer.
>> + *
>> + * This is used in the DRI2 case to detect that glFlush should also
>> copy
>> + * the contents of the fake front buffer to the real front buffer.
>> + */
>> + GLboolean front_buffer_dirty;
>> +
>> + /**
>> + * Track whether front-buffer rendering is currently enabled
>> + *
>> + * A separate flag is used to track this in order to support MRT more
>> + * easily.
>> + */
>> + GLboolean is_front_buffer_rendering;
>> +
>> struct {
>> struct gl_fragment_program *bitmap_fp;
>> struct gl_vertex_program *passthrough_vp;
>> --
>> 1.6.0.3
>>
>>
>>
>> --------
>>
>> From 10ecf4e4bb3bb70938f3e414a16280e6835c0af2 Mon Sep 17 00:00:00 2001
>> From: Joel Bosveld <joel.bosv...@gmail.com>
>> Date: Sat, 25 Apr 2009 10:53:59 +0800
>> Subject: [PATCH] radeon: fix front-buffer rendering
>>
>> ---
>> src/radeon_dri2.c | 15 +++++++++++----
>> 1 files changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
>> index eb15ff2..1497454 100644
>> --- a/src/radeon_dri2.c
>> +++ b/src/radeon_dri2.c
>> @@ -42,6 +42,7 @@
>>
>> struct dri2_buffer_priv {
>> PixmapPtr pixmap;
>> + unsigned int attachment;
>> };
>>
>>
>> @@ -105,6 +106,7 @@ radeon_dri2_create_buffers(DrawablePtr drawable,
>> buffers[i].driverPrivate = &privates[i];
>> buffers[i].flags = 0; /* not tiled */
>> privates[i].pixmap = pixmap;
>> + privates[i].attachment = attachments[i];
>> }
>> return buffers;
>> }
>> @@ -134,10 +136,15 @@ radeon_dri2_copy_region(DrawablePtr drawable,
>> DRI2BufferPtr dest_buffer,
>> DRI2BufferPtr src_buffer)
>> {
>> - struct dri2_buffer_priv *private = src_buffer->driverPrivate;
>> + struct dri2_buffer_priv *srcPrivate = src_buffer->driverPrivate;
>> + struct dri2_buffer_priv *dstPrivate = dest_buffer->driverPrivate;
>> ScreenPtr pScreen = drawable->pScreen;
>> ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
>> - PixmapPtr pixmap = private->pixmap;
>> + PixmapPtr pSrcPixmap = (srcPrivate->attachment ==
>> DRI2BufferFrontLeft)
>> + ? (PixmapPtr) drawable : srcPrivate->pixmap;
>> + PixmapPtr pDstPixmap = (dstPrivate->attachment ==
>> DRI2BufferFrontLeft)
>> + ? (PixmapPtr) drawable : dstPrivate->pixmap;
>> +
>> RegionPtr copy_clip;
>> GCPtr gc;
>>
>> @@ -145,8 +152,8 @@ radeon_dri2_copy_region(DrawablePtr drawable,
>> copy_clip = REGION_CREATE(pScreen, NULL, 0);
>> REGION_COPY(pScreen, copy_clip, region);
>> (*gc->funcs->ChangeClip) (gc, CT_REGION, copy_clip, 0);
>> - ValidateGC(drawable, gc);
>> - (*gc->ops->CopyArea)(&pixmap->drawable, drawable, gc,
>> + ValidateGC(&pDstPixmap->drawable, gc);
>> + (*gc->ops->CopyArea)(&pSrcPixmap->drawable, &pDstPixmap->drawable,
>> gc,
>> 0, 0, drawable->width, drawable->height, 0, 0);
>> FreeScratchGC(gc);
>> RADEONCPReleaseIndirect(pScrn);
>> --
>> 1.6.0.3
>>
>>
>
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel