From 638353103d009d44bd5bdbe97cc7cef1bf011cdf Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Wed, 5 Mar 2008 15:08:46 +0800 Subject: i915: Evict if relocatee buffer is CACHED_MAPPED before writting relocations, otherwise the GPU probably sees some inconsistent data. Fix fd.o bug#14656 --- shared-core/i915_dma.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'shared-core') diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index f9e02c77..9e474bc6 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -806,6 +806,7 @@ struct i915_relocatee_info { struct drm_bo_kmap_obj kmap; int is_iomem; int idle; + int evicted; }; struct drm_i915_validate_buffer { @@ -878,6 +879,12 @@ int i915_apply_reloc(struct drm_file *file_priv, int num_buffers, relocatee->data_page = drm_bmo_virtual(&relocatee->kmap, &relocatee->is_iomem); relocatee->page_offset = (relocatee->offset & PAGE_MASK); + + if (!relocatee->evicted && + relocatee->buf->mem.flags & DRM_BO_FLAG_CACHED_MAPPED) { + drm_bo_evict_cached(relocatee->buf); + relocatee->evicted = 1; + } } val = buffers[buf_index].buffer->offset; -- cgit v1.2.3 From 12574590cdf7871755d1939463ca6898251fd0d1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 6 Mar 2008 05:21:50 +1000 Subject: drm: reorganise minor number handling using code from modesetting branch Rip out the whole head thing and replace it with an idr and drm_minor structure. --- shared-core/i915_dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shared-core') diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index 9e474bc6..7d247f9c 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -988,7 +988,7 @@ static int i915_exec_reloc(struct drm_file *file_priv, drm_handle_t buf_handle, struct drm_i915_validate_buffer *buffers, uint32_t buf_count) { - struct drm_device *dev = file_priv->head->dev; + struct drm_device *dev = file_priv->minor->dev; struct i915_relocatee_info relocatee; int ret = 0; int b; @@ -1195,7 +1195,7 @@ void i915_fence_or_sync(struct drm_file *file_priv, struct drm_fence_arg *fence_arg, struct drm_fence_object **fence_p) { - struct drm_device *dev = file_priv->head->dev; + struct drm_device *dev = file_priv->minor->dev; int ret; struct drm_fence_object *fence; -- cgit v1.2.3