Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 611928 - x11-libs/libdrm depends on video_cards_radeon even if video_cards_amdgpu is only selected
Summary: x11-libs/libdrm depends on video_cards_radeon even if video_cards_amdgpu is o...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Matt Turner
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-07 04:03 UTC by Damien Zammit
Modified: 2017-03-11 16:33 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Damien Zammit 2017-03-07 04:03:17 UTC
The USE flags logic for this package is not quite correct in the case
where the user wants to use amdgpu instead of radeon.

The USE flags for this package should allow the combination of:
"video_cards_amdgpu -video_cards_radeon"
but currently emerge rejects this selection, suggesting that +video_cards_radeon *must* be selected.


Reproducible: Always
Comment 1 Chí-Thanh Christopher Nguyễn gentoo-dev 2017-03-07 09:37:19 UTC
Can you please provide emerge output?

I suspect that not libdrm itself needs that USE flag, but instead some other package like media-libs/mesa[radeonsi] does.
Comment 2 Damien Zammit 2017-03-08 04:20:27 UTC
Calculating dependencies... done!

emerge: there are no ebuilds built with USE flags to satisfy ">=x11-libs/libdrm-2.4.72[video_cards_radeon]".
!!! One of the following packages is required to complete your request:
- x11-libs/libdrm-2.4.75::gentoo (Change USE: +video_cards_radeon)
(dependency required by "media-libs/mesa-17.0.1::gentoo[-video_cards_r200,-video_cards_radeon,-video_cards_r600,video_cards_radeonsi,-video_cards_r100,-video_cards_r300]" [ebuild])
(dependency required by "@profile" [set])
(dependency required by "@world" [argument])
Comment 3 Matt Turner gentoo-dev 2017-03-08 05:00:57 UTC
You could have done a significantly better job explaining what exactly you think is wrong. This was a very unclear bug report.

The driver names for ATI/AMD cards are terrible. I suspect you know all this, but for posterity:

AMDGPU is the name of the kernel driver for modern cards. There is associated code in libdrm.

radeonsi is the name of the Mesa driver for modern cards, going back somewhat farther than what the AMDGPU kernel driver supports.

The older "radeon" kernel driver is used for the cards supported by radeonsi but not AMDGPU. There is associated code in libdrm.

So radeonsi depends on both the radeon and the amdgpu libdrm components. This requirement comes from upstream Mesa, not Gentoo.

See https://cgit.freedesktop.org/mesa/mesa/tree/configure.ac?id=05520ba490c9463391f438c341243d52a00a7168#n2318

The current intention is for VIDEO_CARDS="radeon" to enable *all* radeon drivers, except if you override it by specifying a specific radeon variant, like VIDEO_CARDS="radeonsi". In that case, "radeon" in VIDEO_CARDS="radeon radeonsi" is not supposed to have any effect.

Unfortunately, we seem to have screwed up the logic for that:

        gallium_enable video_cards_r300 r300
        gallium_enable video_cards_r600 r600
        gallium_enable video_cards_radeonsi radeonsi
        if ! use video_cards_r300 && \
                ! use video_cards_r600; then
            gallium_enable video_cards_radeon r300 r600
        fi

That looks intentional, but I think it's definitely wrong to not select radeonsi for VIDEO_CARDS="radeon".

You should be able to set VIDEO_CARDS="radeon radeonsi amdgpu" and get the behavior I think you are requesting. That is, building only the radeonsi Mesa driver, and the radeon and amdgpu libdrm components.

To that end, I have fixed the quoted logic to include radeonsi:

commit 906eaa04d5b56c1b5c7fb3afa1cf33ec92b40279
Author: Matt Turner <mattst88@gentoo.org>
Date:   Tue Mar 7 20:57:08 2017 -0800

    media-libs/mesa: Build radeonsi if only VIDEO_CARDS="radeon" is selected.


I think the Intel/Radeon VIDEO_CARDS are in for an overhaul...
Comment 4 Matt Turner gentoo-dev 2017-03-08 05:05:45 UTC
Whether excluding radeonsi from VIDEO_CARDS="radeon" was intentional or not, it does have one potentially useful effect. VIDEO_CARDS="radeon" USE="gallium" does not current depend on llvm, except on x86 and amd64.

Hmm. We'll see if QA checks complain at me.
Comment 5 Damien Zammit 2017-03-08 07:38:15 UTC
Sorry for the unclear bug report.

Now that you have explained it a bit more, I think I know what the problem is better:

It seems that the USE flag "radeon" refers to a superset of all AMD card/driver combinations, but the name of the old radeon driver is also "radeon" in the kernel.  So there is no obvious way to set amdgpu and radeonsi and exclude the old radeon driver, because you can't, for example, set:

VIDEO_CARDS="radeon -radeon"

So the solution currently is to set:

VIDEO_CARDS="radeon amdgpu radeonsi"

and hope that the logic excludes the old radeon driver.

A better way might be to rename the superset "radeon" USE flag to "amd".
So then you could do:

VIDEO_CARDS="amd amdgpu radeonsi -radeon"

Best,
Damien
Comment 6 Chí-Thanh Christopher Nguyễn gentoo-dev 2017-03-08 11:09:39 UTC
The radeonsi driver in mesa supports some cards which libdrm_radeon also supports, hence the USE dependency.
But with a sufficiently new AMD GPU you don't need radeon for anything else than libdrm, so you can set

/etc/portage/make.conf
VIDEO_CARDS="amdgpu radeonsi"

/etc/portage/package.use
x11-libs/libdrm video_cards_radeon

So you will not build the unnecessary radeon driver in mesa.
Comment 7 Matt Turner gentoo-dev 2017-03-08 16:42:51 UTC
(In reply to Damien Zammit from comment #5)
> Sorry for the unclear bug report.
> 
> Now that you have explained it a bit more, I think I know what the problem
> is better:
> 
> It seems that the USE flag "radeon" refers to a superset of all AMD
> card/driver combinations, but the name of the old radeon driver is also
> "radeon" in the kernel.  So there is no obvious way to set amdgpu and
> radeonsi and exclude the old radeon driver, because you can't, for example,
> set:
> 
> VIDEO_CARDS="radeon -radeon"
> 
> So the solution currently is to set:
> 
> VIDEO_CARDS="radeon amdgpu radeonsi"
> 
> and hope that the logic excludes the old radeon driver.

It will, so long as you have USE="-classic"

> A better way might be to rename the superset "radeon" USE flag to "amd".
> So then you could do:
> 
> VIDEO_CARDS="amd amdgpu radeonsi -radeon"

Indeed. I'm not sure how exactly this should work, but I completely agree that we need to come up with something better.
Comment 8 Matt Turner gentoo-dev 2017-03-11 16:33:34 UTC
I had to revert the patch, per bug 612208.

There's no bug here, per se, just some somewhat annoying configuration required. Reopen if you have a suggestion for how we can do this better? Otherwise, chithanh suggested a way to configure what you want in comment #6.