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

« back to all changes in this revision

Viewing changes to hw/kdrive/ephyr/ephyrdriext.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:
72
72
 
73
73
static int DRIErrorBase;
74
74
 
75
 
static DISPATCH_PROC(ProcXF86DRIQueryVersion);
76
 
static DISPATCH_PROC(ProcXF86DRIQueryDirectRenderingCapable);
77
 
static DISPATCH_PROC(ProcXF86DRIOpenConnection);
78
 
static DISPATCH_PROC(ProcXF86DRICloseConnection);
79
 
static DISPATCH_PROC(ProcXF86DRIGetClientDriverName);
80
 
static DISPATCH_PROC(ProcXF86DRICreateContext);
81
 
static DISPATCH_PROC(ProcXF86DRIDestroyContext);
82
 
static DISPATCH_PROC(ProcXF86DRICreateDrawable);
83
 
static DISPATCH_PROC(ProcXF86DRIDestroyDrawable);
84
 
static DISPATCH_PROC(ProcXF86DRIGetDrawableInfo);
85
 
static DISPATCH_PROC(ProcXF86DRIGetDeviceInfo);
86
 
static DISPATCH_PROC(ProcXF86DRIDispatch);
87
 
static DISPATCH_PROC(ProcXF86DRIAuthConnection);
88
75
 
89
 
static DISPATCH_PROC(SProcXF86DRIQueryVersion);
90
 
static DISPATCH_PROC(SProcXF86DRIQueryDirectRenderingCapable);
91
 
static DISPATCH_PROC(SProcXF86DRIDispatch);
92
76
 
93
77
static Bool ephyrDRIScreenInit (ScreenPtr a_screen) ;
94
78
static Bool ephyrDRICreateWindow (WindowPtr a_win) ;
119
103
#define GET_EPHYR_DRI_SCREEN_PRIV(screen) ((EphyrDRIScreenPrivPtr) \
120
104
    dixLookupPrivate(&(screen)->devPrivates, ephyrDRIScreenKey))
121
105
 
122
 
 
123
 
Bool
124
 
ephyrDRIExtensionInit (ScreenPtr a_screen)
125
 
{
126
 
    Bool is_ok=FALSE ;
127
 
    ExtensionEntry* extEntry=NULL;
128
 
    EphyrDRIScreenPrivPtr screen_priv=NULL ;
129
 
 
130
 
    EPHYR_LOG ("enter\n") ;
131
 
    if (!hostx_has_dri ()) {
132
 
        EPHYR_LOG ("host does not have DRI extension\n") ;
133
 
        goto out ;
134
 
    }
135
 
    EPHYR_LOG ("host X does have DRI extension\n") ;
136
 
    if (!hostx_has_xshape ()) {
137
 
        EPHYR_LOG ("host does not have XShape extension\n") ;
138
 
        goto out ;
139
 
    }
140
 
    EPHYR_LOG ("host X does have XShape extension\n") ;
141
 
 
142
 
#ifdef XF86DRI_EVENTS
143
 
    EventType = CreateNewResourceType (XF86DRIFreeEvents, "DRIEvents");
144
 
    if (!EventType) {
145
 
        EPHYR_LOG_ERROR ("failed to register DRI event resource type\n") ;
146
 
        goto out ;
147
 
    }
148
 
#endif
149
 
 
150
 
    if ((extEntry = AddExtension(XF86DRINAME,
151
 
                                 XF86DRINumberEvents,
152
 
                                 XF86DRINumberErrors,
153
 
                                 ProcXF86DRIDispatch,
154
 
                                 SProcXF86DRIDispatch,
155
 
                                 NULL,
156
 
                                 StandardMinorOpcode))) {
157
 
        DRIReqCode = (unsigned char)extEntry->base;
158
 
        DRIErrorBase = extEntry->errorBase;
159
 
    } else {
160
 
        EPHYR_LOG_ERROR ("failed to register DRI extension\n") ;
161
 
        goto out ;
162
 
    }
163
 
    screen_priv = calloc(1, sizeof (EphyrDRIScreenPrivRec)) ;
164
 
    if (!screen_priv) {
165
 
        EPHYR_LOG_ERROR ("failed to allocate screen_priv\n") ;
166
 
        goto out ;
167
 
    }
168
 
    dixSetPrivate(&a_screen->devPrivates, ephyrDRIScreenKey, screen_priv);
169
 
 
170
 
    if (!ephyrDRIScreenInit (a_screen)) {
171
 
        EPHYR_LOG_ERROR ("ephyrDRIScreenInit() failed\n") ;
172
 
        goto out ;
173
 
    }
174
 
    EphyrMirrorHostVisuals (a_screen) ;
175
 
    is_ok=TRUE ;
176
 
out:
177
 
    EPHYR_LOG ("leave\n") ;
178
 
    return is_ok ;
179
 
}
180
 
 
181
106
static Bool
182
107
ephyrDRIScreenInit (ScreenPtr a_screen)
183
108
{
473
398
    int i=0 ;
474
399
 
475
400
    EPHYR_LOG ("enter\n") ; 
476
 
    if (a_screen > screenInfo.numScreens) {
 
401
    if (a_screen >= screenInfo.numScreens) {
477
402
        EPHYR_LOG_ERROR ("bad screen number\n") ;
478
403
        goto out;
479
404
    }
1428
1353
        }
1429
1354
    }
1430
1355
}
 
1356
 
 
1357
Bool
 
1358
ephyrDRIExtensionInit (ScreenPtr a_screen)
 
1359
{
 
1360
    Bool is_ok=FALSE ;
 
1361
    ExtensionEntry* extEntry=NULL;
 
1362
    EphyrDRIScreenPrivPtr screen_priv=NULL ;
 
1363
 
 
1364
    EPHYR_LOG ("enter\n") ;
 
1365
    if (!hostx_has_dri ()) {
 
1366
        EPHYR_LOG ("host does not have DRI extension\n") ;
 
1367
        goto out ;
 
1368
    }
 
1369
    EPHYR_LOG ("host X does have DRI extension\n") ;
 
1370
    if (!hostx_has_xshape ()) {
 
1371
        EPHYR_LOG ("host does not have XShape extension\n") ;
 
1372
        goto out ;
 
1373
    }
 
1374
    EPHYR_LOG ("host X does have XShape extension\n") ;
 
1375
 
 
1376
#ifdef XF86DRI_EVENTS
 
1377
    EventType = CreateNewResourceType (XF86DRIFreeEvents, "DRIEvents");
 
1378
    if (!EventType) {
 
1379
        EPHYR_LOG_ERROR ("failed to register DRI event resource type\n") ;
 
1380
        goto out ;
 
1381
    }
 
1382
#endif
 
1383
 
 
1384
    if ((extEntry = AddExtension(XF86DRINAME,
 
1385
                                 XF86DRINumberEvents,
 
1386
                                 XF86DRINumberErrors,
 
1387
                                 ProcXF86DRIDispatch,
 
1388
                                 SProcXF86DRIDispatch,
 
1389
                                 NULL,
 
1390
                                 StandardMinorOpcode))) {
 
1391
        DRIReqCode = (unsigned char)extEntry->base;
 
1392
        DRIErrorBase = extEntry->errorBase;
 
1393
    } else {
 
1394
        EPHYR_LOG_ERROR ("failed to register DRI extension\n") ;
 
1395
        goto out ;
 
1396
    }
 
1397
    screen_priv = calloc(1, sizeof (EphyrDRIScreenPrivRec)) ;
 
1398
    if (!screen_priv) {
 
1399
        EPHYR_LOG_ERROR ("failed to allocate screen_priv\n") ;
 
1400
        goto out ;
 
1401
    }
 
1402
    dixSetPrivate(&a_screen->devPrivates, ephyrDRIScreenKey, screen_priv);
 
1403
 
 
1404
    if (!ephyrDRIScreenInit (a_screen)) {
 
1405
        EPHYR_LOG_ERROR ("ephyrDRIScreenInit() failed\n") ;
 
1406
        goto out ;
 
1407
    }
 
1408
    EphyrMirrorHostVisuals (a_screen) ;
 
1409
    is_ok=TRUE ;
 
1410
out:
 
1411
    EPHYR_LOG ("leave\n") ;
 
1412
    return is_ok ;
 
1413
}