aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-08-07 06:01:39 -0400
committerEric Anholt <eric@anholt.net>2010-08-09 14:24:36 -0400
commit6eeefaf3c86b8937db8ad930c48bfb592fc5e32e (patch)
treec73c07925f9bc2d23d62271e95fe083a764a3640
parent560b85bb750c3c539641993dd508b61260c9e874 (diff)
drm/i915: Apply i830 errata for cursor alignment
i830 requires 32bpp cursors to be aligned to 16KB, so we have to expose the alignment parameter to i915_gem_attach_phys_object(). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h4
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c11
-rw-r--r--drivers/gpu/drm/i915/intel_display.c4
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c3
4 files changed, 14 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4b0ffb6c5561..8df6ac735187 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1000,7 +1000,9 @@ int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
1000 int write); 1000 int write);
1001int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj); 1001int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj);
1002int i915_gem_attach_phys_object(struct drm_device *dev, 1002int i915_gem_attach_phys_object(struct drm_device *dev,
1003 struct drm_gem_object *obj, int id); 1003 struct drm_gem_object *obj,
1004 int id,
1005 int align);
1004void i915_gem_detach_phys_object(struct drm_device *dev, 1006void i915_gem_detach_phys_object(struct drm_device *dev,
1005 struct drm_gem_object *obj); 1007 struct drm_gem_object *obj);
1006void i915_gem_free_all_phys_object(struct drm_device *dev); 1008void i915_gem_free_all_phys_object(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 41306217bd7a..b4b25e17d4e9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4674,7 +4674,7 @@ i915_gem_load(struct drm_device *dev)
4674 * e.g. for cursor + overlay regs 4674 * e.g. for cursor + overlay regs
4675 */ 4675 */
4676int i915_gem_init_phys_object(struct drm_device *dev, 4676int i915_gem_init_phys_object(struct drm_device *dev,
4677 int id, int size) 4677 int id, int size, int align)
4678{ 4678{
4679 drm_i915_private_t *dev_priv = dev->dev_private; 4679 drm_i915_private_t *dev_priv = dev->dev_private;
4680 struct drm_i915_gem_phys_object *phys_obj; 4680 struct drm_i915_gem_phys_object *phys_obj;
@@ -4689,7 +4689,7 @@ int i915_gem_init_phys_object(struct drm_device *dev,
4689 4689
4690 phys_obj->id = id; 4690 phys_obj->id = id;
4691 4691
4692 phys_obj->handle = drm_pci_alloc(dev, size, 0); 4692 phys_obj->handle = drm_pci_alloc(dev, size, align);
4693 if (!phys_obj->handle) { 4693 if (!phys_obj->handle) {
4694 ret = -ENOMEM; 4694 ret = -ENOMEM;
4695 goto kfree_obj; 4695 goto kfree_obj;
@@ -4771,7 +4771,9 @@ out:
4771 4771
4772int 4772int
4773i915_gem_attach_phys_object(struct drm_device *dev, 4773i915_gem_attach_phys_object(struct drm_device *dev,
4774 struct drm_gem_object *obj, int id) 4774 struct drm_gem_object *obj,
4775 int id,
4776 int align)
4775{ 4777{
4776 drm_i915_private_t *dev_priv = dev->dev_private; 4778 drm_i915_private_t *dev_priv = dev->dev_private;
4777 struct drm_i915_gem_object *obj_priv; 4779 struct drm_i915_gem_object *obj_priv;
@@ -4790,11 +4792,10 @@ i915_gem_attach_phys_object(struct drm_device *dev,
4790 i915_gem_detach_phys_object(dev, obj); 4792 i915_gem_detach_phys_object(dev, obj);
4791 } 4793 }
4792 4794
4793
4794 /* create a new object */ 4795 /* create a new object */
4795 if (!dev_priv->mm.phys_objs[id - 1]) { 4796 if (!dev_priv->mm.phys_objs[id - 1]) {
4796 ret = i915_gem_init_phys_object(dev, id, 4797 ret = i915_gem_init_phys_object(dev, id,
4797 obj->size); 4798 obj->size, align);
4798 if (ret) { 4799 if (ret) {
4799 DRM_ERROR("failed to init phys object %d size: %zu\n", id, obj->size); 4800 DRM_ERROR("failed to init phys object %d size: %zu\n", id, obj->size);
4800 goto out; 4801 goto out;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6490d8b3867f..53f3a98cc1ae 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4375,8 +4375,10 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
4375 4375
4376 addr = obj_priv->gtt_offset; 4376 addr = obj_priv->gtt_offset;
4377 } else { 4377 } else {
4378 int align = IS_I830(dev) ? 16 * 1024 : 256;
4378 ret = i915_gem_attach_phys_object(dev, bo, 4379 ret = i915_gem_attach_phys_object(dev, bo,
4379 (intel_crtc->pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); 4380 (intel_crtc->pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1,
4381 align);
4380 if (ret) { 4382 if (ret) {
4381 DRM_ERROR("failed to attach phys object\n"); 4383 DRM_ERROR("failed to attach phys object\n");
4382 goto fail_locked; 4384 goto fail_locked;
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 9ae61aa05a1f..4f00390d7c61 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -1367,7 +1367,8 @@ void intel_setup_overlay(struct drm_device *dev)
1367 overlay->flip_addr = overlay->reg_bo->gtt_offset; 1367 overlay->flip_addr = overlay->reg_bo->gtt_offset;
1368 } else { 1368 } else {
1369 ret = i915_gem_attach_phys_object(dev, reg_bo, 1369 ret = i915_gem_attach_phys_object(dev, reg_bo,
1370 I915_GEM_PHYS_OVERLAY_REGS); 1370 I915_GEM_PHYS_OVERLAY_REGS,
1371 0);
1371 if (ret) { 1372 if (ret) {
1372 DRM_ERROR("failed to attach phys overlay regs\n"); 1373 DRM_ERROR("failed to attach phys overlay regs\n");
1373 goto out_free_bo; 1374 goto out_free_bo;