All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-amdgpu 1/2] Refactor drmmode_output_set_tear_free helper
@ 2018-04-26 15:58 Michel Dänzer
       [not found] ` <20180426155850.15218-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2018-04-26 15:58 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Michel Dänzer <michel.daenzer@amd.com>

Preparation for the following fix, no functional change intended.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 793027d50..cf1e5d1f1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1739,6 +1739,22 @@ static void drmmode_output_create_resources(xf86OutputPtr output)
 	}
 }
 
+static void
+drmmode_output_set_tear_free(AMDGPUEntPtr pAMDGPUEnt,
+			     drmmode_output_private_ptr drmmode_output,
+			     xf86CrtcPtr crtc, int tear_free)
+{
+	if (drmmode_output->tear_free == tear_free)
+		return;
+
+	drmmode_output->tear_free = tear_free;
+
+	if (crtc) {
+		drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
+				       crtc->x, crtc->y);
+	}
+}
+
 static Bool
 drmmode_output_set_property(xf86OutputPtr output, Atom property,
 			    RRPropertyValuePtr value)
@@ -1782,18 +1798,9 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
 			for (j = 0; j < p->mode_prop->count_enums; j++) {
 				if (!strcmp(p->mode_prop->enums[j].name, name)) {
 					if (i == (drmmode_output->num_props - 1)) {
-						if (drmmode_output->tear_free != j) {
-							xf86CrtcPtr crtc = output->crtc;
-
-							drmmode_output->tear_free = j;
-							if (crtc) {
-								drmmode_set_mode_major(crtc,
-										       &crtc->mode,
-										       crtc->rotation,
-										       crtc->x,
-										       crtc->y);
-							}
-						}
+						drmmode_output_set_tear_free(pAMDGPUEnt,
+									     drmmode_output,
+									     output->crtc, j);
 					} else {
 						drmModeConnectorSetProperty(pAMDGPUEnt->fd,
 									    drmmode_output->output_id,
-- 
2.17.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH xf86-video-amdgpu 2/2] Wait for pending flips in drmmode_output_set_tear_free
       [not found] ` <20180426155850.15218-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-04-26 15:58   ` Michel Dänzer
       [not found]     ` <20180426155850.15218-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2018-04-26 15:58 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Michel Dänzer <michel.daenzer@amd.com>

This prevents a nested call to drmHandleEvent, which would hang.

Fixes hangs when disabling TearFree on a CRTC while a DRI3 client is
page flipping.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index cf1e5d1f1..4fac645b9 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1750,6 +1750,15 @@ drmmode_output_set_tear_free(AMDGPUEntPtr pAMDGPUEnt,
 	drmmode_output->tear_free = tear_free;
 
 	if (crtc) {
+		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+		/* Wait for pending flips before drmmode_set_mode_major calls 
+		 * drmmode_crtc_update_tear_free, to prevent a nested
+		 * drmHandleEvent call, which would hang
+		 */
+		drmmode_crtc_wait_pending_event(drmmode_crtc,
+						pAMDGPUEnt->fd,
+						drmmode_crtc->flip_pending);
 		drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
 				       crtc->x, crtc->y);
 	}
-- 
2.17.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH xf86-video-amdgpu 2/2] Wait for pending flips in drmmode_output_set_tear_free
       [not found]     ` <20180426155850.15218-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-04-26 18:48       ` Samuel Li
       [not found]         ` <e1c84b66-c870-5ec9-ea49-9c83876ec61b-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Samuel Li @ 2018-04-26 18:48 UTC (permalink / raw)
  To: Michel Dänzer, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW



On 2018-04-26 11:58 AM, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
> 
> This prevents a nested call to drmHandleEvent, which would hang.
> 
> Fixes hangs when disabling TearFree on a CRTC while a DRI3 client is
> page flipping.
> 
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
> ---
>  src/drmmode_display.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index cf1e5d1f1..4fac645b9 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -1750,6 +1750,15 @@ drmmode_output_set_tear_free(AMDGPUEntPtr pAMDGPUEnt,
>  	drmmode_output->tear_free = tear_free;
>  
>  	if (crtc) {
> +		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
> +
> +		/* Wait for pending flips before drmmode_set_mode_major calls 
Trailing white space.
Otherwise the two patches are 
	Reviewed-by: Samuel Li <Samuel.Li@amd.com> 

Sam

> +		 * drmmode_crtc_update_tear_free, to prevent a nested
> +		 * drmHandleEvent call, which would hang
> +		 */
> +		drmmode_crtc_wait_pending_event(drmmode_crtc,
> +						pAMDGPUEnt->fd,
> +						drmmode_crtc->flip_pending);
>  		drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
>  				       crtc->x, crtc->y);
>  	}
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH xf86-video-amdgpu 2/2] Wait for pending flips in drmmode_output_set_tear_free
       [not found]         ` <e1c84b66-c870-5ec9-ea49-9c83876ec61b-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-27 16:01           ` Michel Dänzer
  0 siblings, 0 replies; 4+ messages in thread
From: Michel Dänzer @ 2018-04-27 16:01 UTC (permalink / raw)
  To: Samuel Li; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2018-04-26 08:48 PM, Samuel Li wrote:
> On 2018-04-26 11:58 AM, Michel Dänzer wrote:
>> From: Michel Dänzer <michel.daenzer@amd.com>
>>
>> This prevents a nested call to drmHandleEvent, which would hang.
>>
>> Fixes hangs when disabling TearFree on a CRTC while a DRI3 client is
>> page flipping.
>>
>> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
>> ---
>>  src/drmmode_display.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
>> index cf1e5d1f1..4fac645b9 100644
>> --- a/src/drmmode_display.c
>> +++ b/src/drmmode_display.c
>> @@ -1750,6 +1750,15 @@ drmmode_output_set_tear_free(AMDGPUEntPtr pAMDGPUEnt,
>>  	drmmode_output->tear_free = tear_free;
>>  
>>  	if (crtc) {
>> +		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
>> +
>> +		/* Wait for pending flips before drmmode_set_mode_major calls 
> Trailing white space.
> Otherwise the two patches are 
> 	Reviewed-by: Samuel Li <Samuel.Li@amd.com> 

Thanks Sam! I removed the trailing white space before pushing.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-27 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 15:58 [PATCH xf86-video-amdgpu 1/2] Refactor drmmode_output_set_tear_free helper Michel Dänzer
     [not found] ` <20180426155850.15218-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-04-26 15:58   ` [PATCH xf86-video-amdgpu 2/2] Wait for pending flips in drmmode_output_set_tear_free Michel Dänzer
     [not found]     ` <20180426155850.15218-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-04-26 18:48       ` Samuel Li
     [not found]         ` <e1c84b66-c870-5ec9-ea49-9c83876ec61b-5C7GfCeVMHo@public.gmane.org>
2018-04-27 16:01           ` Michel Dänzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.