~ubuntu-branches/ubuntu/precise/xorg-server/precise

« back to all changes in this revision

Viewing changes to miext/rootless/rootlessGC.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2011-01-31 19:45:19 UTC
  • mfrom: (1.1.38 upstream) (0.1.19 experimental)
  • Revision ID: james.westby@ubuntu.com-20110131194519-fx30d1zsg83invba
Tags: 2:1.9.99.901+git20110131.be3be758-0ubuntu1
* Merge from (unreleased) debian-experimental.  Remaining Ubuntu changes:
  - rules:
    + Disable SELinux, libaudit-dev is not in main yet. (LP: #406226)
    + Enable xcsecurity. (LP: #247537)
    + Add --with-extra-module-dir to support GL alternatives.
  - control: 
    + Xvfb depends on xauth, x11-xkb-utils. (LP: #500102)
    + Add breaks for incompatible drivers. (LP: #614993)
    + Drop libaudit-dev from build-deps.
  - local/xvfb-run*: Add correct docs about error codes. (LP #328205)
  - debian/patches:
    + 100_rethrow_signals.patch:
      When aborting, re-raise signals for apport
    + 109_fix-swcursor-crash.patch:
      Avoid dereferencing null pointer while reloading cursors during
      resume. (LP: #371405)
    + 111_armel-drv-fallbacks.patch:
      Add support for armel driver fallbacks.
    + 121_only_switch_vt_when_active.diff:
      Add a check to prevent the X server from changing the VT when killing
      GDM from the console.
    + 122_xext_fix_card32_overflow_in_xauth.patch:
      Fix server crash when “xauth generate” is called with large timeout.
    + 157_check_null_modes.patch, 162_null_crtc_in_rotation.patch,
      166_nullptr_xinerama_keyrepeat.patch, 167_nullptr_xisbread.patch
      169_mipointer_nullptr_checks.patch,
      172_cwgetbackingpicture_nullptr_check.patch:
      Fix various segfaults in xserver by checking pointers for NULL
      values before dereferencing them.
    + 165_man_xorg_conf_no_device_ident.patch
      Correct man page
    + 168_glibc_trace_to_stderr.patch:
      Report abort traces to stderr instead of terminal
    + 184_virtual_devices_autodetect.patch:
      Use vesa for qemu device, which is not supported by cirrus
    + 188_default_primary_to_first_busid.patch:
      Pick the first device and carry on (LP: #459512)
    + 190_cache-xkbcomp_output_for_fast_start_up.patch:
    + 191-Xorg-add-an-extra-module-path.patch:
      Add support for the alternatives module path.
    + 198_nohwaccess.patch:
      Adds a -nohwaccess argument to make X not access the hardware
      ports directly.
    + 200_randr-null.patch:
      Clarify a pointer initialization.
    + 206_intel_8xx_default_to_fbdev.patch:
      Makes 8xx class intel GPUs default to fbdev for stability. (LP: #633593)
* Refresh 121_only_switch_vt_when_active.diff for new upstream.
* Drop 187_edid_quirk_hp_nc8430.patch; upstream.
* Drop 189_xserver_1.5.0_bg_none_root.patch; functionality now upstream.
* Refresh 190_cache-xkbcomp_output_for_fast_start_up.patch for new upstream.
* Drop 197_xvfb-randr.patch:
  - miRandR, which this used, has been removed from the server. 
* Drop 204_fix-neg-sync-transition.patch; upstream.
* Drop 207_dga_master_device.patch; upstream.
* Drop 208_switch_on_release.diff; upstream.
* debian/patches/209_add_legacy_bgnone_option.patch:
  - Add "-nr" as a synonym for "-background none" to ease the transition from
    the old 189_xserver_1.5.0_bg_none_root.patch patch.  Can be dropped once
    all the ?DM have been updated to use the new option.
* debian/control:
  - Add Breaks: to xserver-xorg-video-8 and current fglrx.  These proprietary
    drivers don't yet have appropriate dependency information, so manually
    handle them here to prevent broken upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
};
149
149
 
150
150
/*
151
 
   There are two issues we must contend with when drawing. These are
152
 
   controlled with ROOTLESS_PROTECT_ALPHA and RootlessAccelInit().
153
 
 
154
151
   If ROOTLESS_PROTECT_ALPHA is set, we have to make sure that the alpha
155
152
   channel of the on screen windows is always opaque. fb makes this harder
156
153
   than it would otherwise be by noticing that a planemask of 0x00ffffff
171
168
   can do this when drawing op is GXcopy. We can also do this when copying
172
169
   from another window since its alpha channel must also be opaque.
173
170
 
174
 
   The other issue to consider is that the rootless implementation may
175
 
   provide accelerated drawing functions if RootlessAccelInit() is called.For 
176
 
   some drawing primitives we swap in rootless acceleration functions, which
177
 
   use the accelerated drawing functions where possible.
178
 
 
179
 
   Where both alpha protection and acceleration is used, it is even a bigger
180
 
   win to relax the planemask to all ones because most accelerated drawing
181
 
   functions can only be used in this case. However, even if we can't set
182
 
   the planemask to all ones, we can still use the accelerated
183
 
   CompositePixels function for GXcopy if it is a forward copy. This is
184
 
   mainly intended for copying from pixmaps to windows. The CompositePixels
185
 
   operation used sets alpha to 0xFF during the copy.
186
 
 
187
 
   The three macros below are used to implement this, potentially accelerated
188
 
   drawing ops look something like this:
 
171
   The three macros below are used to implement this. Drawing ops that can
 
172
   potentially have their planemask relaxed look like:
189
173
 
190
174
   OP {
191
175
       GC_SAVE(gc);
285
269
    return canAccelBlit(pDraw, pGC);
286
270
}
287
271
 
288
 
static unsigned int
289
 
boxBytes(DrawablePtr pDraw, BoxRec *box)
290
 
{
291
 
    unsigned int pixels;
292
 
 
293
 
    pixels = (box->x2 - box->x1) * (box->y2 - box->y1);
294
 
 
295
 
    return pixels * (pDraw->bitsPerPixel >> 3);
296
 
}
297
 
 
298
272
 
299
273
/*
300
274
 * Screen function to create a graphics context
477
451
 
478
452
        RootlessStartDrawing((WindowPtr) dst);
479
453
 
480
 
        if (canAccelFill(dst, pGC) &&
481
 
            boxBytes(dst, &box) >= rootless_FillBytes_threshold)
 
454
        if (canAccelFill(dst, pGC))
482
455
        {
483
456
            GC_UNSET_PM(pGC, dst);
484
457
        }
584
557
    RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst);
585
558
 
586
559
    if (pSrc->type == DRAWABLE_WINDOW && IsFramedWindow((WindowPtr)pSrc)) {
587
 
        unsigned int bytes;
588
 
 
589
560
        /* If both source and dest are windows, and we're doing
590
561
           a simple copy operation, we can remove the alpha-protecting
591
562
           planemask (since source has opaque alpha as well) */
592
563
 
593
 
        bytes = w * h * (pSrc->depth >> 3);
594
 
 
595
 
        if (bytes >= rootless_CopyBytes_threshold && canAccelBlit(pSrc, pGC))
 
564
        if (canAccelBlit(pSrc, pGC))
596
565
        {
597
566
            GC_UNSET_PM(pGC, dst);
598
567
        }
1064
1033
 
1065
1034
        RootlessStartDrawing((WindowPtr) dst);
1066
1035
 
1067
 
        if (canAccelFill(dst, pGC) &&
1068
 
            boxBytes(dst, &box) >= rootless_FillBytes_threshold)
 
1036
        if (canAccelFill(dst, pGC))
1069
1037
        {
1070
1038
            GC_UNSET_PM(pGC, dst);
1071
1039
        }
1117
1085
 
1118
1086
        RootlessStartDrawing((WindowPtr) dst);
1119
1087
 
1120
 
        if (canAccelFill(dst, pGC) &&
1121
 
            boxBytes(dst, &box) >= rootless_FillBytes_threshold)
 
1088
        if (canAccelFill(dst, pGC))
1122
1089
        {
1123
1090
            GC_UNSET_PM(pGC, dst);
1124
1091
        }
1170
1137
 
1171
1138
        RootlessStartDrawing((WindowPtr) dst);
1172
1139
 
1173
 
        if (canAccelFill(dst, pGC) &&
1174
 
            boxBytes(dst, &box) >= rootless_FillBytes_threshold)
 
1140
        if (canAccelFill(dst, pGC))
1175
1141
        {
1176
1142
            GC_UNSET_PM(pGC, dst);
1177
1143
        }
1221
1187
 
1222
1188
        RootlessStartDrawing((WindowPtr) dst);
1223
1189
 
1224
 
        if (canAccelFill(dst, pGC) &&
1225
 
            boxBytes(dst, &box) >= rootless_FillBytes_threshold)
 
1190
        if (canAccelFill(dst, pGC))
1226
1191
        {
1227
1192
            GC_UNSET_PM(pGC, dst);
1228
1193
        }
1309
1274
 
1310
1275
        RootlessStartDrawing((WindowPtr) dst);
1311
1276
 
1312
 
        if (canAccelFill(dst, pGC) &&
1313
 
            boxBytes(dst, &box) >= rootless_FillBytes_threshold)
 
1277
        if (canAccelFill(dst, pGC))
1314
1278
        {
1315
1279
            GC_UNSET_PM(pGC, dst);
1316
1280
        }
1408
1372
 
1409
1373
        RootlessStartDrawing((WindowPtr) dst);
1410
1374
 
1411
 
        if (canAccelFill(dst, pGC) &&
1412
 
            boxBytes(dst, &box) >= rootless_FillBytes_threshold)
 
1375
        if (canAccelFill(dst, pGC))
1413
1376
        {
1414
1377
            GC_UNSET_PM(pGC, dst);
1415
1378
        }