New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Vsync via OpenGL and DRI3/Present #326

Closed
Sunderland93 opened this Issue Jun 7, 2017 · 22 comments

Comments

Projects
None yet
6 participants
@Sunderland93

Sunderland93 commented Jun 7, 2017

This is a very important feature. Currently Marco does not support for OpenGL compositing and DRI3, so one of the methods to prevent screen tearing is using Compiz, Compton, etc. Xfce developers added DRI3/Present and support OpenGL compositing to their Xfwm4. Maybe it can be example for add this feature to Marco.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Jorilx

This comment has been minimized.

Jorilx commented Jun 21, 2017

Looks like a duplicate of #313 ?

@monsta

This comment has been minimized.

Member

monsta commented Aug 11, 2017

Well, I don't know if both OpenGL and DRI3 are needed. I don't really want to introduce OpenGL unless it's absolutely needed.

@pasikarkkainen

This comment has been minimized.

pasikarkkainen commented Aug 11, 2017

Should be possible with only DRI3 and Present extension. No need for OpenGL, afaik.

Check this out, for an example of DRI3+Present support in xfwm4: https://www.bountysource.com/issues/6655651-add-support-for-dri3-present
"Present [extension] is a way to get new window content from a pixmap to the screen in a VBLANK-synchronized way."

@monsta

This comment has been minimized.

Member

monsta commented Aug 11, 2017

I see some patch for Metacity is mentioned there, but I can't find any relevant commits in Metacity... it would be easier to port from there than from xfwm4.

@pasikarkkainen

This comment has been minimized.

pasikarkkainen commented Aug 11, 2017

Here you can find some kind of version (prototype?) of Present extension support for Metacity by keithp (author of Present extension): https://keithp.com/cgit/metacity.git/

@monsta

This comment has been minimized.

Member

monsta commented Aug 11, 2017

Wow, it's quite old. Metacity 2.34 was used as a base...

@muktupavels: what do you think about Keith's patches?

@flexiondotorg

This comment has been minimized.

Member

flexiondotorg commented Aug 12, 2017

@monsta Keith Packard is a well respected X11 developer.

@monsta

This comment has been minimized.

Member

monsta commented Aug 22, 2017

I have no doubts about Keith, I just wanted to hear opinion of Metacity developer about the patch.

@pasikarkkainen

This comment has been minimized.

@vkareh

This comment has been minimized.

Member

vkareh commented Sep 12, 2017

@pasikarkkainen - keithp's patches to Metacity are straightforward but insufficient to get Marco working properly with XPresent. Keep in mind this was done 4 years ago (to the day, actually) for an old version of Metacity. Things have diverged quite a bit since.

@pasikarkkainen

This comment has been minimized.

pasikarkkainen commented Sep 12, 2017

@vkareh yep, I do realize that.. I wish I didn't have tons of other projects atm, so I could see about porting the patches to current version of Marco.. but no time currently :( How about you, are you interested in giving it a go?

@vkareh

This comment has been minimized.

Member

vkareh commented Sep 12, 2017

@pasikarkkainen - I've been working on it for about a week or so. I applied the Metacity patches manually and fixed them so that it compiles with the extension. I also managed to get Present to block rendering - now I'm trying to somehow get the correct events fired and captured so that I can render the screen.

@pasikarkkainen

This comment has been minimized.

pasikarkkainen commented Sep 12, 2017

@vkareh oh, that's awesome! When you have a git branch available (even not yet fully working) feel free to share the link here..

@vkareh

This comment has been minimized.

Member

vkareh commented Sep 12, 2017

@pasikarkkainen - here's what I have so far: master...vkareh:present - it's not fully up to date, as I'm constantly changing and testing things in between other tasks...

@Sunderland93

This comment has been minimized.

Sunderland93 commented Sep 15, 2017

@monsta

Well, I don't know if both OpenGL and DRI3 are needed. I don't really want to introduce OpenGL unless it's absolutely needed.

By OpenGL I mean GLX support, to enable hardware compositing and reduce CPU usage.

@pasikarkkainen

This comment has been minimized.

pasikarkkainen commented Sep 19, 2017

@Sunderland93 I think it's more important to first solve the tearing problem, and as a second, separate step take a look at hardware acceleration (OpenGL support).

@vkareh

This comment has been minimized.

Member

vkareh commented Sep 23, 2017

A status on things: I've been tweaking the code that includes the Present extension on Marco (master...vkareh:present) and managed to get rid of tearing for my desktop, which has an old NVIDIA card, using the open source Xorg nvidia drivers. Tearing persists using the proprietary ones. Not sure what to make of it yet, but I intend on playing some more with it this coming week.

Mostly I've been developing on my laptop, which is what I have with me most of the time, unfortunately (for this at least), I've found it hard to consistently get tearing on it (it definitely happens, but it's hard to spot and/or reproduce at will). Worse, XPresent fails on it with this issue: https://bugzilla.xfce.org/show_bug.cgi?id=13257, so I make most of my changes here, then when I have a chance (i.e. when the wife and kids are all asleep) I then manage to test on my home desktop.

Anyway, things are moving forward and I'm confident that this should be resolved shortly. I will soon start asking people to test on their own machines and collect data on which setups work and which don't. We'll go from there :)

@flexiondotorg

This comment has been minimized.

Member

flexiondotorg commented Sep 23, 2017

Thanks for the progress update! I've seen numerous reports of tearing with the nvidia proprietary drivers with other compositors. It isn't clear to me if this is a driver issue on some models of cards as the work arounds I've seen are not consistent.

@vkareh

This comment has been minimized.

Member

vkareh commented Sep 23, 2017

Yeah, it really is a pain. Based on that, I may as well just focus on solving it using the open source drivers. Once I get this working consistently there, I might recompile the latest x11proto-present headers on my laptop to see if that solves the Window XID encoding issue on it (assuming that's what it is).

If the consensus is that this is unsolvable in a reliable way for the nvidia proprietary drivers, maybe we should at least get it working with the open source ones and worry about nvidia in a separate thread.

Somewhat related: XDC2017 just happened this week, and NVIDIA had a decent representation there, as well as the rest of the X.org team, of course. I'm hoping that this issue is notorious enough that it got spontaneously brought up with their team and they are game to do something about it (although it looks like their current focus is related to GLX).

@Sunderland93

This comment has been minimized.

Sunderland93 commented Sep 24, 2017

@vkareh AFAIK, Nvidia binary driver won't work with XPresent. On all my machines with Nvidia graphics card, I turned on a "FullCompositionPipeline" in /etc/X11/xorg.conf, to prevent tearing. On any compositor.

@pasikarkkainen

This comment has been minimized.

pasikarkkainen commented Sep 24, 2017

@vkareh great, thanks for the update! I agree, let's first focus on getting Present extension working and Marco tearing fixed with opensource drivers.

You mentioned it's difficult for you to reproduce the tearing issue.. for me it's usually simple, watching a video with "mplayer" or watching a video on youtube with Firefox is enough to trigger the tearing issue.

I'll try to find some time soon to test your Present patches!

@monsta

This comment has been minimized.

Member

monsta commented Nov 26, 2017

Closing as #350 is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment