Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xrandr reports screen dimensions as 0mm x 0mm #728

Closed
totaam opened this issue Nov 4, 2014 · 13 comments
Closed

xrandr reports screen dimensions as 0mm x 0mm #728

totaam opened this issue Nov 4, 2014 · 13 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Nov 4, 2014

Issue migrated from trac ticket # 728

component: server | priority: critical | resolution: wontfix | keywords: dummy randr x11

2014-11-04 07:46:52: totaam created the issue


$ 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
@totaam
Copy link
Collaborator Author

totaam commented Nov 5, 2014

2014-11-05 03:11:13: totaam changed status from new to assigned

@totaam
Copy link
Collaborator Author

totaam commented Nov 5, 2014

2014-11-05 03:11:13: totaam changed owner from antoine to totaam

@totaam
Copy link
Collaborator Author

totaam commented Nov 5, 2014

2014-11-05 03:11:13: totaam commented


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; outputoutput->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; outputoutput->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.

@totaam
Copy link
Collaborator Author

totaam commented Nov 5, 2014

2014-11-05 07:55:51: totaam uploaded file dummy_driver.c (24.3 KiB)

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

@totaam
Copy link
Collaborator Author

totaam commented Nov 6, 2014

2014-11-06 06:47:41: totaam commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Nov 6, 2014

2014-11-06 07:30:17: totaam uploaded file dummy_driver.2.c (28.2 KiB)

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

@totaam
Copy link
Collaborator Author

totaam commented Jan 26, 2015

2015-01-26 08:54:34: totaam commented


Re-scheduling, see #56#comment:9

@totaam
Copy link
Collaborator Author

totaam commented Oct 23, 2015

2015-10-23 07:10:25: antoine commented


No movement on this upstream, re-scheduling.

@totaam
Copy link
Collaborator Author

totaam commented Jul 12, 2016

2016-07-12 17:51:51: antoine commented


Milestone renamed

@totaam
Copy link
Collaborator Author

totaam commented Aug 21, 2016

2016-08-21 10:55:50: antoine commented


Milestone renamed

@totaam
Copy link
Collaborator Author

totaam commented Feb 16, 2017

2017-02-16 04:38:22: antoine changed status from assigned to closed

@totaam
Copy link
Collaborator Author

totaam commented Feb 16, 2017

2017-02-16 04:38:22: antoine set resolution to wontfix

@totaam
Copy link
Collaborator Author

totaam commented Feb 16, 2017

2017-02-16 04:38:22: antoine commented


Best to deal with this in #56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant