Subversion Repositories Kolibri OS

Rev

Rev 4280 | Rev 4371 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4280 Rev 4293
Line 1290... Line 1290...
1290
unlock:
1290
unlock:
1291
	mutex_unlock(&dev->struct_mutex);
1291
	mutex_unlock(&dev->struct_mutex);
1292
	return ret;
1292
	return ret;
1293
}
1293
}
Line -... Line 1294...
-
 
1294
 
-
 
1295
/**
-
 
1296
 * Called when user space has done writes to this buffer
-
 
1297
 */
-
 
1298
int
-
 
1299
i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
-
 
1300
			 struct drm_file *file)
-
 
1301
{
-
 
1302
	struct drm_i915_gem_sw_finish *args = data;
-
 
1303
	struct drm_i915_gem_object *obj;
Line -... Line 1304...
-
 
1304
	int ret = 0;
-
 
1305
 
-
 
1306
    if(args->handle == -2)
-
 
1307
    {
-
 
1308
       printf("%s handle %d\n", __FUNCTION__, args->handle);
Line -... Line 1309...
-
 
1309
       return 0;
-
 
1310
    }
-
 
1311
 
Line -... Line 1312...
-
 
1312
	ret = i915_mutex_lock_interruptible(dev);
-
 
1313
	if (ret)
-
 
1314
		return ret;
-
 
1315
 
-
 
1316
	obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
Line -... Line 1317...
-
 
1317
	if (&obj->base == NULL) {
-
 
1318
		ret = -ENOENT;
-
 
1319
		goto unlock;
-
 
1320
	}
-
 
1321
 
-
 
1322
	/* Pinned buffers may be scanout, so flush the cache */
-
 
1323
	if (obj->pin_display)
-
 
1324
		i915_gem_object_flush_cpu_write_domain(obj, true);
-
 
1325
 
Line 1294... Line 1326...
1294
 
1326
	drm_gem_object_unreference(&obj->base);
1295
 
1327
unlock:
1296
 
1328
	mutex_unlock(&dev->struct_mutex);
1297
 
1329
	return ret;
Line 3113... Line 3145...
3113
	 * snooping behaviour occurs naturally as the result of our domain
3145
	 * snooping behaviour occurs naturally as the result of our domain
3114
	 * tracking.
3146
	 * tracking.
3115
	 */
3147
	 */
3116
	if (!force && cpu_cache_is_coherent(obj->base.dev, obj->cache_level))
3148
	if (!force && cpu_cache_is_coherent(obj->base.dev, obj->cache_level))
3117
		return false;
3149
		return false;
3118
#if 0
-
 
3119
     if(obj->mapped != NULL)
-
 
3120
     {
-
 
3121
        uint8_t *page_virtual;
-
 
3122
        unsigned int i;
-
 
Line 3123... Line -...
3123
 
-
 
3124
        page_virtual = obj->mapped;
-
 
3125
        asm volatile("mfence");
-
 
3126
        for (i = 0; i < obj->base.size; i += x86_clflush_size)
-
 
3127
            clflush(page_virtual + i);
-
 
3128
        asm volatile("mfence");
-
 
3129
     }
-
 
3130
     else
-
 
3131
     {
-
 
3132
        uint8_t *page_virtual;
-
 
3133
        unsigned int i;
-
 
3134
        page_virtual = AllocKernelSpace(obj->base.size);
3150
 
3135
        if(page_virtual != NULL)
-
 
3136
        {
-
 
3137
            dma_addr_t *src, *dst;
-
 
3138
            u32 count;
-
 
3139
 
-
 
3140
#define page_tabs  0xFDC00000      /* really dirty hack */
-
 
3141
 
3151
	trace_i915_gem_object_clflush(obj);
3142
            src =  obj->pages.page;
-
 
3143
            dst =  &((dma_addr_t*)page_tabs)[(u32_t)page_virtual >> 12];
-
 
3144
            count = obj->base.size/4096;
-
 
3145
 
-
 
3146
            while(count--)
-
 
3147
            {
-
 
3148
                *dst++ = (0xFFFFF000 & *src++) | 0x001 ;
-
 
3149
            };
-
 
3150
 
-
 
3151
            asm volatile("mfence");
-
 
3152
            for (i = 0; i < obj->base.size; i += x86_clflush_size)
-
 
3153
                clflush(page_virtual + i);
-
 
3154
            asm volatile("mfence");
-
 
3155
            FreeKernelSpace(page_virtual);
-
 
3156
        }
-
 
3157
        else
-
 
3158
        {
-
 
3159
            asm volatile (
-
 
3160
            "mfence         \n"
-
 
3161
            "wbinvd         \n"                 /* this is really ugly  */
-
 
3162
            "mfence");
-
 
3163
        }
-
 
3164
     }
-
 
Line 3165... Line 3152...
3165
#endif
3152
	drm_clflush_sg(obj->pages);
3166
 
3153
 
Line 3167... Line 3154...
3167
	return true;
3154
	return true;