Commit 6eeefaf3 authored by Chris Wilson's avatar Chris Wilson Committed by Eric Anholt

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: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent 560b85bb
...@@ -1000,7 +1000,9 @@ int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, ...@@ -1000,7 +1000,9 @@ int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
int write); int write);
int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj); int i915_gem_object_set_to_display_plane(struct drm_gem_object *obj);
int i915_gem_attach_phys_object(struct drm_device *dev, int i915_gem_attach_phys_object(struct drm_device *dev,
struct drm_gem_object *obj, int id); struct drm_gem_object *obj,
int id,
int align);
void i915_gem_detach_phys_object(struct drm_device *dev, void i915_gem_detach_phys_object(struct drm_device *dev,
struct drm_gem_object *obj); struct drm_gem_object *obj);
void i915_gem_free_all_phys_object(struct drm_device *dev); void i915_gem_free_all_phys_object(struct drm_device *dev);
......
...@@ -4674,7 +4674,7 @@ i915_gem_load(struct drm_device *dev) ...@@ -4674,7 +4674,7 @@ i915_gem_load(struct drm_device *dev)
* e.g. for cursor + overlay regs * e.g. for cursor + overlay regs
*/ */
int i915_gem_init_phys_object(struct drm_device *dev, int i915_gem_init_phys_object(struct drm_device *dev,
int id, int size) int id, int size, int align)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_phys_object *phys_obj; struct drm_i915_gem_phys_object *phys_obj;
...@@ -4689,7 +4689,7 @@ int i915_gem_init_phys_object(struct drm_device *dev, ...@@ -4689,7 +4689,7 @@ int i915_gem_init_phys_object(struct drm_device *dev,
phys_obj->id = id; phys_obj->id = id;
phys_obj->handle = drm_pci_alloc(dev, size, 0); phys_obj->handle = drm_pci_alloc(dev, size, align);
if (!phys_obj->handle) { if (!phys_obj->handle) {
ret = -ENOMEM; ret = -ENOMEM;
goto kfree_obj; goto kfree_obj;
...@@ -4771,7 +4771,9 @@ void i915_gem_detach_phys_object(struct drm_device *dev, ...@@ -4771,7 +4771,9 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
int int
i915_gem_attach_phys_object(struct drm_device *dev, i915_gem_attach_phys_object(struct drm_device *dev,
struct drm_gem_object *obj, int id) struct drm_gem_object *obj,
int id,
int align)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv; struct drm_i915_gem_object *obj_priv;
...@@ -4790,11 +4792,10 @@ i915_gem_attach_phys_object(struct drm_device *dev, ...@@ -4790,11 +4792,10 @@ i915_gem_attach_phys_object(struct drm_device *dev,
i915_gem_detach_phys_object(dev, obj); i915_gem_detach_phys_object(dev, obj);
} }
/* create a new object */ /* create a new object */
if (!dev_priv->mm.phys_objs[id - 1]) { if (!dev_priv->mm.phys_objs[id - 1]) {
ret = i915_gem_init_phys_object(dev, id, ret = i915_gem_init_phys_object(dev, id,
obj->size); obj->size, align);
if (ret) { if (ret) {
DRM_ERROR("failed to init phys object %d size: %zu\n", id, obj->size); DRM_ERROR("failed to init phys object %d size: %zu\n", id, obj->size);
goto out; goto out;
......
...@@ -4375,8 +4375,10 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -4375,8 +4375,10 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
addr = obj_priv->gtt_offset; addr = obj_priv->gtt_offset;
} else { } else {
int align = IS_I830(dev) ? 16 * 1024 : 256;
ret = i915_gem_attach_phys_object(dev, bo, ret = i915_gem_attach_phys_object(dev, bo,
(intel_crtc->pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); (intel_crtc->pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1,
align);
if (ret) { if (ret) {
DRM_ERROR("failed to attach phys object\n"); DRM_ERROR("failed to attach phys object\n");
goto fail_locked; goto fail_locked;
......
...@@ -1367,7 +1367,8 @@ void intel_setup_overlay(struct drm_device *dev) ...@@ -1367,7 +1367,8 @@ void intel_setup_overlay(struct drm_device *dev)
overlay->flip_addr = overlay->reg_bo->gtt_offset; overlay->flip_addr = overlay->reg_bo->gtt_offset;
} else { } else {
ret = i915_gem_attach_phys_object(dev, reg_bo, ret = i915_gem_attach_phys_object(dev, reg_bo,
I915_GEM_PHYS_OVERLAY_REGS); I915_GEM_PHYS_OVERLAY_REGS,
0);
if (ret) { if (ret) {
DRM_ERROR("failed to attach phys overlay regs\n"); DRM_ERROR("failed to attach phys overlay regs\n");
goto out_free_bo; goto out_free_bo;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment