Skip to contentSkip to conversation

New: dual head: different vert refresh freq, applications sync to the wrong one

Bug 39696 [email protected] 1 participant 15 messages Jul 30, 2011 – Aug 10, 2011

lore
Share & tools
lore
#0 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=39696

Summary: dual head: different vert refresh freq, applications
sync to the wrong one
Product: DRI
Version: unspecified
Platform: Other
OS/Version: All
Status: NEW
Severity: major
Priority: medium
Component: DRM/Radeon
AssignedTo: [email protected]
ReportedBy: [email protected]

I've a notebook with a JUNIPER 0x1002:0x68A0 chip, using KMS, dri and gallium.

I mostly use external monitors connected by display port, HDMI or DVI, cloning the internal display onto them (identical resolution, identical screen).

No matter what monitor (I tried two different Dell, an Iiyama and an Acer) and what port (DVI, HDMI, DP) I use,
KMS always sets sligthly different vertical refresh frequencies:
The internal display runs at 60 Hz, the external monitor runs at 59.9 Hz.

However, although I only look at the external monitor, all applications (both 3D/DRM and video/Xv) sync to the vert refresh of the internal display.

This results in very nasty tearing effects:
A clearly visible horizontal offset line moves up slowly on the external monitor
for any video or 3D application (cyclically with a period of about 10 seconds).

1.) Is there a way to run both displays at exactly the same vert frequency and with synchronized vertical retrace?
2.) Is there a way to switch 3D and video application sync from the internal to the external vsync rate?

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#1 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #1 from Michel Dänzer <[email protected]> 2011-08-09 03:54:57 PDT --- (In reply to comment #1)

Quoted 2 lines

KMS always sets sligthly different vertical refresh frequencies:
The internal display runs at 60 Hz, the external monitor runs at 59.9 Hz.

Please attach the Xorg.0.log file, but most likely the external monitor's timing is what it specifies as preferred in its EDID.

Quoted 1 line

However, although I only look at the external monitor,

Then you could switch off the internal display?

Quoted 1 line

1.) Is there a way to run both displays at exactly the same vert frequency

You could try manually setting the internal display's mode on the external monitor (or the other way around, but internal panels are typically pickier).

Quoted 1 line

and with synchronized vertical retrace?

There's no mechanism for that yet in general. However, if you manage to use the same mode for both displays, you might be able to source both of them off the same CRTC, in which case they should be perfectly synchronized.

Quoted 2 lines

2.) Is there a way to switch 3D and video application sync from the internal to the external vsync rate?

For video, you can use the XV_CRTC attribute to choose which CRTC to sync to (see the radeon manpage).

There's no such mechanism for 3D yet.

Signature · 7 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #2 from Klaus Kusche <[email protected]> 2011-08-09 05:29:04 PDT --- Created an attachment (id=50068)
--> (https://bugs.freedesktop.org/attachment.cgi?id=50068)
Xorg.log having the problem

Xorg.log with one of the displays having the problem (similar problem with another display and also external beamer).

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#3 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #3 from Klaus Kusche <[email protected]> 2011-08-09 05:47:04 PDT --- (In reply to comment #1)

Quoted 6 lines

(In reply to comment #1)

Quoted 2 lines

KMS always sets sligthly different vertical refresh frequencies:
The internal display runs at 60 Hz, the external monitor runs at 59.9 Hz.

Please attach the Xorg.0.log file, but most likely the external monitor's timing is what it specifies as preferred in its EDID.

Attached.
Yes, EDID modes used for both outputs.

Quoted 3 lines
Quoted 1 line

However, although I only look at the external monitor,

Then you could switch off the internal display?

Tried that. Works (tearing gone, obviously now syncs to ext monitor). Could be done when I'm working at my desk,
but is impractical when using a beamer in class
(in this case, I need the internal display).

Quoted 4 lines
Quoted 1 line

1.) Is there a way to run both displays at exactly the same vert frequency

You could try manually setting the internal display's mode on the external monitor (or the other way around, but internal panels are typically pickier).

To my surprise, this *doesn't* work:
I defined a new mode (tried both the external and internal modeline) in xrandr, assigned it to both outputs, switched both outputs to the new mode (both LVDS and ext display seem to accept both modelines),
but the tearing is still there.
The sync offset line now moves at a different speed and direction, but is still clearly visible.

Either the actual settings are not what xrandr believes, or the base clocks of the CRTC's are different.

By the way, is there an easy way to "take mode 1920x1200" from output X and assign it to output Y" in xrandr? Or do I have to manually define a new modeline by cut & paste from Xorg.log and assign it to both?

Quoted 5 lines
Quoted 1 line

and with synchronized vertical retrace?

There's no mechanism for that yet in general. However, if you manage to use the same mode for both displays, you might be able to source both of them off the same CRTC, in which case they should be perfectly synchronized.

Can this be set using xrandr or something else?

Quoted 5 lines
Quoted 2 lines

2.) Is there a way to switch 3D and video application sync from the internal to the external vsync rate?

For video, you can use the XV_CRTC attribute to choose which CRTC to sync to (see the radeon manpage).

Works using xvattr: The sync offset line is now moving on the internal display.

Quoted 3 lines

There's no such mechanism for 3D yet.

From the user's point of view, xvattr would be expected to set both?

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#4 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #4 from Michel Dänzer <[email protected]> 2011-08-09 06:39:31 PDT --- (In reply to comment #3)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

and with synchronized vertical retrace?

There's no mechanism for that yet in general. However, if you manage to use the same mode for both displays, you might be able to source both of them off the same CRTC, in which case they should be perfectly synchronized.

Can this be set using xrandr or something else?

Yeah, using the --crtc option. With xrandr --verbose you can see which CRTCs an output can use.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

2.) Is there a way to switch 3D and video application sync from the internal to the external vsync rate?

There's no such mechanism for 3D yet.

From the user's point of view, xvattr would be expected to set both?

Not sure how xvattr could be expected to affect anything but XVideo.

Some random ideas: All other things being equal, the driver could synchronize to the CRTC of the primary output, which can be changed using xrandr --primary. Or if that's not good enough, we could add special RandR properties for this.

Signature · 7 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #5 from Klaus Kusche <[email protected]> 2011-08-09 07:28:24 PDT --- (In reply to comment #4)

Quoted 11 lines

(In reply to comment #3)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

and with synchronized vertical retrace?

There's no mechanism for that yet in general. However, if you manage to use the same mode for both displays, you might be able to source both of them off the same CRTC, in which case they should be perfectly synchronized.

Can this be set using xrandr or something else?

Yeah, using the --crtc option. With xrandr --verbose you can see which CRTCs an output can use.

Doesn't work the way we would like it:
* All outputs can be connected to all CRTC's.
* Default is LVDS:0, DP: 1
* Even if the mode is exactly the same: As soon as I connect the DP to CRTC 0 using xrandr, xrandr automatically reconnects LVDS to CRTC 1 (and if I reconnect the LVDS, DP is also switched). Hence, they can exchange CRTC's, but running both from the same CRTC seems to be impossible.

However, according to xrandr -- verbose they are not clones. How do I set them to clone mode?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

2.) Is there a way to switch 3D and video application sync from the internal to the external vsync rate?

There's no such mechanism for 3D yet.

From the user's point of view, xvattr would be expected to set both?

Not sure how xvattr could be expected to affect anything but XVideo.

I didn't mean that I expect xvattr to do that,
I just wanted to say that the average user would expect that a single setting controls both.

Quoted 3 lines

Some random ideas: All other things being equal, the driver could synchronize to the CRTC of the primary output, which can be changed using xrandr --primary. Or if that's not good enough, we could add special RandR properties for this.

Currently both Xv and GL sync to LVDS by default, no matter which output is primary,
and no matter which CRTC they use:
Even if DP is primary and CRTC 0, sync is on LVDS.

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#6 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #6 from Alex Deucher <[email protected]> 2011-08-09 08:56:34 PDT --- (In reply to comment #5)

Quoted 11 lines

Doesn't work the way we would like it:
* All outputs can be connected to all CRTC's.
* Default is LVDS:0, DP: 1
* Even if the mode is exactly the same: As soon as I connect the DP to CRTC 0 using xrandr, xrandr automatically reconnects LVDS to CRTC 1 (and if I reconnect the LVDS, DP is also switched). Hence, they can exchange CRTC's, but running both from the same CRTC seems to be impossible.

However, according to xrandr -- verbose they are not clones. How do I set them to clone mode?

We disable cloning of certain encoders in the driver. At the hardware level, you can source multiple encoders to the same crtc, but there are too many encoder specific limitations in most cases that make it hard to support cloning from the same crtc. DP and LVDS are not possible for example as they use different clocking for the encoders. LVDS is direct clocked from the PPLL while DP uses fixed clock derived from the DCPLL, so you can't drive both off the same crtc easily, at least not the way the driver is currently structured.

Quoted 5 lines

Currently both Xv and GL sync to LVDS by default, no matter which output is primary,
and no matter which CRTC they use:
Even if DP is primary and CRTC 0, sync is on LVDS.

You might try assigning primary flag to the DP output. xrandr --output DisplayPort-0 --primary

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#7 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #7 from Klaus Kusche <[email protected]> 2011-08-09 09:07:03 PDT --- (In reply to comment #6)

Quoted 13 lines

(In reply to comment #5)

Quoted 11 lines

Doesn't work the way we would like it:
* All outputs can be connected to all CRTC's.
* Default is LVDS:0, DP: 1
* Even if the mode is exactly the same: As soon as I connect the DP to CRTC 0 using xrandr, xrandr automatically reconnects LVDS to CRTC 1 (and if I reconnect the LVDS, DP is also switched). Hence, they can exchange CRTC's, but running both from the same CRTC seems to be impossible.

However, according to xrandr -- verbose they are not clones. How do I set them to clone mode?

Quoted 7 lines

We disable cloning of certain encoders in the driver. At the hardware level, you can source multiple encoders to the same crtc, but there are too many encoder specific limitations in most cases that make it hard to support cloning from the same crtc. DP and LVDS are not possible for example as they use different clocking for the encoders. LVDS is direct clocked from the PPLL while DP uses fixed clock derived from the DCPLL, so you can't drive both off the same crtc easily, at least not the way the driver is currently structured.

That would also explain why I still have a moving tear line even when using exactly the same modeline on both - their base clock seems to differ slightly.

Quoted 7 lines
Quoted 4 lines

Currently both Xv and GL sync to LVDS by default, no matter which output is primary,
and no matter which CRTC they use:
Even if DP is primary and CRTC 0, sync is on LVDS.

You might try assigning primary flag to the DP output. xrandr --output DisplayPort-0 --primary

That's what I tried, but both GL and Xv still sync to LVDS?

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#8 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #8 from Michel Dänzer <[email protected]> 2011-08-09 09:13:15 PDT --- (In reply to comment #7)

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Currently both Xv and GL sync to LVDS by default, no matter which output is primary,
and no matter which CRTC they use:
Even if DP is primary and CRTC 0, sync is on LVDS.

You might try assigning primary flag to the DP output. xrandr --output DisplayPort-0 --primary

That's what I tried, but both GL and Xv still sync to LVDS?

I was merely describing an idea for how we could make this work, not how it's currently working...

Signature · 7 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #9 from Michel Dänzer <[email protected]> 2011-08-09 10:20:35 PDT --- Created an attachment (id=50076)
View: https://bugs.freedesktop.org/attachment.cgi?id=50076
Review: https://bugs.freedesktop.org/review?bug=39696&attachment=50076

All other things being equal, sync to the CRTC of the primary output.

Does this patch work for making 3D and video synchronize to the primary output by default?

Signature · 7 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #10 from Klaus Kusche <[email protected]> 2011-08-09 12:17:56 PDT --- (In reply to comment #9)

Quoted 1 line

Created an attachment (id=50076)

View: https://bugs.freedesktop.org/attachment.cgi?id=50076
Review: https://bugs.freedesktop.org/review?bug=39696&attachment=50076

Quoted 4 lines

All other things being equal, sync to the CRTC of the primary output.

Does this patch work for making 3D and video synchronize to the primary output by default?

Yes, excellent:
At least for me, the moving tear line is always
on the display which is *not* primary.

Even works when switching on-the-fly, for already-running applications.

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#11 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #11 from Michel Dänzer <[email protected]> 2011-08-10 02:50:46 PDT --- Great. Would this be a satisfactory resolution for this report?

Signature · 7 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #12 from Klaus Kusche <[email protected]> 2011-08-10 03:45:07 PDT --- (In reply to comment #11)

Quoted 1 line

Great. Would this be a satisfactory resolution for this report?

Well, as it seems to be impossible (at least for my combination of LVDS and DP) to have two (or even more) outputs in sync at the same time,
and as there is no way for the software to find out automagically which output to sync, syncing to the primary output and depending on the user to set the output he wants to have in sync using xrandr is the best we can get.

So: Yes.

But your patch was radeon-only. I think
* all platforms should behave the same,
* and if they do, this behaviour should be documented somewhere.

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#13 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

--- Comment #13 from Alex Deucher <[email protected]> 2011-08-10 06:45:40 PDT --- (In reply to comment #12)

Quoted 2 lines

Well, as it seems to be impossible (at least for my combination of LVDS and DP) to have two (or even more) outputs in sync at the same time,

Unfortunately this is a hw limitation. It can really only work in some very limited situations. You would have to use identical monitors with identical modelines being driven by the same encoder types. Even in your setup, if you could have used the same crtc, each monitor has different timing for the display so it likely wouldn't have worked as one of the displays may not have synced properly.

LVDS:
Modeline "1920x1200"x60.0 164.80 1920 2020 2052 2224 1200 1202 1208 1235 (74.1 kHz)

DP:
Modeline "1920x1200"x60.0 154.00 1920 1968 2000 2080 1200 1203 1209 1235 +hsync -vsync (74.0 kHz)

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#14 lore raw

[Bug 39696] dual head: different vert refresh freq, applications sync to the wrong one

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=39696

Michel Dänzer <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #14 from Michel Dänzer <[email protected]> 2011-08-10 09:23:08 PDT --- (In reply to comment #12)

Quoted 2 lines

But your patch was radeon-only. I think
* all platforms should behave the same,

It's up to each driver.

Quoted 1 line

* and if they do, this behaviour should be documented somewhere.

I updated the radeon manpage paragraph about XV_CRTC.

Signature · 7 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel