[PATCH] Add Option "TearFree"

2015-04-20 Thread Michel Dänzer
From: Michel Dänzer 

Avoids tearing by flipping between two scanout BOs per (non-rotated) CRTC

Signed-off-by: Michel Dänzer 
---
 man/radeon.man|   7 +++
 src/drmmode_display.c |  78 -
 src/drmmode_display.h |   5 +-
 src/radeon.h  |   2 +
 src/radeon_kms.c  | 136 ++
 5 files changed, 158 insertions(+), 70 deletions(-)

diff --git a/man/radeon.man b/man/radeon.man
index 2703773..f0a6be1 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -276,6 +276,13 @@ Enable DRI2 page flipping.  The default is
 .B on.
 Pageflipping is supported on all radeon hardware.
 .TP
+.BI "Option \*qTearFree\*q \*q" boolean \*q
+Enable tearing prevention using the hardware page flipping mechanism. This
+option currently doesn't have any effect for rotated CRTCs. It requires
+allocating two separate scanout buffers for each non-rotated CRTC. Enabling
+this option currently disables Option \*qEnablePageFlip\*q. The default is
+.B off.
+.TP
 .BI "Option \*qAccelMethod\*q \*q" "string" \*q
 Chooses between available acceleration architectures.  Valid values are
 .B EXA
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 1f22869..ce6cd80 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -488,6 +488,10 @@ drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
scanout->bo = NULL;
}
 
+   if (scanout->damage) {
+   DamageDestroy(scanout->damage);
+   scanout->damage = NULL;
+   }
 }
 
 void
@@ -501,12 +505,9 @@ drmmode_scanout_free(ScrnInfoPtr scrn)
xf86_config->crtc[c]->driver_private;
 
drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
-&drmmode_crtc->scanout);
-
-   if (drmmode_crtc->scanout_damage) {
-   DamageDestroy(drmmode_crtc->scanout_damage);
-   drmmode_crtc->scanout_damage = NULL;
-   }
+&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+&drmmode_crtc->scanout[1]);
}
 }
 
@@ -704,44 +705,49 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr 
mode,
x = drmmode_crtc->prime_pixmap_x;
y = 0;
 
-   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[1]);
} else
 #endif
if (drmmode_crtc->rotate.fb_id) {
fb_id = drmmode_crtc->rotate.fb_id;
x = y = 0;
 
-   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout);
-   } else if (info->shadow_primary) {
-   drmmode_crtc_scanout_create(crtc,
-   &drmmode_crtc->scanout,
-   NULL, mode->HDisplay,
-   mode->VDisplay);
-
-   if (drmmode_crtc->scanout.pixmap) {
-   RegionPtr pRegion;
-   BoxPtr pBox;
-
-   if (!drmmode_crtc->scanout_damage) {
-   drmmode_crtc->scanout_damage =
-   
DamageCreate(radeon_screen_damage_report,
-NULL, 
DamageReportRawRegion,
-TRUE, pScreen, 
NULL);
-   
DamageRegister(&pScreen->GetScreenPixmap(pScreen)->drawable,
-  
drmmode_crtc->scanout_damage);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[1]);
+   } else if (info->tear_free || info->shadow_primary) {
+   for (i = 0; i < (info->tear_free ? 2 : 1); i++) {
+   drmmode_crtc_scanout_create(crtc,
+   
&drmmode_crtc->scanout[i],
+   NULL, 
mode->HDisplay,
+   mode->VDisplay);
+
+   if (drmmode_crtc->scanout[i].pixmap) {
+   RegionPtr pRegion;
+   BoxPtr pBox;
+
+   if (!drmmode_crtc->scanout[i].damage) {
+   

Re: [PATCH] Add Option "TearFree"

2015-04-20 Thread Alex Deucher
On Mon, Apr 20, 2015 at 5:54 AM, Michel Dänzer  wrote:
> From: Michel Dänzer 
>
> Avoids tearing by flipping between two scanout BOs per (non-rotated) CRTC
>
> Signed-off-by: Michel Dänzer 

Reviewed-by: Alex Deucher 

> ---
>  man/radeon.man|   7 +++
>  src/drmmode_display.c |  78 -
>  src/drmmode_display.h |   5 +-
>  src/radeon.h  |   2 +
>  src/radeon_kms.c  | 136 
> ++
>  5 files changed, 158 insertions(+), 70 deletions(-)
>
> diff --git a/man/radeon.man b/man/radeon.man
> index 2703773..f0a6be1 100644
> --- a/man/radeon.man
> +++ b/man/radeon.man
> @@ -276,6 +276,13 @@ Enable DRI2 page flipping.  The default is
>  .B on.
>  Pageflipping is supported on all radeon hardware.
>  .TP
> +.BI "Option \*qTearFree\*q \*q" boolean \*q
> +Enable tearing prevention using the hardware page flipping mechanism. This
> +option currently doesn't have any effect for rotated CRTCs. It requires
> +allocating two separate scanout buffers for each non-rotated CRTC. Enabling
> +this option currently disables Option \*qEnablePageFlip\*q. The default is
> +.B off.
> +.TP
>  .BI "Option \*qAccelMethod\*q \*q" "string" \*q
>  Chooses between available acceleration architectures.  Valid values are
>  .B EXA
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 1f22869..ce6cd80 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -488,6 +488,10 @@ drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
> scanout->bo = NULL;
> }
>
> +   if (scanout->damage) {
> +   DamageDestroy(scanout->damage);
> +   scanout->damage = NULL;
> +   }
>  }
>
>  void
> @@ -501,12 +505,9 @@ drmmode_scanout_free(ScrnInfoPtr scrn)
> xf86_config->crtc[c]->driver_private;
>
> drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
> -&drmmode_crtc->scanout);
> -
> -   if (drmmode_crtc->scanout_damage) {
> -   DamageDestroy(drmmode_crtc->scanout_damage);
> -   drmmode_crtc->scanout_damage = NULL;
> -   }
> +&drmmode_crtc->scanout[0]);
> +   drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
> +&drmmode_crtc->scanout[1]);
> }
>  }
>
> @@ -704,44 +705,49 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr 
> mode,
> x = drmmode_crtc->prime_pixmap_x;
> y = 0;
>
> -   drmmode_crtc_scanout_destroy(drmmode, 
> &drmmode_crtc->scanout);
> +   drmmode_crtc_scanout_destroy(drmmode, 
> &drmmode_crtc->scanout[0]);
> +   drmmode_crtc_scanout_destroy(drmmode, 
> &drmmode_crtc->scanout[1]);
> } else
>  #endif
> if (drmmode_crtc->rotate.fb_id) {
> fb_id = drmmode_crtc->rotate.fb_id;
> x = y = 0;
>
> -   drmmode_crtc_scanout_destroy(drmmode, 
> &drmmode_crtc->scanout);
> -   } else if (info->shadow_primary) {
> -   drmmode_crtc_scanout_create(crtc,
> -   &drmmode_crtc->scanout,
> -   NULL, mode->HDisplay,
> -   mode->VDisplay);
> -
> -   if (drmmode_crtc->scanout.pixmap) {
> -   RegionPtr pRegion;
> -   BoxPtr pBox;
> -
> -   if (!drmmode_crtc->scanout_damage) {
> -   drmmode_crtc->scanout_damage =
> -   
> DamageCreate(radeon_screen_damage_report,
> -NULL, 
> DamageReportRawRegion,
> -TRUE, pScreen, 
> NULL);
> -   
> DamageRegister(&pScreen->GetScreenPixmap(pScreen)->drawable,
> -  
> drmmode_crtc->scanout_damage);
> +   drmmode_crtc_scanout_destroy(drmmode, 
> &drmmode_crtc->scanout[0]);
> +   drmmode_crtc_scanout_destroy(drmmode, 
> &drmmode_crtc->scanout[1]);
> +   } else if (info->tear_free || info->shadow_primary) {
> +   for (i = 0; i < (info->tear_free ? 2 : 1); i++) {
> +   drmmode_crtc_scanout_create(crtc,
> +   
> &drmmode_crtc->scanout[i],
> +   NULL, 
> mode->HDisplay,
> +   mode->VDisplay);
> +
> +  

Re: [PATCH 0/7] glamor: Option "ShadowPrimary"

2015-04-20 Thread Alex Deucher
On Wed, Apr 1, 2015 at 6:04 AM, Michel Dänzer  wrote:
> The first six patches are in preparation for the last patch which adds
> the new xorg.conf option. It's intended to give better 2D
> performance in some cases, but currently has some drawbacks, which I'm
> hoping to address in the future:
>
> * Doesn't support page flipping. Enabling ShadowPrimary disables page
>   flipping.
> * While there should be less tearing in general than without the option,
>   there is still some tearing (which may be more noticeable, because it's
>   more constant), in particular in the upper right corner of each monitor.
>
> These changes are also available on the master branch of
> git://people.freedesktop.org/~daenzer/xf86-video-ati .

For the series:
Reviewed-by: Alex Deucher 


>
> [PATCH 1/7] Rename scanout_pixmap_x field to prime_pixmap_x
> [PATCH 2/7] Split out struct drmmode_scanout for rotation shadow
> [PATCH 3/7] Add RADEON_CREATE_PIXMAP_SCANOUT flag
> [PATCH 4/7] glamor: Remove unused function
> [PATCH 5/7] glamor: Add radeon_pixmap parameter to
> [PATCH 6/7] glamor: Add wrappers for the X server rendering hooks
> [PATCH 7/7] glamor: Add Option "ShadowPrimary"
> ___
> xorg-driver-ati mailing list
> xorg-driver-ati@lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-ati
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 90083] unusable desktop with dell u2515h

2015-04-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90083

--- Comment #10 from Sebastian Bauer  ---
Unfortunaltely, i have to revise this statement. The phenomenon described above
happened again when i booted my pc today. Probably, i just got lucky
yesterday...

Is there anything i can provide additionally?

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


Re: [PATCH] Add Option "TearFree"

2015-04-20 Thread Richard Wilbur
On Mon, Apr 20, 2015 at 3:54 AM, Michel Dänzer  wrote:
[...]
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index 64593ab..e18f85a 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -1092,15 +1157,22 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
>  }
>  #endif
>
> +info->tear_free = xf86ReturnOptValBool(info->Options, OPTION_TEAR_FREE,
> +  FALSE);
> +
> +if (info->shadow_primary)
> +   xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TearFree enabled\n");
> +

It seems likely that I don't understand the full implications of
info->tear_free and info->shadow_primary.  I would have expected the
message about "TearFree enabled" to be predicated on info->tear_free,
since that is what we are adding with this patch, as opposed to
info->shadow_primary, which doesn't seem to be touched by the new
option.

Sincerely,
Richard
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH] Add Option "TearFree" v2

2015-04-20 Thread Michel Dänzer
From: Michel Dänzer 

Avoids tearing by flipping between two scanout BOs per (non-rotated) CRTC

v2:
* Fix condition for TearFree log message (Richard Wilbur)
* Log warning message about DRI page flipping being enabled because of
  TearFree (or ShadowPrimary) also when building without glamor support

Signed-off-by: Michel Dänzer 
---
 man/radeon.man|   7 +++
 src/drmmode_display.c |  78 ++-
 src/drmmode_display.h |   5 +-
 src/radeon.h  |   2 +
 src/radeon_kms.c  | 142 +-
 5 files changed, 160 insertions(+), 74 deletions(-)

diff --git a/man/radeon.man b/man/radeon.man
index 2703773..f0a6be1 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -276,6 +276,13 @@ Enable DRI2 page flipping.  The default is
 .B on.
 Pageflipping is supported on all radeon hardware.
 .TP
+.BI "Option \*qTearFree\*q \*q" boolean \*q
+Enable tearing prevention using the hardware page flipping mechanism. This
+option currently doesn't have any effect for rotated CRTCs. It requires
+allocating two separate scanout buffers for each non-rotated CRTC. Enabling
+this option currently disables Option \*qEnablePageFlip\*q. The default is
+.B off.
+.TP
 .BI "Option \*qAccelMethod\*q \*q" "string" \*q
 Chooses between available acceleration architectures.  Valid values are
 .B EXA
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 1f22869..ce6cd80 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -488,6 +488,10 @@ drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
scanout->bo = NULL;
}
 
+   if (scanout->damage) {
+   DamageDestroy(scanout->damage);
+   scanout->damage = NULL;
+   }
 }
 
 void
@@ -501,12 +505,9 @@ drmmode_scanout_free(ScrnInfoPtr scrn)
xf86_config->crtc[c]->driver_private;
 
drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
-&drmmode_crtc->scanout);
-
-   if (drmmode_crtc->scanout_damage) {
-   DamageDestroy(drmmode_crtc->scanout_damage);
-   drmmode_crtc->scanout_damage = NULL;
-   }
+&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+&drmmode_crtc->scanout[1]);
}
 }
 
@@ -704,44 +705,49 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr 
mode,
x = drmmode_crtc->prime_pixmap_x;
y = 0;
 
-   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[1]);
} else
 #endif
if (drmmode_crtc->rotate.fb_id) {
fb_id = drmmode_crtc->rotate.fb_id;
x = y = 0;
 
-   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout);
-   } else if (info->shadow_primary) {
-   drmmode_crtc_scanout_create(crtc,
-   &drmmode_crtc->scanout,
-   NULL, mode->HDisplay,
-   mode->VDisplay);
-
-   if (drmmode_crtc->scanout.pixmap) {
-   RegionPtr pRegion;
-   BoxPtr pBox;
-
-   if (!drmmode_crtc->scanout_damage) {
-   drmmode_crtc->scanout_damage =
-   
DamageCreate(radeon_screen_damage_report,
-NULL, 
DamageReportRawRegion,
-TRUE, pScreen, 
NULL);
-   
DamageRegister(&pScreen->GetScreenPixmap(pScreen)->drawable,
-  
drmmode_crtc->scanout_damage);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[0]);
+   drmmode_crtc_scanout_destroy(drmmode, 
&drmmode_crtc->scanout[1]);
+   } else if (info->tear_free || info->shadow_primary) {
+   for (i = 0; i < (info->tear_free ? 2 : 1); i++) {
+   drmmode_crtc_scanout_create(crtc,
+   
&drmmode_crtc->scanout[i],
+   NULL, 
mode->HDisplay,
+   mode->VDisplay);
+
+   if (drmmode_crtc->scanout[i].pixmap) {
+ 

Re: [PATCH] Add Option "TearFree"

2015-04-20 Thread Michel Dänzer
On 21.04.2015 06:08, Richard Wilbur wrote:
> On Mon, Apr 20, 2015 at 3:54 AM, Michel Dänzer  wrote:
> [...]
>> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
>> index 64593ab..e18f85a 100644
>> --- a/src/radeon_kms.c
>> +++ b/src/radeon_kms.c
>> @@ -1092,15 +1157,22 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
>>  }
>>  #endif
>>
>> +info->tear_free = xf86ReturnOptValBool(info->Options, OPTION_TEAR_FREE,
>> +  FALSE);
>> +
>> +if (info->shadow_primary)
>> +   xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TearFree enabled\n");
>> +
> 
> It seems likely that I don't understand the full implications of
> info->tear_free and info->shadow_primary.  I would have expected the
> message about "TearFree enabled" to be predicated on info->tear_free,
> since that is what we are adding with this patch, as opposed to
> info->shadow_primary, which doesn't seem to be touched by the new
> option.

You're absolutely right, thanks for the catch. Copy'n'paste accident. :)
Fixed in v2.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 89772] xf86-video-ati-git unstable

2015-04-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89772

--- Comment #42 from Michel Dänzer  ---
Note that the problem actually happens during a DRI2 page flip operation. Any
idea whether it's the app or compositor (which one are you using, BTW?) which
is falling back to DRI2?

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


Re: [PATCH] Add Option "TearFree"

2015-04-20 Thread Richard Wilbur
On Mon, Apr 20, 2015 at 6:54 PM, Michel Dänzer  wrote:
> [...] thanks for the catch. Copy'n'paste accident. :)

Glad to help in some small way.  Thank you for your significant contributions.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 89772] xf86-video-ati-git unstable

2015-04-20 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89772

--- Comment #43 from John  ---
I am unable to answer that question, it's too deep for me, maybe Sarnex can.

But I am using kwin_x11 as my compositor. Is there any special settings you'd
like me to try there?

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati