xf86: Assign GPUs to screens according to configuration
If there is an explicit configuration, assign the RandR provider of the GPUDevice to the screen it was specified for. If there is no configuration (default case) the screen number is still 0 so it doesn't change behaviour. The result is e.g: # DISPLAY=:0.2 xrandr --listproviders Providers: number : 2 Provider 0: id: 0xd2 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting Provider 1: id: 0xfd cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 2 outputs: 2 associated providers: 0 name:Intel Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
This commit is contained in:
parent
cd567415cc
commit
f08bc32f5a
|
@ -107,9 +107,9 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
|
||||||
}
|
}
|
||||||
|
|
||||||
static screenLayoutPtr
|
static screenLayoutPtr
|
||||||
xf86BusConfigMatch(ScrnInfoPtr scrnInfo) {
|
xf86BusConfigMatch(ScrnInfoPtr scrnInfo, Bool is_gpu) {
|
||||||
screenLayoutPtr layout;
|
screenLayoutPtr layout;
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
|
for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
|
||||||
layout++) {
|
layout++) {
|
||||||
|
@ -118,9 +118,18 @@ xf86BusConfigMatch(ScrnInfoPtr scrnInfo) {
|
||||||
xf86GetDevFromEntity(scrnInfo->entityList[i],
|
xf86GetDevFromEntity(scrnInfo->entityList[i],
|
||||||
scrnInfo->entityInstanceList[i]);
|
scrnInfo->entityInstanceList[i]);
|
||||||
|
|
||||||
if (dev == layout->screen->device) {
|
if (is_gpu) {
|
||||||
/* A match has been found */
|
for (j = 0; j < layout->screen->num_gpu_devices; j++) {
|
||||||
return layout;
|
if (dev == layout->screen->gpu_devices[j]) {
|
||||||
|
/* A match has been found */
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (dev == layout->screen->device) {
|
||||||
|
/* A match has been found */
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +201,7 @@ xf86BusConfig(void)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
layout = xf86BusConfigMatch(xf86Screens[i]);
|
layout = xf86BusConfigMatch(xf86Screens[i], FALSE);
|
||||||
if (layout && layout->screen)
|
if (layout && layout->screen)
|
||||||
xf86Screens[i]->confScreen = layout->screen;
|
xf86Screens[i]->confScreen = layout->screen;
|
||||||
else {
|
else {
|
||||||
|
@ -204,9 +213,12 @@ xf86BusConfig(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bind GPU conf screen to protocol screen 0 */
|
/* bind GPU conf screen to the configured protocol screen, or 0 if not configured */
|
||||||
for (i = 0; i < xf86NumGPUScreens; i++)
|
for (i = 0; i < xf86NumGPUScreens; i++) {
|
||||||
xf86GPUScreens[i]->confScreen = xf86Screens[0]->confScreen;
|
layout = xf86BusConfigMatch(xf86GPUScreens[i], TRUE);
|
||||||
|
int scrnum = (layout && layout->screen) ? layout->screen->screennum : 0;
|
||||||
|
xf86GPUScreens[i]->confScreen = xf86Screens[scrnum]->confScreen;
|
||||||
|
}
|
||||||
|
|
||||||
/* If no screens left, return now. */
|
/* If no screens left, return now. */
|
||||||
if (xf86NumScreens == 0) {
|
if (xf86NumScreens == 0) {
|
||||||
|
|
|
@ -209,9 +209,11 @@ xf86AutoConfigOutputDevices(void)
|
||||||
if (!xf86Info.autoBindGPU)
|
if (!xf86Info.autoBindGPU)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < xf86NumGPUScreens; i++)
|
for (i = 0; i < xf86NumGPUScreens; i++) {
|
||||||
|
int scrnum = xf86GPUScreens[i]->confScreen->screennum;
|
||||||
RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
|
RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
|
||||||
xf86ScrnToScreen(xf86Screens[0]));
|
xf86ScrnToScreen(xf86Screens[scrnum]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -689,8 +691,10 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < xf86NumGPUScreens; i++)
|
for (i = 0; i < xf86NumGPUScreens; i++) {
|
||||||
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
|
int scrnum = xf86GPUScreens[i]->confScreen->screennum;
|
||||||
|
AttachUnboundGPU(xf86Screens[scrnum]->pScreen, xf86GPUScreens[i]->pScreen);
|
||||||
|
}
|
||||||
|
|
||||||
xf86AutoConfigOutputDevices();
|
xf86AutoConfigOutputDevices();
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,7 @@ xf86platformAddGPUDevices(DriverPtr drvp)
|
||||||
int
|
int
|
||||||
xf86platformAddDevice(int index)
|
xf86platformAddDevice(int index)
|
||||||
{
|
{
|
||||||
int i, old_screens, scr_index;
|
int i, old_screens, scr_index, scrnum;
|
||||||
DriverPtr drvp = NULL;
|
DriverPtr drvp = NULL;
|
||||||
screenLayoutPtr layout;
|
screenLayoutPtr layout;
|
||||||
static const char *hotplug_driver_name = "modesetting";
|
static const char *hotplug_driver_name = "modesetting";
|
||||||
|
@ -674,14 +674,15 @@ xf86platformAddDevice(int index)
|
||||||
xf86NumGPUScreens = old_screens;
|
xf86NumGPUScreens = old_screens;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* attach unbound to 0 protocol screen */
|
/* attach unbound to the configured protocol screen (or 0) */
|
||||||
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
|
scrnum = xf86GPUScreens[i]->confScreen->screennum;
|
||||||
|
AttachUnboundGPU(xf86Screens[scrnum]->pScreen, xf86GPUScreens[i]->pScreen);
|
||||||
if (xf86Info.autoBindGPU)
|
if (xf86Info.autoBindGPU)
|
||||||
RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
|
RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
|
||||||
xf86ScrnToScreen(xf86Screens[0]));
|
xf86ScrnToScreen(xf86Screens[scrnum]));
|
||||||
|
|
||||||
RRResourcesChanged(xf86Screens[0]->pScreen);
|
RRResourcesChanged(xf86Screens[scrnum]->pScreen);
|
||||||
RRTellChanged(xf86Screens[0]->pScreen);
|
RRTellChanged(xf86Screens[scrnum]->pScreen);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -690,7 +691,7 @@ void
|
||||||
xf86platformRemoveDevice(int index)
|
xf86platformRemoveDevice(int index)
|
||||||
{
|
{
|
||||||
EntityPtr entity;
|
EntityPtr entity;
|
||||||
int ent_num, i, j;
|
int ent_num, i, j, scrnum;
|
||||||
Bool found;
|
Bool found;
|
||||||
|
|
||||||
for (ent_num = 0; ent_num < xf86NumEntities; ent_num++) {
|
for (ent_num = 0; ent_num < xf86NumEntities; ent_num++) {
|
||||||
|
@ -717,6 +718,8 @@ xf86platformRemoveDevice(int index)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scrnum = xf86GPUScreens[i]->confScreen->screennum;
|
||||||
|
|
||||||
xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen);
|
xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen);
|
||||||
|
|
||||||
RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
|
RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
|
||||||
|
@ -726,8 +729,8 @@ xf86platformRemoveDevice(int index)
|
||||||
|
|
||||||
xf86_remove_platform_device(index);
|
xf86_remove_platform_device(index);
|
||||||
|
|
||||||
RRResourcesChanged(xf86Screens[0]->pScreen);
|
RRResourcesChanged(xf86Screens[scrnum]->pScreen);
|
||||||
RRTellChanged(xf86Screens[0]->pScreen);
|
RRTellChanged(xf86Screens[scrnum]->pScreen);
|
||||||
out:
|
out:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue