~ubuntu-branches/ubuntu/oneiric/xserver-xorg-video-ati/oneiric

« back to all changes in this revision

Viewing changes to src/modes/xf86Rotate.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker
  • Date: 2010-07-08 16:45:59 UTC
  • mfrom: (1.1.34 upstream) (0.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100708164559-t1gwcpobj4n39lhf
Tags: 1:6.13.1-1ubuntu1
* Merge from Debian Unstable. Remainning Ubuntu changes:
  + debian/control:
    - Add quilt to build-depends for Ubuntu patches
  + debian/patches/100_radeon-6.9.0-bgnr-enable.patch:
    - Smooth plymouth transition enablement patch
  + debian/rules:
    - Add xsfbs patchsys
    - Drop /etc/modprobe.d/radeon-kms.conf install.
  + debian/xserver-xorg-video-ati.{pre,post}inst.in:
    - Clean existing /etc/modprobe.d/radeon-kms.conf on install.
      At best this does nothing (KMS is the default for our kernel)
      and at worst it makes it harder to disable KMS.
* Add debian/gbp.conf pointing to Ubuntu branch to make git-buildpackage
  less narky.
* Drop 102-no-xv-rn50.patch and 103_new_pci_ids.patch from previous
  Ubuntu releases, they are upstream now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "xf86Modes.h"
41
41
#include "xf86RandR12.h"
42
42
#include "X11/extensions/render.h"
43
 
#define DPMS_SERVER
44
 
#include "X11/extensions/dpms.h"
 
43
#include "X11/extensions/dpmsconst.h"
45
44
#include "X11/Xatom.h"
46
45
 
47
46
/* borrowed from composite extension, move to Render and publish? */
77
76
{
78
77
    ScrnInfoPtr         scrn = crtc->scrn;
79
78
    ScreenPtr           screen = scrn->pScreen;
80
 
    WindowPtr           root = WindowTable[screen->myNum];
 
79
    WindowPtr           root = screen->root;
81
80
    PixmapPtr           dst_pixmap = crtc->rotatedPixmap;
82
 
    PictFormatPtr       format = compWindowFormat (WindowTable[screen->myNum]);
 
81
    PictFormatPtr       format = compWindowFormat (screen->root);
83
82
    int                 error;
84
83
    PicturePtr          src, dst;
85
 
    int                 n = REGION_NUM_RECTS(region);
86
 
    BoxPtr              b = REGION_RECTS(region);
 
84
    int                 n = RegionNumRects(region);
 
85
    BoxPtr              b = RegionRects(region);
87
86
    XID                 include_inferiors = IncludeInferiors;
88
87
    
89
88
    src = CreatePicture (None,
146
145
}
147
146
 
148
147
static void
149
 
xf86CrtcShadowClear (xf86CrtcPtr crtc)
150
 
{
151
 
    PixmapPtr           dst_pixmap = crtc->rotatedPixmap;
152
 
    ScrnInfoPtr         scrn = crtc->scrn;
153
 
    ScreenPtr           screen = scrn->pScreen;
154
 
    PicturePtr          dst;
155
 
    PictFormatPtr       format = compWindowFormat (WindowTable[screen->myNum]);
156
 
    static xRenderColor black = { 0, 0, 0, 0 };
157
 
    xRectangle          rect;
158
 
    int                 error;
159
 
 
160
 
    if (!dst_pixmap)
161
 
        return;
162
 
    dst = CreatePicture (None,
163
 
                         &dst_pixmap->drawable,
164
 
                         format,
165
 
                         0L,
166
 
                         NULL,
167
 
                         serverClient,
168
 
                         &error);
169
 
    if (!dst)
170
 
        return;
171
 
    rect.x = 0;
172
 
    rect.y = 0;
173
 
    rect.width = dst_pixmap->drawable.width;
174
 
    rect.height = dst_pixmap->drawable.height;
175
 
    CompositeRects (PictOpSrc, dst, &black, 1, &rect);
176
 
    FreePicture (dst, None);
177
 
}
178
 
 
179
 
static void
180
148
xf86CrtcDamageShadow (xf86CrtcPtr crtc)
181
149
{
182
150
    ScrnInfoPtr pScrn = crtc->scrn;
199
167
    if (damage_box.y1 < 0) damage_box.y1 = 0;
200
168
    if (damage_box.x2 > pScreen->width) damage_box.x2 = pScreen->width;
201
169
    if (damage_box.y2 > pScreen->height) damage_box.y2 = pScreen->height;
202
 
    REGION_INIT (pScreen, &damage_region, &damage_box, 1);
 
170
    RegionInit(&damage_region, &damage_box, 1);
203
171
    DamageRegionAppend (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
204
172
                        &damage_region);
205
 
    REGION_UNINIT (pScreen, &damage_region);
 
173
    RegionUninit(&damage_region);
206
174
    crtc->shadowClear = TRUE;
207
175
}
208
176
 
229
197
                DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
230
198
                                xf86_config->rotation_damage);
231
199
                xf86_config->rotation_damage_registered = TRUE;
 
200
                EnableLimitedSchedulingLatency();
232
201
            }
233
202
            
234
203
            xf86CrtcDamageShadow (crtc);
248
217
        return FALSE;
249
218
    xf86RotatePrepare (pScreen);
250
219
    region = DamageRegion(damage);
251
 
    if (REGION_NOTEMPTY(pScreen, region)) 
 
220
    if (RegionNotEmpty(region))
252
221
    {
253
222
        int                     c;
254
223
        SourceValidateProcPtr   SourceValidate;
271
240
                RegionRec   crtc_damage;
272
241
 
273
242
                /* compute portion of damage that overlaps crtc */
274
 
                REGION_INIT(pScreen, &crtc_damage, &crtc->bounds, 1);
275
 
                REGION_INTERSECT (pScreen, &crtc_damage, &crtc_damage, region);
 
243
                RegionInit(&crtc_damage, &crtc->bounds, 1);
 
244
                RegionIntersect(&crtc_damage, &crtc_damage, region);
276
245
                
277
246
                /* update damaged region */
278
 
                if (REGION_NOTEMPTY(pScreen, &crtc_damage))
 
247
                if (RegionNotEmpty(&crtc_damage))
279
248
                    xf86RotateCrtcRedisplay (crtc, &crtc_damage);
280
249
                
281
 
                REGION_UNINIT (pScreen, &crtc_damage);
 
250
                RegionUninit(&crtc_damage);
282
251
            }
283
252
        }
284
253
        pScreen->SourceValidate = SourceValidate;
294
263
    ScreenPtr           pScreen = screenInfo.screens[screenNum];
295
264
    ScrnInfoPtr         pScrn = xf86Screens[screenNum];
296
265
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
 
266
    Bool                rotation_active;
297
267
 
 
268
    rotation_active = xf86RotateRedisplay(pScreen);
298
269
    pScreen->BlockHandler = xf86_config->BlockHandler;
299
270
    (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
300
 
    if (xf86RotateRedisplay(pScreen))
301
 
    {
302
 
        /* Re-wrap if rotation is still happening */
303
 
        xf86_config->BlockHandler = pScreen->BlockHandler;
304
 
        pScreen->BlockHandler = xf86RotateBlockHandler;
305
 
    } else {
306
 
        xf86_config->BlockHandler = NULL;
307
 
    }
 
271
    /* cannot avoid re-wrapping until all wrapping is audited */
 
272
    xf86_config->BlockHandler = pScreen->BlockHandler;
 
273
    pScreen->BlockHandler = xf86RotateBlockHandler;
308
274
}
309
275
 
310
276
void
338
304
            DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
339
305
                              xf86_config->rotation_damage);
340
306
            xf86_config->rotation_damage_registered = FALSE;
 
307
            DisableLimitedSchedulingLatency();
341
308
        }
342
309
        DamageDestroy (xf86_config->rotation_damage);
343
310
        xf86_config->rotation_damage = NULL;
438
405
         */
439
406
        xf86RotateDestroy (crtc);
440
407
        crtc->transform_in_use = FALSE;
441
 
        if (new_params)
442
 
            xfree (new_params);
 
408
        free(new_params);
443
409
        new_params = NULL;
444
410
        new_nparams = 0;
445
411
        new_filter = NULL;
500
466
        if (transform)
501
467
        {
502
468
            if (transform->nparams) {
503
 
                new_params = xalloc (transform->nparams * sizeof (xFixed));
 
469
                new_params = malloc(transform->nparams * sizeof (xFixed));
504
470
                if (new_params) {
505
471
                    memcpy (new_params, transform->params,
506
472
                            transform->nparams * sizeof (xFixed));
539
505
    crtc->crtc_to_framebuffer = crtc_to_fb;
540
506
    crtc->f_crtc_to_framebuffer = f_crtc_to_fb;
541
507
    crtc->f_framebuffer_to_crtc = f_fb_to_crtc;
542
 
    if (crtc->params)
543
 
        xfree (crtc->params);
 
508
    free(crtc->params);
544
509
    crtc->params = new_params;
545
510
    crtc->nparams = new_nparams;
546
511
    crtc->filter = new_filter;