Commit 95f2050e authored by Ignacio Casal Quinteiro's avatar Ignacio Casal Quinteiro Committed by Ignacio Casal

vfb: factor out method to add a crtc

parent 074c98cf
Pipeline #50320 passed with stages
in 4 minutes and 36 seconds
......@@ -792,18 +792,55 @@ vfbRRGetInfo(ScreenPtr pScreen, Rotation *rotations)
return TRUE;
}
#if RANDR_12_INTERFACE
static Bool
vfbRandRInit(ScreenPtr pScreen)
addCrtc(ScreenPtr pScreen, const char *name, int x, int y, int width, int height)
{
rrScrPrivPtr pScrPriv;
#if RANDR_12_INTERFACE
RRModePtr mode;
RRCrtcPtr crtc;
RROutputPtr output;
char modeInfoName[64];
xRRModeInfo modeInfo;
char name[64];
RROutputPtr output;
RRCrtcPtr crtc;
RRModePtr mode;
sprintf(modeInfoName, "%dx%d", width, height);
memset(&modeInfo, '\0', sizeof(modeInfo));
modeInfo.width = width;
modeInfo.height = height;
modeInfo.nameLength = strlen(modeInfoName);
mode = RRModeGet(&modeInfo, modeInfoName);
if (!mode)
return FALSE;
crtc = RRCrtcCreate(pScreen, NULL);
if (!crtc)
return FALSE;
/* This is to avoid xrandr to complain about the gamma missing */
RRCrtcGammaSetSize(crtc, 256);
output = RROutputCreate(pScreen, name, strlen(name), NULL);
if (!output)
return FALSE;
if (!RROutputSetClones(output, NULL, 0))
return FALSE;
if (!RROutputSetModes(output, &mode, 1, 0))
return FALSE;
if (!RROutputSetCrtcs(output, &crtc, 1))
return FALSE;
if (!RROutputSetConnection(output, RR_Connected))
return FALSE;
RRCrtcNotify(crtc, mode, x, y, RR_Rotate_0, NULL, 1, &output);
return TRUE;
}
#endif
static Bool
vfbRandRInit(ScreenPtr pScreen)
{
rrScrPrivPtr pScrPriv;
if (!RRScreenInit (pScreen))
return FALSE;
pScrPriv = rrGetScrPriv(pScreen);
......@@ -822,35 +859,11 @@ vfbRandRInit(ScreenPtr pScreen)
1, 1,
pScreen->width, pScreen->height);
sprintf (name, "%dx%d", pScreen->width, pScreen->height);
memset (&modeInfo, '\0', sizeof (modeInfo));
modeInfo.width = pScreen->width;
modeInfo.height = pScreen->height;
modeInfo.nameLength = strlen (name);
mode = RRModeGet (&modeInfo, name);
if (!mode)
return FALSE;
crtc = RRCrtcCreate (pScreen, NULL);
if (!crtc)
return FALSE;
/* This is to avoid xrandr to complain about the gamma missing */
RRCrtcGammaSetSize (crtc, 256);
output = RROutputCreate (pScreen, "screen", 6, NULL);
if (!output)
return FALSE;
if (!RROutputSetClones (output, NULL, 0))
return FALSE;
if (!RROutputSetModes (output, &mode, 1, 0))
return FALSE;
if (!RROutputSetCrtcs (output, &crtc, 1))
return FALSE;
if (!RROutputSetConnection (output, RR_Connected))
return FALSE;
RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, NULL, 1, &output);
addCrtc(pScreen,
"screen",
0, 0,
pScreen->width,
pScreen->height);
#endif
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment