<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">I should have add a link to the initial
patch:<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="http://lists.x.org/archives/xorg-devel/2011-June/023102.html"
target="_blank" style="margin: 0px; padding: 0px; border: 0px
none; vertical-align: baseline; text-decoration: none; color:
rgb(102, 17, 204); cursor: pointer; font-size: 13px; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
word-spacing: 0px; background-color: rgb(255, 255, 255);">http://lists.x.org/archives/<wbr>xorg-devel/2011-June/023102.<wbr>html</a><span
style="color: rgb(34, 34, 34); font-size: 13px; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
word-spacing: 0px; background-color: rgb(255, 255, 255);
display: inline ! important; float: none;"><span
class="Apple-converted-space"> </span></span><br>
<br>
Other versions of the patch are:<br style="color: rgb(34, 34, 34);
font-size: 13px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
normal; text-align: start; text-indent: 0px; text-transform:
none; white-space: normal; word-spacing: 0px; background-color:
rgb(255, 255, 255);">
<small><u><font color="#3366ff"><a
href="http://lists.x.org/archives/xorg-devel/2012-November/034446.html"
target="_blank" style="margin: 0px; padding: 0px; border:
0px none; vertical-align: baseline; text-decoration: none;
cursor: pointer; font-size: 13px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; text-align: start;
text-indent: 0px; text-transform: none; white-space:
normal; word-spacing: 0px; background-color: rgb(255, 255,
255);">http://lists.x.org/archives/<wbr>xorg-devel/2012-November/<wbr>034446.html</a><span
style="font-size: 13px; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; word-spacing:
0px; background-color: rgb(255, 255, 255); display: inline
! important; float: none;"><span
class="Apple-converted-space"> </span></span><br>
<a class="moz-txt-link-freetext" href="http://lists.x.org/archives/xorg-devel/2013-September/037661.html">http://lists.x.org/archives/xorg-devel/2013-September/037661.html</a></font></u></small><br>
<br>
Le 17/10/2013 00:16, Axel Davy a écrit :<br>
</div>
<blockquote
cite="mid:1381961819-3400-2-git-send-email-axel.davy@ens.fr"
type="cite">
<pre wrap="">The patch is a modified version of a Chris Wilson patch of 2011.
It makes the X server call AsyncSwap, defined by the DDX, when
it does a dri2 swap and swap_interval is 0. It allows the DDX
to avoid the copy if possible, and reduce tearings.
Signed-off-by: Axel Davy <a class="moz-txt-link-rfc2396E" href="mailto:axel.davy@ens.fr"><axel.davy@ens.fr></a>
---
hw/xfree86/dri2/dri2.c | 36 ++++++++++++++++++++++++------------
hw/xfree86/dri2/dri2.h | 8 +++++++-
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 483d630..7b06da9 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -118,6 +118,7 @@ typedef struct _DRI2Screen {
DRI2CreateBufferProcPtr CreateBuffer;
DRI2DestroyBufferProcPtr DestroyBuffer;
DRI2CopyRegionProcPtr CopyRegion;
+ DRI2AsyncSwapProcPtr AsyncSwap;
DRI2ScheduleSwapProcPtr ScheduleSwap;
DRI2GetMSCProcPtr GetMSC;
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
@@ -1107,20 +1108,30 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
/* Old DDX or no swap interval, just blit */
if (!ds->ScheduleSwap || !pPriv->swap_interval || pPriv->prime_id) {
- BoxRec box;
- RegionRec region;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pDraw->width;
- box.y2 = pDraw->height;
- RegionInit(®ion, &box, 0);
-
pPriv->swapsPending++;
- dri2_copy_region(pDraw, ®ion, pDestBuffer, pSrcBuffer);
- DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
- func, data);
+ if (ds->AsyncSwap)
+ {
+ (*ds->AsyncSwap)(client, pDraw,
+ pDestBuffer, pSrcBuffer,
+ func, data);
+ DRI2InvalidateDrawableAll(pDraw);
+ }
+ else
+ {
+ BoxRec box;
+ RegionRec region;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pDraw->width;
+ box.y2 = pDraw->height;
+ RegionInit(®ion, &box, 0);
+
+ dri2_copy_region(pDraw, ®ion, pDestBuffer, pSrcBuffer);
+ DRI2SwapComplete(client, pDraw, target_msc, 0, 0,
+ DRI2_BLIT_COMPLETE, func, data);
+ }
return Success;
}
@@ -1463,6 +1474,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
if (info->version >= 10) {
ds->AuthMagic = info->AuthMagic3;
+ ds->AsyncSwap = info->AsyncSwap;
}
if (info->version >= 8) {
ds->LegacyAuthMagic2 = info->AuthMagic2;
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index ed67d01..f376e42 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -52,7 +52,12 @@ extern CARD8 dri2_minor;
typedef DRI2BufferRec DRI2Buffer2Rec, *DRI2Buffer2Ptr;
typedef void (*DRI2SwapEventPtr) (ClientPtr client, void *data, int type,
CARD64 ust, CARD64 msc, CARD32 sbc);
-
+typedef void (*DRI2AsyncSwapProcPtr)(ClientPtr client,
+ DrawablePtr pDraw,
+ DRI2BufferPtr pDestBuffer,
+ DRI2BufferPtr pSrcBuffer,
+ DRI2SwapEventPtr func,
+ void *data);
typedef DRI2BufferPtr(*DRI2CreateBuffersProcPtr) (DrawablePtr pDraw,
unsigned int *attachments,
int count);
@@ -257,6 +262,7 @@ typedef struct {
/* added in version 10 */
DRI2AuthMagic3ProcPtr AuthMagic3;
+ DRI2AsyncSwapProcPtr AsyncSwap;
} DRI2InfoRec, *DRI2InfoPtr;
extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);
</pre>
</blockquote>
<br>
</body>
</html>