diff options
Diffstat (limited to 'src/sna')
-rw-r--r-- | src/sna/gen5_render.c | 2 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 18 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 30 | ||||
-rw-r--r-- | src/sna/kgem.c | 6 | ||||
-rw-r--r-- | src/sna/sna.h | 1 | ||||
-rw-r--r-- | src/sna/sna_display.c | 6 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 15 | ||||
-rw-r--r-- | src/sna/sna_video_hwmc.c | 12 |
8 files changed, 55 insertions, 35 deletions
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index f6eec6a1..af146801 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -3315,7 +3315,7 @@ const char *gen5_render_init(struct sna *sna, const char *backend) #if !NO_COMPOSITE_SPANS sna->render.check_composite_spans = gen5_check_composite_spans; sna->render.composite_spans = gen5_render_composite_spans; - if (sna->PciInfo->device_id == 0x0044) + if (intel_get_device_id(sna->scrn) == 0x0044) sna->render.prefer_gpu |= PREFER_GPU_SPANS; #endif sna->render.video = gen5_render_video; diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 123bb15c..e5e07ce1 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -3694,17 +3694,17 @@ static void gen6_render_fini(struct sna *sna) kgem_bo_destroy(&sna->kgem, sna->render_state.gen6.general_bo); } -static bool is_gt2(struct sna *sna) +static bool is_gt2(struct sna *sna, int devid) { - return sna->PciInfo->device_id & 0x30; + return devid & 0x30; } -static bool is_mobile(struct sna *sna) +static bool is_mobile(struct sna *sna, int devid) { - return (sna->PciInfo->device_id & 0xf) == 0x6; + return (devid & 0xf) == 0x6; } -static bool gen6_render_setup(struct sna *sna) +static bool gen6_render_setup(struct sna *sna, int devid) { struct gen6_render_state *state = &sna->render_state.gen6; struct sna_static_stream general; @@ -3712,7 +3712,7 @@ static bool gen6_render_setup(struct sna *sna) int i, j, k, l, m; state->info = >1_info; - if (is_gt2(sna)) + if (is_gt2(sna, devid)) state->info = >2_info; /* XXX requires GT_MODE WiZ disabled */ sna_static_stream_init(&general); @@ -3784,7 +3784,9 @@ static bool gen6_render_setup(struct sna *sna) const char *gen6_render_init(struct sna *sna, const char *backend) { - if (!gen6_render_setup(sna)) + int devid = intel_get_device_id(sna->scrn); + + if (!gen6_render_setup(sna, devid)) return backend; sna->kgem.context_switch = gen6_render_context_switch; @@ -3799,7 +3801,7 @@ const char *gen6_render_init(struct sna *sna, const char *backend) #if !NO_COMPOSITE_SPANS sna->render.check_composite_spans = gen6_check_composite_spans; sna->render.composite_spans = gen6_render_composite_spans; - if (is_mobile(sna)) + if (is_mobile(sna, devid)) sna->render.prefer_gpu |= PREFER_GPU_SPANS; #endif sna->render.video = gen6_render_video; diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index d0cdc795..0a863726 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -3897,23 +3897,23 @@ static void gen7_render_fini(struct sna *sna) kgem_bo_destroy(&sna->kgem, sna->render_state.gen7.general_bo); } -static bool is_gt3(struct sna *sna) +static bool is_gt3(struct sna *sna, int devid) { assert(sna->kgem.gen == 075); - return sna->PciInfo->device_id & 0x20; + return devid & 0x20; } -static bool is_gt2(struct sna *sna) +static bool is_gt2(struct sna *sna, int devid) { - return sna->PciInfo->device_id & (is_hsw(sna)? 0x30 : 0x20); + return devid & (is_hsw(sna)? 0x30 : 0x20); } -static bool is_mobile(struct sna *sna) +static bool is_mobile(struct sna *sna, int devid) { - return (sna->PciInfo->device_id & 0xf) == 0x6; + return (devid & 0xf) == 0x6; } -static bool gen7_render_setup(struct sna *sna) +static bool gen7_render_setup(struct sna *sna, int devid) { struct gen7_render_state *state = &sna->render_state.gen7; struct sna_static_stream general; @@ -3922,19 +3922,19 @@ static bool gen7_render_setup(struct sna *sna) if (is_ivb(sna)) { state->info = &ivb_gt_info; - if (sna->PciInfo->device_id & 0xf) { + if (devid & 0xf) { state->info = &ivb_gt1_info; - if (is_gt2(sna)) + if (is_gt2(sna, devid)) state->info = &ivb_gt2_info; /* XXX requires GT_MODE WiZ disabled */ } } else if (is_byt(sna)) { state->info = &byt_gt_info; } else if (is_hsw(sna)) { state->info = &hsw_gt_info; - if (sna->PciInfo->device_id & 0xf) { - if (is_gt3(sna)) + if (devid & 0xf) { + if (is_gt3(sna, devid)) state->info = &hsw_gt3_info; - else if (is_gt2(sna)) + else if (is_gt2(sna, devid)) state->info = &hsw_gt2_info; else state->info = &hsw_gt1_info; @@ -4006,7 +4006,9 @@ static bool gen7_render_setup(struct sna *sna) const char *gen7_render_init(struct sna *sna, const char *backend) { - if (!gen7_render_setup(sna)) + int devid = intel_get_device_id(sna->scrn); + + if (!gen7_render_setup(sna, devid)) return backend; sna->kgem.context_switch = gen7_render_context_switch; @@ -4020,7 +4022,7 @@ const char *gen7_render_init(struct sna *sna, const char *backend) #if !NO_COMPOSITE_SPANS sna->render.check_composite_spans = gen7_check_composite_spans; sna->render.composite_spans = gen7_render_composite_spans; - if (is_mobile(sna) || is_gt2(sna) || is_byt(sna)) + if (is_mobile(sna, devid) || is_gt2(sna, devid) || is_byt(sna)) sna->render.prefer_gpu |= PREFER_GPU_SPANS; #endif sna->render.video = gen7_render_video; diff --git a/src/sna/kgem.c b/src/sna/kgem.c index eb511493..7da05dde 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -891,7 +891,7 @@ static bool is_hw_supported(struct kgem *kgem, * hw acceleration. */ - if (kgem->gen == 060 && dev->revision < 8) { + if (kgem->gen == 060 && dev && dev->revision < 8) { /* pre-production SNB with dysfunctional BLT */ return false; } @@ -1283,7 +1283,9 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen) kgem->aperture_low, kgem->aperture_low / (1024*1024), kgem->aperture_high, kgem->aperture_high / (1024*1024))); - kgem->aperture_mappable = agp_aperture_size(dev, gen); + kgem->aperture_mappable = 256 * 1024 * 1024; + if (dev != NULL) + kgem->aperture_mappable = agp_aperture_size(dev, gen); if (kgem->aperture_mappable == 0 || kgem->aperture_mappable > aperture.aper_size) kgem->aperture_mappable = aperture.aper_size; diff --git a/src/sna/sna.h b/src/sna/sna.h index f7c5315c..19728f1c 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -288,7 +288,6 @@ struct sna { #define SNA_TILING_ALL (~0) EntityInfoPtr pEnt; - struct pci_device *PciInfo; const struct intel_device_info *info; ScreenBlockHandlerProcPtr BlockHandler; diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 28ddce5f..13796051 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -476,12 +476,16 @@ has_device_backlight(xf86OutputPtr output, int *best_type) { struct sna_output *sna_output = output->driver_private; struct sna *sna = to_sna(output->scrn); - struct pci_device *pci = sna->PciInfo; + struct pci_device *pci; char path[1024]; char *best_iface = NULL; DIR *dir; struct dirent *de; + pci = xf86GetPciInfoForEntity(sna->pEnt->index); + if (pci == NULL) + return NULL; + snprintf(path, sizeof(path), "/sys/bus/pci/devices/%04x:%02x:%02x.%d/backlight", pci->domain, pci->bus, pci->dev, pci->func); diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 6d4420fe..00d90bfd 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -501,8 +501,6 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) scrn->displayWidth = 640; /* default it */ - sna->PciInfo = xf86GetPciInfoForEntity(sna->pEnt->index); - scrn->monitor = scrn->confScreen->monitor; scrn->progClock = TRUE; scrn->rgbBits = 8; @@ -558,9 +556,11 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) sna_setup_capabilities(scrn, fd); - intel_detect_chipset(scrn, sna->pEnt, sna->PciInfo); + intel_detect_chipset(scrn, pEnt); - kgem_init(&sna->kgem, fd, sna->PciInfo, sna->info->gen); + kgem_init(&sna->kgem, fd, + xf86GetPciInfoForEntity(pEnt->index), + sna->info->gen); if (xf86ReturnOptValBool(sna->Options, OPTION_ACCEL_DISABLE, FALSE) || !sna_option_cast_to_bool(sna, OPTION_ACCEL_METHOD, TRUE)) { xf86DrvMsg(sna->scrn->scrnIndex, X_CONFIG, @@ -939,6 +939,7 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct sna *sna = to_sna(scrn); + struct pci_device *pci; VisualPtr visuals; DepthPtr depths; int nvisuals; @@ -956,7 +957,11 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL) if (!sna_register_all_privates()) return FALSE; - scrn->videoRam = agp_aperture_size(sna->PciInfo, sna->kgem.gen) / 1024; + pci = xf86GetPciInfoForEntity(sna->pEnt->index); + if (pci != NULL) + scrn->videoRam = agp_aperture_size(pci, sna->kgem.gen) / 1024; + else + scrn->videoRam = 256; miClearVisualTypes(); if (!miSetVisualTypes(scrn->depth, diff --git a/src/sna/sna_video_hwmc.c b/src/sna/sna_video_hwmc.c index 4010b81c..3c453a78 100644 --- a/src/sna/sna_video_hwmc.c +++ b/src/sna/sna_video_hwmc.c @@ -81,12 +81,14 @@ static int create_context(XvPortPtr port, XvMCContextPtr ctx, return BadAlloc; if (sna->kgem.gen >= 040) { + int devid = intel_get_device_id(sna->scrn); + if (sna->kgem.gen >= 045) priv->type = XVMC_I965_MPEG2_VLD; else priv->type = XVMC_I965_MPEG2_MC; priv->i965.is_g4x = sna->kgem.gen == 045; - priv->i965.is_965_q = sna->PciInfo->device_id == PCI_CHIP_I965_Q; + priv->i965.is_965_q = devid == PCI_CHIP_I965_Q; priv->i965.is_igdng = sna->kgem.gen == 050; } else priv->type = XVMC_I915_MPEG2_MC; @@ -199,10 +201,15 @@ static XvMCSurfaceInfoPtr surface_info_vld[] = { void sna_video_xvmc_setup(struct sna *sna, ScreenPtr screen) { XvMCAdaptorRec *adaptors; + struct pci_device *pci; const char *name; char bus[64]; int i; + pci = xf86GetPciInfoForEntity(sna->pEnt->index); + if (pci == NULL) + return; + if (!sna->xv.num_adaptors) return; @@ -253,8 +260,7 @@ void sna_video_xvmc_setup(struct sna *sna, ScreenPtr screen) } sprintf(bus, "pci:%04x:%02x:%02x.%d", - sna->PciInfo->domain, - sna->PciInfo->bus, sna->PciInfo->dev, sna->PciInfo->func); + pci->domain, pci->bus, pci->dev, pci->func); xf86XvMCRegisterDRInfo(screen, (char *)SNA_XVMC_LIBNAME, bus, SNA_XVMC_MAJOR, SNA_XVMC_MINOR, |