aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h26
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c1
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c17
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.c30
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.h4
-rw-r--r--xorg-server/hw/xfree86/common/xf86sbusBus.c6
8 files changed, 57 insertions, 31 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index 1514c2603..eada01cf9 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -198,11 +198,6 @@ extern _X_EXPORT void *xf86GetPointerScreenFuncs(void);
extern _X_EXPORT void xf86InitOrigins(void);
extern _X_EXPORT void xf86ReconfigureLayout(void);
-/* xf86cvt.c */
-extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay,
- float VRefresh, Bool Reduced,
- Bool Interlaced);
-
/* xf86DPMS.c */
extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set,
@@ -243,6 +238,7 @@ extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler) (void));
extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new);
extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg);
extern _X_EXPORT void xf86PrintBacktrace(void);
+extern _X_EXPORT Bool xf86VTOwner(void);
/* xf86Helper.c */
@@ -413,26 +409,6 @@ extern _X_EXPORT void
xf86PrintModes(ScrnInfoPtr scrp);
extern _X_EXPORT void
xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
-extern _X_EXPORT double
-xf86ModeHSync(const DisplayModeRec * mode);
-extern _X_EXPORT double
-xf86ModeVRefresh(const DisplayModeRec * mode);
-extern _X_EXPORT void
-xf86SetModeDefaultName(DisplayModePtr mode);
-extern _X_EXPORT void
-xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-extern _X_EXPORT DisplayModePtr
-xf86DuplicateMode(const DisplayModeRec * pMode);
-extern _X_EXPORT void
-xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec * pMode);
-extern _X_EXPORT DisplayModePtr
-xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
-extern _X_EXPORT Bool
-xf86ModesEqual(const DisplayModeRec * pMode1, const DisplayModeRec * pMode2);
-extern _X_EXPORT void
-xf86PrintModeline(int scrnIndex, DisplayModePtr mode);
-extern _X_EXPORT DisplayModePtr
-xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
/* xf86Option.c */
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 486752b07..74d5ed3b7 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -52,6 +52,7 @@
#endif
#include "xf86.h"
+#include "xf86Modes.h"
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "xf86Config.h"
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index 055223310..7a949fd74 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -84,6 +84,7 @@
#include "dpmsproc.h"
#endif
+#include "xf86platformBus.h"
/*
* This is a toggling variable:
* FALSE = No VT switching keys have been pressed last time around
@@ -427,7 +428,7 @@ xf86VTSwitch(void)
* Since all screens are currently all in the same state it is sufficient
* check the first. This might change in future.
*/
- if (xf86Screens[0]->vtSema) {
+ if (xf86VTOwner()) {
DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
@@ -560,6 +561,11 @@ xf86VTSwitch(void)
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
+#ifdef XSERVER_PLATFORM_BUS
+ /* check for any new output devices */
+ xf86platformVTProbe();
+#endif
+
OsReleaseSIGIO();
}
}
@@ -768,3 +774,12 @@ DDXRingBell(int volume, int pitch, int duration)
{
xf86OSRingBell(volume, pitch, duration);
}
+
+Bool
+xf86VTOwner(void)
+{
+ /* at system startup xf86Screens[0] won't be set - but we will own the VT */
+ if (xf86NumScreens == 0)
+ return TRUE;
+ return xf86Screens[0]->vtSema;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index 1695dbf74..91ec4c8bb 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -819,7 +819,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
if (serverGeneration != 1) {
xf86Resetting = TRUE;
/* All screens are in the same state, so just check the first */
- if (!xf86Screens[0]->vtSema) {
+ if (!xf86VTOwner()) {
#ifdef HAS_USL_VTS
ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index bee407bf9..26c03c6c3 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -870,7 +870,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
}
/* Enable it if it's properly initialised and we're currently in the VT */
- if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema) {
+ if (enable && dev->inited && dev->startup && xf86VTOwner()) {
OsBlockSignals();
EnableDevice(dev, TRUE);
if (!dev->enabled) {
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c
index 58663336a..e368deeb8 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.c
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.c
@@ -47,6 +47,7 @@
#include "Pci.h"
#include "xf86platformBus.h"
+#include "randrstr.h"
int platformSlotClaimed;
int xf86_num_platform_devices;
@@ -113,6 +114,11 @@ xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_
return NULL;
}
+Bool
+xf86_get_platform_device_unowned(int index)
+{
+ return xf86_platform_devices[index].attribs->unowned;
+}
/*
* xf86IsPrimaryPlatform() -- return TRUE if primary device
@@ -449,6 +455,14 @@ xf86platformAddDevice(int index)
CreateScratchPixmapsForScreen(xf86GPUScreens[i]->pScreen);
+ if (xf86GPUScreens[i]->pScreen->CreateScreenResources &&
+ !(*xf86GPUScreens[i]->pScreen->CreateScreenResources) (xf86GPUScreens[i]->pScreen)) {
+ RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
+ xf86DeleteScreen(xf86GPUScreens[i]);
+ xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
+ xf86NumGPUScreens = old_screens;
+ return -1;
+ }
/* attach unbound to 0 protocol screen */
AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
@@ -494,8 +508,22 @@ xf86platformRemoveDevice(int index)
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
xf86_remove_platform_device(index);
-
+ RRTellChanged(xf86Screens[0]->pScreen);
out:
return;
}
+
+/* called on return from VT switch to find any new devices */
+void xf86platformVTProbe(void)
+{
+ int i;
+
+ for (i = 0; i < xf86_num_platform_devices; i++) {
+ if (xf86_platform_devices[i].attribs->unowned == FALSE)
+ continue;
+
+ xf86_platform_devices[i].attribs->unowned = FALSE;
+ xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs);
+ }
+}
#endif
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.h b/xorg-server/hw/xfree86/common/xf86platformBus.h
index 49afc247b..4e1757854 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.h
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.h
@@ -46,6 +46,8 @@ extern int
xf86_remove_platform_device(int dev_index);
extern Bool
xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_str);
+extern Bool
+xf86_get_platform_device_unowned(int index);
extern int
xf86platformAddDevice(int index);
@@ -59,6 +61,8 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu
extern _X_EXPORT int
xf86PlatformMatchDriver(char *matches[], int nmatches);
+
+extern void xf86platformVTProbe(void);
#endif
#endif
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
index b6a6b94b3..07eb71ed8 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.c
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -641,14 +641,16 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
int i, index;
sbusCmapPtr cmap;
struct fbcmap fbcmap;
- unsigned char *data = malloc(numColors * 3);
+ unsigned char *data;
cmap = SBUSCMAPPTR(pScrn->pScreen);
if (!cmap)
return;
fbcmap.count = 0;
fbcmap.index = indices[0];
- fbcmap.red = data;
+ fbcmap.red = data = malloc(numColors * 3);
+ if (!data)
+ return;
fbcmap.green = data + numColors;
fbcmap.blue = fbcmap.green + numColors;
for (i = 0; i < numColors; i++) {