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>

authored by

Chris Wilson and committed by
Eric Anholt
6eeefaf3 560b85bb

+14 -8
+3 -1
drivers/gpu/drm/i915/i915_drv.h
··· 1000 1000 int write); 1001 1001 int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj); 1002 1002 int 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); 1004 1006 void i915_gem_detach_phys_object(struct drm_device *dev, 1005 1007 struct drm_gem_object *obj); 1006 1008 void i915_gem_free_all_phys_object(struct drm_device *dev);
+6 -5
drivers/gpu/drm/i915/i915_gem.c
··· 4674 4674 * e.g. for cursor + overlay regs 4675 4675 */ 4676 4676 int i915_gem_init_phys_object(struct drm_device *dev, 4677 - int id, int size) 4677 + int id, int size, int align) 4678 4678 { 4679 4679 drm_i915_private_t *dev_priv = dev->dev_private; 4680 4680 struct drm_i915_gem_phys_object *phys_obj; ··· 4689 4689 4690 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 4693 if (!phys_obj->handle) { 4694 4694 ret = -ENOMEM; 4695 4695 goto kfree_obj; ··· 4771 4771 4772 4772 int 4773 4773 i915_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 4778 drm_i915_private_t *dev_priv = dev->dev_private; 4777 4779 struct drm_i915_gem_object *obj_priv; ··· 4792 4790 i915_gem_detach_phys_object(dev, obj); 4793 4791 } 4794 4792 4795 - 4796 4793 /* create a new object */ 4797 4794 if (!dev_priv->mm.phys_objs[id - 1]) { 4798 4795 ret = i915_gem_init_phys_object(dev, id, 4799 - obj->size); 4796 + obj->size, align); 4800 4797 if (ret) { 4801 4798 DRM_ERROR("failed to init phys object %d size: %zu\n", id, obj->size); 4802 4799 goto out;
+3 -1
drivers/gpu/drm/i915/intel_display.c
··· 4375 4375 4376 4376 addr = obj_priv->gtt_offset; 4377 4377 } else { 4378 + int align = IS_I830(dev) ? 16 * 1024 : 256; 4378 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 4382 if (ret) { 4381 4383 DRM_ERROR("failed to attach phys object\n"); 4382 4384 goto fail_locked;
+2 -1
drivers/gpu/drm/i915/intel_overlay.c
··· 1367 1367 overlay->flip_addr = overlay->reg_bo->gtt_offset; 1368 1368 } else { 1369 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 1372 if (ret) { 1372 1373 DRM_ERROR("failed to attach phys overlay regs\n"); 1373 1374 goto out_free_bo;