summaryrefslogtreecommitdiff
path: root/src/sna/sna_video_hwmc.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-10-03 15:35:54 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-10-03 16:13:38 +0100
commit6c157a925f258fd4c82cf0c3004e7d0056c1cd70 (patch)
tree44ef3ea4eea1cc67121e924ae8bebb93bd814f9b /src/sna/sna_video_hwmc.c
parent4685e79d1163325b78722c84ce173c91c217ac02 (diff)
intel: Remove dependence upon having PciInfo
After some probing mechanisms, we may end up with a valid device without knowing its PCI address a priori. Having a valid device, we can just query it for the correct device id, and can safely abort any path that requires PCI information that we don't have. (Those paths are not valid under such hosting anyway - if it may be required, we could reconstruct the address.) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_video_hwmc.c')
-rw-r--r--src/sna/sna_video_hwmc.c12
1 files changed, 9 insertions, 3 deletions
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,