Bug 102008

Summary: DRI_PRIME causes X Error of failed request: BadAlloc (insufficient resources for operation)
Product: Mesa Reporter: bartos.petr
Component: Drivers/DRI/i965Assignee: Intel 3D Bugs Mailing List <intel-3d-bugs>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: critical    
Priority: medium CC: mike
Version: 17.2   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description bartos.petr 2017-08-01 21:20:24 UTC
Hi,
I'm on Fedora using git mesa from  che/mesa Copr repository. From build based on commit 5ffe0c9 I am encountering problem with using discrete Radeon R5 M240 via DRI_PRIME. When using wine, it crashes with message:

X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  148 ()
  Minor opcode of failed request:  2
  Serial number of failed request:  4615
  Current serial number in output stream:  4616

Steam via wine with DRI_PRIME starts, but crashes whenever any game is started or when system information dialog is invoked (with above message).

Native Steam with DRI_PRIME does not start at all, some native games work (Amnesia), some not (Serious Sam Fusion), however message printed when using wine does not appear.

Last mesa built which works for me is based on commit 7250cba.

I'm using modesetting driver for both GPUs. Programs with DRI_PRIME starts when DRI3 is disabled via LIBGL_DRI3_DISABLE, however in that case image is distorted and thus unusable.

I thought it might be some problem related to 101867 or 101876, however these should be fixed and latest mesa build based on commit b8bea9a still does not work for me.
Comment 1 Michel Dänzer 2017-08-02 01:42:24 UTC
Please track down which commit exactly broke it.
Comment 2 bartos.petr 2017-08-02 21:04:37 UTC
So I have some partial results.

First problem I've encoutered is that I had to use patch from https://bugs.freedesktop.org/show_bug.cgi?id=101774 in order to be able to build mesa between 7250cbafb90271579a1d07160498e902996cbc97 and 5ffe0c9e1be0257de1943135244419cbc86a6d84 so I hope it does not affect these results.

Second problem I found is that problem is connected with using modesetting DDX drivers, and between working and non-working commits is some problem causing segfault with modesetting drivers (X do not start). So I have tested not only particular commits, but also DDX driver combinations:

intel - IGPU, DRI3, SNA accel
radeon - DGPU, DRI3, glamor accel
modesetting - both, default settings

So far I managed to find this (I have not finished bisecting yet, so these commits are ones I've found so far):

f33d8af7aa354d00808f8bfd55028c396c706635
    intel, radeon - OK
    intel, modesetting - OK
    modesetting, radeon - ERROR
    modesetting, modesetting - ERROR

81fb1547772d42c527318837d4207ecdb6899e5d
    intel, radeon - OK
    intel, modesetting - SEGFAULT
    modesetting, radeon - SEGFAULT
    modesetting, modesetting - SEGFAULT

3645268748c44825ce8d37bf03f684731eb2652a
    intel, radeon - OK
    intel, modesetting - SEGFAULT
    modesetting, radeon - SEGFAULT
    modesetting, modesetting - SEGFAULT

84ed8b67c56b323cd834d463151e1a3c0430c53e
    intel, radeon - OK
    intel, modesetting - OK
    modesetting, radeon - OK
    modesetting, modesetting - OK

So it seems between somewhere between 84ed8b67c56b323cd834d463151e1a3c0430c53e and f33d8af7aa354d00808f8bfd55028c396c706635 (https://cgit.freedesktop.org/mesa/mesa/log/?qt=range&q=84ed8b67c56b323cd834d463151e1a3c0430c53e..f33d8af7aa354d00808f8bfd55028c396c706635) modesetting driver started to segfault which was fixed, but this fix probably also caused problem which I have reported.

It also seems there is no problem when using only intel+radeon DDX drivers.
Comment 3 Mike Lothian 2017-08-03 00:25:59 UTC
I've been seeing this too, out of interest Bartos do 32bit apps render correctly with DRI_PRIME I've been getting a black screen?
Comment 4 MWATTT 2017-08-03 03:26:14 UTC
I also have this problem to with my laptop (Intel Skylake iGPU + AMD TOPAZ dGPU)
The issue is only with opengl, radv works fine.

The BadAlloc only happens with some window sizes. It can be easily tested with glxgears. For instance, there is no problem with 1600x900 or default size, 300x300. With this height (300), I can resize the width between 257 and 448 without hitting a BadAlloc.

With a width of 192, I have no problem with the following heights:
123, 124, 129, 123, 131, 132, 134, 135, 136, 139, 140, 145, 146, 147, 148, 150, 151, 152, 155, 156, 161
I have a BadAlloc with those heights:
125, 126, 127, 128, 133, 137, 138, 141, 142, 143, 144, 149, 153, 154, 157, 158, 159, 160
Comment 5 bartos.petr 2017-08-04 13:52:51 UTC
So after applying patch to avoid segfault (from 655a32f729a46176c1fc0c1727b33c15c69cad78) I was able to further bisect and found that error is caused by commit

34e1ccbfbe851ecf4ebbfc86d70da384d176d994

Therefore I have also changed component from radeonsi to i965.

As for rendering, Mike, I am using plasma where I must disable kwin compositor for full screen apps, else I see also blackscreen (but I did not notice, that is is related to 32 or 64bit apps)
Comment 6 MWATTT 2017-08-23 02:47:40 UTC
I no longer have this problem with mesa git. Can you confirm that?
Comment 7 bartos.petr 2017-08-23 07:34:47 UTC
Hi, confirming, I also do not have this problem with mesa git anymore. And it is fixed also in 17.2.0 rc5

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.