Rebased ref, commits from common ancestor: commit 3f5cedf00a82f08a433c95ffbb7f8ac69dcf6a50 Author: Keith Packard <[EMAIL PROTECTED]> Date: Mon Mar 5 23:49:35 2007 -0800
Allow relative positions to use output names or monitor identifiers. Previous version used monitor identifiers if present, otherwise output names. That caused existing working configurations to break when additional information was added to the configuration file. diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index c38da62..46515fd 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -879,13 +879,17 @@ xf86InitialOutputPositions (ScrnInfoPtr { xf86OutputPtr out_rel = config->output[or]; XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor; - char *name; if (rel_mon) - name = rel_mon->mon_identifier; - else - name = out_rel->name; - if (!strcmp (relative_name, name)) + { + if (xf86nameCompare (rel_mon->mon_identifier, + relative_name) == 0) + { + relative = config->output[or]; + break; + } + } + if (strcmp (out_rel->name, relative_name) == 0) { relative = config->output[or]; break; commit 843077f23a1b49bd712d931421753e3a09d4008c Author: Keith Packard <[EMAIL PROTECTED]> Date: Mon Mar 5 23:36:00 2007 -0800 Use EDID data to set screen physical size at server startup. Screen physical size is set to a random value before the RandR code gets control, override that and reset it to a value based on the compat_output physical size (if available). If that output has no physical size, just use 96dpi as the default resolution and set the physical size as appropriate. diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 1a349ef..4213fea 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -422,8 +422,28 @@ #endif } else { - mmWidth = pScreen->mmWidth; - mmHeight = pScreen->mmHeight; + xf86OutputPtr output = config->output[config->compat_output]; + xf86CrtcPtr crtc = output->crtc; + + if (crtc && crtc->mode.HDisplay && + output->mm_width && output->mm_height) + { + /* + * If the output has a mode and a declared size, use that + * to scale the screen size + */ + DisplayModePtr mode = &crtc->mode; + mmWidth = output->mm_width * width / mode->HDisplay; + mmHeight = output->mm_height * height / mode->VDisplay; + } + else + { + /* + * Otherwise, just set the screen to 96dpi + */ + mmWidth = width * 25.4 / 96; + mmHeight = height * 25.4 / 96; + } } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting screen physical size to %d x %d\n", commit bcade98ccaa18298d844a606cb44271f0254c185 Author: Keith Packard <[EMAIL PROTECTED]> Date: Mon Mar 5 22:07:01 2007 -0800 Add xf86SetDesiredModes to apply desired modes to crtcs. xf86SetDesiredModes applies the desired modes to each crtc (as selected by xf86InitialConfiguration initially and modified by successful mode settings afterwards). For crtcs without a desired mode, pScrn->currentMode is used to select something workable. diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 3d28293..c38da62 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1542,6 +1542,63 @@ xf86InitialConfiguration (ScrnInfoPtr sc return TRUE; } +/* + * Using the desired mode information in each crtc, set + * modes (used in EnterVT functions, or at server startup) + */ + +Bool +xf86SetDesiredModes (ScrnInfoPtr scrn) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int c; + + for (c = 0; c < config->num_crtc; c++) + { + xf86CrtcPtr crtc = config->crtc[c]; + xf86OutputPtr output = NULL; + int o; + + if (config->output[config->compat_output]->crtc == crtc) + output = config->output[config->compat_output]; + else + { + for (o = 0; o < config->num_output; o++) + if (config->output[o]->crtc == crtc) + { + output = config->output[o]; + break; + } + } + /* + * Skip disabled crtcs + */ + if (!output) + continue; + + /* Mark that we'll need to re-set the mode for sure */ + memset(&crtc->mode, 0, sizeof(crtc->mode)); + if (!crtc->desiredMode.CrtcHDisplay) + { + DisplayModePtr mode = xf86OutputFindClosestMode (output, scrn->currentMode); + + if (!mode) + return FALSE; + crtc->desiredMode = *mode; + crtc->desiredRotation = RR_Rotate_0; + crtc->desiredX = 0; + crtc->desiredY = 0; + } + + if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation, + crtc->desiredX, crtc->desiredY)) + return FALSE; + } + + xf86DisableUnusedFunctions(scrn); + return TRUE; +} + /** * In the current world order, there are lists of modes per output, which may * or may not include the mode that was asked to be set by XFree86's mode diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 56c7769..062a2db 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -644,4 +644,12 @@ xf86CrtcSetScreenSubpixelOrder (ScreenPt char * xf86ConnectorGetName(xf86ConnectorType connector); +/* + * Using the desired mode information in each crtc, set + * modes (used in EnterVT functions, or at server startup) + */ + +Bool +xf86SetDesiredModes (ScrnInfoPtr pScrn); + #endif /* _XF86CRTC_H_ */ diff --git a/hw/xfree86/modes/xf86Rename.h b/hw/xfree86/modes/xf86Rename.h index 6cfa5ca..eae6d64 100644 --- a/hw/xfree86/modes/xf86Rename.h +++ b/hw/xfree86/modes/xf86Rename.h @@ -76,5 +76,8 @@ #define xf86SaveScreen XF86NAME(xf86Save #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_ */ commit 5a595c1f767a8d666348b845d18934aee0cfe38f Author: Keith Packard <[EMAIL PROTECTED]> Date: Sat Mar 3 23:10:31 2007 -0800 Move xf86SetSingleMode into X server from intel driver. This function applies a single mode to the screen (as from RandR 1.1, XFree86-VidModeExtension or XFree86-DGA) using a policy that selects one output to reconfigure to the requested mode and then makes all other outputs fit within that size. diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 2ffa956..3d28293 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1543,6 +1543,132 @@ xf86InitialConfiguration (ScrnInfoPtr sc } /** + * In the current world order, there are lists of modes per output, which may + * or may not include the mode that was asked to be set by XFree86's mode + * selection. Find the closest one, in the following preference order: + * + * - Equality + * - Closer in size to the requested mode, but no larger + * - Closer in refresh rate to the requested mode. + */ + +DisplayModePtr +xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired) +{ + DisplayModePtr best = NULL, scan = NULL; + + for (scan = output->probed_modes; scan != NULL; scan = scan->next) + { + /* If there's an exact match, we're done. */ + if (xf86ModesEqual(scan, desired)) { + best = desired; + break; + } + + /* Reject if it's larger than the desired mode. */ + if (scan->HDisplay > desired->HDisplay || + scan->VDisplay > desired->VDisplay) + { + continue; + } + + /* + * If we haven't picked a best mode yet, use the first + * one in the size range + */ + if (best == NULL) + { + best = scan; + continue; + } + + /* Find if it's closer to the right size than the current best + * option. + */ + if ((scan->HDisplay > best->HDisplay && + scan->VDisplay >= best->VDisplay) || + (scan->HDisplay >= best->HDisplay && + scan->VDisplay > best->VDisplay)) + { + best = scan; + continue; + } + + /* Find if it's still closer to the right refresh than the current + * best resolution. + */ + if (scan->HDisplay == best->HDisplay && + scan->VDisplay == best->VDisplay && + (fabs(scan->VRefresh - desired->VRefresh) < + fabs(best->VRefresh - desired->VRefresh))) { + best = scan; + } + } + return best; +} + +/** + * When setting a mode through XFree86-VidModeExtension or XFree86-DGA, + * take the specified mode and apply it to the crtc connected to the compat + * output. Then, find similar modes for the other outputs, as with the + * InitialConfiguration code above. The goal is to clone the desired + * mode across all outputs that are currently active. + */ + +Bool +xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + Bool ok = TRUE; + xf86OutputPtr compat_output = config->output[config->compat_output]; + DisplayModePtr compat_mode; + int c; + + /* + * Let the compat output drive the final mode selection + */ + compat_mode = xf86OutputFindClosestMode (compat_output, desired); + if (compat_mode) + desired = compat_mode; + + for (c = 0; c < config->num_crtc; c++) + { + xf86CrtcPtr crtc = config->crtc[c]; + DisplayModePtr crtc_mode = NULL; + int o; + + if (!crtc->enabled) + continue; + + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; + DisplayModePtr output_mode; + + /* skip outputs not on this crtc */ + if (output->crtc != crtc) + continue; + + if (crtc_mode) + { + output_mode = xf86OutputFindClosestMode (output, crtc_mode); + if (output_mode != crtc_mode) + output->crtc = NULL; + } + else + crtc_mode = xf86OutputFindClosestMode (output, desired); + } + if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0)) + ok = FALSE; + else + crtc->desiredMode = *crtc_mode; + } + xf86DisableUnusedFunctions(pScrn); + return ok; +} + + +/** * Set the DPMS power mode of all outputs and CRTCs. * * If the new mode is off, it will turn off outputs and then CRTCs. diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 537df3a..56c7769 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -594,6 +594,12 @@ xf86SaveScreen(ScreenPtr pScreen, int mo void xf86DisableUnusedFunctions(ScrnInfoPtr pScrn); +DisplayModePtr +xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired); + +Bool +xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation); + /** * Set the EDID information for the specified output */ commit 73904d953f2f9cbe941a215ba240b46bc7a61357 Author: Keith Packard <[EMAIL PROTECTED]> Date: Sun Mar 4 21:07:35 2007 -0800 Xprint includes a filename which is too long for tar. diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am b/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am index 1e8c8a7..e7ddb6c 100644 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am +++ b/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am @@ -18,7 +18,6 @@ dist_xpc_DATA = \ LubalinGraph-DemiOblique.pmf \ LubalinGraph-Demi.pmf \ NewCenturySchlbk-Bold.pmf \ - NewCenturySchlbk-BoldItalic.pmf \ NewCenturySchlbk-Italic.pmf \ NewCenturySchlbk-Roman.pmf \ Souvenir-DemiItalic.pmf \ commit cb86fced0e379badd96af5ad303710af30fafd2e Author: Keith Packard <[EMAIL PROTECTED]> Date: Sun Mar 4 19:48:40 2007 -0800 Set version to 1.3-rc1 (1.2.99.901). diff --git a/configure.ac b/configure.ac index a54e06d..c290926 100644 --- a/configure.ac +++ b/configure.ac @@ -25,11 +25,25 @@ dnl Process this file with autoconf to c AC_PREREQ(2.57) dnl This is the not the Xorg version number, it's the server version number. dnl Yes, that's weird. -AC_INIT([xorg-server], 1.2.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +AC_INIT([xorg-server], 1.2.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([dist-bzip2 foreign]) AM_MAINTAINER_MODE +dnl +dnl Make sure these line up with the version number above. Automatically +dnl extracting them would be cool. +dnl + +DEFAULT_VENDOR_NAME="The X.Org Foundation" +DEFAULT_VENDOR_NAME_SHORT="X.Org" +DEFAULT_VERSION_MAJOR=1 +DEFAULT_VERSION_MINOR=2 +DEFAULT_VERSION_PATCH=99 +DEFAULT_VERSION_SNAP=901 +DEFAULT_RELEASE_DATE="4 March 2007" +DEFAULT_VENDOR_WEB="http://wiki.x.org" + dnl this gets generated by autoheader, and thus contains all the defines. we dnl don't ever actually use it, internally. AC_CONFIG_HEADERS(include/do-not-use-config.h) @@ -292,14 +306,6 @@ OSNAME=`uname -srm` AC_DEFINE_UNQUOTED(OSNAME, "$OSNAME", [Define to OS Name string to display for build OS in Xorg log]) -DEFAULT_VENDOR_NAME="The X.Org Foundation" -DEFAULT_VENDOR_NAME_SHORT="X.Org" -DEFAULT_VERSION_MAJOR=7 -DEFAULT_VERSION_MINOR=2 -DEFAULT_VERSION_PATCH=0 -DEFAULT_VERSION_SNAP=0 -DEFAULT_RELEASE_DATE="22 January 2007" -DEFAULT_VENDOR_WEB="http://wiki.x.org" m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))]) commit e707604ab3fd45c1f9d07b666181fc181e68a827 Author: Alan Coopersmith <[EMAIL PROTECTED]> Date: Tue Feb 27 09:55:48 2007 -0800 Sun bug 6529003: Xorg should not be including <sys/immu.h> on Solaris <sys/immu.h> was removed from the latest Solaris Nevada build, but it's been useless to Xorg for a long time (it only declared a couple of kernel variables) <http://bugs.opensolaris.org/view_bug.do?bug_id=6529003> diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index e048547..934c52a 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -130,8 +130,8 @@ # endif # include <errno.h> # if defined(_NEED_SYSI86) -# include <sys/immu.h> # if !(defined (sun) && defined (SVR4)) +# include <sys/immu.h> # include <sys/region.h> # endif # include <sys/proc.h> commit 6b63fb399a904c3953b7b347483980a9768c7878 Author: Dave Airlie <[EMAIL PROTECTED]> Date: Mon Mar 5 13:46:41 2007 +1100 add a standard connector type and name for us as an output property (cherry picked from commit 8ba5e8d82014b774a52f3e050ddbbb8bde4e0933) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 8b13e2b..2ffa956 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1738,3 +1738,12 @@ xf86OutputGetEDID (xf86OutputPtr output, return xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus); } + +static char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D", + "DVI-A", "Composite", "S-Video", + "Component", "LFP", "Proprietary" }; +char * +xf86ConnectorGetName(xf86ConnectorType connector) +{ + return _xf86ConnectorNames[connector]; +} diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index c8aafc1..537df3a 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -41,6 +41,20 @@ #endif typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr; typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr; +/* define a standard for connector types */ +typedef enum _xf86ConnectorType { + XF86ConnectorNone, + XF86ConnectorVGA, + XF86ConnectorDVI_I, + XF86ConnectorDVI_D, + XF86ConnectorDVI_A, + XF86ConnectorComposite, + XF86ConnectorSvideo, + XF86ConnectorComponent, + XF86ConnectorLFP, + XF86ConnectorProprietary, +} xf86ConnectorType; + typedef enum _xf86OutputStatus { XF86OutputStatusConnected, XF86OutputStatusDisconnected, @@ -618,4 +632,10 @@ xf86DiDGAReInit (ScreenPtr pScreen); void xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen); +/* + * Get a standard string name for a connector type + */ +char * +xf86ConnectorGetName(xf86ConnectorType connector); + #endif /* _XF86CRTC_H_ */ commit 90f5e77eab88522d64c6e20cd77a7a680eab3b1b Author: Dave Airlie <[EMAIL PROTECTED]> Date: Mon Feb 26 09:40:00 2007 +1100 modes: add commit/prepare hooks (cherry picked from commit 2e31872e05c2408d53ba0182bcddc5dabb3615fe) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index c53d2a8..8b13e2b 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -282,7 +282,7 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, Displ goto done; } - /* Disable the outputs and CRTCs before setting the mode. */ + /* Prepare the outputs and CRTCs before setting the mode. */ for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; @@ -290,10 +290,10 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, Displ continue; /* Disable the output as the first thing we do. */ - output->funcs->dpms(output, DPMSModeOff); + output->funcs->prepare(output); } - crtc->funcs->dpms(crtc, DPMSModeOff); + crtc->funcs->prepare(crtc); /* Set up the DPLL and any output state that needs to adjust or depend * on the DPLL. @@ -307,12 +307,12 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, Displ } /* Now, enable the clocks, plane, pipe, and outputs that we set up. */ - crtc->funcs->dpms(crtc, DPMSModeOn); + crtc->funcs->commit(crtc); for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; if (output->crtc == crtc) - output->funcs->dpms(output, DPMSModeOn); + output->funcs->commit(output); } /* XXX free adjustedmode */ diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index b04f7f3..c8aafc1 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -97,6 +97,12 @@ typedef struct _xf86CrtcFuncs { DisplayModePtr adjusted_mode); /** + * Prepare CRTC for an upcoming mode set. + */ + void + (*prepare)(xf86CrtcPtr crtc); + + /** * Callback for setting up a video mode after fixups have been made. */ void @@ -105,6 +111,12 @@ typedef struct _xf86CrtcFuncs { DisplayModePtr adjusted_mode, int x, int y); + /** + * Commit mode changes to a CRTC + */ + void + (*commit)(xf86CrtcPtr crtc); + /* Set the color ramps for the CRTC to the given values. */ void (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, @@ -264,6 +276,18 @@ typedef struct _xf86OutputFuncs { DisplayModePtr adjusted_mode); /** + * Callback for preparing mode changes on an output + */ + void + (*prepare)(xf86OutputPtr output); + + /** + * Callback for committing mode changes on an output + */ + void + (*commit)(xf86OutputPtr output); + + /** * Callback for setting up a video mode after fixups have been made. * * This is only called while the output is disabled. The dpms callback commit e6af7569f201842b4754aec6e72b30dc2daefdfb Author: Keith Packard <[EMAIL PROTECTED]> Date: Sun Mar 4 17:15:24 2007 -0800 Remove debugging ErrorF from rotation code. diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index ef637ee..6826b62 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -143,10 +143,9 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crt &include_inferiors, serverClient, &error); - if (!src) { - ErrorF("couldn't create src pict\n"); + if (!src) return; - } + dst = CreatePicture (None, &dst_pixmap->drawable, format, @@ -154,10 +153,8 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crt NULL, serverClient, &error); - if (!dst) { - ErrorF("couldn't create src pict\n"); + if (!dst) return; - } memset (&transform, '\0', sizeof (transform)); transform.matrix[2][2] = IntToxFixed(1); @@ -198,17 +195,13 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crt } error = SetPictureTransform (src, &transform); - if (error) { - ErrorF("Couldn't set transform\n"); + if (error) return; - } while (n--) { BoxRec dst_box; - ErrorF ("painting %d,%d - %d,%d\n", - b->x1, b->y1, b->x2, b->y2); xf86TransformBox (&dst_box, b, crtc->rotation, crtc->x, crtc->y, crtc->mode.HDisplay, crtc->mode.VDisplay); @@ -235,8 +228,6 @@ xf86CrtcDamageShadow (xf86CrtcPtr crtc) damage_box.x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation); damage_box.y1 = crtc->y; damage_box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation); - ErrorF ("damaged %d,%d - %d,%d\n", - damage_box.x1, damage_box.y1, damage_box.x2, damage_box.y2); REGION_INIT (pScreen, &damage_region, &damage_box, 1); DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, &damage_region); commit 2a50ca2160bc05af1c24421ec079e902ff730277 Author: Keith Packard <[EMAIL PROTECTED]> Date: Sun Mar 4 17:06:37 2007 -0800 Handle non-zero origin rotated crtc. Damage crtc area on re-rotate. Box transformation from source to dest area was broken, leaving the wrong areas painted when the crtc origin was non-zero. When rotating from left to right, the pixmap doesn't get reallocated, and so no damage was left in the pixmap from xf86RotatePrepare. Separately damage the whole crtc area when this occurs to repaint the area. diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 7b20498..ef637ee 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -69,31 +69,44 @@ compWindowFormat (WindowPtr pWin) } static void -xf86RotateBox (BoxPtr dst, BoxPtr src, Rotation rotation, - int dest_width, int dest_height) +xf86TranslateBox (BoxPtr b, int dx, int dy) { + b->x1 += dx; + b->y1 += dy; + b->x2 += dx; + b->y2 += dy; +} + +static void +xf86TransformBox (BoxPtr dst, BoxPtr src, Rotation rotation, + int xoff, int yoff, + int dest_width, int dest_height) +{ + BoxRec stmp = *src; + + xf86TranslateBox (&stmp, -xoff, -yoff); switch (rotation & 0xf) { default: case RR_Rotate_0: - *dst = *src; + *dst = stmp; break; case RR_Rotate_90: - dst->x1 = src->y1; - dst->y1 = dest_height - src->x2; - dst->x2 = src->y2; - dst->y2 = dest_height - src->x1; + dst->x1 = stmp.y1; + dst->y1 = dest_height - stmp.x2; + dst->x2 = stmp.y2; + dst->y2 = dest_height - stmp.x1; break; case RR_Rotate_180: - dst->x1 = dest_width - src->x2; - dst->y1 = dest_height - src->y2; - dst->x2 = dest_width - src->x1; - dst->y2 = dest_height - src->y1; + dst->x1 = dest_width - stmp.x2; + dst->y1 = dest_height - stmp.y2; + dst->x2 = dest_width - stmp.x1; + dst->y2 = dest_height - stmp.y1; break; case RR_Rotate_270: - dst->x1 = dest_width - src->y2; - dst->y1 = src->x1; - dst->y2 = src->x2; - dst->x2 = dest_width - src->y1; + dst->x1 = dest_width - stmp.y2; + dst->y1 = stmp.x1; + dst->y2 = stmp.x2; + dst->x2 = dest_width - stmp.y1; break; } if (rotation & RR_Reflect_X) { @@ -194,8 +207,11 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crt { BoxRec dst_box; - xf86RotateBox (&dst_box, b, crtc->rotation, - crtc->mode.HDisplay, crtc->mode.VDisplay); + ErrorF ("painting %d,%d - %d,%d\n", + b->x1, b->y1, b->x2, b->y2); + xf86TransformBox (&dst_box, b, crtc->rotation, + crtc->x, crtc->y, + crtc->mode.HDisplay, crtc->mode.VDisplay); CompositePicture (PictOpSrc, src, NULL, dst, dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1, @@ -208,6 +224,26 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crt } static void +xf86CrtcDamageShadow (xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + BoxRec damage_box; + RegionRec damage_region; + ScreenPtr pScreen = pScrn->pScreen; + + damage_box.x1 = crtc->x; + damage_box.x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation); + damage_box.y1 = crtc->y; + damage_box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation); + ErrorF ("damaged %d,%d - %d,%d\n", + damage_box.x1, damage_box.y1, damage_box.x2, damage_box.y2); + REGION_INIT (pScreen, &damage_region, &damage_box, 1); + DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, + &damage_region); + REGION_UNINIT (pScreen, &damage_region); +} + +static void xf86RotatePrepare (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -220,9 +256,6 @@ xf86RotatePrepare (ScreenPtr pScreen) if (crtc->rotatedData && !crtc->rotatedPixmap) { - BoxRec damage_box; - RegionRec damage_region; - crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc, crtc->rotatedData, crtc->mode.HDisplay, @@ -231,14 +264,7 @@ xf86RotatePrepare (ScreenPtr pScreen) DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, xf86_config->rotationDamage); - damage_box.x1 = 0; - damage_box.y1 = 0; - damage_box.x2 = xf86ModeWidth (&crtc->mode, crtc->rotation); - damage_box.y2 = xf86ModeHeight (&crtc->mode, crtc->rotation); - REGION_INIT (pScreen, &damage_region, &damage_box, 1); - DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, - &damage_region); - REGION_UNINIT (pScreen, &damage_region); + xf86CrtcDamageShadow (crtc); } } } @@ -357,6 +383,12 @@ xf86CrtcRotate (xf86CrtcPtr crtc, Displa if (!shadowData) goto bail1; crtc->rotatedData = shadowData; + /* shadow will be damaged in xf86RotatePrepare */ + } + else + { + /* mark shadowed area as damaged so it will be repainted */ + xf86CrtcDamageShadow (crtc); } if (!xf86_config->rotationDamage) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]