[Mesa-dev] GBM backend dynamic dispatch method

Yu, Qiang Qiang.Yu at amd.com
Thu May 12 08:58:38 UTC 2016

Oh, what a crazy idea. So you mean it can work like this?

1. use the libgbm/gbm_dri/libEGL/libGLES from mesa which will load radeonsi_dri.so

2. libGL/amdgpu_dri.so from amdgpu-pro



From: Axel Davy <axel.davy at ens.fr>
Sent: Thursday, May 12, 2016 4:04:12 PM
To: Yu, Qiang; mesa-dev at lists.freedesktop.org
Subject: Re: [Mesa-dev] GBM backend dynamic dispatch method

Another question:

Why not just use Mesa handle gbm ?
If I understand radeonsi uses the same libdrm and kernel than amdgpu-pro.

Thus having Mesa handle gbm should be fine, as radeonsi could work alongside amdgpu-pro.

Then the only implementation details are about the extension to import gbm bo into EGLImage (and the gbm code to import EGLImage)
Importing into EGL can be done with gbm function to export dma-buf (and then the dma-buf would get imported for EGLImage).
Not sure for the other way, but it could be made possible.

Also next question would be: why not let radeonsi handle EGL (and gbm), and have amdgpu-pro handle glx only ?
That way amdgpu-pro won't need to duplicate the code for wayland support, gbm support, etc.


On 12/05/2016 09:10, Yu, Qiang wrote :

Thanks Axel, I find the current GBM already works like you said except

GBM_BACKEND only support one backend. So I just have to make amdgpu-pro

backend create_device return NULL for Intel GPU.

Many thanks,


From: mesa-dev <mesa-dev-bounces at lists.freedesktop.org><mailto:mesa-dev-bounces at lists.freedesktop.org> on behalf of Axel Davy <axel.davy at ens.fr><mailto:axel.davy at ens.fr>
Sent: Thursday, May 12, 2016 2:36:34 PM
To: mesa-dev at lists.freedesktop.org<mailto:mesa-dev at lists.freedesktop.org>
Subject: Re: [Mesa-dev] GBM backend dynamic dispatch method


I'm not sure if that answers your need, but to me it looks like
it would be simpler if gbm was trying different backends for the given
device, until it succeeds. You'd pass several backends to GBM_BACKEND (perhaps
rename to GBM_BACKENDS), and in your example it would put amdgpu pro first.
Then when using the amd card, amdgpu pro would be used, else since the loading
would fail, it would use the second backend, which would be mesa.

That's just a suggestion, and you'd better wait for gbm maintainers to voice theirs.


On 12/05/2016 04:45, Yu, Qiang wrote:

Hi guys,

Let me introduce myself. My name is Qiang Yu, I'm a developer of amdgpu-pro driver.

As you know the amdgpu-pro adopts some open source part like GBM but due to its

close source OGL part, we implement our own GBM backend.

Currently libgbm only support static selection of GBM backend by GBM_BACKEND,

so for the hybrid GPU case like Intel iGPU + AMD dGPU and AMD dGPU is drived

by amdgpu-pro, it's not convenient for client to switch backend all the time and even

impossible for applications that need to deal with both GPUs like the XServer.

So I'm wondering a dynamic dispatch method and hope it can go upstream to the libgbm:

1. create a /etc/gbm/xxx.conf for libgbm to read when none default backend needed

2. the content should be like: <kernel driver name>:<gbm backend name>

    In the amdgpu-pro case, the content is: amdgpu:gbm_amdgpu.so

This method need libgbm use libdrm to determine the FD kernel driver first.

Any feedback on this method and the hope to go upstream?



mesa-dev mailing list
mesa-dev at lists.freedesktop.org<mailto:mesa-dev at lists.freedesktop.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160512/e3f96013/attachment.html>

More information about the mesa-dev mailing list