Conversation
70574c7 to
1aecede
Compare
Signed-off-by: Joseph Crowell <joseph.w.crowell@gmail.com>
|
@josephcrowell can you provide context where/what bug hit this fix |
|
It's the thing we were talking about in the chat about 1.5 months ago. There were also some function exports that needed to happen I think but Enrico was going to handle that one. |
|
Is this intended to allow re-initialization of DRI3? |
DRI3 is initialized once early in the lifecycle with a null info struct. (dri3.c line 102) Later on when the video card and driver are initializing this again (glamor_egl.c line 1174), they call this with a valid info struct that has all the DRI3 function calls from the driver included, but since it was already initialized earlier in the lifecycle with the null info struct, the if condition returns false and the info struct never gets populated with the valid info value. In kwin, I had to do a workaround where it was checking for the existence of the DRI functions directly instead of using the version check because of this and also because of the missing function export. At initialization time everything seems fine because the log shows that the driver initialized DRI3 and it's supposed to be available, but from a consumer's standpoint (such as kwin_x11 or even glxgears), it is NOT fine because they do the version check and it always reports DRI3 1.0 regardless of the actual capabilities of the driver because the null info struct of course doesn't point to any DRI3 functions. |
|
Doesn't glamor_egl call
If |
It has enough info to know that some level of DRI support exists, but the version check defaults to 1.0 and only raises the version based on finding functions, which can't be found because of this bug. proc_dri3_query_version(ClientPtr client) dri3_request.c line 78 |
How does it get this info? When the driver calls
Then, dix indirectly calls If Does the amd driver try to reinitialize dri3 after glamor does it / instead of glamor , and it is not able to because of the check that was here before? |
|
The amd driver does (and has to do) the exact same thing as the modesetting driver so the modesetting driver would be broken too fyi. I would prefer to use the modesetting driver and not have to screw around with all these different drivers myself but to make it as functional as the amd/nvidia/intel/etc specific drivers you have to do a bunch of nested if statements in real time code and every one of them involves a performance hit. It's kind of a chicken and egg type situation. |
|
I took a look at the amdgpu driver: In
This is what the modesetting driver does: In As I see it, both drivers initialize dri3 and glamor in ScreenInit, so if modesetting has working dri3, amdgpu should too. And in modesetting, dri3 does work. And vkgears works. Sadly, dri3 is not runtime-disableable (yet), so I can't compare with the output from modesetting, but here is Xfbdev with no DRI3 support. Fwiw, DRI3 also works in Xfbdev with this patch (applied on top of the whole pr): #2143 (comment) This is what I don't get. How come DRI3 works in modesetting (and Xfbdev), but not with the amd driver? EDIT: To be clear, I'm not denying there is an issue, not am I opposed to the change. I just want to understand what exactly is happening here. |
I would like to know too. We are inheriting spaghetti code and sorting through it one strand at a time. It would be better if the double initialization wasn't necessary at all in my opinion. |
|
If you've got the time, could you run the X server with the amd driver under gdb (both the server and the driver built with debug symbols), with breakpoints on This way, we could see exactly where these functions get called, and the entire call stack at those points. The way I understand it, |
|
If it wasn't getting called twice, I wouldn't have made the change. I already tested and know although I was using debug messages to get the state of variables at every point in the path instead of break points. The real problem is the call in dri3_extension_init. DIX_FOR_EACH_SCREEN({
if (!dri3_screen_init(walkScreen, NULL))
goto bail;
});The second null argument is the info struct. This is never good and will always break DRI3. The info struct isn't just screen information. It's the mechanism by which applications are supposed to access the DRI3 functions in the driver. |

This ensures that the info struct is populated when valid info has been obtained after the screen was initialized with a null info struct which always happens.