Commit c060a4e1 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/vmwgfx: get rid of different types of fence_flags entirely

Only one type was ever used. This is needed to simplify the fence
support in the next commit.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
parent 954605ca
...@@ -826,15 +826,12 @@ static int vmw_sync_obj_flush(void *sync_obj) ...@@ -826,15 +826,12 @@ static int vmw_sync_obj_flush(void *sync_obj)
static bool vmw_sync_obj_signaled(void *sync_obj) static bool vmw_sync_obj_signaled(void *sync_obj)
{ {
return vmw_fence_obj_signaled((struct vmw_fence_obj *) sync_obj, return vmw_fence_obj_signaled((struct vmw_fence_obj *) sync_obj);
DRM_VMW_FENCE_FLAG_EXEC);
} }
static int vmw_sync_obj_wait(void *sync_obj, bool lazy, bool interruptible) static int vmw_sync_obj_wait(void *sync_obj, bool lazy, bool interruptible)
{ {
return vmw_fence_obj_wait((struct vmw_fence_obj *) sync_obj, return vmw_fence_obj_wait((struct vmw_fence_obj *) sync_obj,
DRM_VMW_FENCE_FLAG_EXEC,
lazy, interruptible, lazy, interruptible,
VMW_FENCE_WAIT_TIMEOUT); VMW_FENCE_WAIT_TIMEOUT);
} }
......
...@@ -342,7 +342,6 @@ struct vmw_sw_context{ ...@@ -342,7 +342,6 @@ struct vmw_sw_context{
uint32_t *cmd_bounce; uint32_t *cmd_bounce;
uint32_t cmd_bounce_size; uint32_t cmd_bounce_size;
struct list_head resource_list; struct list_head resource_list;
uint32_t fence_flags;
struct ttm_buffer_object *cur_query_bo; struct ttm_buffer_object *cur_query_bo;
struct list_head res_relocations; struct list_head res_relocations;
uint32_t *buf_start; uint32_t *buf_start;
......
...@@ -350,8 +350,6 @@ static int vmw_bo_to_validate_list(struct vmw_sw_context *sw_context, ...@@ -350,8 +350,6 @@ static int vmw_bo_to_validate_list(struct vmw_sw_context *sw_context,
vval_buf->validate_as_mob = validate_as_mob; vval_buf->validate_as_mob = validate_as_mob;
} }
sw_context->fence_flags |= DRM_VMW_FENCE_FLAG_EXEC;
if (p_val_node) if (p_val_node)
*p_val_node = val_node; *p_val_node = val_node;
...@@ -2337,13 +2335,9 @@ int vmw_execbuf_fence_commands(struct drm_file *file_priv, ...@@ -2337,13 +2335,9 @@ int vmw_execbuf_fence_commands(struct drm_file *file_priv,
if (p_handle != NULL) if (p_handle != NULL)
ret = vmw_user_fence_create(file_priv, dev_priv->fman, ret = vmw_user_fence_create(file_priv, dev_priv->fman,
sequence, sequence, p_fence, p_handle);
DRM_VMW_FENCE_FLAG_EXEC,
p_fence, p_handle);
else else
ret = vmw_fence_create(dev_priv->fman, sequence, ret = vmw_fence_create(dev_priv->fman, sequence, p_fence);
DRM_VMW_FENCE_FLAG_EXEC,
p_fence);
if (unlikely(ret != 0 && !synced)) { if (unlikely(ret != 0 && !synced)) {
(void) vmw_fallback_wait(dev_priv, false, false, (void) vmw_fallback_wait(dev_priv, false, false,
...@@ -2416,8 +2410,7 @@ vmw_execbuf_copy_fence_user(struct vmw_private *dev_priv, ...@@ -2416,8 +2410,7 @@ vmw_execbuf_copy_fence_user(struct vmw_private *dev_priv,
ttm_ref_object_base_unref(vmw_fp->tfile, ttm_ref_object_base_unref(vmw_fp->tfile,
fence_handle, TTM_REF_USAGE); fence_handle, TTM_REF_USAGE);
DRM_ERROR("Fence copy error. Syncing.\n"); DRM_ERROR("Fence copy error. Syncing.\n");
(void) vmw_fence_obj_wait(fence, fence->signal_mask, (void) vmw_fence_obj_wait(fence, false, false,
false, false,
VMW_FENCE_WAIT_TIMEOUT); VMW_FENCE_WAIT_TIMEOUT);
} }
} }
...@@ -2469,7 +2462,6 @@ int vmw_execbuf_process(struct drm_file *file_priv, ...@@ -2469,7 +2462,6 @@ int vmw_execbuf_process(struct drm_file *file_priv,
sw_context->fp = vmw_fpriv(file_priv); sw_context->fp = vmw_fpriv(file_priv);
sw_context->cur_reloc = 0; sw_context->cur_reloc = 0;
sw_context->cur_val_buf = 0; sw_context->cur_val_buf = 0;
sw_context->fence_flags = 0;
INIT_LIST_HEAD(&sw_context->resource_list); INIT_LIST_HEAD(&sw_context->resource_list);
sw_context->cur_query_bo = dev_priv->pinned_bo; sw_context->cur_query_bo = dev_priv->pinned_bo;
sw_context->last_query_ctx = NULL; sw_context->last_query_ctx = NULL;
......
...@@ -207,9 +207,7 @@ void vmw_fence_manager_takedown(struct vmw_fence_manager *fman) ...@@ -207,9 +207,7 @@ void vmw_fence_manager_takedown(struct vmw_fence_manager *fman)
} }
static int vmw_fence_obj_init(struct vmw_fence_manager *fman, static int vmw_fence_obj_init(struct vmw_fence_manager *fman,
struct vmw_fence_obj *fence, struct vmw_fence_obj *fence, u32 seqno,
u32 seqno,
uint32_t mask,
void (*destroy) (struct vmw_fence_obj *fence)) void (*destroy) (struct vmw_fence_obj *fence))
{ {
unsigned long irq_flags; unsigned long irq_flags;
...@@ -220,7 +218,6 @@ static int vmw_fence_obj_init(struct vmw_fence_manager *fman, ...@@ -220,7 +218,6 @@ static int vmw_fence_obj_init(struct vmw_fence_manager *fman,
INIT_LIST_HEAD(&fence->seq_passed_actions); INIT_LIST_HEAD(&fence->seq_passed_actions);
fence->fman = fman; fence->fman = fman;
fence->signaled = 0; fence->signaled = 0;
fence->signal_mask = mask;
kref_init(&fence->kref); kref_init(&fence->kref);
fence->destroy = destroy; fence->destroy = destroy;
init_waitqueue_head(&fence->queue); init_waitqueue_head(&fence->queue);
...@@ -356,7 +353,7 @@ static bool vmw_fence_goal_check_locked(struct vmw_fence_obj *fence) ...@@ -356,7 +353,7 @@ static bool vmw_fence_goal_check_locked(struct vmw_fence_obj *fence)
u32 goal_seqno; u32 goal_seqno;
__le32 __iomem *fifo_mem; __le32 __iomem *fifo_mem;
if (fence->signaled & DRM_VMW_FENCE_FLAG_EXEC) if (fence->signaled)
return false; return false;
fifo_mem = fence->fman->dev_priv->mmio_virt; fifo_mem = fence->fman->dev_priv->mmio_virt;
...@@ -386,7 +383,7 @@ void vmw_fences_update(struct vmw_fence_manager *fman) ...@@ -386,7 +383,7 @@ void vmw_fences_update(struct vmw_fence_manager *fman)
list_for_each_entry_safe(fence, next_fence, &fman->fence_list, head) { list_for_each_entry_safe(fence, next_fence, &fman->fence_list, head) {
if (seqno - fence->seqno < VMW_FENCE_WRAP) { if (seqno - fence->seqno < VMW_FENCE_WRAP) {
list_del_init(&fence->head); list_del_init(&fence->head);
fence->signaled |= DRM_VMW_FENCE_FLAG_EXEC; fence->signaled = 1;
INIT_LIST_HEAD(&action_list); INIT_LIST_HEAD(&action_list);
list_splice_init(&fence->seq_passed_actions, list_splice_init(&fence->seq_passed_actions,
&action_list); &action_list);
...@@ -417,8 +414,7 @@ void vmw_fences_update(struct vmw_fence_manager *fman) ...@@ -417,8 +414,7 @@ void vmw_fences_update(struct vmw_fence_manager *fman)
} }
} }
bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence, bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence)
uint32_t flags)
{ {
struct vmw_fence_manager *fman = fence->fman; struct vmw_fence_manager *fman = fence->fman;
unsigned long irq_flags; unsigned long irq_flags;
...@@ -428,28 +424,25 @@ bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence, ...@@ -428,28 +424,25 @@ bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence,
signaled = fence->signaled; signaled = fence->signaled;
spin_unlock_irqrestore(&fman->lock, irq_flags); spin_unlock_irqrestore(&fman->lock, irq_flags);
flags &= fence->signal_mask; if (signaled)
if ((signaled & flags) == flags)
return 1; return 1;
if ((signaled & DRM_VMW_FENCE_FLAG_EXEC) == 0) vmw_fences_update(fman);
vmw_fences_update(fman);
spin_lock_irqsave(&fman->lock, irq_flags); spin_lock_irqsave(&fman->lock, irq_flags);
signaled = fence->signaled; signaled = fence->signaled;
spin_unlock_irqrestore(&fman->lock, irq_flags); spin_unlock_irqrestore(&fman->lock, irq_flags);
return ((signaled & flags) == flags); return signaled;
} }
int vmw_fence_obj_wait(struct vmw_fence_obj *fence, int vmw_fence_obj_wait(struct vmw_fence_obj *fence, bool lazy,
uint32_t flags, bool lazy,
bool interruptible, unsigned long timeout) bool interruptible, unsigned long timeout)
{ {
struct vmw_private *dev_priv = fence->fman->dev_priv; struct vmw_private *dev_priv = fence->fman->dev_priv;
long ret; long ret;
if (likely(vmw_fence_obj_signaled(fence, flags))) if (likely(vmw_fence_obj_signaled(fence)))
return 0; return 0;
vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC); vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
...@@ -458,12 +451,12 @@ int vmw_fence_obj_wait(struct vmw_fence_obj *fence, ...@@ -458,12 +451,12 @@ int vmw_fence_obj_wait(struct vmw_fence_obj *fence,
if (interruptible) if (interruptible)
ret = wait_event_interruptible_timeout ret = wait_event_interruptible_timeout
(fence->queue, (fence->queue,
vmw_fence_obj_signaled(fence, flags), vmw_fence_obj_signaled(fence),
timeout); timeout);
else else
ret = wait_event_timeout ret = wait_event_timeout
(fence->queue, (fence->queue,
vmw_fence_obj_signaled(fence, flags), vmw_fence_obj_signaled(fence),
timeout); timeout);
vmw_seqno_waiter_remove(dev_priv); vmw_seqno_waiter_remove(dev_priv);
...@@ -497,7 +490,6 @@ static void vmw_fence_destroy(struct vmw_fence_obj *fence) ...@@ -497,7 +490,6 @@ static void vmw_fence_destroy(struct vmw_fence_obj *fence)
int vmw_fence_create(struct vmw_fence_manager *fman, int vmw_fence_create(struct vmw_fence_manager *fman,
uint32_t seqno, uint32_t seqno,
uint32_t mask,
struct vmw_fence_obj **p_fence) struct vmw_fence_obj **p_fence)
{ {
struct ttm_mem_global *mem_glob = vmw_mem_glob(fman->dev_priv); struct ttm_mem_global *mem_glob = vmw_mem_glob(fman->dev_priv);
...@@ -515,7 +507,7 @@ int vmw_fence_create(struct vmw_fence_manager *fman, ...@@ -515,7 +507,7 @@ int vmw_fence_create(struct vmw_fence_manager *fman,
goto out_no_object; goto out_no_object;
} }
ret = vmw_fence_obj_init(fman, fence, seqno, mask, ret = vmw_fence_obj_init(fman, fence, seqno,
vmw_fence_destroy); vmw_fence_destroy);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out_err_init; goto out_err_init;
...@@ -559,7 +551,6 @@ static void vmw_user_fence_base_release(struct ttm_base_object **p_base) ...@@ -559,7 +551,6 @@ static void vmw_user_fence_base_release(struct ttm_base_object **p_base)
int vmw_user_fence_create(struct drm_file *file_priv, int vmw_user_fence_create(struct drm_file *file_priv,
struct vmw_fence_manager *fman, struct vmw_fence_manager *fman,
uint32_t seqno, uint32_t seqno,
uint32_t mask,
struct vmw_fence_obj **p_fence, struct vmw_fence_obj **p_fence,
uint32_t *p_handle) uint32_t *p_handle)
{ {
...@@ -586,7 +577,7 @@ int vmw_user_fence_create(struct drm_file *file_priv, ...@@ -586,7 +577,7 @@ int vmw_user_fence_create(struct drm_file *file_priv,
} }
ret = vmw_fence_obj_init(fman, &ufence->fence, seqno, ret = vmw_fence_obj_init(fman, &ufence->fence, seqno,
mask, vmw_user_fence_destroy); vmw_user_fence_destroy);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
kfree(ufence); kfree(ufence);
goto out_no_object; goto out_no_object;
...@@ -647,13 +638,12 @@ void vmw_fence_fifo_down(struct vmw_fence_manager *fman) ...@@ -647,13 +638,12 @@ void vmw_fence_fifo_down(struct vmw_fence_manager *fman)
kref_get(&fence->kref); kref_get(&fence->kref);
spin_unlock_irq(&fman->lock); spin_unlock_irq(&fman->lock);
ret = vmw_fence_obj_wait(fence, fence->signal_mask, ret = vmw_fence_obj_wait(fence, false, false,
false, false,
VMW_FENCE_WAIT_TIMEOUT); VMW_FENCE_WAIT_TIMEOUT);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
list_del_init(&fence->head); list_del_init(&fence->head);
fence->signaled |= DRM_VMW_FENCE_FLAG_EXEC; fence->signaled = 1;
INIT_LIST_HEAD(&action_list); INIT_LIST_HEAD(&action_list);
list_splice_init(&fence->seq_passed_actions, list_splice_init(&fence->seq_passed_actions,
&action_list); &action_list);
...@@ -716,14 +706,14 @@ int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data, ...@@ -716,14 +706,14 @@ int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
timeout = jiffies; timeout = jiffies;
if (time_after_eq(timeout, (unsigned long)arg->kernel_cookie)) { if (time_after_eq(timeout, (unsigned long)arg->kernel_cookie)) {
ret = ((vmw_fence_obj_signaled(fence, arg->flags)) ? ret = ((vmw_fence_obj_signaled(fence)) ?
0 : -EBUSY); 0 : -EBUSY);
goto out; goto out;
} }
timeout = (unsigned long)arg->kernel_cookie - timeout; timeout = (unsigned long)arg->kernel_cookie - timeout;
ret = vmw_fence_obj_wait(fence, arg->flags, arg->lazy, true, timeout); ret = vmw_fence_obj_wait(fence, arg->lazy, true, timeout);
out: out:
ttm_base_object_unref(&base); ttm_base_object_unref(&base);
...@@ -760,10 +750,10 @@ int vmw_fence_obj_signaled_ioctl(struct drm_device *dev, void *data, ...@@ -760,10 +750,10 @@ int vmw_fence_obj_signaled_ioctl(struct drm_device *dev, void *data,
fence = &(container_of(base, struct vmw_user_fence, base)->fence); fence = &(container_of(base, struct vmw_user_fence, base)->fence);
fman = fence->fman; fman = fence->fman;
arg->signaled = vmw_fence_obj_signaled(fence, arg->flags); arg->signaled = vmw_fence_obj_signaled(fence);
spin_lock_irq(&fman->lock); spin_lock_irq(&fman->lock);
arg->signaled_flags = fence->signaled; arg->signaled_flags = arg->flags;
arg->passed_seqno = dev_priv->last_read_seqno; arg->passed_seqno = dev_priv->last_read_seqno;
spin_unlock_irq(&fman->lock); spin_unlock_irq(&fman->lock);
...@@ -908,7 +898,7 @@ static void vmw_fence_obj_add_action(struct vmw_fence_obj *fence, ...@@ -908,7 +898,7 @@ static void vmw_fence_obj_add_action(struct vmw_fence_obj *fence,
spin_lock_irqsave(&fman->lock, irq_flags); spin_lock_irqsave(&fman->lock, irq_flags);
fman->pending_actions[action->type]++; fman->pending_actions[action->type]++;
if (fence->signaled & DRM_VMW_FENCE_FLAG_EXEC) { if (fence->signaled) {
struct list_head action_list; struct list_head action_list;
INIT_LIST_HEAD(&action_list); INIT_LIST_HEAD(&action_list);
......
...@@ -56,7 +56,6 @@ struct vmw_fence_obj { ...@@ -56,7 +56,6 @@ struct vmw_fence_obj {
struct vmw_fence_manager *fman; struct vmw_fence_manager *fman;
struct list_head head; struct list_head head;
uint32_t signaled; uint32_t signaled;
uint32_t signal_mask;
struct list_head seq_passed_actions; struct list_head seq_passed_actions;
void (*destroy)(struct vmw_fence_obj *fence); void (*destroy)(struct vmw_fence_obj *fence);
wait_queue_head_t queue; wait_queue_head_t queue;
...@@ -74,10 +73,9 @@ vmw_fence_obj_reference(struct vmw_fence_obj *fence); ...@@ -74,10 +73,9 @@ vmw_fence_obj_reference(struct vmw_fence_obj *fence);
extern void vmw_fences_update(struct vmw_fence_manager *fman); extern void vmw_fences_update(struct vmw_fence_manager *fman);
extern bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence, extern bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence);
uint32_t flags);
extern int vmw_fence_obj_wait(struct vmw_fence_obj *fence, uint32_t flags, extern int vmw_fence_obj_wait(struct vmw_fence_obj *fence,
bool lazy, bool lazy,
bool interruptible, unsigned long timeout); bool interruptible, unsigned long timeout);
...@@ -85,13 +83,11 @@ extern void vmw_fence_obj_flush(struct vmw_fence_obj *fence); ...@@ -85,13 +83,11 @@ extern void vmw_fence_obj_flush(struct vmw_fence_obj *fence);
extern int vmw_fence_create(struct vmw_fence_manager *fman, extern int vmw_fence_create(struct vmw_fence_manager *fman,
uint32_t seqno, uint32_t seqno,
uint32_t mask,
struct vmw_fence_obj **p_fence); struct vmw_fence_obj **p_fence);
extern int vmw_user_fence_create(struct drm_file *file_priv, extern int vmw_user_fence_create(struct drm_file *file_priv,
struct vmw_fence_manager *fman, struct vmw_fence_manager *fman,
uint32_t sequence, uint32_t sequence,
uint32_t mask,
struct vmw_fence_obj **p_fence, struct vmw_fence_obj **p_fence,
uint32_t *p_handle); uint32_t *p_handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment