diff options
Diffstat (limited to 'xorg-server/hw/xfree86')
30 files changed, 177 insertions, 183 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++) { diff --git a/xorg-server/hw/xfree86/ddc/xf86DDC.h b/xorg-server/hw/xfree86/ddc/xf86DDC.h index c63da8bff..bdc7648a9 100644 --- a/xorg-server/hw/xfree86/ddc/xf86DDC.h +++ b/xorg-server/hw/xfree86/ddc/xf86DDC.h @@ -45,8 +45,6 @@ extern _X_EXPORT void extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC); -extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC); - extern _X_EXPORT Bool xf86MonitorIsHDMI(xf86MonPtr mon); diff --git a/xorg-server/hw/xfree86/fbdevhw/Makefile.am b/xorg-server/hw/xfree86/fbdevhw/Makefile.am index 1fa9321cb..ee5577a86 100644 --- a/xorg-server/hw/xfree86/fbdevhw/Makefile.am +++ b/xorg-server/hw/xfree86/fbdevhw/Makefile.am @@ -10,7 +10,7 @@ else libfbdevhw_la_SOURCES = fbdevhwstub.c endif -INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c +INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c -I$(srcdir)/../modes -I$(srcdir)/../ddc -I$(srcdir)/../parser AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c index d4b5558a7..cbb40930b 100644 --- a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c +++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c @@ -6,6 +6,7 @@ #include <string.h> #include "xf86.h" +#include "xf86Modes.h" #include "xf86_OSproc.h" /* pci stuff */ diff --git a/xorg-server/hw/xfree86/modes/Makefile.am b/xorg-server/hw/xfree86/modes/Makefile.am index 9236426bf..7e33ebb17 100644 --- a/xorg-server/hw/xfree86/modes/Makefile.am +++ b/xorg-server/hw/xfree86/modes/Makefile.am @@ -16,7 +16,6 @@ libxf86modes_la_SOURCES = \ xf86Modes.h \ xf86RandR12.c \ xf86RandR12.h \ - xf86Rename.h \ xf86Rotate.c \ $(DGA_SRCS) @@ -29,7 +28,6 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ sdk_HEADERS = \ xf86Crtc.h \ xf86Modes.h \ - xf86RandR12.h \ - xf86Rename.h + xf86RandR12.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index e4b393cb1..35845e875 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -1997,6 +1997,14 @@ xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, Bool any_enabled = FALSE; int o; + /* + * Don't bother enabling outputs on GPU screens: a client needs to attach + * it to a source provider before setting a mode that scans out a shared + * pixmap. + */ + if (scrn->is_gpu) + return FALSE; + for (o = 0; o < config->num_output; o++) any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE); @@ -2449,11 +2457,11 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow) config->debug_modes = xf86ReturnOptValBool(config->options, OPTION_MODEDEBUG, FALSE); - if (scrn->display->virtualX) + if (scrn->display->virtualX && !scrn->is_gpu) width = scrn->display->virtualX; else width = config->maxWidth; - if (scrn->display->virtualY) + if (scrn->display->virtualY && !scrn->is_gpu) height = scrn->display->virtualY; else height = config->maxHeight; @@ -2466,9 +2474,11 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow) ret = xf86CollectEnabledOutputs(scrn, config, enabled); if (ret == FALSE && canGrow) { - xf86DrvMsg(i, X_WARNING, - "Unable to find connected outputs - setting %dx%d initial framebuffer\n", - NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT); + if (!scrn->is_gpu) + xf86DrvMsg(i, X_WARNING, + "Unable to find connected outputs - setting %dx%d " + "initial framebuffer\n", + NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT); have_outputs = FALSE; } else { @@ -2517,8 +2527,10 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow) /* XXX override xf86 common frame computation code */ - scrn->display->frameX0 = 0; - scrn->display->frameY0 = 0; + if (!scrn->is_gpu) { + scrn->display->frameX0 = 0; + scrn->display->frameY0 = 0; + } for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; @@ -2566,7 +2578,7 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow) } } - if (scrn->display->virtualX == 0) { + if (scrn->display->virtualX == 0 || scrn->is_gpu) { /* * Expand virtual size to cover the current config and potential mode * switches, if the driver can't enlarge the screen later. @@ -2581,8 +2593,10 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow) } } - scrn->display->virtualX = width; - scrn->display->virtualY = height; + if (!scrn->is_gpu) { + scrn->display->virtualX = width; + scrn->display->virtualY = height; + } } if (width > scrn->virtualX) @@ -2687,8 +2701,8 @@ xf86SetDesiredModes(ScrnInfoPtr scrn) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); xf86CrtcPtr crtc = config->crtc[0]; + int enabled = 0, failed = 0; int c; - int enabled = 0; /* A driver with this hook will take care of this */ if (!crtc->funcs->set_mode_major) { @@ -2748,11 +2762,12 @@ xf86SetDesiredModes(ScrnInfoPtr scrn) if (config->output[o]->crtc == crtc) config->output[o]->crtc = NULL; crtc->enabled = FALSE; + ++failed; } } xf86DisableUnusedFunctions(scrn); - return enabled != 0; + return enabled != 0 || failed == 0; } /** diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h index 802303f74..c127d78af 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.h +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h @@ -25,9 +25,6 @@ #include <edid.h> #include "randrstr.h" -#if XF86_MODES_RENAME -#include "xf86Rename.h" -#endif #include "xf86Modes.h" #include "xf86Cursor.h" #include "xf86i2c.h" diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c index 634ee3fe0..2b0db3492 100644 --- a/xorg-server/hw/xfree86/modes/xf86Cursors.c +++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c @@ -481,7 +481,7 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; - ++cursor->refcnt; + cursor = RefCursor(cursor); if (xf86_config->cursor) FreeCursor(xf86_config->cursor, None); xf86_config->cursor = cursor; @@ -500,7 +500,7 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; - ++cursor->refcnt; + cursor = RefCursor(cursor); if (xf86_config->cursor) FreeCursor(xf86_config->cursor, None); xf86_config->cursor = cursor; diff --git a/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c b/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c index bead1265a..c2e771894 100644 --- a/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c +++ b/xorg-server/hw/xfree86/modes/xf86DisplayIDModes.c @@ -25,6 +25,7 @@ #include "xorg-config.h" #include "xf86.h" +#include "xf86Modes.h" #include "xf86str.h" #include "edid.h" #include "xf86DDC.h" diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.h b/xorg-server/hw/xfree86/modes/xf86Modes.h index aec7688c4..545891884 100644 --- a/xorg-server/hw/xfree86/modes/xf86Modes.h +++ b/xorg-server/hw/xfree86/modes/xf86Modes.h @@ -36,9 +36,6 @@ #include "xorgVersion.h" #include "edid.h" #include "xf86Parser.h" -#if XF86_MODES_RENAME -#include "xf86Rename.h" -#endif extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec * mode); extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec * mode); @@ -112,6 +109,9 @@ xf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor); extern _X_EXPORT DisplayModePtr xf86GetDefaultModes(void); extern _X_EXPORT void +xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode); + +extern _X_EXPORT void xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC); #endif /* _XF86MODES_H_ */ diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c index 01fc9c5e3..2817aaa1f 100644 --- a/xorg-server/hw/xfree86/modes/xf86RandR12.c +++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c @@ -31,6 +31,7 @@ #include "xf86.h" #include "os.h" #include "globals.h" +#include "xf86Modes.h" #include "xf86Priv.h" #include "xf86DDC.h" #include "mipointer.h" @@ -1895,10 +1896,12 @@ xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider) if (config->randr_provider->offload_sink) { DetachOffloadGPU(screen); config->randr_provider->offload_sink = NULL; + RRSetChanged(screen); } else if (config->randr_provider->output_source) { DetachOutputGPU(screen); config->randr_provider->output_source = NULL; + RRSetChanged(screen); } else if (screen->current_master) DetachUnboundGPU(screen); diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.h b/xorg-server/hw/xfree86/modes/xf86RandR12.h index 9ad695cec..e603799be 100644 --- a/xorg-server/hw/xfree86/modes/xf86RandR12.h +++ b/xorg-server/hw/xfree86/modes/xf86RandR12.h @@ -24,9 +24,6 @@ #define _XF86_RANDR_H_ #include <randrstr.h> #include <X11/extensions/render.h> -#if XF86_MODES_RENAME -#include "xf86Rename.h" -#endif extern _X_EXPORT Bool xf86RandR12CreateScreenResources(ScreenPtr pScreen); extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen); diff --git a/xorg-server/hw/xfree86/modes/xf86Rename.h b/xorg-server/hw/xfree86/modes/xf86Rename.h deleted file mode 100644 index 46690a8f6..000000000 --- a/xorg-server/hw/xfree86/modes/xf86Rename.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright © 2006 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#ifndef _XF86RENAME_H_ -#define _XF86RENAME_H_ - -#include "local_xf86Rename.h" - -#define xf86_cursors_fini XF86NAME(xf86_cursors_fini) -#define xf86_cursors_init XF86NAME(xf86_cursors_init) -#define xf86_hide_cursors XF86NAME(xf86_hide_cursors) -#define xf86_reload_cursors XF86NAME(xf86_reload_cursors) -#define xf86_show_cursors XF86NAME(xf86_show_cursors) -#define xf86ConnectorGetName XF86NAME(xf86ConnectorGetName) -#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit) -#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex) -#define xf86CrtcCreate XF86NAME(xf86CrtcCreate) -#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy) -#define xf86CrtcInUse XF86NAME(xf86CrtcInUse) -#define xf86CrtcRotate XF86NAME(xf86CrtcRotate) -#define xf86CrtcScreenInit XF86NAME(xf86CrtcScreenInit) -#define xf86CrtcSetModeTransform XF86NAME(xf86CrtcSetModeTransform) -#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode) -#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange) -#define xf86CVTMode XF86NAME(xf86CVTMode) -#define xf86DDCMonitorSet XF86NAME(xf86DDCMonitorSet) -#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions) -#define xf86DPMSSet XF86NAME(xf86DPMSSet) -#define xf86DuplicateMode XF86NAME(xf86DuplicateMode) -#define xf86DuplicateModes XF86NAME(xf86DuplicateModes) -#define xf86GetDefaultModes XF86NAME(xf86GetDefaultModes) -#define xf86GetMonitorModes XF86NAME(xf86GetMonitorModes) -#define xf86InitialConfiguration XF86NAME(xf86InitialConfiguration) -#define xf86ModeHSync XF86NAME(xf86ModeHSync) -#define xf86ModesAdd XF86NAME(xf86ModesAdd) -#define xf86ModesEqual XF86NAME(xf86ModesEqual) -#define xf86ModeVRefresh XF86NAME(xf86ModeVRefresh) -#define xf86OutputCreate XF86NAME(xf86OutputCreate) -#define xf86OutputDestroy XF86NAME(xf86OutputDestroy) -#define xf86OutputGetEDID XF86NAME(xf86OutputGetEDID) -#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes) -#define xf86OutputRename XF86NAME(xf86OutputRename) -#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID) -#define xf86OutputUseScreenMonitor XF86NAME(xf86OutputUseScreenMonitor) -#define xf86PrintModeline XF86NAME(xf86PrintModeline) -#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes) -#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes) -#define xf86RotateCloseScreen XF86NAME(xf86RotateCloseScreen) -#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc) -#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName) -#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes) -#define xf86ValidateModesClocks XF86NAME(xf86ValidateModesClocks) -#define xf86ValidateModesFlags XF86NAME(xf86ValidateModesFlags) -#define xf86ValidateModesSize XF86NAME(xf86ValidateModesSize) -#define xf86ValidateModesSync XF86NAME(xf86ValidateModesSync) -#define xf86ValidateModesUserConfig XF86NAME(xf86ValidateModesUserConfig) -#define xf86DiDGAInit XF86NAME(xf86DiDGAInit) -#define xf86DiDGAReInit XF86NAME(xf86DiDGAReInit) -#define xf86DDCGetModes XF86NAME(xf86DDCGetModes) -#define xf86RandR12CreateScreenResources XF86NAME(xf86RandR12CreateScreenResources) -#define xf86RandR12GetOriginalVirtualSize XF86NAME(xf86RandR12GetOriginalVirtualSize) -#define xf86RandR12GetRotation XF86NAME(xf86RandR12GetRotation) -#define xf86RandR12Init XF86NAME(xf86RandR12Init) -#define xf86RandR12PreInit XF86NAME(xf86RandR12PreInit) -#define xf86RandR12SetConfig XF86NAME(xf86RandR12SetConfig) -#define xf86RandR12SetRotations XF86NAME(xf86RandR12SetRotations) -#define xf86SaveScreen XF86NAME(xf86SaveScreen) -#define xf86CrtcSetScreenSubpixelOrder XF86NAME(xf86CrtcSetScreenSubpixelOrder) -#define xf86ModeWidth XF86NAME(xf86ModeWidth) -#define xf86ModeHeight XF86NAME(xf86ModeHeight) -#define xf86OutputFindClosestMode XF86NAME(xf86OutputFindClosestMode) -#define xf86SetSingleMode XF86NAME(xf86SetSingleMode) -#define xf86SetDesiredModes XF86NAME(xf86SetDesiredModes) - -#endif /* _XF86RENAME_H_ */ diff --git a/xorg-server/hw/xfree86/os-support/bus/Sbus.c b/xorg-server/hw/xfree86/os-support/bus/Sbus.c index 826000712..14e6d4bfd 100644 --- a/xorg-server/hw/xfree86/os-support/bus/Sbus.c +++ b/xorg-server/hw/xfree86/os-support/bus/Sbus.c @@ -617,8 +617,10 @@ sparcPromPathname2Node(const char *pathName) return 0; strcpy(name, pathName); name[i + 1] = 0; - if (name[0] != '/') + if (name[0] != '/') { + free(name); return 0; + } p = strchr(name + 1, '/'); if (p) *p = 0; @@ -629,8 +631,10 @@ sparcPromPathname2Node(const char *pathName) *regstr++ = 0; else regstr = p; - if (name + 1 == regstr) + if (name + 1 == regstr) { + free(name); return 0; + } promGetSibling(0); i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0); free(name); diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c b/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c index 76f5583dd..1865b31b9 100644 --- a/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c +++ b/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c @@ -7,6 +7,8 @@ #include <xf86drm.h> #include <fcntl.h> #include <unistd.h> +#include <errno.h> +#include <string.h> /* Linux platform device support */ #include "xf86_OSproc.h" @@ -18,11 +20,12 @@ #include "hotplug.h" static Bool -get_drm_info(struct OdevAttributes *attribs, char *path) +get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) { drmSetVersion sv; char *buf; int fd; + int err = 0; fd = open(path, O_RDWR, O_CLOEXEC); if (fd == -1) @@ -32,19 +35,26 @@ get_drm_info(struct OdevAttributes *attribs, char *path) sv.drm_di_minor = 4; sv.drm_dd_major = -1; /* Don't care */ sv.drm_dd_minor = -1; /* Don't care */ - if (drmSetInterfaceVersion(fd, &sv)) { - ErrorF("setversion 1.4 failed\n"); - return FALSE; + + err = drmSetInterfaceVersion(fd, &sv); + if (err) { + ErrorF("setversion 1.4 failed: %s\n", strerror(-err)); + goto out; } - xf86_add_platform_device(attribs); + /* for a delayed probe we've already added the device */ + if (delayed_index == -1) { + xf86_add_platform_device(attribs); + delayed_index = xf86_num_platform_devices - 1; + } buf = drmGetBusid(fd); - xf86_add_platform_device_attrib(xf86_num_platform_devices - 1, + xf86_add_platform_device_attrib(delayed_index, ODEV_ATTRIB_BUSID, buf); drmFreeBusid(buf); +out: close(fd); - return TRUE; + return (err == 0); } Bool @@ -89,6 +99,23 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu } void +xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs) +{ + Bool ret; + char *dpath; + dpath = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH); + + ret = get_drm_info(attribs, dpath, index); + if (ret == FALSE) { + xf86_remove_platform_device(index); + return; + } + ret = xf86platformAddDevice(index); + if (ret == -1) + xf86_remove_platform_device(index); +} + +void xf86PlatformDeviceProbe(struct OdevAttributes *attribs) { struct OdevAttribute *attrib; @@ -116,10 +143,17 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs) if (i != xf86_num_platform_devices) goto out_free; - LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", - path); + LogMessage(X_INFO, "xfree86: Adding drm device (%s)\n", path); - ret = get_drm_info(attribs, path); + if (!xf86VTOwner()) { + /* if we don't currently own the VT then don't probe the device, + just mark it as unowned for later use */ + attribs->unowned = TRUE; + xf86_add_platform_device(attribs); + return; + } + + ret = get_drm_info(attribs, path, -1); if (ret == FALSE) goto out_free; @@ -138,6 +172,9 @@ void NewGPUDeviceRequest(struct OdevAttributes *attribs) if (old_num == xf86_num_platform_devices) return; + if (xf86_get_platform_device_unowned(xf86_num_platform_devices - 1) == TRUE) + return; + ret = xf86platformAddDevice(xf86_num_platform_devices-1); if (ret == -1) xf86_remove_platform_device(xf86_num_platform_devices-1); @@ -171,7 +208,10 @@ void DeleteGPUDeviceRequest(struct OdevAttributes *attribs) ErrorF("xf86: remove device %d %s\n", index, syspath); - xf86platformRemoveDevice(index); + if (xf86_get_platform_device_unowned(index) == TRUE) + xf86_remove_platform_device(index); + else + xf86platformRemoveDevice(index); out: config_odev_free_attribute_list(attribs); } diff --git a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c index ab3757a2a..4d08c1e85 100644 --- a/xorg-server/hw/xfree86/os-support/shared/posix_tty.c +++ b/xorg-server/hw/xfree86/os-support/shared/posix_tty.c @@ -421,7 +421,8 @@ xf86FlushInput(int fd) { fd_set fds; struct timeval timeout; - char c[4]; + /* this needs to be big enough to flush an evdev event. */ + char c[256]; DebugF("FlushingSerial\n"); if (tcflush(fd, TCIFLUSH) == 0) diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c index 4b75a98ac..68527a577 100644 --- a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c +++ b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c @@ -274,7 +274,7 @@ xf86OpenConsole(void) * this is to make sure we don't continue until the activate * signal is received. */ - if (!xf86Screens[0]->vtSema) + if (!xf86VTOwner()) sleep(5); } #endif /* HAS_USL_VTS */ diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h index ea2b16e46..6be594651 100644 --- a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h +++ b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h @@ -223,6 +223,9 @@ extern _X_EXPORT void xf86InitVidMem(void); #include "hotplug.h" void xf86PlatformDeviceProbe(struct OdevAttributes *attribs); + +void +xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs); #endif _XFUNCPROTOEND diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c index d32aac1cf..860704e1c 100644 --- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c +++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c @@ -271,7 +271,7 @@ xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs) (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); - if (pCurs->refcnt <= 1) + if (CursorRefCount(pCurs) <= 1) dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL); @@ -285,7 +285,7 @@ xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs) (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); - if (pCurs->refcnt <= 1) { + if (CursorRefCount(pCurs) <= 1) { free(dixLookupScreenPrivate (&pCurs->devPrivates, CursorScreenKey, pScreen)); dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, @@ -322,37 +322,37 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs, /* only update for VCP, otherwise we get cursor jumps when removing a sprite. The second cursor is never HW rendered anyway. */ if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer) { - pCurs->refcnt++; + CursorPtr cursor = RefCursor(pCurs); if (ScreenPriv->CurrentCursor) FreeCursor(ScreenPriv->CurrentCursor, None); - ScreenPriv->CurrentCursor = pCurs; + ScreenPriv->CurrentCursor = cursor; ScreenPriv->x = x; ScreenPriv->y = y; ScreenPriv->CursorToRestore = NULL; - ScreenPriv->HotX = pCurs->bits->xhot; - ScreenPriv->HotY = pCurs->bits->yhot; + ScreenPriv->HotX = cursor->bits->xhot; + ScreenPriv->HotY = cursor->bits->yhot; if (!infoPtr->pScrn->vtSema) - ScreenPriv->SavedCursor = pCurs; + ScreenPriv->SavedCursor = cursor; if (infoPtr->pScrn->vtSema && xorg_list_is_empty(&pScreen->pixmap_dirty_list) && (ScreenPriv->ForceHWCursorCount || (( #ifdef ARGB_CURSOR - pCurs->bits->argb && + cursor->bits->argb && infoPtr->UseHWCursorARGB && - (*infoPtr->UseHWCursorARGB)(pScreen, pCurs)) || - (pCurs->bits->argb == 0 && + (*infoPtr->UseHWCursorARGB)(pScreen, cursor)) || + (cursor->bits->argb == 0 && #endif - (pCurs->bits->height <= infoPtr->MaxHeight) && - (pCurs->bits->width <= infoPtr->MaxWidth) && - (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, pCurs)))))) { + (cursor->bits->height <= infoPtr->MaxHeight) && + (cursor->bits->width <= infoPtr->MaxWidth) && + (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, cursor)))))) { if (ScreenPriv->SWCursor) /* remove the SW cursor */ (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, NullCursor, x, y); - xf86SetCursor(pScreen, pCurs, x, y); + xf86SetCursor(pScreen, cursor, x, y); ScreenPriv->SWCursor = FALSE; ScreenPriv->isUp = TRUE; diff --git a/xorg-server/hw/xfree86/utils/cvt/Makefile.am b/xorg-server/hw/xfree86/utils/cvt/Makefile.am index 4ebcedf39..754606e8e 100644 --- a/xorg-server/hw/xfree86/utils/cvt/Makefile.am +++ b/xorg-server/hw/xfree86/utils/cvt/Makefile.am @@ -24,6 +24,7 @@ bin_PROGRAMS = cvt INCLUDES = $(XORG_INCS) \ -I$(top_srcdir)/hw/xfree86/ddc \ + -I$(top_srcdir)/hw/xfree86/modes \ -I$(top_srcdir)/hw/xfree86/parser # gah diff --git a/xorg-server/hw/xfree86/utils/cvt/cvt.c b/xorg-server/hw/xfree86/utils/cvt/cvt.c index 9483964e0..5e2888e94 100644 --- a/xorg-server/hw/xfree86/utils/cvt/cvt.c +++ b/xorg-server/hw/xfree86/utils/cvt/cvt.c @@ -24,6 +24,7 @@ /* Standalone VESA CVT standard timing modelines generator. */ #include "xf86.h" +#include "xf86Modes.h" /* FatalError implementation used by the server code we built in */ void diff --git a/xorg-server/hw/xfree86/vbe/Makefile.am b/xorg-server/hw/xfree86/vbe/Makefile.am index 0b24faf1f..1720eb93b 100644 --- a/xorg-server/hw/xfree86/vbe/Makefile.am +++ b/xorg-server/hw/xfree86/vbe/Makefile.am @@ -10,4 +10,5 @@ sdk_HEADERS = vbe.h vbeModes.h AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ + -I$(srcdir)/../modes -I$(srcdir)/../parser \ -I$(srcdir)/../int10 diff --git a/xorg-server/hw/xfree86/vbe/vbe.c b/xorg-server/hw/xfree86/vbe/vbe.c index 97a9bcf60..f0344af9c 100644 --- a/xorg-server/hw/xfree86/vbe/vbe.c +++ b/xorg-server/hw/xfree86/vbe/vbe.c @@ -16,6 +16,7 @@ #include <string.h> #include "xf86.h" +#include "xf86Modes.h" #include "vbe.h" #include <X11/extensions/dpmsconst.h> |