From 80408f471074022f7300901bf92a1533dae3f8da Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sat, 31 Oct 2009 14:09:45 +0000 Subject: Update to server 1.6.5. --- xserver/hw/xfree86/common/xf86Config.c | 16 ----- xserver/hw/xfree86/common/xf86DGA.c | 29 ++++---- xserver/hw/xfree86/dri2/dri2.c | 12 +++- xserver/hw/xfree86/fbdevhw/fbdevhw.c | 8 ++- xserver/hw/xfree86/modes/xf86Crtc.c | 7 ++ xserver/hw/xfree86/modes/xf86Crtc.h | 8 +++ xserver/hw/xfree86/modes/xf86DiDGA.c | 128 ++++++++------------------------- xserver/hw/xfree86/modes/xf86RandR12.c | 4 +- 8 files changed, 79 insertions(+), 133 deletions(-) (limited to 'xserver/hw/xfree86') diff --git a/xserver/hw/xfree86/common/xf86Config.c b/xserver/hw/xfree86/common/xf86Config.c index eb9acef39..c9f7307e5 100644 --- a/xserver/hw/xfree86/common/xf86Config.c +++ b/xserver/hw/xfree86/common/xf86Config.c @@ -612,22 +612,6 @@ configFiles(XF86ConfFilesPtr fileconf) pathFrom = X_DEFAULT; temp_path = defaultFontPath ? defaultFontPath : ""; - /* ensure defaultFontPath contains "built-ins" */ - start = strstr(temp_path, "built-ins"); - end = start + strlen("built-ins"); - if (start == NULL || - !((start == temp_path || start[-1] == ',') && (!*end || *end == ','))) { - defaultFontPath = Xprintf("%s%sbuilt-ins", - temp_path, *temp_path ? "," : ""); - if (must_copy == TRUE) { - if (defaultFontPath != NULL) { - must_copy = FALSE; - } - } else { - /* already made a copy of the font path */ - xfree(temp_path); - } - } /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */ temp_path = must_copy ? XNFstrdup(defaultFontPath) : defaultFontPath; defaultFontPath = xf86ValidateFontPath(temp_path); diff --git a/xserver/hw/xfree86/common/xf86DGA.c b/xserver/hw/xfree86/common/xf86DGA.c index a06f285f1..3f7deba84 100644 --- a/xserver/hw/xfree86/common/xf86DGA.c +++ b/xserver/hw/xfree86/common/xf86DGA.c @@ -120,8 +120,22 @@ DGAInit( DGAScreenKey = &DGAScreenKeyIndex; - if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec)))) - return FALSE; + pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + + if (!pScreenPriv) + { + if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec)))) + return FALSE; + dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv); + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = DGACloseScreen; + pScreenPriv->DestroyColormap = pScreen->DestroyColormap; + pScreen->DestroyColormap = DGADestroyColormap; + pScreenPriv->InstallColormap = pScreen->InstallColormap; + pScreen->InstallColormap = DGAInstallColormap; + pScreenPriv->UninstallColormap = pScreen->UninstallColormap; + pScreen->UninstallColormap = DGAUninstallColormap; + } pScreenPriv->pScrn = pScrn; pScreenPriv->numModes = num; @@ -146,17 +160,6 @@ DGAInit( modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; #endif - dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv); - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = DGACloseScreen; - pScreenPriv->DestroyColormap = pScreen->DestroyColormap; - pScreen->DestroyColormap = DGADestroyColormap; - pScreenPriv->InstallColormap = pScreen->InstallColormap; - pScreen->InstallColormap = DGAInstallColormap; - pScreenPriv->UninstallColormap = pScreen->UninstallColormap; - pScreen->UninstallColormap = DGAUninstallColormap; - - return TRUE; } diff --git a/xserver/hw/xfree86/dri2/dri2.c b/xserver/hw/xfree86/dri2/dri2.c index 580383dbc..3e8a7d4a8 100644 --- a/xserver/hw/xfree86/dri2/dri2.c +++ b/xserver/hw/xfree86/dri2/dri2.c @@ -190,10 +190,18 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height, int need_fake_front = 0; int have_fake_front = 0; int front_format = 0; - const int dimensions_match = (pDraw->width == pPriv->width) - && (pDraw->height == pPriv->height); + int dimensions_match; int i; + if (!pPriv) { + *width = pDraw->width; + *height = pDraw->height; + *out_count = 0; + return NULL; + } + + dimensions_match = (pDraw->width == pPriv->width) + && (pDraw->height == pPriv->height); buffers = xalloc((count + 1) * sizeof(buffers[0])); diff --git a/xserver/hw/xfree86/fbdevhw/fbdevhw.c b/xserver/hw/xfree86/fbdevhw/fbdevhw.c index 5269277ef..d6e78b9ff 100644 --- a/xserver/hw/xfree86/fbdevhw/fbdevhw.c +++ b/xserver/hw/xfree86/fbdevhw/fbdevhw.c @@ -318,7 +318,13 @@ fbdev_open_pci(struct pci_device * pPci, char **namep) pPci->domain, pPci->bus, pPci->dev, pPci->func, i); fd = open(filename, O_RDONLY, 0); - if (fd != -1) { + if (fd < 0) { + sprintf(filename, + "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d", + pPci->domain, pPci->bus, pPci->dev, pPci->func, i); + fd = open(filename, O_RDONLY, 0); + } + if (fd >= 0) { close(fd); sprintf(filename, "/dev/fb%d", i); diff --git a/xserver/hw/xfree86/modes/xf86Crtc.c b/xserver/hw/xfree86/modes/xf86Crtc.c index 546ae35b3..ec2089d09 100644 --- a/xserver/hw/xfree86/modes/xf86Crtc.c +++ b/xserver/hw/xfree86/modes/xf86Crtc.c @@ -771,6 +771,9 @@ xf86CrtcScreenInit (ScreenPtr screen) config->CloseScreen = screen->CloseScreen; screen->CloseScreen = xf86CrtcCloseScreen; +#ifdef XFreeXDGA + _xf86_di_dga_init_internal(screen); +#endif #ifdef RANDR_13_INTERFACE return RANDR_INTERFACE_VERSION; #else @@ -1884,6 +1887,10 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) } } scrn->currentMode = scrn->modes; +#ifdef XFreeXDGA + if (scrn->pScreen) + _xf86_di_dga_reinit_internal(scrn->pScreen); +#endif } static void diff --git a/xserver/hw/xfree86/modes/xf86Crtc.h b/xserver/hw/xfree86/modes/xf86Crtc.h index 0a596bc49..4fe4150d4 100644 --- a/xserver/hw/xfree86/modes/xf86Crtc.h +++ b/xserver/hw/xfree86/modes/xf86Crtc.h @@ -807,6 +807,10 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus); Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address); +/* this is the real function, used only internally */ +_X_INTERNAL Bool +_xf86_di_dga_init_internal (ScreenPtr pScreen); + /** * Re-initialize dga for this screen (as when the set of modes changes) */ @@ -814,6 +818,10 @@ xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address); Bool xf86DiDGAReInit (ScreenPtr pScreen); +/* This is the real function, used only internally */ +_X_INTERNAL Bool +_xf86_di_dga_reinit_internal (ScreenPtr pScreen); + /* * Set the subpixel order reported for the screen using * the information from the outputs diff --git a/xserver/hw/xfree86/modes/xf86DiDGA.c b/xserver/hw/xfree86/modes/xf86DiDGA.c index f40d0abef..bc59535a0 100644 --- a/xserver/hw/xfree86/modes/xf86DiDGA.c +++ b/xserver/hw/xfree86/modes/xf86DiDGA.c @@ -72,8 +72,7 @@ xf86_dga_get_modes (ScreenPtr pScreen) mode = modes + num++; mode->mode = display_mode; - mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; - mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + mode->flags = DGA_CONCURRENT_ACCESS; if (display_mode->Flags & V_DBLSCAN) mode->flags |= DGA_DOUBLESCAN; if (display_mode->Flags & V_INTERLACE) @@ -91,14 +90,14 @@ xf86_dga_get_modes (ScreenPtr pScreen) mode->yViewportStep = 1; mode->viewportFlags = DGA_FLIP_RETRACE; mode->offset = 0; - mode->address = (unsigned char *) xf86_config->dga_address; - mode->bytesPerScanline = xf86_config->dga_stride; - mode->imageWidth = xf86_config->dga_width; - mode->imageHeight = xf86_config->dga_height; + mode->address = 0; + mode->imageWidth = mode->viewportWidth; + mode->imageHeight = mode->viewportHeight; + mode->bytesPerScanline = (mode->imageWidth * scrn->bitsPerPixel) >> 3; mode->pixmapWidth = mode->imageWidth; mode->pixmapHeight = mode->imageHeight; - mode->maxViewportX = mode->imageWidth - mode->viewportWidth; - mode->maxViewportY = mode->imageHeight - mode->viewportHeight; + mode->maxViewportX = 0; + mode->maxViewportY = 0; display_mode = display_mode->next; if (display_mode == scrn->modes) @@ -148,94 +147,12 @@ xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags) scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags); } -static Bool -xf86_dga_get_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr *ppDrawable, GCPtr *ppGC) -{ - ScreenPtr pScreen = scrn->pScreen; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - PixmapPtr pPixmap; - GCPtr pGC; - - pPixmap = GetScratchPixmapHeader (pScreen, xf86_config->dga_width, xf86_config->dga_height, - scrn->depth, scrn->bitsPerPixel, xf86_config->dga_stride, - (char *) scrn->memPhysBase + scrn->fbOffset); - if (!pPixmap) - return FALSE; - pGC = GetScratchGC (scrn->depth, pScreen); - if (!pGC) - { - FreeScratchPixmapHeader (pPixmap); - return FALSE; - } - *ppDrawable = &pPixmap->drawable; - *ppGC = pGC; - return TRUE; -} - -static void -xf86_dga_release_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr pDrawable, GCPtr pGC) -{ - FreeScratchGC (pGC); - FreeScratchPixmapHeader ((PixmapPtr) pDrawable); -} - -static void -xf86_dga_fill_rect(ScrnInfoPtr scrn, int x, int y, int w, int h, unsigned long color) -{ - GCPtr pGC; - DrawablePtr pDrawable; - XID vals[1]; - xRectangle r; - - if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC)) - return; - vals[0] = color; - ChangeGC (pGC, GCForeground, vals); - ValidateGC (pDrawable, pGC); - r.x = x; - r.y = y; - r.width = w; - r.height = h; - pGC->ops->PolyFillRect (pDrawable, pGC, 1, &r); - xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC); -} - -static void -xf86_dga_sync(ScrnInfoPtr scrn) -{ - ScreenPtr pScreen = scrn->pScreen; - WindowPtr pRoot = WindowTable [pScreen->myNum]; - char buffer[4]; - - pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer); -} - -static void -xf86_dga_blit_rect(ScrnInfoPtr scrn, int srcx, int srcy, int w, int h, int dstx, int dsty) -{ - DrawablePtr pDrawable; - GCPtr pGC; - - if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC)) - return; - ValidateGC (pDrawable, pGC); - pGC->ops->CopyArea (pDrawable, pDrawable, pGC, srcx, srcy, w, h, dstx, dsty); - xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC); -} - static Bool xf86_dga_open_framebuffer(ScrnInfoPtr scrn, char **name, unsigned char **mem, int *size, int *offset, int *flags) { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); - - *size = xf86_config->dga_stride * xf86_config->dga_height; - *mem = (unsigned char *) (xf86_config->dga_address); - *offset = 0; - *flags = DGA_NEED_ROOT; - - return TRUE; + return FALSE; } static void @@ -249,18 +166,27 @@ static DGAFunctionRec xf86_dga_funcs = { xf86_dga_set_mode, xf86_dga_set_viewport, xf86_dga_get_viewport, - xf86_dga_sync, - xf86_dga_fill_rect, - xf86_dga_blit_rect, + NULL, + NULL, + NULL, NULL }; _X_EXPORT Bool xf86DiDGAReInit (ScreenPtr pScreen) +{ + return TRUE; +} + +Bool +_xf86_di_dga_reinit_internal (ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + if (!DGAAvailable(pScreen->myNum)) + return TRUE; + if (!xf86_dga_get_modes (pScreen)) return FALSE; @@ -269,15 +195,21 @@ xf86DiDGAReInit (ScreenPtr pScreen) _X_EXPORT Bool xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address) +{ + return TRUE; +} + +Bool +_xf86_di_dga_init_internal (ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86_config->dga_flags = 0; - xf86_config->dga_address = dga_address; - xf86_config->dga_width = scrn->virtualX; - xf86_config->dga_height = scrn->virtualY; - xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3; + xf86_config->dga_address = 0; + xf86_config->dga_width = 0; + xf86_config->dga_height = 0; + xf86_config->dga_stride = 0; if (!xf86_dga_get_modes (pScreen)) return FALSE; diff --git a/xserver/hw/xfree86/modes/xf86RandR12.c b/xserver/hw/xfree86/modes/xf86RandR12.c index 454649213..0637ed5b1 100644 --- a/xserver/hw/xfree86/modes/xf86RandR12.c +++ b/xserver/hw/xfree86/modes/xf86RandR12.c @@ -1,5 +1,5 @@ /* - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. + * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -460,7 +460,6 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations) { xf86ProbeOutputModes (scrp, 0, 0); xf86SetScrnInfoModes (scrp); - xf86DiDGAReInit (pScreen); } for (mode = scrp->modes; ; mode = mode->next) @@ -1481,7 +1480,6 @@ xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations) return TRUE; xf86ProbeOutputModes (pScrn, 0, 0); xf86SetScrnInfoModes (pScrn); - xf86DiDGAReInit (pScreen); return xf86RandR12SetInfo12 (pScreen); } -- cgit v1.2.3