Opened 4 years ago

Closed 4 years ago

#9636 closed defect (fixed)

Remove PRIME support patch in Xorg server

Reported by: Pierre Labastie Owned by: Pierre Labastie
Priority: normal Milestone: 8.1
Component: BOOK Version: SVN
Severity: normal Keywords:
Cc:

Description

From Paul Menzel on blfs-dev:

I’d like to report, that the patch to add PRIME support to the X.Org server [...] breaks the X.Org server on certain setups [3].

Not applying the patch, fixes the problem.
[3] https://bugs.freedesktop.org/show_bug.cgi?id=102222

Change History (11)

comment:1 by Pierre Labastie, 4 years ago

This patch was added for a fairly old version of Xorg. It seems now PRIME support is fully included in Xorg (and in some graphic drivers).

comment:2 by bdubbs@…, 4 years ago

That patch was first added on Dec 2012. It still applies and we haven't had reports of problems before. Perhaps this is something specific to amd graphics cards.

comment:3 by Pierre Labastie, 4 years ago

I do not know how many users have really tried to use a dual card system. To me there is a fundamental flaw in the patch. The function xf86AutoConfigOutputDevice contains the sequence:

 DetachUnboundGPU(pScrn->pScreen);
 AttachOffloadGPU(master->pScreen, pScrn->pScreen);

Now DetachUnboundGPU (in xorg-server-source/dix/dispatch.c) contains:

void
DetachUnboundGPU(ScreenPtr slave)
{
    /*...*/
    xorg_list_del(&slave->slave_head);
    slave->current_master = NULL;
}

so that pScrn->pScreen->current_master = NULL after this call. Now AttachOffloadGPU (same source) contains:

void
AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new)
{
    assert(new->isGPU);
    assert(!new->is_offload_slave);
    assert(new->current_master == pScreen);
/*...*/
}

So that new->current_master is NULL and not pScreen!

Reading the source of dispatch.c, I think that AttachOutputGPU should be called before AttachOffloadGPU. But I need some confirmation.

comment:4 by Pierre Labastie, 4 years ago

The logic has changed in May 2016 (commit 5c7af02b1037). Before that, new->current_master had to be NULL.

comment:5 by Pierre Labastie, 4 years ago

Note also that according to the archlinux wiki, DRI3 automates setting master and slave cards, which is also what this patch does. I guess that with graphic drivers which use dri2 (which ones?), the patch is still useful. the modesetting driver can use dri3, but does it always do?

comment:6 by Armin K, 4 years ago

This is the most current patch, it seems:

https://src.fedoraproject.org/rpms/xorg-x11-server/raw/master/f/xserver-autobind-hotplug.patch

Now, what you said about DRI3 is correct. I have been using DRI3 with xf86-video-intel for some time now and did not need the patch (the experience is not perfect, but the intel driver isn't that maintained). And that's the only driver that matters (apart from modesetting, which uses DRI3), for hybrid setups are either Intel+AMD, Intel+NVidia, or some rare AMD+AMD (APU graphics + discrete graphics - never heard AMD+NVidia situation, yet). And a side note, for DRI3 side, Mesa is responsible for switching, X server has nothing to do with it. That setup works with Wayland compositors as well.

comment:7 by Pierre Labastie, 4 years ago

Owner: changed from blfs-book@… to Pierre Labastie
Status: newassigned

comment:8 by Pierre Labastie, 4 years ago

Well, I'm leaning towards removing the patch from the book; I have no hardware to test it anyway. So unless Paul Menzel could test the above patch from fedora, I am not sure it should be included in the book. And the current patch is definitely wrong.

comment:9 by Armin K, 4 years ago

As I said, I don't mind the patch being removed, since PRIME support requires no additional configuration with DRI3, as you've noted. Maybe the section discussing PRIME in "Xorg-7 Testing and Configuration" could be expanded with xrandr commands from Arch Wiki and a note that they aren't needed when DRI3 is in use.

comment:10 by Pierre Labastie, 4 years ago

There is no answer from Paul Menzel... I'll remove the patch. I agree completely on expanding the section discussing PRIME, and I'll try to do that.

comment:11 by Pierre Labastie, 4 years ago

Resolution: fixed
Status: assignedclosed

Done at r19111. Feel free to improve the "Xorg-7 Testing and Configuration" text...

Note: See TracTickets for help on using tickets.