NV50: basic fbcon + misc fixes
[platform/upstream/libdrm.git] / linux-core / i915_buffer.c
index 3dd236d..4224b73 100644 (file)
@@ -89,7 +89,7 @@ int i915_init_mem_type(struct drm_device *dev, uint32_t type,
                man->drm_bus_maptype = _DRM_AGP;
                man->gpu_offset = 0;
                break;
-       case DRM_BO_MEM_PRIV0:
+       case DRM_BO_MEM_VRAM:
                if (!(drm_core_has_AGP(dev) && dev->agp)) {
                        DRM_ERROR("AGP is not enabled for memory type %u\n",
                                  (unsigned)type);
@@ -103,6 +103,9 @@ int i915_init_mem_type(struct drm_device *dev, uint32_t type,
                man->drm_bus_maptype = _DRM_AGP;
                man->gpu_offset = 0;
                break;
+       case DRM_BO_MEM_PRIV0: /* for OS preallocated space */
+               DRM_ERROR("PRIV0 not used yet.\n");
+               break;
        default:
                DRM_ERROR("Unsupported memory type %u\n", (unsigned)type);
                return -EINVAL;
@@ -139,7 +142,7 @@ static void i915_emit_copy_blit(struct drm_device * dev,
 {
        uint32_t cur_pages;
        uint32_t stride = PAGE_SIZE;
-       drm_i915_private_t *dev_priv = dev->dev_private;
+       struct drm_i915_private *dev_priv = dev->dev_private;
        RING_LOCALS;
 
        if (!dev_priv)
@@ -249,10 +252,10 @@ int i915_move(struct drm_buffer_object *bo,
        if (old_mem->mem_type == DRM_BO_MEM_LOCAL) {
                return drm_bo_move_memcpy(bo, evict, no_wait, new_mem);
        } else if (new_mem->mem_type == DRM_BO_MEM_LOCAL) {
-               if (0) /*i915_move_flip(bo, evict, no_wait, new_mem)*/
+               if (1) /*i915_move_flip(bo, evict, no_wait, new_mem)*/
                        return drm_bo_move_memcpy(bo, evict, no_wait, new_mem);
        } else {
-               if (0) /*i915_move_blit(bo, evict, no_wait, new_mem)*/
+               if (1) /*i915_move_blit(bo, evict, no_wait, new_mem)*/
                        return drm_bo_move_memcpy(bo, evict, no_wait, new_mem);
        }
        return 0;
@@ -267,10 +270,12 @@ static inline void clflush(volatile void *__p)
 
 static inline void drm_cache_flush_addr(void *virt)
 {
+#ifdef cpu_has_clflush
        int i;
 
        for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size)
                clflush(virt+i);
+#endif
 }
 
 static inline void drm_cache_flush_page(struct page *p)
@@ -286,7 +291,21 @@ void i915_flush_ttm(struct drm_ttm *ttm)
                return;
 
        DRM_MEMORYBARRIER();
+
+#ifdef CONFIG_X86_32
+#ifndef cpu_has_clflush
+#define cpu_has_clflush 0
+#endif
+       /* Hopefully nobody has built an x86-64 processor without clflush */
+       if (!cpu_has_clflush) {
+               wbinvd();
+               DRM_MEMORYBARRIER();
+               return;
+       }
+#endif
+
        for (i = ttm->num_pages - 1; i >= 0; i--)
                drm_cache_flush_page(drm_ttm_get_page(ttm, i));
+
        DRM_MEMORYBARRIER();
 }