~ubuntu-branches/debian/jessie/xserver-xorg-video-intel/jessie

« back to all changes in this revision

Viewing changes to src/intel_module.c

  • Committer: Package Import Robot
  • Author(s): Cyril Brulebois
  • Date: 2012-06-12 20:30:51 UTC
  • mfrom: (26.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20120612203051-mex5136iqfafp06b
Tags: 2:2.19.0-3
* Add patch to avoid X segfaults with Driver-less Device sections in
  xorg.conf (Closes: #677206):
  - 0003-Avoid-calling-xf86nameCompare-with-a-NULL-pointer.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <xf86.h>
32
32
#include <xf86_OSproc.h>
33
33
#include <xf86cmap.h>
 
34
#include <xf86Parser.h>
34
35
#include <xf86drmMode.h>
35
36
 
36
37
#include <xorgVersion.h>
41
42
 
42
43
#include "common.h"
43
44
#include "intel_driver.h"
 
45
#include "intel_options.h"
44
46
#include "legacy/legacy.h"
45
47
#include "sna/sna_module.h"
46
48
 
291
293
        return ret == 0;
292
294
}
293
295
 
 
296
extern XF86ConfigPtr xf86configptr;
 
297
 
 
298
static XF86ConfDevicePtr
 
299
_xf86findDriver(const char *ident, XF86ConfDevicePtr p)
 
300
{
 
301
        while (p) {
 
302
                if (xf86nameCompare(ident, p->dev_driver) == 0)
 
303
                        return p;
 
304
 
 
305
                p = p->list.next;
 
306
        }
 
307
        return NULL;
 
308
}
 
309
 
 
310
static enum accel_method { UXA, SNA } get_accel_method(void)
 
311
{
 
312
        enum accel_method accel_method = DEFAULT_ACCEL_METHOD;
 
313
        XF86ConfDevicePtr dev;
 
314
 
 
315
        dev = _xf86findDriver("intel", xf86configptr->conf_device_lst);
 
316
        if (dev && dev->dev_option_lst) {
 
317
                const char *s;
 
318
 
 
319
                s = xf86FindOptionValue(dev->dev_option_lst, "AccelMethod");
 
320
                if (s ) {
 
321
                        if (strcasecmp(s, "sna") == 0)
 
322
                                accel_method = SNA;
 
323
                        else if (strcasecmp(s, "uxa") == 0)
 
324
                                accel_method = UXA;
 
325
                        else if (strcasecmp(s, "glamor") == 0)
 
326
                                accel_method = UXA;
 
327
                }
 
328
        }
 
329
 
 
330
        return accel_method;
 
331
}
 
332
 
294
333
/*
295
334
 * intel_pci_probe --
296
335
 *
337
376
 
338
377
        scrn = xf86ConfigPciEntity(NULL, 0, entity_num, intel_pci_chipsets,
339
378
                                   NULL, NULL, NULL, NULL, NULL);
340
 
        if (scrn != NULL) {
341
 
                scrn->driverVersion = INTEL_VERSION;
342
 
                scrn->driverName = INTEL_DRIVER_NAME;
343
 
                scrn->name = INTEL_NAME;
344
 
                scrn->Probe = NULL;
345
 
 
346
 
                switch (DEVICE_ID(device)) {
 
379
        if (scrn == NULL)
 
380
                return FALSE;
 
381
 
 
382
        scrn->driverVersion = INTEL_VERSION;
 
383
        scrn->driverName = INTEL_DRIVER_NAME;
 
384
        scrn->name = INTEL_NAME;
 
385
        scrn->Probe = NULL;
 
386
 
347
387
#if !KMS_ONLY
348
 
                case PCI_CHIP_I810:
349
 
                case PCI_CHIP_I810_DC100:
350
 
                case PCI_CHIP_I810_E:
351
 
                case PCI_CHIP_I815:
352
 
                        lg_i810_init(scrn);
353
 
                        break;
 
388
        switch (DEVICE_ID(device)) {
 
389
        case PCI_CHIP_I810:
 
390
        case PCI_CHIP_I810_DC100:
 
391
        case PCI_CHIP_I810_E:
 
392
        case PCI_CHIP_I815:
 
393
                return lg_i810_init(scrn);
 
394
        }
354
395
#endif
355
396
 
356
 
                default:
 
397
        switch (get_accel_method()) {
357
398
#if USE_SNA
358
 
                        sna_init_scrn(scrn, entity_num);
359
 
#elif USE_UXA
360
 
                        intel_init_scrn(scrn);
361
 
#else
362
 
                        scrn = NULL;
363
 
#endif
364
 
                        break;
365
 
                }
 
399
        case SNA: return sna_init_scrn(scrn, entity_num);
 
400
#endif
 
401
 
 
402
#if USE_UXA
 
403
        case UXA: return intel_init_scrn(scrn);
 
404
#endif
 
405
 
 
406
        default: return FALSE;
366
407
        }
367
 
        return scrn != NULL;
368
408
}
369
409
 
370
410
#ifdef XFree86LOADER
397
437
#endif
398
438
 
399
439
        default:
400
 
#if USE_SNA
401
 
                return sna_available_options(chipid, busid);
402
 
#elif USE_UXA
403
 
                return intel_uxa_available_options(chipid, busid);
404
 
#else
405
 
                return NULL;
406
 
#endif
 
440
                return intel_options;
407
441
        }
408
442
}
409
443