xpra icon
Bug tracker and wiki

Opened 5 years ago

Closed 3 years ago

#728 closed defect (wontfix)

xrandr reports screen dimensions as 0mm x 0mm

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: critical Milestone: 2.0
Component: server Version: trunk
Keywords: dummy randr x11 Cc: rektide@…

Description

$ 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

Attachments (2)

dummy_driver.c (24.3 KB) - added by Antoine Martin 5 years ago.
modified dummy driver which dumps a lot more information about internal data structures
dummy_driver.2.c (28.2 KB) - added by Antoine Martin 5 years ago.
hacked driver with lots of unsuccessful changes to try to figure out what we need to do

Download all attachments as: .zip

Change History (10)

comment:1 Changed 5 years ago by Antoine Martin

Owner: changed from Antoine Martin to Antoine Martin
Status: newassigned

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.

Last edited 5 years ago by Antoine Martin (previous) (diff)

Changed 5 years ago by Antoine Martin

Attachment: dummy_driver.c added

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

comment:2 Changed 5 years ago by 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.

Changed 5 years ago by Antoine Martin

Attachment: dummy_driver.2.c added

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

comment:3 Changed 5 years ago by Antoine Martin

Milestone: 0.150.16

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

comment:4 Changed 4 years ago by Antoine Martin

Keywords: dummy randr x11 added
Milestone: 0.161.0

No movement on this upstream, re-scheduling.

comment:5 Changed 3 years ago by Antoine Martin

Milestone: 1.01.1

Milestone renamed

comment:6 Changed 3 years ago by Antoine Martin

Milestone: 1.12.0

Milestone renamed

comment:7 Changed 3 years ago by rektide

Cc: rektide@… added

comment:8 Changed 3 years ago by Antoine Martin

Resolution: wontfix
Status: assignedclosed

Best to deal with this in #56

Note: See TracTickets for help on using tickets.