From b3db85118c4bc84150c6fc956fba2a8f4a50c45c Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sat, 21 Dec 2013 09:57:20 +0000 Subject: [PATCH] i915-v3.12.5-v1 git-svn-id: svn://kolibrios.org@4392 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/video/drm/i915/i915_dma.c | 2 +- drivers/video/drm/i915/i915_gem.c | 104 ++----------------- drivers/video/drm/i915/i915_gem_execbuffer.c | 25 +---- drivers/video/drm/i915/intel_display.c | 1 - drivers/video/drm/i915/intel_fb.c | 2 +- drivers/video/drm/i915/kos_gem_fb.c | 2 +- 6 files changed, 12 insertions(+), 124 deletions(-) diff --git a/drivers/video/drm/i915/i915_dma.c b/drivers/video/drm/i915/i915_dma.c index 8609772dd9..f6e1f10592 100644 --- a/drivers/video/drm/i915/i915_dma.c +++ b/drivers/video/drm/i915/i915_dma.c @@ -1008,7 +1008,7 @@ int i915_getparam(struct drm_device *dev, void *data, value = 1; break; case I915_PARAM_HAS_EXEC_HANDLE_LUT: - value = 0; //1; + value = 1; break; default: DRM_DEBUG("Unknown parameter %d\n", param->param); diff --git a/drivers/video/drm/i915/i915_gem.c b/drivers/video/drm/i915/i915_gem.c index 891f0d7a65..0c4ff64276 100644 --- a/drivers/video/drm/i915/i915_gem.c +++ b/drivers/video/drm/i915/i915_gem.c @@ -43,12 +43,6 @@ extern int x86_clflush_size; #define PROT_WRITE 0x2 /* page can be written */ #define MAP_SHARED 0x01 /* Share changes */ -#undef mb -#undef rmb -#undef wmb -#define mb() asm volatile("mfence") -#define rmb() asm volatile ("lfence") -#define wmb() asm volatile ("sfence") struct drm_i915_gem_object *get_fb_obj(); @@ -66,10 +60,6 @@ static inline void clflush(volatile void *__p) #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) -#define I915_EXEC_CONSTANTS_MASK (3<<6) -#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */ -#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6) -#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */ static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj); static void i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj, @@ -911,11 +901,6 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, if (args->size == 0) return 0; - if(args->handle == -2) - { - printf("%s handle %d\n", __FUNCTION__, args->handle); - return 0; - } ret = i915_mutex_lock_interruptible(dev); if (ret) @@ -1234,13 +1219,6 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, uint32_t write_domain = args->write_domain; int ret; - - if(args->handle == -2) - { - printf("%s handle %d\n", __FUNCTION__, args->handle); - return 0; - } - /* Only handle setting domains to types used by the CPU. */ if (write_domain & I915_GEM_GPU_DOMAINS) return -EINVAL; @@ -1303,12 +1281,6 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, struct drm_i915_gem_object *obj; int ret = 0; - if(args->handle == -2) - { - printf("%s handle %d\n", __FUNCTION__, args->handle); - return 0; - } - ret = i915_mutex_lock_interruptible(dev); if (ret) return ret; @@ -1342,13 +1314,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, { struct drm_i915_gem_mmap *args = data; struct drm_gem_object *obj; - unsigned long addr = 0; - - if(args->handle == -2) - { - printf("%s handle %d\n", __FUNCTION__, args->handle); - return 0; - } + unsigned long addr; obj = drm_gem_object_lookup(dev, file, args->handle); if (obj == NULL) @@ -1457,34 +1423,7 @@ i915_gem_get_gtt_alignment(struct drm_device *dev, uint32_t size, return i915_gem_get_gtt_size(dev, size, tiling_mode); } -/** - * i915_gem_get_unfenced_gtt_alignment - return required GTT alignment for an - * unfenced object - * @dev: the device - * @size: size of the object - * @tiling_mode: tiling mode of the object - * - * Return the required GTT alignment for an object, only taking into account - * unfenced tiled surface requirements. - */ -uint32_t -i915_gem_get_unfenced_gtt_alignment(struct drm_device *dev, - uint32_t size, - int tiling_mode) -{ - /* - * Minimum alignment is 4k (GTT page size) for sane hw. - */ - if (INTEL_INFO(dev)->gen >= 4 || IS_G33(dev) || - tiling_mode == I915_TILING_NONE) - return 4096; - /* Previous hardware however needs to be aligned to a power-of-two - * tile height. The simplest method for determining this is to reuse - * the power-of-tile object size. - */ - return i915_gem_get_gtt_size(dev, size, tiling_mode); -} int i915_gem_mmap_gtt(struct drm_file *file, @@ -1768,6 +1707,11 @@ i915_gem_object_get_pages(struct drm_i915_gem_object *obj) if (obj->pages) return 0; + if (obj->madv != I915_MADV_WILLNEED) { + DRM_ERROR("Attempting to obtain a purgeable object\n"); + return -EINVAL; + } + BUG_ON(obj->pages_pin_count); ret = ops->get_pages(obj); @@ -2382,12 +2326,6 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) if (ret) return ret; - if(args->bo_handle == -2) - { - obj = get_fb_obj(); - drm_gem_object_reference(&obj->base); - } - else obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->bo_handle)); if (&obj->base == NULL) { mutex_unlock(&dev->struct_mutex); @@ -3350,12 +3288,6 @@ int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data, struct drm_i915_gem_object *obj; int ret; - if(args->handle == -2) - { - printf("%s handle %d\n", __FUNCTION__, args->handle); - return 0; - } - ret = i915_mutex_lock_interruptible(dev); if (ret) return ret; @@ -3395,12 +3327,6 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, enum i915_cache_level level; int ret; - if(args->handle == -2) - { - printf("%s handle %d\n", __FUNCTION__, args->handle); - return 0; - } - switch (args->caching) { case I915_CACHING_NONE: level = I915_CACHE_NONE; @@ -3717,12 +3643,6 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data, struct drm_i915_gem_object *obj; int ret; - if(args->handle == -2) - { - printf("%s handle %d\n", __FUNCTION__, args->handle); - return 0; - } - ret = i915_mutex_lock_interruptible(dev); if (ret) return ret; @@ -3775,12 +3695,6 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data, if (ret) return ret; - if(args->handle == -2) - { - obj = get_fb_obj(); - drm_gem_object_reference(&obj->base); - } - else obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); if (&obj->base == NULL) { ret = -ENOENT; @@ -3818,12 +3732,6 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, if (ret) return ret; - if(args->handle == -2) - { - obj = get_fb_obj(); - drm_gem_object_reference(&obj->base); - } - else obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); if (&obj->base == NULL) { ret = -ENOENT; diff --git a/drivers/video/drm/i915/i915_gem_execbuffer.c b/drivers/video/drm/i915/i915_gem_execbuffer.c index 3ac857d965..574478b3fc 100644 --- a/drivers/video/drm/i915/i915_gem_execbuffer.c +++ b/drivers/video/drm/i915/i915_gem_execbuffer.c @@ -33,13 +33,6 @@ #include "intel_drv.h" //#include -#define I915_EXEC_SECURE (1<<9) -#define I915_EXEC_IS_PINNED (1<<10) -#define I915_EXEC_VEBOX (4<<0) - - -struct drm_i915_gem_object *get_fb_obj(); - static unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) @@ -115,9 +108,6 @@ eb_lookup_objects(struct eb_objects *eb, for (i = 0; i < args->buffer_count; i++) { struct drm_i915_gem_object *obj; - if(exec[i].handle == -2) - obj = get_fb_obj(); - else obj = to_intel_bo(idr_find(&file->object_idr, exec[i].handle)); if (obj == NULL) { spin_unlock(&file->table_lock); @@ -137,10 +127,6 @@ eb_lookup_objects(struct eb_objects *eb, list_add_tail(&obj->exec_list, &eb->objects); obj->exec_entry = &exec[i]; - - if(exec[i].handle == -2) - continue; - if (eb->and < 0) { eb->lut[i] = obj; } else { @@ -158,10 +144,6 @@ eb_lookup_objects(struct eb_objects *eb, static struct drm_i915_gem_object * eb_get_object(struct eb_objects *eb, unsigned long handle) { - - if(handle == -2) - return get_fb_obj(); - if (eb->and < 0) { if (handle >= -eb->and) return NULL; @@ -381,9 +363,12 @@ i915_gem_execbuffer_relocate_object(struct drm_i915_gem_object *obj, if (ret) return ret; + if (r->presumed_offset != offset) + { memcpy(&user_relocs->presumed_offset, &r->presumed_offset, sizeof(r->presumed_offset)); + } user_relocs++; r++; @@ -823,11 +808,7 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, * to read, but since we may need to update the presumed * offsets during execution, check for full write access. */ -// if (!access_ok(VERIFY_WRITE, ptr, length)) -// return -EFAULT; -// if (fault_in_multipages_readable(ptr, length)) -// return -EFAULT; } return 0; diff --git a/drivers/video/drm/i915/intel_display.c b/drivers/video/drm/i915/intel_display.c index 136689fede..11a5dce0e1 100644 --- a/drivers/video/drm/i915/intel_display.c +++ b/drivers/video/drm/i915/intel_display.c @@ -1876,7 +1876,6 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, i915_gem_object_pin_fence(obj); dev_priv->mm.interruptible = true; - return 0; err_unpin: diff --git a/drivers/video/drm/i915/intel_fb.c b/drivers/video/drm/i915/intel_fb.c index ef065079d8..b74a513247 100644 --- a/drivers/video/drm/i915/intel_fb.c +++ b/drivers/video/drm/i915/intel_fb.c @@ -120,7 +120,7 @@ static int intelfb_create(struct drm_fb_helper *helper, ret = -ENOMEM; goto out; } - + obj->has_global_gtt_mapping = 0; obj->stride = mode_cmd.pitches[0]; mutex_lock(&dev->struct_mutex); diff --git a/drivers/video/drm/i915/kos_gem_fb.c b/drivers/video/drm/i915/kos_gem_fb.c index d577617c08..e55e7364b0 100644 --- a/drivers/video/drm/i915/kos_gem_fb.c +++ b/drivers/video/drm/i915/kos_gem_fb.c @@ -182,7 +182,7 @@ kos_gem_fb_object_create(struct drm_device *dev, } } - obj->has_global_gtt_mapping = 1; +// obj->has_global_gtt_mapping = 1; list_add_tail(&obj->global_list, &dev_priv->mm.bound_list); list_add_tail(&vma->mm_list, &ggtt->inactive_list);