summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/intel_device.c59
-rw-r--r--src/intel_driver.h21
-rw-r--r--src/intel_module.c38
-rw-r--r--src/legacy/i810/i810_driver.c2
-rw-r--r--src/sna/gen5_render.c2
-rw-r--r--src/sna/gen6_render.c2
-rw-r--r--src/sna/gen7_render.c2
-rw-r--r--src/sna/gen8_render.c2
-rw-r--r--src/sna/sna.h1
-rw-r--r--src/sna/sna_accel.c2
-rw-r--r--src/sna/sna_dri2.c2
-rw-r--r--src/sna/sna_dri3.c2
-rw-r--r--src/sna/sna_driver.c22
-rw-r--r--src/sna/sna_video_hwmc.c2
-rw-r--r--src/uxa/intel.h15
-rw-r--r--src/uxa/intel_dri3.c4
-rw-r--r--src/uxa/intel_driver.c21
-rw-r--r--src/uxa/intel_hwmc.c8
-rw-r--r--src/uxa/intel_memory.c2
19 files changed, 108 insertions, 101 deletions
diff --git a/src/intel_device.c b/src/intel_device.c
index 2e16ce5f..140e1536 100644
--- a/src/intel_device.c
+++ b/src/intel_device.c
@@ -65,9 +65,11 @@
#include "fd.h"
struct intel_device {
+ int idx;
char *master_node;
char *render_node;
int fd;
+ int device_id;
int open_count;
int master_count;
};
@@ -184,7 +186,7 @@ int intel_entity_get_devid(int idx)
if (dev == NULL)
return 0;
- return __intel_get_device_id(dev->fd);
+ return dev->device_id;
}
static inline struct intel_device *intel_device(ScrnInfoPtr scrn)
@@ -195,11 +197,6 @@ static inline struct intel_device *intel_device(ScrnInfoPtr scrn)
return xf86GetEntityPrivate(scrn->entityList[0], intel_device_key)->ptr;
}
-static inline void intel_set_device(ScrnInfoPtr scrn, struct intel_device *dev)
-{
- xf86GetEntityPrivate(scrn->entityList[0], intel_device_key)->ptr = dev;
-}
-
static int is_i915_device(int fd)
{
drm_version_t version;
@@ -585,6 +582,12 @@ int intel_open_device(int entity_num,
if (geteuid() && is_master(fd))
master_count++;
+ if (pci)
+ dev->device_id = pci->device_id;
+ else
+ dev->device_id = __intel_get_device_id(fd);
+
+ dev->idx = entity_num;
dev->fd = fd;
dev->open_count = master_count;
dev->master_count = master_count;
@@ -615,24 +618,24 @@ int __intel_peek_fd(ScrnInfoPtr scrn)
return dev->fd;
}
-int intel_has_render_node(ScrnInfoPtr scrn)
+int intel_has_render_node(struct intel_device *dev)
{
- struct intel_device *dev;
struct stat st;
- dev = intel_device(scrn);
assert(dev && dev->fd != -1);
-
return is_render_node(dev->fd, &st);
}
-int intel_get_device(ScrnInfoPtr scrn)
+struct intel_device *intel_get_device(ScrnInfoPtr scrn, int *fd)
{
struct intel_device *dev;
int ret;
dev = intel_device(scrn);
- assert(dev && dev->fd != -1);
+ if (dev == NULL)
+ return NULL;
+
+ assert(dev->fd != -1);
if (dev->open_count++ == 0) {
drmSetVersion sv;
@@ -661,16 +664,16 @@ int intel_get_device(ScrnInfoPtr scrn)
strerror(errno), errno);
dump_clients_info(scrn, dev->fd);
dev->open_count--;
- return -1;
+ return NULL;
}
}
- return dev->fd;
+ *fd = dev->fd;
+ return dev;
}
-const char *intel_get_client_name(ScrnInfoPtr scrn)
+const char *intel_get_client_name(struct intel_device *dev)
{
- struct intel_device *dev = intel_device(scrn);
assert(dev && dev->render_node);
return dev->render_node;
}
@@ -686,14 +689,11 @@ static int authorise(struct intel_device *dev, int fd)
return drmGetMagic(fd, &magic) == 0 && drmAuthMagic(dev->fd, magic) == 0;
}
-int intel_get_client_fd(ScrnInfoPtr scrn)
+int intel_get_client_fd(struct intel_device *dev)
{
- struct intel_device *dev;
int fd = -1;
- dev = intel_device(scrn);
- assert(dev);
- assert(dev->fd != -1);
+ assert(dev && dev->fd != -1);
assert(dev->render_node);
#ifdef O_CLOEXEC
@@ -714,16 +714,14 @@ int intel_get_client_fd(ScrnInfoPtr scrn)
return fd;
}
-int intel_get_device_id(ScrnInfoPtr scrn)
+int intel_get_device_id(struct intel_device *dev)
{
- struct intel_device *dev = intel_device(scrn);
assert(dev && dev->fd != -1);
- return __intel_get_device_id(dev->fd);
+ return dev->device_id;
}
-int intel_get_master(ScrnInfoPtr scrn)
+int intel_get_master(struct intel_device *dev)
{
- struct intel_device *dev = intel_device(scrn);
int ret;
assert(dev && dev->fd != -1);
@@ -744,9 +742,8 @@ int intel_get_master(ScrnInfoPtr scrn)
return ret;
}
-int intel_put_master(ScrnInfoPtr scrn)
+int intel_put_master(struct intel_device *dev)
{
- struct intel_device *dev = intel_device(scrn);
int ret;
assert(dev && dev->fd != -1);
@@ -762,10 +759,8 @@ int intel_put_master(ScrnInfoPtr scrn)
return ret;
}
-void intel_put_device(ScrnInfoPtr scrn)
+void intel_put_device(struct intel_device *dev)
{
- struct intel_device *dev = intel_device(scrn);
-
assert(dev && dev->fd != -1);
assert(dev->open_count);
@@ -773,7 +768,7 @@ void intel_put_device(ScrnInfoPtr scrn)
return;
assert(!hosted());
- intel_set_device(scrn, NULL);
+ xf86GetEntityPrivate(dev->idx, intel_device_key)->ptr = NULL;
drmClose(dev->fd);
if (dev->render_node != dev->master_node)
diff --git a/src/intel_driver.h b/src/intel_driver.h
index 13e26886..f3eb90a2 100644
--- a/src/intel_driver.h
+++ b/src/intel_driver.h
@@ -117,23 +117,24 @@ struct xf86_platform_device;
struct intel_device_info {
int gen;
};
+struct intel_device;
int intel_entity_get_devid(int index);
-void intel_detect_chipset(ScrnInfoPtr scrn, EntityInfoPtr ent);
-
int intel_open_device(int entity_num,
const struct pci_device *pci,
struct xf86_platform_device *dev);
int __intel_peek_fd(ScrnInfoPtr scrn);
-int intel_has_render_node(ScrnInfoPtr scrn);
-int intel_get_device(ScrnInfoPtr scrn);
-const char *intel_get_client_name(ScrnInfoPtr scrn);
-int intel_get_client_fd(ScrnInfoPtr scrn);
-int intel_get_device_id(ScrnInfoPtr scrn);
-int intel_get_master(ScrnInfoPtr scrn);
-int intel_put_master(ScrnInfoPtr scrn);
-void intel_put_device(ScrnInfoPtr scrn);
+struct intel_device *intel_get_device(ScrnInfoPtr scrn, int *fd);
+int intel_has_render_node(struct intel_device *dev);
+const char *intel_get_client_name(struct intel_device *dev);
+int intel_get_client_fd(struct intel_device *dev);
+int intel_get_device_id(struct intel_device *dev);
+int intel_get_master(struct intel_device *dev);
+int intel_put_master(struct intel_device *dev);
+void intel_put_device(struct intel_device *dev);
+
+void intel_detect_chipset(ScrnInfoPtr scrn, struct intel_device *dev);
#define IS_DEFAULT_ACCEL_METHOD(x) ({ \
enum { NOACCEL, SNA, UXA, GLAMOR } default_accel_method__ = DEFAULT_ACCEL_METHOD; \
diff --git a/src/intel_module.c b/src/intel_module.c
index e3da2908..2fbb4df2 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -325,27 +325,31 @@ static const struct pci_id_match intel_device_match[] = {
};
void
-intel_detect_chipset(ScrnInfoPtr scrn, EntityInfoPtr ent)
+intel_detect_chipset(ScrnInfoPtr scrn, struct intel_device *dev)
{
- MessageType from = X_PROBED;
- const char *name = NULL;
int devid;
+ const char *name = NULL;
int i;
- if (ent->device->chipID >= 0) {
- xf86DrvMsg(scrn->scrnIndex, from = X_CONFIG,
- "ChipID override: 0x%04X\n",
- ent->device->chipID);
- devid = ent->device->chipID;
- } else {
+ if (dev == NULL) {
+ EntityInfoPtr ent;
struct pci_device *pci;
- pci = xf86GetPciInfoForEntity(ent->index);
- if (pci != NULL)
- devid = pci->device_id;
- else
- devid = intel_get_device_id(scrn);
- }
+ ent = xf86GetEntityInfo(scrn->entityList[0]);
+ if (ent->device->chipID >= 0) {
+ xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
+ "ChipID override: 0x%04X\n",
+ ent->device->chipID);
+ devid = ent->device->chipID;
+ } else {
+ pci = xf86GetPciInfoForEntity(ent->index);
+ if (pci)
+ devid = pci->device_id;
+ else
+ devid = ~0;
+ }
+ } else
+ devid = intel_get_device_id(dev);
for (i = 0; intel_chipsets[i].name != NULL; i++) {
if (devid == intel_chipsets[i].token) {
@@ -365,7 +369,7 @@ intel_detect_chipset(ScrnInfoPtr scrn, EntityInfoPtr ent)
}
if (gen) {
- xf86DrvMsg(scrn->scrnIndex, from,
+ xf86DrvMsg(scrn->scrnIndex, X_PROBED,
"gen%d engineering sample\n", gen);
} else {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
@@ -374,7 +378,7 @@ intel_detect_chipset(ScrnInfoPtr scrn, EntityInfoPtr ent)
name = "unknown";
} else {
- xf86DrvMsg(scrn->scrnIndex, from,
+ xf86DrvMsg(scrn->scrnIndex, X_PROBED,
"Integrated Graphics Chipset: Intel(R) %s\n",
name);
}
diff --git a/src/legacy/i810/i810_driver.c b/src/legacy/i810/i810_driver.c
index 3d53d043..778b1a41 100644
--- a/src/legacy/i810/i810_driver.c
+++ b/src/legacy/i810/i810_driver.c
@@ -364,7 +364,7 @@ I810PreInit(ScrnInfoPtr scrn, int flags)
*/
I810DoDDC(scrn, pI810->pEnt->index);
- intel_detect_chipset(scrn, pI810->pEnt);
+ intel_detect_chipset(scrn, NULL);
pI810->LinearAddr = pI810->PciInfo->regions[0].base_addr;
xf86DrvMsg(scrn->scrnIndex, X_PROBED, "Linear framebuffer at 0x%lX\n",
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 435e6749..37cf1ff9 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -3333,7 +3333,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 (intel_get_device_id(sna->scrn) == 0x0044)
+ if (intel_get_device_id(sna->dev) == 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 5c625efc..a05196a5 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -3633,7 +3633,7 @@ static bool gen6_render_setup(struct sna *sna, int devid)
const char *gen6_render_init(struct sna *sna, const char *backend)
{
- int devid = intel_get_device_id(sna->scrn);
+ int devid = intel_get_device_id(sna->dev);
if (!gen6_render_setup(sna, devid))
return backend;
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 16e666b9..2d8f2960 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -3885,7 +3885,7 @@ static bool gen7_render_setup(struct sna *sna, int devid)
const char *gen7_render_init(struct sna *sna, const char *backend)
{
- int devid = intel_get_device_id(sna->scrn);
+ int devid = intel_get_device_id(sna->dev);
if (!gen7_render_setup(sna, devid))
return backend;
diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index 6cc7a68b..b615fa0e 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -3885,7 +3885,7 @@ static bool gen8_render_setup(struct sna *sna)
int i, j, k, l, m;
uint32_t devid;
- devid = intel_get_device_id(sna->scrn);
+ devid = intel_get_device_id(sna->dev);
if (devid & 0xf)
state->gt = ((devid >> 4) & 0xf) + 1;
DBG(("%s: gt=%d\n", __FUNCTION__, state->gt));
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 1a6244b2..30b0292b 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -242,6 +242,7 @@ struct sna {
struct kgem kgem;
ScrnInfoPtr scrn;
+ struct intel_device *dev;
unsigned flags;
#define SNA_IS_SLAVED 0x1
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index a6ba2a01..12221f2e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -17886,7 +17886,7 @@ void sna_accel_leave(struct sna *sna)
return;
/* as a user, we can only render now if we have a rendernode */
- if (intel_has_render_node(sna->scrn))
+ if (intel_has_render_node(sna->dev))
return;
/* no longer authorized to use our fd */
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index d38e43a4..04ba786e 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -3300,7 +3300,7 @@ bool sna_dri2_open(struct sna *sna, ScreenPtr screen)
memset(&info, '\0', sizeof(info));
info.fd = sna->kgem.fd;
info.driverName = dri_driver_name(sna);
- info.deviceName = intel_get_client_name(sna->scrn);
+ info.deviceName = intel_get_client_name(sna->dev);
DBG(("%s: loading dri driver '%s' [gen=%d] for device '%s'\n",
__FUNCTION__, info.driverName, sna->kgem.gen, info.deviceName));
diff --git a/src/sna/sna_dri3.c b/src/sna/sna_dri3.c
index cd4c174a..1f09aec8 100644
--- a/src/sna/sna_dri3.c
+++ b/src/sna/sna_dri3.c
@@ -158,7 +158,7 @@ static int sna_dri3_open_device(ScreenPtr screen,
int fd;
DBG(("%s()\n", __FUNCTION__));
- fd = intel_get_client_fd(xf86ScreenToScrn(screen));
+ fd = intel_get_client_fd(to_sna_from_screen(screen)->dev);
if (fd < 0)
return -fd;
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index a09aa986..03db7606 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -268,7 +268,7 @@ static Bool sna_create_screen_resources(ScreenPtr screen)
* already revoked our KMS privileges, so just carry on regardless,
* and hope that everything is sorted after the VT switch.
*/
- if (intel_get_master(sna->scrn) == 0) {
+ if (intel_get_master(sna->dev) == 0) {
/* Only preserve the fbcon, not any subsequent server regens */
if (serverGeneration == 1 && (sna->flags & SNA_IS_HOSTED) == 0)
sna_copy_fbcon(sna);
@@ -597,8 +597,8 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int probe)
scrn->progClock = TRUE;
scrn->rgbBits = 8;
- fd = intel_get_device(scrn);
- if (fd == -1) {
+ sna->dev = intel_get_device(scrn, &fd);
+ if (sna->dev == NULL) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to claim DRM device.\n");
goto cleanup;
@@ -611,7 +611,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int probe)
goto cleanup;
}
- intel_detect_chipset(scrn, pEnt);
+ intel_detect_chipset(scrn, sna->dev);
xf86DrvMsg(scrn->scrnIndex, X_PROBED, "CPU: %s\n",
sna_cpu_features_to_string(sna->cpu_features, buf));
@@ -715,6 +715,8 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int probe)
cleanup:
scrn->driverPrivate = (void *)((uintptr_t)sna->info | (sna->flags & SNA_IS_SLAVED) | 2);
+ if (sna->dev)
+ intel_put_device(sna->dev);
free(sna);
return FALSE;
}
@@ -929,7 +931,7 @@ static void sna_leave_vt(VT_FUNC_ARGS_DECL)
sna_accel_leave(sna);
sna_mode_reset(sna);
- if (intel_put_master(scrn))
+ if (intel_put_master(sna->dev))
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"drmDropMaster failed: %s\n", strerror(errno));
}
@@ -967,7 +969,7 @@ static Bool sna_early_close_screen(CLOSE_SCREEN_ARGS_DECL)
}
if (scrn->vtSema) {
- intel_put_master(scrn);
+ intel_put_master(sna->dev);
scrn->vtSema = FALSE;
}
@@ -1234,9 +1236,9 @@ static void sna_free_screen(FREE_SCREEN_ARGS_DECL)
sna_mode_fini(sna);
sna_acpi_fini(sna);
- free(sna);
- intel_put_device(scrn);
+ intel_put_device(sna->dev);
+ free(sna);
}
static Bool sna_enter_vt(VT_FUNC_ARGS_DECL)
@@ -1245,7 +1247,7 @@ static Bool sna_enter_vt(VT_FUNC_ARGS_DECL)
struct sna *sna = to_sna(scrn);
DBG(("%s\n", __FUNCTION__));
- if (intel_get_master(scrn))
+ if (intel_get_master(sna->dev))
return FALSE;
if (sna->flags & SNA_REPROBE) {
@@ -1257,7 +1259,7 @@ static Bool sna_enter_vt(VT_FUNC_ARGS_DECL)
}
if (!sna_set_desired_mode(sna)) {
- intel_put_master(scrn);
+ intel_put_master(sna->dev);
return FALSE;
}
diff --git a/src/sna/sna_video_hwmc.c b/src/sna/sna_video_hwmc.c
index 3c453a78..b2319c96 100644
--- a/src/sna/sna_video_hwmc.c
+++ b/src/sna/sna_video_hwmc.c
@@ -81,7 +81,7 @@ static int create_context(XvPortPtr port, XvMCContextPtr ctx,
return BadAlloc;
if (sna->kgem.gen >= 040) {
- int devid = intel_get_device_id(sna->scrn);
+ int devid = intel_get_device_id(sna->dev);
if (sna->kgem.gen >= 045)
priv->type = XVMC_I965_MPEG2_VLD;
diff --git a/src/uxa/intel.h b/src/uxa/intel.h
index 3a1641f3..a3982298 100644
--- a/src/uxa/intel.h
+++ b/src/uxa/intel.h
@@ -54,7 +54,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xorg-server.h"
#include "xf86_OSproc.h"
#include "compiler.h"
-#include "xf86Pci.h"
#include "xf86Cursor.h"
#include "xf86xv.h"
#include "xf86Crtc.h"
@@ -113,6 +112,7 @@ enum dri_type {
typedef struct intel_screen_private {
ScrnInfoPtr scrn;
+ struct intel_device *dev;
int cpp;
#define RENDER_BATCH I915_EXEC_RENDER
@@ -167,7 +167,6 @@ typedef struct intel_screen_private {
int Chipset;
EntityInfoPtr pEnt;
- struct pci_device *PciInfo;
const struct intel_device_info *info;
unsigned int BR[20];
@@ -326,14 +325,14 @@ typedef struct intel_screen_private {
#define IS_HSW(intel) (INTEL_INFO(intel)->gen == 075)
/* Some chips have specific errata (or limits) that we need to workaround. */
-#define IS_I830(intel) ((intel)->PciInfo->device_id == PCI_CHIP_I830_M)
-#define IS_845G(intel) ((intel)->PciInfo->device_id == PCI_CHIP_845_G)
-#define IS_I865G(intel) ((intel)->PciInfo->device_id == PCI_CHIP_I865_G)
+#define IS_I830(intel) (intel_get_device_id((intel)->dev) == PCI_CHIP_I830_M)
+#define IS_845G(intel) (intel_get_device_id((intel)->dev) == PCI_CHIP_845_G)
+#define IS_I865G(intel) (intel_get_device_id((intel)->dev) == PCI_CHIP_I865_G)
-#define IS_I915G(pI810) ((intel)->PciInfo->device_id == PCI_CHIP_I915_G || (intel)->PciInfo->device_id == PCI_CHIP_E7221_G)
-#define IS_I915GM(pI810) ((intel)->PciInfo->device_id == PCI_CHIP_I915_GM)
+#define IS_I915G(pI810) (intel_get_device_id((intel)->dev) == PCI_CHIP_I915_G || intel_get_device_id((intel)->dev) == PCI_CHIP_E7221_G)
+#define IS_I915GM(pI810) (intel_get_device_id((intel)->dev) == PCI_CHIP_I915_GM)
-#define IS_965_Q(pI810) ((intel)->PciInfo->device_id == PCI_CHIP_I965_Q)
+#define IS_965_Q(pI810) (intel_get_device_id((intel)->dev) == PCI_CHIP_I965_Q)
/* supports Y tiled surfaces (pre-965 Mesa isn't ready yet) */
#define SUPPORTS_YTILING(pI810) (INTEL_INFO(intel)->gen >= 040)
diff --git a/src/uxa/intel_dri3.c b/src/uxa/intel_dri3.c
index fed6b185..2dd2b55f 100644
--- a/src/uxa/intel_dri3.c
+++ b/src/uxa/intel_dri3.c
@@ -40,9 +40,11 @@ intel_dri3_open(ScreenPtr screen,
RRProviderPtr provider,
int *out)
{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ intel_screen_private *intel = intel_get_screen_private(scrn);
int fd;
- fd = intel_get_client_fd(xf86ScreenToScrn(screen));
+ fd = intel_get_client_fd(intel->dev);
if (fd < 0)
return -fd;
diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c
index f31f7bd6..ebd7498f 100644
--- a/src/uxa/intel_driver.c
+++ b/src/uxa/intel_driver.c
@@ -200,7 +200,7 @@ static void PreInitCleanup(ScrnInfoPtr scrn)
static void intel_check_chipset_option(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
- intel_detect_chipset(scrn, intel->pEnt);
+ intel_detect_chipset(scrn, intel->dev);
}
static Bool I830GetEarlyOptions(ScrnInfoPtr scrn)
@@ -268,9 +268,8 @@ static void intel_check_dri_option(ScrnInfoPtr scrn)
static Bool intel_open_drm_master(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
-
- intel->drmSubFD = intel_get_device(scrn);
- return intel->drmSubFD != -1;
+ intel->dev = intel_get_device(scrn, &intel->drmSubFD);
+ return intel->dev != NULL;
}
static int intel_init_bufmgr(intel_screen_private *intel)
@@ -381,7 +380,7 @@ static Bool can_accelerate_blt(struct intel_screen_private *intel)
}
if (INTEL_INFO(intel)->gen == 060) {
- struct pci_device *const device = intel->PciInfo;
+ struct pci_device *const device = xf86GetPciInfoForEntity(intel->pEnt->index);
/* Sandybridge rev07 locks up easily, even with the
* BLT ring workaround in place.
@@ -482,8 +481,6 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
scrn->displayWidth = 640; /* default it */
- intel->PciInfo = xf86GetPciInfoForEntity(intel->pEnt->index);
-
if (!intel_open_drm_master(scrn)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to become DRM master.\n");
@@ -860,7 +857,7 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
#ifdef INTEL_XVMC
MessageType from;
#endif
- struct pci_device *const device = intel->PciInfo;
+ struct pci_device *const device = xf86GetPciInfoForEntity(intel->pEnt->index);
int fb_bar = IS_GEN2(intel) ? 0 : 2;
scrn->videoRam = device->regions[fb_bar].size / 1024;
@@ -1065,7 +1062,7 @@ static void I830FreeScreen(FREE_SCREEN_ARGS_DECL)
if (intel && !((uintptr_t)intel & 3)) {
intel_mode_fini(intel);
intel_bufmgr_fini(intel);
- intel_put_device(scrn);
+ intel_put_device(intel->dev);
free(intel);
scrn->driverPrivate = NULL;
@@ -1075,12 +1072,13 @@ static void I830FreeScreen(FREE_SCREEN_ARGS_DECL)
static void I830LeaveVT(VT_FUNC_ARGS_DECL)
{
SCRN_INFO_PTR(arg);
+ intel_screen_private *intel = intel_get_screen_private(scrn);
xf86RotateFreeShadow(scrn);
xf86_hide_cursors(scrn);
- if (intel_put_master(scrn))
+ if (intel_put_master(intel->dev))
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"drmDropMaster failed: %s\n", strerror(errno));
}
@@ -1091,8 +1089,9 @@ static void I830LeaveVT(VT_FUNC_ARGS_DECL)
static Bool I830EnterVT(VT_FUNC_ARGS_DECL)
{
SCRN_INFO_PTR(arg);
+ intel_screen_private *intel = intel_get_screen_private(scrn);
- if (intel_get_master(scrn)) {
+ if (intel_get_master(intel->dev)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"drmSetMaster failed: %s\n",
strerror(errno));
diff --git a/src/uxa/intel_hwmc.c b/src/uxa/intel_hwmc.c
index f991aa65..829cb8e0 100644
--- a/src/uxa/intel_hwmc.c
+++ b/src/uxa/intel_hwmc.c
@@ -191,6 +191,7 @@ Bool intel_xvmc_adaptor_init(ScreenPtr pScreen)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
intel_screen_private *intel = intel_get_screen_private(scrn);
+ struct pci_device *pci;
static XF86MCAdaptorRec *pAdapt;
char *name;
char buf[64];
@@ -207,6 +208,10 @@ Bool intel_xvmc_adaptor_init(ScreenPtr pScreen)
return FALSE;
}
+ pci = xf86GetPciInfoForEntity(intel->pEnt->index);
+ if (pci == NULL)
+ return FALSE;
+
pAdapt = calloc(1, sizeof(XF86MCAdaptorRec));
if (!pAdapt) {
ErrorF("Allocation error.\n");
@@ -249,8 +254,7 @@ Bool intel_xvmc_adaptor_init(ScreenPtr pScreen)
}
sprintf(buf, "pci:%04x:%02x:%02x.%d",
- intel->PciInfo->domain,
- intel->PciInfo->bus, intel->PciInfo->dev, intel->PciInfo->func);
+ pci->domain, pci->bus, pci->dev, pci->func);
xf86XvMCRegisterDRInfo(pScreen, INTEL_XVMC_LIBNAME,
buf,
diff --git a/src/uxa/intel_memory.c b/src/uxa/intel_memory.c
index 5796e6d5..0c6cf30c 100644
--- a/src/uxa/intel_memory.c
+++ b/src/uxa/intel_memory.c
@@ -168,7 +168,7 @@ agp_aperture_size(struct pci_device *dev, int gen)
void intel_set_gem_max_sizes(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
- size_t agp_size = agp_aperture_size(intel->PciInfo,
+ size_t agp_size = agp_aperture_size(xf86GetPciInfoForEntity(intel->pEnt->index),
INTEL_INFO(intel)->gen);
/* The chances of being able to mmap an object larger than