Sólo en /home/alex/instaladores-linux/xserver/xorg-git/xserver/: .git diff -ur /home/alex/instaladores-linux/xserver/xorg-git/xserver/hw/xfree86/modes/xf86Crtc.c xserver/hw/xfree86/modes/xf86Crtc.c --- /home/alex/instaladores-linux/xserver/xorg-git/xserver/hw/xfree86/modes/xf86Crtc.c 2008-12-23 11:07:09.000000000 -0500 +++ xserver/hw/xfree86/modes/xf86Crtc.c 2009-01-13 21:23:37.000000000 -0500 @@ -75,12 +75,14 @@ int minWidth, int minHeight, int maxWidth, int maxHeight) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + if (xf86CrtcConfigPrivateIndex != -1) { + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); - config->minWidth = minWidth; - config->minHeight = minHeight; - config->maxWidth = maxWidth; - config->maxHeight = maxHeight; + config->minWidth = minWidth; + config->minHeight = minHeight; + config->maxWidth = maxWidth; + config->maxHeight = maxHeight; + } } /* @@ -90,9 +92,12 @@ xf86CrtcCreate (ScrnInfoPtr scrn, const xf86CrtcFuncsRec *funcs) { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr xf86_config; xf86CrtcPtr crtc, *crtcs; + if (xf86CrtcConfigPrivateIndex == -1) return NULL; + xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + crtc = xcalloc (sizeof (xf86CrtcRec), 1); if (!crtc) return NULL; @@ -145,23 +150,25 @@ void xf86CrtcDestroy (xf86CrtcPtr crtc) { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); - int c; - - (*crtc->funcs->destroy) (crtc); - for (c = 0; c < xf86_config->num_crtc; c++) - if (xf86_config->crtc[c] == crtc) - { - memmove (&xf86_config->crtc[c], - &xf86_config->crtc[c+1], - ((xf86_config->num_crtc - (c + 1)) * sizeof(void*))); - xf86_config->num_crtc--; - break; - } - if (crtc->params) - xfree (crtc->params); - free(crtc->gamma_red); - xfree (crtc); + if (xf86CrtcConfigPrivateIndex != -1) { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); + int c; + + (*crtc->funcs->destroy) (crtc); + for (c = 0; c < xf86_config->num_crtc; c++) + if (xf86_config->crtc[c] == crtc) + { + memmove (&xf86_config->crtc[c], + &xf86_config->crtc[c+1], + ((xf86_config->num_crtc - (c + 1)) * sizeof(void*))); + xf86_config->num_crtc--; + break; + } + if (crtc->params) + xfree (crtc->params); + free(crtc->gamma_red); + xfree (crtc); + } } @@ -173,9 +180,11 @@ xf86CrtcInUse (xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcConfigPtr xf86_config; int o; + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); for (o = 0; o < xf86_config->num_output; o++) if (xf86_config->output[o]->crtc == crtc) return TRUE; @@ -189,9 +198,11 @@ int subpixel_order = SubPixelUnknown; Bool has_none = FALSE; ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr xf86_config; int c, o; + if (xf86CrtcConfigPrivateIndex == -1) return; + xf86_config = XF86_CRTC_CONFIG_PTR(scrn); for (c = 0; c < xf86_config->num_crtc; c++) { xf86CrtcPtr crtc = xf86_config->crtc[c]; @@ -255,7 +266,7 @@ RRTransformPtr transform, int x, int y) { ScrnInfoPtr scrn = crtc->scrn; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr xf86_config; int i; Bool ret = FALSE; Bool didLock = FALSE; @@ -279,6 +290,9 @@ return TRUE; } + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + adjusted_mode = xf86DuplicateMode(mode); didLock = crtc->funcs->lock (crtc); @@ -613,9 +627,12 @@ const char *name) { xf86OutputPtr output, *outputs; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr xf86_config; int len; + if (xf86CrtcConfigPrivateIndex == -1) return NULL; + xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + if (name) len = strlen (name) + 1; else @@ -700,9 +717,12 @@ xf86OutputDestroy (xf86OutputPtr output) { ScrnInfoPtr scrn = output->scrn; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr xf86_config; int o; + if (xf86CrtcConfigPrivateIndex == -1) return; + xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + (*output->funcs->destroy) (output); while (output->probed_modes) xf86DeleteMode (&output->probed_modes, output->probed_modes); @@ -727,7 +747,10 @@ xf86CrtcCreateScreenResources (ScreenPtr screen) { ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; + + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + config = XF86_CRTC_CONFIG_PTR(scrn); screen->CreateScreenResources = config->CreateScreenResources; @@ -747,9 +770,12 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen) { ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int o, c; + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + config = XF86_CRTC_CONFIG_PTR(scrn); + screen->CloseScreen = config->CloseScreen; xf86RotateCloseScreen (screen); @@ -780,9 +806,12 @@ xf86CrtcScreenInit (ScreenPtr screen) { ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int c; + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + config = XF86_CRTC_CONFIG_PTR(scrn); + /* Rotation */ xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n"); xf86DisableRandR(); /* Disable old RandR extension support */ @@ -938,7 +967,7 @@ int width, int height) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int c, o; xf86OutputPtr output; xf86CrtcPtr crtc; @@ -947,6 +976,9 @@ int best_score; int score; int my_score; + + if (xf86CrtcConfigPrivateIndex == -1) return 0; + config = XF86_CRTC_CONFIG_PTR(scrn); if (n == config->num_output) return 0; @@ -1035,12 +1067,15 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp, Bool canGrow) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int width = 0, height = 0; int o; int c; int s; + if (xf86CrtcConfigPrivateIndex == -1) return; + config = XF86_CRTC_CONFIG_PTR(scrn); + for (c = 0; c < config->num_crtc; c++) { int crtc_width = 0, crtc_height = 0; @@ -1096,10 +1131,13 @@ static Bool xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int o; Bool user_conf = FALSE; + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + config = XF86_CRTC_CONFIG_PTR(scrn); + for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; @@ -1140,10 +1178,13 @@ static Bool xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int o; int min_x, min_y; + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + config = XF86_CRTC_CONFIG_PTR(scrn); + for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; @@ -1334,8 +1375,11 @@ static void xf86InitialPanning (ScrnInfoPtr scrn) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int o; + + if (xf86CrtcConfigPrivateIndex == -1) return; + config = XF86_CRTC_CONFIG_PTR(scrn); for (o = 0; o < config->num_output; o++) { @@ -1533,9 +1577,12 @@ void xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int o; + if (xf86CrtcConfigPrivateIndex == -1) return; + config = XF86_CRTC_CONFIG_PTR(scrn); + /* When canGrow was TRUE in the initial configuration we have to * compare against the maximum values so that we don't drop modes. * When canGrow was FALSE, the maximum values would have been clamped @@ -1889,11 +1936,14 @@ void xf86SetScrnInfoModes (ScrnInfoPtr scrn) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; xf86OutputPtr output; xf86CrtcPtr crtc; DisplayModePtr last, mode = NULL; + if (xf86CrtcConfigPrivateIndex == -1) return; + config = XF86_CRTC_CONFIG_PTR(scrn); + output = SetCompatOutput(config); if (!output) @@ -2333,7 +2383,7 @@ Bool xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int o, c; xf86CrtcPtr *crtcs; DisplayModePtr *modes; @@ -2341,6 +2391,9 @@ int width, height; int i = scrn->scrnIndex; + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + config = XF86_CRTC_CONFIG_PTR(scrn); + /* Set up the device options */ config->options = xnfalloc (sizeof (xf86DeviceOptions)); memcpy (config->options, xf86DeviceOptions, sizeof (xf86DeviceOptions)); @@ -2510,9 +2563,12 @@ static void xf86PrepareOutputs (ScrnInfoPtr scrn) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int o; + if (xf86CrtcConfigPrivateIndex == -1) return; + config = XF86_CRTC_CONFIG_PTR(scrn); + for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; #if RANDR_GET_CRTC_INTERFACE @@ -2528,9 +2584,12 @@ static void xf86PrepareCrtcs (ScrnInfoPtr scrn) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int c; + if (xf86CrtcConfigPrivateIndex == -1) return; + config = XF86_CRTC_CONFIG_PTR(scrn); + for (c = 0; c < config->num_crtc; c++) { #if RANDR_GET_CRTC_INTERFACE xf86CrtcPtr crtc = config->crtc[c]; @@ -2572,9 +2631,12 @@ Bool xf86SetDesiredModes (ScrnInfoPtr scrn) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int c; + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + config = XF86_CRTC_CONFIG_PTR(scrn); + xf86PrepareOutputs(scrn); xf86PrepareCrtcs(scrn); @@ -2708,12 +2770,16 @@ Bool xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcConfigPtr config; Bool ok = TRUE; - xf86OutputPtr compat_output = config->output[config->compat_output]; + xf86OutputPtr compat_output; DisplayModePtr compat_mode; int c; + if (xf86CrtcConfigPrivateIndex == -1) return FALSE; + config = XF86_CRTC_CONFIG_PTR(pScrn); + compat_output = config->output[config->compat_output]; + /* * Let the compat output drive the final mode selection */ @@ -2781,12 +2847,15 @@ void xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags) { - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int i; if (!scrn->vtSema) return; + if (xf86CrtcConfigPrivateIndex == -1) return; + config = XF86_CRTC_CONFIG_PTR(scrn); + if (mode == DPMSModeOff) { for (i = 0; i < config->num_output; i++) { xf86OutputPtr output = config->output[i]; @@ -2835,9 +2904,12 @@ void xf86DisableUnusedFunctions(ScrnInfoPtr pScrn) { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcConfigPtr xf86_config; int o, c; + if (xf86CrtcConfigPrivateIndex == -1) return; + xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + for (o = 0; o < xf86_config->num_output; o++) { xf86OutputPtr output = xf86_config->output[o]; @@ -2894,12 +2966,15 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon) { ScrnInfoPtr scrn = output->scrn; - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcConfigPtr config; int i; #ifdef RANDR_12_INTERFACE int size; #endif + if (xf86CrtcConfigPrivateIndex == -1) return; + config = XF86_CRTC_CONFIG_PTR(scrn); + if (output->MonInfo != NULL) xfree(output->MonInfo); @@ -3037,12 +3112,15 @@ xf86CrtcPtr desired, BoxPtr crtc_box_ret) { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcConfigPtr xf86_config; xf86CrtcPtr crtc, best_crtc; int coverage, best_coverage; int c; BoxRec crtc_box, cover_box; + if (xf86CrtcConfigPrivateIndex == -1) return NULL; + xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + best_crtc = NULL; best_coverage = 0; crtc_box_ret->x1 = 0; @@ -3117,46 +3195,56 @@ xf86_crtc_notify_proc_ptr xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); - xf86_crtc_notify_proc_ptr old; - - old = config->xf86_crtc_notify; - config->xf86_crtc_notify = new; - return old; + if (xf86CrtcConfigPrivateIndex != -1) { + ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + xf86_crtc_notify_proc_ptr old; + + old = config->xf86_crtc_notify; + config->xf86_crtc_notify = new; + return old; + } + return NULL; } void xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + if (xf86CrtcConfigPrivateIndex != -1) { + ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); - config->xf86_crtc_notify = old; + config->xf86_crtc_notify = old; + } } void xf86_crtc_notify(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + if (xf86CrtcConfigPrivateIndex != -1) { + ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); - if (config->xf86_crtc_notify) - config->xf86_crtc_notify(screen); + if (config->xf86_crtc_notify) + config->xf86_crtc_notify(screen); + } } Bool xf86_crtc_supports_gamma(ScrnInfoPtr pScrn) { - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - xf86CrtcPtr crtc; + if (xf86CrtcConfigPrivateIndex != -1) { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcPtr crtc; - if ((xf86CrtcConfigPrivateIndex == -1) || !xf86_config) - return FALSE; + if ((xf86CrtcConfigPrivateIndex == -1) || !xf86_config) + return FALSE; - if (xf86_config->num_crtc == 0) - return FALSE; - crtc = xf86_config->crtc[0]; + if (xf86_config->num_crtc == 0) + return FALSE; + crtc = xf86_config->crtc[0]; - return (crtc->funcs->gamma_set != NULL); + return (crtc->funcs->gamma_set != NULL); + } + return FALSE; }