~ubuntu-branches/ubuntu/raring/xserver-xorg-video-intel/raring

« back to all changes in this revision

Viewing changes to src/intel_display.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-09-12 07:43:59 UTC
  • mfrom: (1.4.22)
  • Revision ID: package-import@ubuntu.com-20120912074359-i3h8ol6hoghbemoq
Tags: 2:2.20.7-0ubuntu1
Merge from unreleased debian git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        uint32_t rotate_fb_id;
87
87
        xf86CrtcPtr crtc;
88
88
        struct list link;
 
89
        PixmapPtr scanout_pixmap;
 
90
        uint32_t scanout_fb_id;
89
91
};
90
92
 
91
93
struct intel_property {
260
262
        int i;
261
263
 
262
264
        str = xf86GetOptValString(intel->Options, OPTION_BACKLIGHT);
263
 
        if (str == NULL) {
 
265
        if (str != NULL) {
264
266
                sprintf(path, "%s/%s", BACKLIGHT_CLASS, str);
265
267
                if (!stat(path, &buf)) {
266
 
                        intel_output->backlight_iface = backlight_interfaces[i];
 
268
                        intel_output->backlight_iface = str;
267
269
                        intel_output->backlight_max = intel_output_backlight_get_max(output);
268
270
                        if (intel_output->backlight_max > 0) {
269
271
                                xf86DrvMsg(output->scrn->scrnIndex, X_CONFIG,
378
380
        ScrnInfoPtr scrn = crtc->scrn;
379
381
        struct intel_crtc *intel_crtc = crtc->driver_private;
380
382
        struct intel_mode *mode = intel_crtc->mode;
 
383
        intel_screen_private *intel = intel_get_screen_private(scrn);
381
384
        xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
382
385
        uint32_t *output_ids;
383
386
        int output_count = 0;
401
404
                output_count++;
402
405
        }
403
406
 
 
407
        if (!intel_crtc->scanout_fb_id) {
404
408
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,5,99,0,0)
405
 
        if (!xf86CrtcRotate(crtc, mode, rotation))
406
 
                goto done;
 
409
                if (!xf86CrtcRotate(crtc, mode, rotation))
 
410
                        goto done;
407
411
#else
408
 
        if (!xf86CrtcRotate(crtc))
409
 
                goto done;
 
412
                if (!xf86CrtcRotate(crtc))
 
413
                        goto done;
410
414
#endif
 
415
        }
411
416
 
412
417
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,7,0,0,0)
413
418
        crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
421
426
                fb_id = intel_crtc->rotate_fb_id;
422
427
                x = 0;
423
428
                y = 0;
 
429
        } else if (intel_crtc->scanout_fb_id && intel_crtc->scanout_pixmap->drawable.width >= crtc->mode.HDisplay && intel_crtc->scanout_pixmap->drawable.height >= crtc->mode.VDisplay) {
 
430
                fb_id = intel_crtc->scanout_fb_id;
 
431
                x = 0;
 
432
                y = 0;
424
433
        }
425
434
        ret = drmModeSetCrtc(mode->fd, crtc_id(intel_crtc),
426
435
                             fb_id, x, y, output_ids, output_count,
684
693
        crtc->driver_private = NULL;
685
694
}
686
695
 
 
696
#ifdef INTEL_PIXMAP_SHARING
 
697
static Bool
 
698
intel_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 
699
{
 
700
        struct intel_crtc *intel_crtc = crtc->driver_private;
 
701
        ScrnInfoPtr scrn = crtc->scrn;
 
702
        intel_screen_private *intel = intel_get_screen_private(scrn);
 
703
        dri_bo *bo;
 
704
        int ret;
 
705
 
 
706
        if (ppix == intel_crtc->scanout_pixmap)
 
707
                return TRUE;
 
708
 
 
709
        if (!ppix) {
 
710
                intel_crtc->scanout_pixmap = NULL;
 
711
                if (intel_crtc->scanout_fb_id) {
 
712
                        drmModeRmFB(intel->drmSubFD, intel_crtc->scanout_fb_id);
 
713
                        intel_crtc->scanout_fb_id = 0;
 
714
                }
 
715
                return TRUE;
 
716
        }
 
717
 
 
718
        bo = intel_get_pixmap_bo(ppix);
 
719
        if (intel->front_buffer) {
 
720
                ErrorF("have front buffer\n");
 
721
        }
 
722
 
 
723
        intel_crtc->scanout_pixmap = ppix;
 
724
        ret = drmModeAddFB(intel->drmSubFD, ppix->drawable.width,
 
725
                           ppix->drawable.height, ppix->drawable.depth,
 
726
                           ppix->drawable.bitsPerPixel, ppix->devKind,
 
727
                           bo->handle, &intel_crtc->scanout_fb_id);
 
728
        return TRUE;
 
729
}
 
730
#endif
 
731
 
687
732
static const xf86CrtcFuncsRec intel_crtc_funcs = {
688
733
        .dpms = intel_crtc_dpms,
689
734
        .set_mode_major = intel_crtc_set_mode_major,
697
742
        .shadow_destroy = intel_crtc_shadow_destroy,
698
743
        .gamma_set = intel_crtc_gamma_set,
699
744
        .destroy = intel_crtc_destroy,
 
745
#ifdef INTEL_PIXMAP_SHARING
 
746
        .set_scanout_pixmap = intel_set_scanout_pixmap,
 
747
#endif
700
748
};
701
749
 
702
750
static void
1662
1710
        for (i = 0; i < mode->mode_res->count_connectors; i++)
1663
1711
                intel_output_init(scrn, mode, i);
1664
1712
 
 
1713
#ifdef INTEL_PIXMAP_SHARING
 
1714
        xf86ProviderSetup(scrn, NULL, "Intel");
 
1715
#endif
 
1716
 
1665
1717
        xf86InitialConfiguration(scrn, TRUE);
1666
1718
 
1667
1719
        mode->event_context.version = DRM_EVENT_CONTEXT_VERSION;