Xpra: Ticket #728: xrandr reports screen dimensions as 0mm x 0mm

$ xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 175, current 2560 x 1600, maximum 8192 x 4096
default connected 2560x1600+0+0 0mm x 0mm


Wed, 05 Nov 2014 03:11:13 GMT - Antoine Martin: owner, status changed

The code that prints this is is in xrandr.c

if (cur_mode)
{
    printf (" %dmm x %dmm",
	(int)output_info->mm_width, (int)output_info->mm_height);
}

With:

get_screen (current);
get_crtcs ();
get_outputs ();
(..)
for (output = all_outputs; output; output = output->next)
{
    XRROutputInfo   *output_info = output->output_info;
(..)

And we have in get_outputs() the core of it, which populates the all_outputs global, a linked list (see all_outputs_tail) of all outputs:

for (o = 0; o < res->noutput; o++)
{
    XRROutputInfo   *output_info = XRRGetOutputInfo (dpy, res, res->outputs[o]);

noutput is set in crtc_add_output:

crtc_add_output (crtc_t *crtc, output_t *output)

Which is called from set_crtcs:

for (output = all_outputs; output; output = output->next)
{
    if (!output->mode_info) continue;
    crtc_add_output (output->crtc_info, output);
}

So, it looks like we need to ensure XRROutputInfo is populated correctly. Here it is:

typedef struct _XRROutputInfo {
    Time	    timestamp;
    RRCrtc	    crtc;
    char	    *name;
    int		    nameLen;
    unsigned long   mm_width;
    unsigned long   mm_height;
    Connection	    connection;
    SubpixelOrder   subpixel_order;
    int		    ncrtc;
    RRCrtc	    *crtcs;
    int		    nclone;
    RROutput	    *clones;
    int		    nmode;
    int		    npreferred;
    RRMode	    *modes;
} XRROutputInfo;

It is interesting to see subpixel_order is in there too. Maybe we should add another window property to allow us to change this on the fly (see #559) as there is bound to be software out there that does not use the standard way of figuring out the pixel order and will use hardware calls instead.


We may also want to deal with the gamma warning, which comes from:

size = XRRGetCrtcGammaSize(dpy, output->crtc_info->crtc.xid);
if (!size) {
    warning("Failed to get size of gamma for output %s\n", output->output.string);
    return;
}

This should be simple enough:

typedef struct _XRRCrtcGamma {
    int		    size;
    unsigned short  *red;
    unsigned short  *green;
    unsigned short  *blue;
} XRRCrtcGamma;

Which is returned by:

XRRCrtcGamma *
XRRGetCrtcGamma (Display *dpy, RRCrtc crtc);

I don't think we want to do any gamma correction on the server. The client will do it already when rendering the output. Would be easy to add if we need it.


Wed, 05 Nov 2014 07:55:51 GMT - Antoine Martin: attachment set

modified dummy driver which dumps a lot more information about internal data structures


Thu, 06 Nov 2014 06:47:41 GMT - Antoine Martin:

Following the work on #349, down the rabbit hole we go..

XRRGetOutputInfo is from libXRandR, it gets the mm dimensions from the xRRGetOutputInfoReply response to a RRGetOutputInfo X11 server call (subpixelOrder is in there too).

The server populates xRRGetOutputInfoReply from the RROutputPtr it gets using the VERIFY_RR_OUTPUT macro.. RROutputPtr is a pointer to RROutputRec (aka _rrOutput) which has more or less the same data in it, including mm and subpixel order. The only place the server creates RROutputRec is in RROutputCreate. But when I dump the outputs in the dummy driver, there aren't any! And if I add one using:

output = RROutputCreate(pScrn->pScreen, "default", 7, NULL);
output->mmWidth = pScrn->pScreen->mmWidth;
output->mmHeight = pScrn->pScreen->mmHeight;

It shows the output (and more warnings about missing modes for the output):

dummy connected 2560x1600+0+0 (0x55) normal (normal) 677mm x 423mm

but the mm stays at 0...

In the end, I think the "default" output we see is a virtual one. Created where?

I give up. For now.


Thu, 06 Nov 2014 07:30:16 GMT - Antoine Martin: attachment set

hacked driver with lots of unsuccessful changes to try to figure out what we need to do


Mon, 26 Jan 2015 08:54:34 GMT - Antoine Martin: milestone changed

Re-scheduling, see ticket:56#comment:9


Fri, 23 Oct 2015 06:10:24 GMT - Antoine Martin: milestone changed; keywords set

No movement on this upstream, re-scheduling.


Tue, 12 Jul 2016 16:51:50 GMT - Antoine Martin: milestone changed

Milestone renamed


Sun, 21 Aug 2016 09:55:49 GMT - Antoine Martin: milestone changed

Milestone renamed


Fri, 30 Dec 2016 02:27:57 GMT - rektide: cc set


Thu, 16 Feb 2017 04:38:22 GMT - Antoine Martin: status changed; resolution set

Best to deal with this in #56


Sat, 23 Jan 2021 05:04:14 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/728