Subversion Repositories Kolibri OS

Rev

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

Rev 4104 Rev 4246
Line 1319... Line 1319...
1319
 
1319
 
1320
	obj = drm_gem_object_lookup(dev, file, args->handle);
1320
	obj = drm_gem_object_lookup(dev, file, args->handle);
1321
	if (obj == NULL)
1321
	if (obj == NULL)
Line 1322... Line -...
1322
		return -ENOENT;
-
 
1323
 
-
 
1324
    //dbgprintf("%s offset %lld size %lld\n",
1322
		return -ENOENT;
1325
//                __FUNCTION__, args->offset, args->size);
1323
 
1326
	/* prime objects have no backing filp to GEM mmap
1324
	/* prime objects have no backing filp to GEM mmap
1327
	 * pages from.
1325
	 * pages from.
1328
	 */
1326
	 */
Line 2328... Line 2326...
2328
 * nanoseconds on an object becoming unbusy. Since the wait itself does so
2326
 * nanoseconds on an object becoming unbusy. Since the wait itself does so
2329
 * without holding struct_mutex the object may become re-busied before this
2327
 * without holding struct_mutex the object may become re-busied before this
2330
 * function completes. A similar but shorter * race condition exists in the busy
2328
 * function completes. A similar but shorter * race condition exists in the busy
2331
 * ioctl
2329
 * ioctl
2332
 */
2330
 */
-
 
2331
int
-
 
2332
i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
-
 
2333
{
-
 
2334
	drm_i915_private_t *dev_priv = dev->dev_private;
-
 
2335
	struct drm_i915_gem_wait *args = data;
-
 
2336
	struct drm_i915_gem_object *obj;
-
 
2337
	struct intel_ring_buffer *ring = NULL;
-
 
2338
	struct timespec timeout_stack, *timeout = NULL;
-
 
2339
	unsigned reset_counter;
-
 
2340
	u32 seqno = 0;
-
 
2341
	int ret = 0;
Line -... Line 2342...
-
 
2342
 
-
 
2343
	if (args->timeout_ns >= 0) {
-
 
2344
		timeout_stack = ns_to_timespec(args->timeout_ns);
-
 
2345
		timeout = &timeout_stack;
Line -... Line 2346...
-
 
2346
	}
-
 
2347
 
-
 
2348
	ret = i915_mutex_lock_interruptible(dev);
Line -... Line 2349...
-
 
2349
	if (ret)
-
 
2350
		return ret;
-
 
2351
 
-
 
2352
    if(args->bo_handle == -2)
-
 
2353
    {
-
 
2354
        obj = get_fb_obj();
-
 
2355
        drm_gem_object_reference(&obj->base);
-
 
2356
    }
-
 
2357
    else
-
 
2358
	obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->bo_handle));
-
 
2359
	if (&obj->base == NULL) {
Line -... Line 2360...
-
 
2360
		mutex_unlock(&dev->struct_mutex);
-
 
2361
		return -ENOENT;
-
 
2362
	}
-
 
2363
 
Line -... Line 2364...
-
 
2364
	/* Need to make sure the object gets inactive eventually. */
-
 
2365
	ret = i915_gem_object_flush_active(obj);
-
 
2366
	if (ret)
-
 
2367
		goto out;
Line -... Line 2368...
-
 
2368
 
-
 
2369
	if (obj->active) {
Line -... Line 2370...
-
 
2370
		seqno = obj->last_read_seqno;
-
 
2371
		ring = obj->ring;
-
 
2372
	}
-
 
2373
 
-
 
2374
	if (seqno == 0)
-
 
2375
		 goto out;
-
 
2376
 
Line -... Line 2377...
-
 
2377
	/* Do this after OLR check to make sure we make forward progress polling
-
 
2378
	 * on this IOCTL with a 0 timeout (like busy ioctl)
-
 
2379
	 */
Line -... Line 2380...
-
 
2380
	if (!args->timeout_ns) {
-
 
2381
		ret = -ETIME;
-
 
2382
		goto out;
-
 
2383
	}
Line -... Line 2384...
-
 
2384
 
-
 
2385
	drm_gem_object_unreference(&obj->base);
-
 
2386
	reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
-
 
2387
	mutex_unlock(&dev->struct_mutex);
2333
 
2388
 
Line 2334... Line 2389...
2334
 
2389
	ret = __wait_seqno(ring, seqno, reset_counter, true, timeout);
2335
 
2390
	if (timeout)
2336
 
2391
		args->timeout_ns = timespec_to_ns(timeout);
2337
 
2392
	return ret;
Line 3611... Line 3666...
3611
	int ret;
3666
	int ret;
Line 3612... Line 3667...
3612
 
3667
 
3613
	if (WARN_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT))
3668
	if (WARN_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT))
Line -... Line 3669...
-
 
3669
		return -EBUSY;
-
 
3670
 
-
 
3671
//    if( obj == get_fb_obj())
3614
		return -EBUSY;
3672
//        return 0;
Line 3615... Line 3673...
3615
 
3673
 
Line 3616... Line 3674...
3616
	WARN_ON(map_and_fenceable && !i915_is_ggtt(vm));
3674
	WARN_ON(map_and_fenceable && !i915_is_ggtt(vm));
Line 3718... Line 3776...
3718
unlock:
3776
unlock:
3719
	mutex_unlock(&dev->struct_mutex);
3777
	mutex_unlock(&dev->struct_mutex);
3720
	return ret;
3778
	return ret;
3721
}
3779
}
Line 3722... Line -...
3722
 
-
 
3723
#if 0
-
 
3724
 
3780
 
3725
int
3781
int
3726
i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
3782
i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
3727
		     struct drm_file *file)
3783
		     struct drm_file *file)
3728
{
3784
{
Line 3732... Line 3788...
3732
 
3788
 
3733
	ret = i915_mutex_lock_interruptible(dev);
3789
	ret = i915_mutex_lock_interruptible(dev);
3734
	if (ret)
3790
	if (ret)
Line -... Line 3791...
-
 
3791
		return ret;
-
 
3792
 
-
 
3793
    if(args->handle == -2)
-
 
3794
    {
-
 
3795
        obj = get_fb_obj();
-
 
3796
        drm_gem_object_reference(&obj->base);
3735
		return ret;
3797
    }
3736
 
3798
    else
3737
	obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
3799
	obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
3738
	if (&obj->base == NULL) {
3800
	if (&obj->base == NULL) {
3739
		ret = -ENOENT;
3801
		ret = -ENOENT;
Line 3757... Line 3819...
3757
unlock:
3819
unlock:
3758
	mutex_unlock(&dev->struct_mutex);
3820
	mutex_unlock(&dev->struct_mutex);
3759
	return ret;
3821
	return ret;
3760
}
3822
}
Line 3761... Line -...
3761
 
-
 
3762
#endif
-
 
3763
 
3823
 
3764
int
3824
int
3765
i915_gem_busy_ioctl(struct drm_device *dev, void *data,
3825
i915_gem_busy_ioctl(struct drm_device *dev, void *data,
3766
		    struct drm_file *file)
3826
		    struct drm_file *file)
3767
{
3827
{
Line 3892... Line 3952...
3892
	struct address_space *mapping;
3952
	struct address_space *mapping;
3893
	gfp_t mask;
3953
	gfp_t mask;
Line 3894... Line 3954...
3894
 
3954
 
3895
	obj = i915_gem_object_alloc(dev);
3955
	obj = i915_gem_object_alloc(dev);
3896
	if (obj == NULL)
-
 
3897
    {
-
 
3898
        FAIL();
3956
	if (obj == NULL)
3899
		return NULL;
-
 
Line 3900... Line 3957...
3900
    };
3957
		return NULL;
3901
 
3958
 
3902
	if (drm_gem_object_init(dev, &obj->base, size) != 0) {
3959
	if (drm_gem_object_init(dev, &obj->base, size) != 0) {
3903
		i915_gem_object_free(obj);
3960
		i915_gem_object_free(obj);
Line 4213... Line 4270...
4213
	}
4270
	}
Line 4214... Line 4271...
4214
 
4271
 
4215
	return 0;
4272
	return 0;
Line 4216... Line -...
4216
}
-
 
4217
 
-
 
4218
#define LFB_SIZE 0xC00000
4273
}
4219
 
4274
 
4220
int i915_gem_init(struct drm_device *dev)
4275
int i915_gem_init(struct drm_device *dev)
4221
{
4276
{