xvfb: Use RROutputSetPhysicalSize to set physical size of display

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1532
Signed-off-by: Twaik Yont <twaikyont@gmail.com>
This commit is contained in:
Twaik Yont 2023-03-10 16:10:46 +02:00 committed by Matt Turner
parent 818130bb12
commit 43a7bb3c92

View File

@ -753,6 +753,8 @@ vfbRRScreenSetSize(ScreenPtr pScreen,
CARD32 mmWidth, CARD32 mmWidth,
CARD32 mmHeight) CARD32 mmHeight)
{ {
rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
// Prevent screen updates while we change things around // Prevent screen updates while we change things around
SetRootClip(pScreen, ROOT_CLIP_NONE); SetRootClip(pScreen, ROOT_CLIP_NONE);
@ -767,7 +769,7 @@ vfbRRScreenSetSize(ScreenPtr pScreen,
RRScreenSizeNotify (pScreen); RRScreenSizeNotify (pScreen);
RRTellChanged(pScreen); RRTellChanged(pScreen);
return TRUE; return RROutputSetPhysicalSize(pScrPriv->outputs[pScreen->myNum], mmWidth, mmHeight);
} }
static Bool static Bool
@ -803,6 +805,7 @@ vfbRandRInit(ScreenPtr pScreen)
xRRModeInfo modeInfo; xRRModeInfo modeInfo;
char name[64]; char name[64];
#endif #endif
int mmWidth, mmHeight;
if (!RRScreenInit (pScreen)) if (!RRScreenInit (pScreen))
return FALSE; return FALSE;
@ -818,6 +821,9 @@ vfbRandRInit(ScreenPtr pScreen)
pScrPriv->rrOutputValidateMode = vfbRROutputValidateMode; pScrPriv->rrOutputValidateMode = vfbRROutputValidateMode;
pScrPriv->rrModeDestroy = NULL; pScrPriv->rrModeDestroy = NULL;
mmWidth = pScreen->width * 25.4 / monitorResolution;
mmHeight = pScreen->height * 25.4 / monitorResolution;
RRScreenSetSizeRange (pScreen, RRScreenSetSizeRange (pScreen,
1, 1, 1, 1,
pScreen->width, pScreen->height); pScreen->width, pScreen->height);
@ -850,6 +856,8 @@ vfbRandRInit(ScreenPtr pScreen)
return FALSE; return FALSE;
if (!RROutputSetConnection (output, RR_Connected)) if (!RROutputSetConnection (output, RR_Connected))
return FALSE; return FALSE;
if (!RROutputSetPhysicalSize (output, mmWidth, mmHeight))
return FALSE;
RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, NULL, 1, &output); RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, NULL, 1, &output);
#endif #endif
return TRUE; return TRUE;
@ -958,6 +966,9 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv)
int i; int i;
int NumFormats = 0; int NumFormats = 0;
if (!monitorResolution)
monitorResolution = 96;
/* initialize pixmap formats */ /* initialize pixmap formats */
/* must have a pixmap depth to match every screen depth */ /* must have a pixmap depth to match every screen depth */