diff options
-rw-r--r-- | linux-core/drm_bo.c | 19 | ||||
-rw-r--r-- | linux-core/drm_fence.c | 53 | ||||
-rw-r--r-- | linux-core/drm_objects.h | 18 | ||||
-rw-r--r-- | linux-core/i915_fence.c | 2 | ||||
-rw-r--r-- | linux-core/via_fence.c | 4 | ||||
-rw-r--r-- | linux-core/xgi_fence.c | 2 |
6 files changed, 48 insertions, 50 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 717e5dab..a2f66dc6 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -538,7 +538,7 @@ EXPORT_SYMBOL(drm_bo_usage_deref_unlocked); int drm_fence_buffer_objects(struct drm_file * file_priv, struct list_head *list, - uint32_t fence_flags, + uint32_t fence_class, uint32_t fence_flags, struct drm_fence_object * fence, struct drm_fence_object ** used_fence) { @@ -560,13 +560,8 @@ int drm_fence_buffer_objects(struct drm_file * file_priv, list_for_each_entry(entry, list, lru) { BUG_ON(!(entry->priv_flags & _DRM_BO_FLAG_UNFENCED)); fence_type |= entry->fence_type; - if (entry->fence_class != 0) { - DRM_ERROR("Fence class %d is not implemented yet.\n", - entry->fence_class); - ret = -EINVAL; - goto out; - } - count++; + if (entry->fence_class == fence_class) + count++; } if (!count) { @@ -583,7 +578,8 @@ int drm_fence_buffer_objects(struct drm_file * file_priv, list_splice_init(list, &f_list); if (fence) { - if ((fence_type & fence->type) != fence_type) { + if ((fence_type & fence->type) != fence_type || + (fence->fence_class != fence_class)) { DRM_ERROR("Given fence doesn't match buffers " "on unfenced list.\n"); ret = -EINVAL; @@ -591,7 +587,7 @@ int drm_fence_buffer_objects(struct drm_file * file_priv, } } else { mutex_unlock(&dev->struct_mutex); - ret = drm_fence_object_create(dev, 0, fence_type, + ret = drm_fence_object_create(dev, fence_class, fence_type, fence_flags | DRM_FENCE_FLAG_EMIT, &fence); mutex_lock(&dev->struct_mutex); @@ -609,7 +605,8 @@ int drm_fence_buffer_objects(struct drm_file * file_priv, mutex_lock(&entry->mutex); mutex_lock(&dev->struct_mutex); list_del_init(l); - if (entry->priv_flags & _DRM_BO_FLAG_UNFENCED) { + if (entry->priv_flags & _DRM_BO_FLAG_UNFENCED && + entry->fence_class == fence_class) { count++; if (entry->fence) drm_fence_usage_deref_locked(&entry->fence); diff --git a/linux-core/drm_fence.c b/linux-core/drm_fence.c index 2f16f7ef..a6787b09 100644 --- a/linux-core/drm_fence.c +++ b/linux-core/drm_fence.c @@ -34,14 +34,14 @@ * Typically called by the IRQ handler. */ -void drm_fence_handler(struct drm_device * dev, uint32_t class, +void drm_fence_handler(struct drm_device * dev, uint32_t fence_class, uint32_t sequence, uint32_t type) { int wake = 0; uint32_t diff; uint32_t relevant; struct drm_fence_manager *fm = &dev->fm; - struct drm_fence_class_manager *fc = &fm->class[class]; + struct drm_fence_class_manager *fc = &fm->fence_class[fence_class]; struct drm_fence_driver *driver = dev->driver->fence_driver; struct list_head *head; struct drm_fence_object *fence, *next; @@ -198,7 +198,7 @@ int drm_fence_object_signaled(struct drm_fence_object * fence, struct drm_fence_driver *driver = dev->driver->fence_driver; if (poke_flush) - driver->poke_flush(dev, fence->class); + driver->poke_flush(dev, fence->fence_class); read_lock_irqsave(&fm->lock, flags); signaled = (fence->type & mask & fence->signaled) == (fence->type & mask); @@ -229,7 +229,7 @@ int drm_fence_object_flush(struct drm_fence_object * fence, { struct drm_device *dev = fence->dev; struct drm_fence_manager *fm = &dev->fm; - struct drm_fence_class_manager *fc = &fm->class[fence->class]; + struct drm_fence_class_manager *fc = &fm->fence_class[fence->fence_class]; struct drm_fence_driver *driver = dev->driver->fence_driver; unsigned long flags; @@ -253,7 +253,7 @@ int drm_fence_object_flush(struct drm_fence_object * fence, } } write_unlock_irqrestore(&fm->lock, flags); - driver->poke_flush(dev, fence->class); + driver->poke_flush(dev, fence->fence_class); return 0; } @@ -262,10 +262,10 @@ int drm_fence_object_flush(struct drm_fence_object * fence, * wrapped around and reused. */ -void drm_fence_flush_old(struct drm_device * dev, uint32_t class, uint32_t sequence) +void drm_fence_flush_old(struct drm_device * dev, uint32_t fence_class, uint32_t sequence) { struct drm_fence_manager *fm = &dev->fm; - struct drm_fence_class_manager *fc = &fm->class[class]; + struct drm_fence_class_manager *fc = &fm->fence_class[fence_class]; struct drm_fence_driver *driver = dev->driver->fence_driver; uint32_t old_sequence; unsigned long flags; @@ -308,7 +308,7 @@ static int drm_fence_lazy_wait(struct drm_fence_object *fence, { struct drm_device *dev = fence->dev; struct drm_fence_manager *fm = &dev->fm; - struct drm_fence_class_manager *fc = &fm->class[fence->class]; + struct drm_fence_class_manager *fc = &fm->fence_class[fence->fence_class]; int signaled; unsigned long _end = jiffies + 3*DRM_HZ; int ret = 0; @@ -366,7 +366,7 @@ int drm_fence_object_wait(struct drm_fence_object * fence, } else { - if (driver->has_irq(dev, fence->class, + if (driver->has_irq(dev, fence->fence_class, DRM_FENCE_TYPE_EXE)) { ret = drm_fence_lazy_wait(fence, ignore_signals, DRM_FENCE_TYPE_EXE); @@ -374,7 +374,7 @@ int drm_fence_object_wait(struct drm_fence_object * fence, return ret; } - if (driver->has_irq(dev, fence->class, + if (driver->has_irq(dev, fence->fence_class, mask & ~DRM_FENCE_TYPE_EXE)) { ret = drm_fence_lazy_wait(fence, ignore_signals, mask); @@ -409,7 +409,7 @@ int drm_fence_object_emit(struct drm_fence_object * fence, struct drm_device *dev = fence->dev; struct drm_fence_manager *fm = &dev->fm; struct drm_fence_driver *driver = dev->driver->fence_driver; - struct drm_fence_class_manager *fc = &fm->class[fence->class]; + struct drm_fence_class_manager *fc = &fm->fence_class[fence->fence_class]; unsigned long flags; uint32_t sequence; uint32_t native_type; @@ -421,7 +421,7 @@ int drm_fence_object_emit(struct drm_fence_object * fence, return ret; write_lock_irqsave(&fm->lock, flags); - fence->class = class; + fence->fence_class = class; fence->type = type; fence->flush_mask = 0x00; fence->submitted_flush = 0x00; @@ -456,7 +456,7 @@ static int drm_fence_object_init(struct drm_device * dev, uint32_t class, */ INIT_LIST_HEAD(&fence->base.list); - fence->class = class; + fence->fence_class = class; fence->type = type; fence->flush_mask = 0; fence->submitted_flush = 0; @@ -466,7 +466,7 @@ static int drm_fence_object_init(struct drm_device * dev, uint32_t class, write_unlock_irqrestore(&fm->lock, flags); if (fence_flags & DRM_FENCE_FLAG_EMIT) { ret = drm_fence_object_emit(fence, fence_flags, - fence->class, type); + fence->fence_class, type); } return ret; } @@ -533,7 +533,7 @@ void drm_fence_manager_init(struct drm_device * dev) BUG_ON(fm->num_classes > _DRM_FENCE_CLASSES); for (i=0; i<fm->num_classes; ++i) { - class = &fm->class[i]; + class = &fm->fence_class[i]; INIT_LIST_HEAD(&class->ring); class->pending_flush = 0; @@ -582,7 +582,7 @@ int drm_fence_create_ioctl(struct drm_device *dev, void *data, struct drm_file * if (arg->flags & DRM_FENCE_FLAG_EMIT) LOCK_TEST_WITH_RETURN(dev, file_priv); - ret = drm_fence_object_create(dev, arg->class, + ret = drm_fence_object_create(dev, arg->fence_class, arg->type, arg->flags, &fence); if (ret) return ret; @@ -601,7 +601,7 @@ int drm_fence_create_ioctl(struct drm_device *dev, void *data, struct drm_file * arg->handle = fence->base.hash.key; read_lock_irqsave(&fm->lock, flags); - arg->class = fence->class; + arg->fence_class = fence->fence_class; arg->type = fence->type; arg->signaled = fence->signaled; read_unlock_irqrestore(&fm->lock, flags); @@ -656,7 +656,7 @@ int drm_fence_reference_ioctl(struct drm_device *dev, void *data, struct drm_fil fence = drm_lookup_fence_object(file_priv, arg->handle); read_lock_irqsave(&fm->lock, flags); - arg->class = fence->class; + arg->fence_class = fence->fence_class; arg->type = fence->type; arg->signaled = fence->signaled; read_unlock_irqrestore(&fm->lock, flags); @@ -700,7 +700,7 @@ int drm_fence_signaled_ioctl(struct drm_device *dev, void *data, struct drm_file return -EINVAL; read_lock_irqsave(&fm->lock, flags); - arg->class = fence->class; + arg->fence_class = fence->fence_class; arg->type = fence->type; arg->signaled = fence->signaled; read_unlock_irqrestore(&fm->lock, flags); @@ -729,7 +729,7 @@ int drm_fence_flush_ioctl(struct drm_device *dev, void *data, struct drm_file *f ret = drm_fence_object_flush(fence, arg->type); read_lock_irqsave(&fm->lock, flags); - arg->class = fence->class; + arg->fence_class = fence->fence_class; arg->type = fence->type; arg->signaled = fence->signaled; read_unlock_irqrestore(&fm->lock, flags); @@ -761,7 +761,7 @@ int drm_fence_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *fi 0, arg->type); read_lock_irqsave(&fm->lock, flags); - arg->class = fence->class; + arg->fence_class = fence->fence_class; arg->type = fence->type; arg->signaled = fence->signaled; read_unlock_irqrestore(&fm->lock, flags); @@ -789,11 +789,11 @@ int drm_fence_emit_ioctl(struct drm_device *dev, void *data, struct drm_file *fi fence = drm_lookup_fence_object(file_priv, arg->handle); if (!fence) return -EINVAL; - ret = drm_fence_object_emit(fence, arg->flags, arg->class, + ret = drm_fence_object_emit(fence, arg->flags, arg->fence_class, arg->type); read_lock_irqsave(&fm->lock, flags); - arg->class = fence->class; + arg->fence_class = fence->fence_class; arg->type = fence->type; arg->signaled = fence->signaled; read_unlock_irqrestore(&fm->lock, flags); @@ -821,8 +821,8 @@ int drm_fence_buffers_ioctl(struct drm_device *dev, void *data, struct drm_file return -EINVAL; } LOCK_TEST_WITH_RETURN(dev, file_priv); - ret = drm_fence_buffer_objects(file_priv, NULL, arg->flags, - NULL, &fence); + ret = drm_fence_buffer_objects(file_priv, NULL, arg->fence_class, + arg->flags, NULL, &fence); if (ret) return ret; ret = drm_fence_add_user_object(file_priv, fence, @@ -834,9 +834,10 @@ int drm_fence_buffers_ioctl(struct drm_device *dev, void *data, struct drm_file arg->handle = fence->base.hash.key; read_lock_irqsave(&fm->lock, flags); - arg->class = fence->class; + arg->fence_class = fence->fence_class; arg->type = fence->type; arg->signaled = fence->signaled; + arg->sequence = fence->sequence; read_unlock_irqrestore(&fm->lock, flags); drm_fence_usage_deref_unlocked(&fence); diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h index 096041d7..b2f1ae17 100644 --- a/linux-core/drm_objects.h +++ b/linux-core/drm_objects.h @@ -149,7 +149,7 @@ struct drm_fence_object { */ struct list_head ring; - int class; + int fence_class; uint32_t native_type; uint32_t type; uint32_t signaled; @@ -173,7 +173,7 @@ struct drm_fence_class_manager { struct drm_fence_manager { int initialized; rwlock_t lock; - struct drm_fence_class_manager class[_DRM_FENCE_CLASSES]; + struct drm_fence_class_manager fence_class[_DRM_FENCE_CLASSES]; uint32_t num_classes; atomic_t count; }; @@ -184,18 +184,18 @@ struct drm_fence_driver { uint32_t flush_diff; uint32_t sequence_mask; int lazy_capable; - int (*has_irq) (struct drm_device * dev, uint32_t class, + int (*has_irq) (struct drm_device * dev, uint32_t fence_class, uint32_t flags); - int (*emit) (struct drm_device * dev, uint32_t class, uint32_t flags, + int (*emit) (struct drm_device * dev, uint32_t fence_class, uint32_t flags, uint32_t * breadcrumb, uint32_t * native_type); - void (*poke_flush) (struct drm_device * dev, uint32_t class); + void (*poke_flush) (struct drm_device * dev, uint32_t fence_class); }; -extern void drm_fence_handler(struct drm_device *dev, uint32_t class, +extern void drm_fence_handler(struct drm_device *dev, uint32_t fence_class, uint32_t sequence, uint32_t type); extern void drm_fence_manager_init(struct drm_device *dev); extern void drm_fence_manager_takedown(struct drm_device *dev); -extern void drm_fence_flush_old(struct drm_device *dev, uint32_t class, +extern void drm_fence_flush_old(struct drm_device *dev, uint32_t fence_class, uint32_t sequence); extern int drm_fence_object_flush(struct drm_fence_object * fence, uint32_t type); extern int drm_fence_object_signaled(struct drm_fence_object * fence, @@ -208,7 +208,7 @@ extern void drm_fence_reference_unlocked(struct drm_fence_object **dst, extern int drm_fence_object_wait(struct drm_fence_object * fence, int lazy, int ignore_signals, uint32_t mask); extern int drm_fence_object_create(struct drm_device *dev, uint32_t type, - uint32_t fence_flags, uint32_t class, + uint32_t fence_flags, uint32_t fence_class, struct drm_fence_object ** c_fence); extern int drm_fence_add_user_object(struct drm_file * priv, struct drm_fence_object * fence, int shareable); @@ -474,7 +474,7 @@ extern int drm_mem_reg_is_pci(struct drm_device *dev, struct drm_bo_mem_reg * me extern void drm_bo_usage_deref_locked(struct drm_buffer_object ** bo); extern int drm_fence_buffer_objects(struct drm_file * priv, struct list_head *list, - uint32_t fence_flags, + uint32_t fence_class, uint32_t fence_flags, struct drm_fence_object * fence, struct drm_fence_object ** used_fence); extern void drm_bo_add_to_lru(struct drm_buffer_object * bo); diff --git a/linux-core/i915_fence.c b/linux-core/i915_fence.c index 6f0de2ca..89830333 100644 --- a/linux-core/i915_fence.c +++ b/linux-core/i915_fence.c @@ -42,7 +42,7 @@ static void i915_perform_flush(struct drm_device * dev) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; struct drm_fence_manager *fm = &dev->fm; - struct drm_fence_class_manager *fc = &fm->class[0]; + struct drm_fence_class_manager *fc = &fm->fence_class[0]; struct drm_fence_driver *driver = dev->driver->fence_driver; uint32_t flush_flags = 0; uint32_t flush_sequence = 0; diff --git a/linux-core/via_fence.c b/linux-core/via_fence.c index a6d4ece9..8d60afa6 100644 --- a/linux-core/via_fence.c +++ b/linux-core/via_fence.c @@ -42,7 +42,7 @@ static uint32_t via_perform_flush(struct drm_device *dev, uint32_t class) { drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; - struct drm_fence_class_manager *fc = &dev->fm.class[class]; + struct drm_fence_class_manager *fc = &dev->fm.fence_class[class]; uint32_t pending_flush_types = 0; uint32_t signaled_flush_types = 0; uint32_t status; @@ -204,7 +204,7 @@ void via_fence_timer(unsigned long data) drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; struct drm_fence_manager *fm = &dev->fm; uint32_t pending_flush; - struct drm_fence_class_manager *fc = &dev->fm.class[0]; + struct drm_fence_class_manager *fc = &dev->fm.fence_class[0]; if (!dev_priv) return; diff --git a/linux-core/xgi_fence.c b/linux-core/xgi_fence.c index adedf300..22e1dced 100644 --- a/linux-core/xgi_fence.c +++ b/linux-core/xgi_fence.c @@ -33,7 +33,7 @@ static uint32_t xgi_do_flush(struct drm_device * dev, uint32_t class) { struct xgi_info * info = dev->dev_private; - struct drm_fence_class_manager * fc = &dev->fm.class[class]; + struct drm_fence_class_manager * fc = &dev->fm.fence_class[class]; uint32_t pending_flush_types = 0; uint32_t signaled_flush_types = 0; |