Bug 87063

Summary: X server called SharePixmapBacking on a pixmap that was not created with the USAGE_SHARED flag
Product: xorg Reporter: Karen Pease <meme02>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: blocker    
Priority: medium CC: aplattner, hans
Version: 7.7 (2012.06)   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg log file. none

Description Karen Pease 2014-12-07 03:21:22 UTC
Created attachment 110527 [details]
Xorg log file.

I was informed by a NVidia developer that the problem I'm experience indicates an Xorg bug, and thus I'm reporting it here. Source thread:

https://devtalk.nvidia.com/default/topic/794298/linux/take-3-unable-to-share-pixmap-random-x-crash/?offset=4#4385986

System: MSI Apache Pro G70 with a GeForce GTX 860M (01:00.0) and a Intel 4th-gen integrated graphics controller (00:02.0). Nvidia driver is 346.16. OS is a late beta Fedora 21, kernel 3.17.4-301.fc21.x86_64 stock. Xorg package is xorg-x11-server-Xorg-1.16.2-1.fc21.x86_64, the newest on the FC21 line.

Problem, short summary: new laptop, purchased to do specific graphics work which requires the nvidia driver. This means getting  the nvidia driver working for X with optimus. This requires modesetting with xrandr, but this crashes X or makes X otherwise refuse to work, with an error about X failing to share a non-sharable pixmap.

I'm using the following xorg config:

------------------
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "nvidia"
Inactive "intel"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option "DPMS"
EndSection

Section "Device"
Identifier "nvidia"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "PCI:1:0:0"
EndSection

Section "Device"
Identifier "intel"
Driver "modesetting"
BusID "PCI:0:2:0"
EndSection

Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "UseDisplayDevice" "none"
Option "AddARGBGLXVisuals" "True"
EndSection

Section "Screen"
Identifier "intel"
Device "intel"
Monitor "Monitor0"
EndSection
----------------

So, your standard optimus modesetting config. Which of course requires the following xrandr lines at startup:

----------------
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
----------------

I've taken to issuing them of the form "DISPLAY=:0 xrandr...." so that I can control the timing and see the output.

I've gotten things to the point that X starts up without crashing (but, of course, without the backlight). And now I can even issue the first statement - no error returned. X somewhat randomly either continues, continues for a while then crashes, or crashes immediately. The second line fails with:

----------
DISPLAY=:0 xrandr --auto

X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 139 (RANDR)
Minor opcode of failed request: 7 (RRSetScreenSize)
Serial number of failed request: 29
Current serial number in output stream: 30
----------

xrandr with no arguments yields:

----------
Screen 0: minimum 8 x 8, current 640 x 480, maximum 16384 x 16384
eDP-1-0 connected (normal left inverted right x axis y axis)
1920x1080 60.01 +
1400x1050 59.98
1280x1024 60.02
1280x960 60.00
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
800x600 60.00 60.32 56.25
700x525 59.98
640x512 60.02
640x480 60.00 59.94
512x384 60.00
400x300 60.32 56.34
320x240 60.05
VGA-1-0 disconnected (normal left inverted right x axis y axis)
HDMI-1-0 disconnected (normal left inverted right x axis y axis)
----------

Now, for the failure. The relevant parts of the Xorg.0.log:

-------------
[ 114.855] reporting 3 3 20 149
[ 114.855] reporting 3 3 20 149
[ 114.855] reporting 3 3 20 149
[ 114.857] reporting 3 3 20 149
[ 116.086] reporting 3 3 20 149
[ 118.157] reporting 3 3 20 149
[ 118.158] have a master to look out for
[ 118.158] (EE) NVIDIA(0): The X server tried to share a non-shareable pixmap
[ 118.158] need to create shared pixmap 0(EE)
[ 133.239] (EE) Backtrace:
[ 133.239] (EE) 0: /usr/libexec/Xorg.bin (OsLookupColor+0x119) [0x59bfd9]
[ 133.240] (EE) 1: /lib64/libc.so.6 (__restore_rt+0x0) [0x7f052dbac94f]
[ 133.240] (EE) 2: /usr/lib64/xorg/modules/drivers/nvidia_drv.so (nvidiaAddDrawableHandler+0x3dcd0) [0x7f05273e8650]
[ 133.240] (EE) 3: /usr/lib64/xorg/modules/libwfb.so (wfbBlt+0x13d) [0x7f0526ca066d]
[ 133.240] (EE) 4: /usr/lib64/xorg/modules/libwfb.so (wfbCopyNtoN+0x30b) [0x7f0526ca48bb]
[ 133.240] (EE) 5: /usr/libexec/Xorg.bin (miCopyRegion+0x1a7) [0x5773e7]
[ 133.240] (EE) 6: /usr/libexec/Xorg.bin (miDoCopy+0x45e) [0x57798e]
[ 133.240] (EE) 7: /usr/lib64/xorg/modules/libwfb.so (wfbCopyArea+0x2d) [0x7f0526ca5a5d]
[ 133.240] (EE) 8: /usr/lib64/xorg/modules/drivers/nvidia_drv.so (nvidiaAddDrawableHandler+0x514259) [0x7f0527d950a9]
[ 133.240] (EE) 9: /usr/libexec/Xorg.bin (DamageRegionAppend+0x33ed) [0x52495d]
[ 133.275] (EE) 10: /usr/libexec/Xorg.bin (CompositeRegisterImplicitRedirectionException+0x26d5) [0x4cdd25]
[ 133.275] (EE) 11: /usr/libexec/Xorg.bin (CompositeRegisterImplicitRedirectionException+0x34f5) [0x4cfb15]
[ 133.275] (EE) 12: /usr/libexec/Xorg.bin (CompositeRegisterImplicitRedirectionException+0x1fcd) [0x4cd0bd]
[ 133.275] (EE) 13: /usr/libexec/Xorg.bin (SwapConnClientPrefix+0x1e96) [0x464656]
[ 133.275] (EE) 14: /usr/libexec/Xorg.bin (MapWindow+0x117) [0x465697]
[ 133.275] (EE) 15: /usr/libexec/Xorg.bin (ProcBadRequest+0x5f5) [0x433d95]
[ 133.275] (EE) 16: /usr/libexec/Xorg.bin (SendErrorToClient+0x2f7) [0x439037]
[ 133.275] (EE) 17: /usr/libexec/Xorg.bin (remove_fs_handlers+0x416) [0x43d196]
[ 133.275] (EE) 18: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f052db97fe0]
[ 133.276] (EE) 19: /usr/libexec/Xorg.bin (_start+0x29) [0x42761e]
[ 133.276] (EE) 20: ? (?+0x29) [0x29]
[ 133.276] (EE)
[ 133.276] (EE) Segmentation fault at address 0x0
[ 133.276] (EE)
Fatal server error:
[ 133.276] (EE) Caught signal 11 (Segmentation fault). Server aborting
[ 133.276] (EE)
[ 133.276] (EE)
Please consult the Fedora Project support
at http://wiki.x.org

for help.
[ 133.276] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[ 133.276] (EE)
[ 133.326] (EE) Server terminated with error (1). Closing log file.
-------------

When presented with this, an NVidia developer stated:

-------------
"For display offload, the X server is expected to create a shareable pixmap by calling the CreatePixmap function with the CREATE_PIXMAP_USAGE_SHARED hint. Then, it actually shares the pixmap by calling SharePixmapBacking. The message

    (EE) NVIDIA(0): The X server tried to share a non-shareable pixmap

means that the X server called SharePixmapBacking on a pixmap that was not created with the USAGE_SHARED flag. That indicates an X server bug. "
-------------

This problem is a blocker for me. I'll do whatever I need to do to assist with its resolution.
Comment 1 Dave Airlie 2014-12-11 02:51:22 UTC
reproduce with nouveau?

I can't see any codepath in the X server where this is true, two places share pixmaps, and both places create them with the flag

randr.c:rrCreateSharedPixmap

   mpix = master->CreatePixmap(master, width, height, depth,
                                CREATE_PIXMAP_USAGE_SHARED);
    if (!mpix)
        return FALSE;

    spix = PixmapShareToSlave(mpix, crtc->pScreen);
Comment 2 Chris Wilson 2014-12-11 08:22:39 UTC
The other is DRI2UpdatePrime(), which may do:

PixmapShareToSlave(GetDrawablePixmap(pDraw))

But that is allowed to fail.
Comment 3 Karen Pease 2014-12-11 11:29:24 UTC
You don't know how happy I am to check in today and see two responses to this!  :)  I was beginning to lose hope. Tried to see if I could do my intensive graphics work on Windows the other day since I have no GLX in Linux, but Windows "thanked" me by deciding to overwrite and corrupt my boot sector, leaving me to waste the whole evening working on a restore.  :(

As for reproducing with nouveau: Do you mean with my current X config, or with an X config tailored for nouveau? I removed nouveau from my modprobe.conf blacklist and simply swapped out usage of the nvidia driver in the current X config, but it didn't work - perhaps it's not compatible with modesetting?

--------
[   118.301] (II) Loading /usr/lib64/xorg/modules/drivers/nouveau_drv.so
[   118.329] (II) Module nouveau: vendor="X.Org Foundation"
[   118.329]    compiled for 1.16.1, module version = 1.0.11
[   118.329]    Module class: X.Org Video Driver
[   118.329]    ABI class: X.Org Video Driver, version 18.0
[   118.329] (II) LoadModule: "modesetting"
[   118.329] (II) Loading /usr/lib64/xorg/modules/drivers/modesetting_drv.so
[   118.336] (II) Module modesetting: vendor="X.Org Foundation"
[   118.336]    compiled for 1.16.0, module version = 0.9.0
[   118.336]    Module class: X.Org Video Driver
[   118.336]    ABI class: X.Org Video Driver, version 18.0
[   118.336] (II) NOUVEAU driver
[   118.336] (II) NOUVEAU driver for NVIDIA chipset families :
[   118.336]    RIVA TNT        (NV04)
[   118.336]    RIVA TNT2       (NV05)
[   118.336]    GeForce 256     (NV10)
[   118.336]    GeForce 2       (NV11, NV15)
[   118.336]    GeForce 4MX     (NV17, NV18)
[   118.336]    GeForce 3       (NV20)
[   118.336]    GeForce 4Ti     (NV25, NV28)
[   118.336]    GeForce FX      (NV3x)
[   118.336]    GeForce 6       (NV4x)
[   118.336]    GeForce 7       (G7x)
[   118.336]    GeForce 8       (G8x)
[   118.336]    GeForce GTX 200 (NVA0)
[   118.336]    GeForce GTX 400 (NVC0)
[   118.336] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[   118.336] (++) using VT number 5

[   118.336] (--) controlling tty is VT number 5, auto-enabling KeepTty
[   118.337] (EE) [drm] KMS not enabled
[   118.337] (EE) [drm] KMS not enabled
[   118.337] (EE) [drm] KMS not enabled
[   118.337] (II) modesetting(0): using drv /dev/dri/card0
[   118.337] (EE) Screen 0 deleted because of no matching config section.
[   118.337] (II) UnloadModule: "modesetting"
[   118.337] (EE) Device(s) detected, but none match those in the config file.
[   118.337] (EE)
Fatal server error:
[   118.337] (EE) no screens found(EE)
[   118.337] (EE)
Please consult the Fedora Project support
         at http://wiki.x.org
 for help.
[   118.337] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[   118.337] (EE)
[   118.341] (EE) Server terminated with error (1). Closing log file.
--------

I don't have much experience with nouveau so if I'm making an obvious mistake, my apologies (I've spent little time on nouveau but I've spent maybe 8 hours on Bumblebee and maybe 40-50 on nvidia/modesetting).

I could try a very simple xorg.conf with nouveau and without modesetting if yo think that would give you useful info, or maybe play around with my kernel boot parameters.

-----------
two places share pixmaps, and both places create them with the flag
-----------
The other is DRI2UpdatePrime()
-----------

So, what's the next step for me here? Seriously I'm up to any and all options, even giving one of you a root shell if it'd help!   :)
Comment 4 Karen Pease 2014-12-17 14:28:45 UTC
Anyone?  :(
Comment 5 Karen Pease 2014-12-28 00:20:23 UTC
Ping?
Comment 6 mwp.junk 2015-01-31 07:46:09 UTC
I am seeing a similar issue:

Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) Backtrace:
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 0: /usr/libexec/Xorg.bin (OsLookupColor+0x119) [0x59c5f9]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 1: /lib64/libc.so.6 (__restore_rt+0x0) [0x7fa42887794f]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 2: /usr/lib64/xorg/modules/drivers/nvidia_drv.so (nvidiaAddDrawableHandler+0x30e2e) [0x7fa42209f88e]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) unw_get_proc_name failed: no unwind info found [-10]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 3: /usr/lib64/xorg/modules/drivers/nvidia_drv.so (?+0x30e2e) [0x7fa4220453ce]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 4: /usr/lib64/xorg/modules/drivers/nvidia_drv.so (nvidiaAddDrawableHandler+0x9d4a) [0x7fa42205162a]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 5: /usr/lib64/xorg/modules/drivers/nvidia_drv.so (nvidiaAddDrawableHandler+0x5098d6) [0x7fa422a50db6]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 6: /usr/libexec/Xorg.bin (RRCrtcDetachScanoutPixmap+0x6a) [0x4fb4fa]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 7: /usr/libexec/Xorg.bin (xf86PruneDuplicateModes+0x1a78) [0x4bced8]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 8: /usr/libexec/Xorg.bin (xf86PruneDuplicateModes+0x1b4f) [0x4bd04f]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 9: /usr/libexec/Xorg.bin (ProcRRGetOutputProperty+0x4f2) [0x502b32]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 10: /usr/libexec/Xorg.bin (RegisterResourceName+0x232) [0x45c2f2]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 11: /usr/libexec/Xorg.bin (FreeClientResources+0x6c) [0x45d1ec]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 12: /usr/libexec/Xorg.bin (FreeAllResources+0x47) [0x45d297]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 13: /usr/libexec/Xorg.bin (remove_fs_handlers+0x449) [0x43d339]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 14: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7fa428862fe0]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 15: /usr/libexec/Xorg.bin (_start+0x29) [0x4276ee]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) 16: ? (?+0x29) [0x29]
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE)
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) Segmentation fault at address 0x30
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE)
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: Fatal server error:
Jan 30 08:59:31 hpomen gdm-Xorg-:0[1323]: (EE) Caught signal 11 (Segmentation fault). Server aborting
Comment 7 Karen Pease 2015-02-16 02:36:20 UTC
Would be nice to get some acknowledgement that all of the Xorg developers haven't died in a tragic train accident or something, even if that acknowledgement is "sorry, you're on your own, we're too understaffed to deal with all bugs". 

Just saying...
Comment 8 Tim 2015-03-12 00:45:07 UTC
I speak for myself based on experience and not Xorg in that if the issue you're experiencing is not present when the nouveau open-source driver is used, the problem rests with nVidia.

If it is found to be a problem even with the nouveau driver, then care will be taken to resolve the actual bug (being that both projects are open source).

It is not the responsibility of Xorg developers to conform their code to nuances (whatever they may be) found in proprietary drivers.  nVidia needs to fix their driver so it is compatible with Xorg, not the other way around.

Backup your existing configs and start with a basic video configuration utilizing the nouveau driver instead.  See if the issue can be duplicated that way.
Comment 9 Karen Pease 2015-03-12 01:48:48 UTC
As you can see above, I already attempted this with nouveau. If you want me to do something different with nouveau, please tell me and I'll do it. But nouveau and nvidia do not work in the same manner, so it's unlikely that one is going to address the nvidia problem by messing around with nouveau.
Comment 10 Karen Pease 2015-03-12 01:58:19 UTC
Just ran nouveau again in the same config:

[  1834.260] (II) NOUVEAU driver
[  1834.260] (II) NOUVEAU driver for NVIDIA chipset families :
[  1834.260]    RIVA TNT        (NV04)
[  1834.260]    RIVA TNT2       (NV05)
[  1834.260]    GeForce 256     (NV10)
[  1834.260]    GeForce 2       (NV11, NV15)
[  1834.260]    GeForce 4MX     (NV17, NV18)
[  1834.260]    GeForce 3       (NV20)
[  1834.260]    GeForce 4Ti     (NV25, NV28)
[  1834.260]    GeForce FX      (NV3x)
[  1834.260]    GeForce 6       (NV4x)
[  1834.260]    GeForce 7       (G7x)
[  1834.260]    GeForce 8       (G8x)
[  1834.260]    GeForce GTX 200 (NVA0)
[  1834.260]    GeForce GTX 400 (NVC0)
[  1834.260] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[  1834.260] (++) using VT number 5

[  1834.260] (II) modeset(0): using drv /dev/dri/card0
[  1834.260] (EE) Screen 0 deleted because of no matching config section.
[  1834.260] (II) UnloadModule: "modesetting"
[  1834.260] (EE) Device(s) detected, but none match those in the config file.
[  1834.260] (EE)
Fatal server error:
[  1834.260] (EE) no screens found(EE)

But again, I don't see what any of this has to do with xrandr errors trying to set the screen size and Xorg trying to share a non-shareable pixmap.
Comment 11 GitLab Migration User 2018-12-13 22:31:04 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/465.

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.