Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#18316 closed enhancement (fixed)

Backporting TearFree option in Xorg-server-21.1.8

Reported by: Rahul Chandra Owned by: Douglas R. Reno
Priority: normal Milestone: 12.0
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description (last modified by Rahul Chandra)

With the removal of the xf86-video-* the TearFree option no longer works for any graphics driver. This has been solved in Xorg master with the addition of a TearFree option in the modesetting driver.

Relevant Commits:

https://gitlab.freedesktop.org/search?group_id=1154&project_id=371&repository_ref=master&scope=commits&search=TearFree

I have backported a patch that builds and works in runtime. Both the patch for the book and the patch to xorg server are attached.

Attachments (2)

xorg-tearfree.patch (2.5 KB ) - added by Rahul Chandra 14 months ago.
xorg-server-21.1.8-tearfree-backport.patch (71.8 KB ) - added by Rahul Chandra 14 months ago.

Download all attachments as: .zip

Change History (17)

by Rahul Chandra, 14 months ago

Attachment: xorg-tearfree.patch added

by Rahul Chandra, 14 months ago

comment:1 by Rahul Chandra, 14 months ago

Description: modified (diff)

comment:2 by Bruce Dubbs, 14 months ago

Checking https://www.x.org/archive//individual/xserver/?C=M;O=D, the most recent release was March 29 and the one before that was February 7. I wonder how long it will be before the next release.

in reply to:  2 comment:3 by Xi Ruoyao, 14 months ago

Replying to Bruce Dubbs:

Checking https://www.x.org/archive//individual/xserver/?C=M;O=D, the most recent release was March 29 and the one before that was February 7. I wonder how long it will be before the next release.

The "problem" is even if they release a 21.1.9 there will be still no tearfree. I guess tearfree will only show up in 21.2 or 22.0.

comment:4 by Rahul Chandra, 14 months ago

Description: modified (diff)

Yeah, Gitlab master for xwayland is still very active, but xorg-server has had barely any activity. Let's hope for a release before the package freeze for 12.0. I saw a bunch of new functions and a lot of reorganization when I went to backport the patch, so hopefully they'll release 21.2/22.0 soon...

Last edited 14 months ago by Rahul Chandra (previous) (diff)

comment:5 by Douglas R. Reno, 14 months ago

Owner: changed from blfs-book to Douglas R. Reno
Status: newassigned

comment:6 by Bruce Dubbs, 14 months ago

I tried the patch and it applied fine, but the build failed:

../present/present.c:160:43: error: ‘PresentAllAsyncOptions’ undeclared (first use in this function); did you mean ‘PresentAllOptions’?
  160 |     const Bool  synced_flip = !(options & PresentAllAsyncOptions);
      |                                           ^~~~~~~~~~~~~~~~~~~~~~
      |                                           PresentAllOptions

comment:7 by Rahul Chandra, 14 months ago

Weird, I can't seem to reproduce on any of my systems. But at first glance, it seems like nothing in the patch would affect 'PresentAllAsyncOptions' as it's defined in xorgproto, not xorg-server. And PresentAllAsyncOptions is still in present/present.c even before the patch is applied. Upon further inspection, it seems like that function was first introduced in xorgproto 2023.2. And in the current release (11.3) we are using xorgproto 2022.2, but on the development branch we are using 2023.2 which does have the function. Could you try updating/recompiling xorgproto?

Last edited 14 months ago by Rahul Chandra (previous) (diff)

comment:8 by Bruce Dubbs, 14 months ago

Yes, that was it. I was building on a system that was not quite up-to date.

Do you have any suggestions for testing?

comment:9 by Rahul Chandra, 14 months ago

To test the TearFree option you have to edit the device-specific configuration within xorg. I could only reproduce the tearing on bare-metal though cause it seems like QEMU has an in built sync with the cirrus vga adapter

First build a non-composited Desktop Environment or Window Manager (twm, icewm, openbox, or Xfce4 with the display compositor turned off in settings. Then log in and open a window, then move it around, if the system has problems with tearing you will see that the border of the window will not be a straight line while in motion. Alternatively use this test, https://www.youtube.com/watch?v=MfL_JkcEFbE Once you have confirmed that the system is tearing you can move on to trying to modify the config file

On Intel GPU's,

cat > /usr/share/X11/xorg.conf.d/20-amdgpu.conf << "EOF"
Section "Device"
    Identifier "Intel Graphics"
    Driver "modesetting"
    Option "TearFree"    "true"
EndSection
EOF

On AMD Graphics Cards

cat > /usr/share/X11/xorg.conf.d/20-intel.conf << "EOF"
Section "OutputClass"
     Identifier "AMD"
     MatchDriver "modesetting"
     Option "TearFree"    "true"
     Driver "modesetting"
EndSection
EOF

Restart Xorg and confirm that the tearing problem has been resolved either using the test or moving around the window

Last edited 14 months ago by Rahul Chandra (previous) (diff)

comment:10 by Bruce Dubbs, 14 months ago

I had already rebuilt xorg-server with the patch. My video card is Radeon RX 550 and I'm already using the modesetting driver.

I tested with both twm and openbox with Option "TearFree" both true and false, but could not tell the difference. As a note, I don't think twm is a good choice for the testing because dragging a window just drags the outline.

comment:11 by Rahul Chandra, 14 months ago

Sorry, I accidentally read out the wrong files. The modesetting driver doesn't want the Identifier line to be the name of a GPU.

This should work for any GPU,

cat > /usr/share/X11/xorg.conf.d/20-amdgpu.conf << "EOF"
Section "Device"
        Identifier "Graphics Adapter"
        Driver "modesetting"
        Option "TearFree" "true"
EndSection
EOF
Last edited 14 months ago by Rahul Chandra (previous) (diff)

comment:12 by Douglas R. Reno, 14 months ago

Resolution: fixed
Status: assignedclosed

Thank you for the patch! Fixed at a1ea6d4e942bc3f2b98e361e16b05494ae4e0737

comment:13 by Xi Ruoyao, 14 months ago

Resolution: fixed
Status: closedreopened

Reopening because we'd better add a Xorg configuration example to enable TearFree.

comment:14 by Douglas R. Reno, 14 months ago

Resolution: fixed
Status: reopenedclosed

Added a section on configuring Tearfree in 810935e2b5ecc28d2d64cf13745ad884e490811f

comment:15 by Bruce Dubbs, 14 months ago

Milestone: 11.412.0

Milestone renamed

Note: See TracTickets for help on using tickets.