xf86-video-intel: 3 commits - src/intel_driver.c src/intel_module.c src/sna/kgem.c src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Jul 6 03:11:50 PDT 2012
src/intel_driver.c | 29 +++++++++++++--------
src/intel_module.c | 18 +++++++++----
src/sna/kgem.c | 41 +++++++++++++++++++++++-------
src/sna/sna_display.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++---
4 files changed, 125 insertions(+), 30 deletions(-)
New commits:
commit 68b357454af705f1ed3a9599435a402f2611a180
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Jul 6 10:58:06 2012 +0100
sna: Clear garbage from the new front buffer when resizing
Avoid displaying a buffer filled with random junk when resizing (and
thereby creating a new) framebuffer.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index fb38c25..0b1a494 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -525,6 +525,7 @@ sna_crtc_apply(xf86CrtcPtr crtc)
int i, ret = FALSE;
DBG(("%s\n", __FUNCTION__));
+ kgem_bo_submit(&sna->kgem, sna_crtc->bo);
assert(xf86_config->num_output < ARRAY_SIZE(output_ids));
@@ -788,15 +789,15 @@ void sna_copy_fbcon(struct sna *sna)
sx = dx = 0;
if (box.x2 < (uint16_t)fbcon.width)
- sx = (fbcon.width - box.x2) / 2.;
+ sx = (fbcon.width - box.x2) / 2;
if (box.x2 < sna->front->drawable.width)
- dx = (sna->front->drawable.width - box.x2) / 2.;
+ dx = (sna->front->drawable.width - box.x2) / 2;
sy = dy = 0;
if (box.y2 < (uint16_t)fbcon.height)
- sy = (fbcon.height - box.y2) / 2.;
+ sy = (fbcon.height - box.y2) / 2;
if (box.y2 < sna->front->drawable.height)
- dy = (sna->front->drawable.height - box.y2) / 2.;
+ dy = (sna->front->drawable.height - box.y2) / 2;
ok = sna->render.copy_boxes(sna, GXcopy,
scratch, bo, sx, sy,
@@ -2122,6 +2123,62 @@ sna_redirect_screen_pixmap(ScrnInfoPtr scrn, PixmapPtr old, PixmapPtr new)
screen->SetScreenPixmap(new);
}
+static void copy_front(struct sna *sna, PixmapPtr old, PixmapPtr new)
+{
+ struct sna_pixmap *old_priv, *new_priv;
+ int16_t sx, sy, dx, dy;
+ BoxRec box;
+
+ DBG(("%s\n", __FUNCTION__));
+
+ if (wedged(sna))
+ return;
+
+ old_priv = sna_pixmap_force_to_gpu(old, MOVE_READ);
+ if (!old_priv)
+ return;
+
+ new_priv = sna_pixmap_force_to_gpu(new, MOVE_WRITE);
+ if (!new_priv)
+ return;
+
+ box.x1 = box.y1 = 0;
+ box.x2 = min(old->drawable.width, new->drawable.width);
+ box.y2 = min(old->drawable.height, new->drawable.height);
+
+ sx = dx = 0;
+ if (box.x2 < old->drawable.width)
+ sx = (old->drawable.width - box.x2) / 2;
+ if (box.x2 < new->drawable.width)
+ dx = (new->drawable.width - box.x2) / 2;
+
+ sy = dy = 0;
+ if (box.y2 < old->drawable.height)
+ sy = (old->drawable.height - box.y2) / 2;
+ if (box.y2 < new->drawable.height)
+ dy = (new->drawable.height - box.y2) / 2;
+
+ DBG(("%s: copying box (%dx%d) from (%d, %d) to (%d, %d)\n",
+ __FUNCTION__, box.x2, box.y2, sx, sy, dx, dy));
+
+ if (box.x2 != new->drawable.width || box.y2 != new->drawable.height) {
+ (void)sna->render.fill_one(sna, new, new_priv->gpu_bo, 0,
+ 0, 0,
+ new->drawable.width,
+ new->drawable.height,
+ GXclear);
+ }
+ (void)sna->render.copy_boxes(sna, GXcopy,
+ old, old_priv->gpu_bo, sx, sy,
+ new, new_priv->gpu_bo, dx, dy,
+ &box, 1, 0);
+
+ if (!DAMAGE_IS_ALL(new_priv->gpu_damage))
+ sna_damage_all(&new_priv->gpu_damage,
+ new->drawable.width,
+ new->drawable.height);
+}
+
static Bool
sna_crtc_resize(ScrnInfoPtr scrn, int width, int height)
{
@@ -2157,6 +2214,8 @@ sna_crtc_resize(ScrnInfoPtr scrn, int width, int height)
assert(sna->mode.shadow_damage == NULL);
assert(sna->mode.shadow == NULL);
+ copy_front(sna, sna->front, new_front);
+
sna->front = new_front;
scrn->virtualX = width;
scrn->virtualY = height;
commit 5784e0f21dc91f33c99a507105a0695cc53d6574
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Jul 6 09:42:37 2012 +0100
Allow matching against any device supported by drm/i915
However we cannot enable acceleration if we do not recognise its
hardware layout or instruction set.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 77611f5..f2770d6 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -417,6 +417,9 @@ static Bool has_relaxed_fencing(struct intel_screen_private *intel)
static Bool can_accelerate_blt(struct intel_screen_private *intel)
{
+ if (INTEL_INFO(intel)->gen == 0)
+ return FALSE;
+
if (0 && (IS_I830(intel) || IS_845G(intel))) {
/* These pair of i8xx chipsets have a crippling erratum
* that prevents the use of a PTE entry by the BLT
diff --git a/src/intel_module.c b/src/intel_module.c
index af82cff..f8ba149 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -48,6 +48,10 @@
static struct intel_device_info *chipset_info;
+static const struct intel_device_info intel_generic_info = {
+ .gen = 0,
+};
+
static const struct intel_device_info intel_i81x_info = {
.gen = 10,
};
@@ -215,6 +219,7 @@ static const struct pci_id_match intel_device_match[] = {
INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_S_GT1, &intel_ivybridge_info ),
INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_S_GT2, &intel_ivybridge_info ),
+ INTEL_DEVICE_MATCH (PCI_MATCH_ANY, &intel_generic_info ),
{ 0, 0, 0 },
};
@@ -225,6 +230,7 @@ void intel_detect_chipset(ScrnInfoPtr scrn,
int i;
chipset->info = chipset_info;
+ chipset->name = NULL;
for (i = 0; intel_chipsets[i].name != NULL; i++) {
if (DEVICE_ID(pci) == intel_chipsets[i].token) {
@@ -232,12 +238,14 @@ void intel_detect_chipset(ScrnInfoPtr scrn,
break;
}
}
- if (intel_chipsets[i].name == NULL) {
- chipset->name = "unknown chipset";
+ if (chipset->name == NULL) {
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING, "unknown chipset\n");
+ chipset->name = "unknown";
+ } else {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Integrated Graphics Chipset: Intel(R) %s\n",
+ chipset->name);
}
-
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "Integrated Graphics Chipset: Intel(R) %s\n", chipset->name);
}
/*
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index abae21a..2ace6ca 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -543,7 +543,10 @@ static struct list *active(struct kgem *kgem, int num_pages, int tiling)
static size_t
agp_aperture_size(struct pci_device *dev, int gen)
{
- return dev->regions[gen < 30 ? 0 : 2].size;
+ /* XXX assume that only future chipsets are unknown and follow
+ * the post gen2 PCI layout.
+ */
+ return dev->regions[(gen && gen < 30) ? 0 : 2].size;
}
static size_t
commit 1ee10cc3b2aa0888753eeb25c7fde7296a3c92eb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Jul 6 00:01:58 2012 +0100
Make the detection of broken pre-production hardware verbose
These SDV should have been returned to the manufacturer long ago and
replaced with real systems. So if they are still in use, add a gentle
reminder.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/intel_driver.c b/src/intel_driver.c
index f1bb10d..77611f5 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -432,6 +432,21 @@ static Bool can_accelerate_blt(struct intel_screen_private *intel)
return FALSE;
}
+ if (INTEL_INFO(intel)->gen == 60) {
+ struct pci_device *const device = intel->PciInfo;
+
+ /* Sandybridge rev07 locks up easily, even with the
+ * BLT ring workaround in place.
+ * Thus use shadowfb by default.
+ */
+ if (device->revision < 8) {
+ xf86DrvMsg(intel->scrn->scrnIndex, X_WARNING,
+ "Disabling hardware acceleration on this pre-production hardware.\n");
+
+ return FALSE;
+ }
+ }
+
if (INTEL_INFO(intel)->gen >= 60) {
drm_i915_getparam_t gp;
int value;
@@ -445,17 +460,6 @@ static Bool can_accelerate_blt(struct intel_screen_private *intel)
return FALSE;
}
- if (INTEL_INFO(intel)->gen == 60) {
- struct pci_device *const device = intel->PciInfo;
-
- /* Sandybridge rev07 locks up easily, even with the
- * BLT ring workaround in place.
- * Thus use shadowfb by default.
- */
- if (device->revision < 8)
- return FALSE;
- }
-
return TRUE;
}
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index ed1d700..abae21a 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -625,17 +625,23 @@ static bool __kgem_throttle(struct kgem *kgem)
return errno == EIO;
}
-static bool is_hw_supported(struct kgem *kgem)
+static bool is_hw_supported(struct kgem *kgem,
+ struct pci_device *dev)
{
if (DBG_NO_HW)
return false;
- if (kgem->gen >= 60) /* Only if the kernel supports the BLT ring */
- return gem_param(kgem, I915_PARAM_HAS_BLT) > 0;
-
if (kgem->gen <= 20) /* dynamic GTT is fubar */
return false;
+ if (kgem->gen == 60 && dev->revision < 8) {
+ /* pre-production SNB with dysfunctional BLT */
+ return false;
+ }
+
+ if (kgem->gen >= 60) /* Only if the kernel supports the BLT ring */
+ return gem_param(kgem, I915_PARAM_HAS_BLT) > 0;
+
return true;
}
@@ -663,6 +669,12 @@ static bool test_has_cache_level(struct kgem *kgem)
#endif
}
+static int kgem_get_screen_index(struct kgem *kgem)
+{
+ struct sna *sna = container_of(kgem, struct sna, kgem);
+ return sna->scrn->scrnIndex;
+}
+
void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
{
struct drm_i915_gem_get_aperture aperture;
@@ -674,8 +686,15 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
kgem->fd = fd;
kgem->gen = gen;
- kgem->wedged = __kgem_throttle(kgem);
- kgem->wedged |= !is_hw_supported(kgem);
+ if (!is_hw_supported(kgem, dev)) {
+ xf86DrvMsg(kgem_get_screen_index(kgem), X_WARNING,
+ "Detected unsupported/dysfunctional hardware, disabling acceleration.\n");
+ kgem->wedged = 1;
+ } else if (__kgem_throttle(kgem)) {
+ xf86DrvMsg(kgem_get_screen_index(kgem), X_WARNING,
+ "Detected a hung GPU, disabling acceleration.\n");
+ kgem->wedged = 1;
+ }
kgem->batch_size = ARRAY_SIZE(kgem->batch);
if (gen == 22)
@@ -2072,10 +2091,9 @@ void kgem_throttle(struct kgem *kgem)
kgem->wedged |= __kgem_throttle(kgem);
DBG(("%s: wedged=%d\n", __FUNCTION__, kgem->wedged));
if (kgem->wedged && !warned) {
- struct sna *sna = container_of(kgem, struct sna, kgem);
- xf86DrvMsg(sna->scrn->scrnIndex, X_ERROR,
+ xf86DrvMsg(kgem_get_screen_index(kgem), X_ERROR,
"Detected a hung GPU, disabling acceleration.\n");
- xf86DrvMsg(sna->scrn->scrnIndex, X_ERROR,
+ xf86DrvMsg(kgem_get_screen_index(kgem), X_ERROR,
"When reporting this, please include i915_error_state from debugfs and the full dmesg.\n");
warned = 1;
}
More information about the xorg-commit
mailing list