Bug 37502

Summary: xdmxconfig fails to create a GC and bails
Product: xorg Reporter: torquil
Component: Server/DDX/dmxAssignee: dmx-bugs
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:
Attachments:
Description Flags
patch to prevent a BadPixmap error being thrown
none
0001-dmx-don-t-include-dmx-config.h-from-xdmxconfig-37502.patch none

Description torquil 2011-05-23 07:02:35 UTC
My Debian version number is 2:1.10.1-2 and the top of /var/log/Xorg.0.log says

X.Org X Server 1.10.1

so I'm not sure how to choose the version in this bug report. Only number around 6 and 7 are available...

Anyway, here is the problem: I get an error when running xdmxconfig:

tmac@asus:~$ xdmxconfig
(**) dmx: Unable to read configuration file 
X Error of failed request:  BadPixmap (invalid Pixmap parameter)
  Major opcode of failed request:  55 (X_CreateGC)
  Resource id in failed request:  0x0
  Serial number of failed request:  131
  Current serial number in output stream:  152

Same problem appears when running with a filename argument, e.g. xdmx.conf

Here is a 2.5 year old Debian report of a similar problem, by another reporter:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495816

It doesn't seem to have been reported here before.
Comment 1 Matt Hirsch 2013-01-25 08:35:25 UTC
Created attachment 73633 [details] [review]
patch to prevent a BadPixmap error being thrown

I've attached a patch that hopefully resolves this. It removes GCClipMask from the valuemask. The X server seems to be objecting that 'None' is not a valid pixmap for the clip_mask member of XGCValues, even though the manual says:

http://www.tronche.com/gui/x/xlib/GC/manipulating.html

"The clip-mask restricts writes to the destination drawable. If the clip-mask is set to a pixmap, it must have depth one and have the same root as the GC, or a BadMatch error results. If clip-mask is set to None, the pixels are always drawn regardless of the clip origin."

There seem to be no ill effects to simply removing the clip-mask (i.e. the graphics are still drawn). The manual is ambiguous as to whether the flag should be included if the pixmap is set to None, anyway.

This is against the version packaged by Fedora as xorg-x11-server-Xdmx-1.13.1-4.fc18.x86_64, but it seems the code hasn't changed much recently anyway...
Comment 2 Peter Hutterer 2013-01-26 04:20:11 UTC
Created attachment 73666 [details] [review]
0001-dmx-don-t-include-dmx-config.h-from-xdmxconfig-37502.patch
Comment 3 Peter Hutterer 2013-01-26 04:33:18 UTC
Note that while this patch fixes the immediate issue here, there may be more issues hidden. both server and xdmxconfig use libdmxconfig.a which still includes the server headers. This needs full auditing, though I don't think I've got time for that right now.
Comment 4 Peter Hutterer 2013-02-15 01:48:41 UTC
commit 1058fcf57fdcb94d92e7b5f4483b347853d5f8e6
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Sat Jan 26 14:13:33 2013 +1000

    dmx: don't include dmx-config.h from xdmxconfig (#37502)

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.