You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
drm/vmwgfx: rework to new fence interface, v2
Use the new fence interface on vmwgfx too. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> --- Changes since v1: Fix a sleeping function called from invalid context in enable_signaling.
This commit is contained in:
@@ -703,6 +703,7 @@ extern void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes);
|
||||
extern void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes);
|
||||
extern int vmw_fifo_send_fence(struct vmw_private *dev_priv,
|
||||
uint32_t *seqno);
|
||||
extern void vmw_fifo_ping_host_locked(struct vmw_private *, uint32_t reason);
|
||||
extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason);
|
||||
extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv);
|
||||
extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv);
|
||||
|
||||
@@ -2389,7 +2389,7 @@ vmw_execbuf_copy_fence_user(struct vmw_private *dev_priv,
|
||||
BUG_ON(fence == NULL);
|
||||
|
||||
fence_rep.handle = fence_handle;
|
||||
fence_rep.seqno = fence->seqno;
|
||||
fence_rep.seqno = fence->base.seqno;
|
||||
vmw_update_seqno(dev_priv, &dev_priv->fifo);
|
||||
fence_rep.passed_seqno = dev_priv->last_read_seqno;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,8 @@
|
||||
|
||||
#ifndef _VMWGFX_FENCE_H_
|
||||
|
||||
#include <linux/fence.h>
|
||||
|
||||
#define VMW_FENCE_WAIT_TIMEOUT (5*HZ)
|
||||
|
||||
struct vmw_private;
|
||||
@@ -50,15 +52,11 @@ struct vmw_fence_action {
|
||||
};
|
||||
|
||||
struct vmw_fence_obj {
|
||||
struct kref kref;
|
||||
u32 seqno;
|
||||
struct fence base;
|
||||
|
||||
struct vmw_fence_manager *fman;
|
||||
struct list_head head;
|
||||
uint32_t signaled;
|
||||
struct list_head seq_passed_actions;
|
||||
void (*destroy)(struct vmw_fence_obj *fence);
|
||||
wait_queue_head_t queue;
|
||||
};
|
||||
|
||||
extern struct vmw_fence_manager *
|
||||
@@ -66,10 +64,23 @@ vmw_fence_manager_init(struct vmw_private *dev_priv);
|
||||
|
||||
extern void vmw_fence_manager_takedown(struct vmw_fence_manager *fman);
|
||||
|
||||
extern void vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p);
|
||||
static inline void
|
||||
vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p)
|
||||
{
|
||||
struct vmw_fence_obj *fence = *fence_p;
|
||||
|
||||
extern struct vmw_fence_obj *
|
||||
vmw_fence_obj_reference(struct vmw_fence_obj *fence);
|
||||
*fence_p = NULL;
|
||||
if (fence)
|
||||
fence_put(&fence->base);
|
||||
}
|
||||
|
||||
static inline struct vmw_fence_obj *
|
||||
vmw_fence_obj_reference(struct vmw_fence_obj *fence)
|
||||
{
|
||||
if (fence)
|
||||
fence_get(&fence->base);
|
||||
return fence;
|
||||
}
|
||||
|
||||
extern void vmw_fences_update(struct vmw_fence_manager *fman);
|
||||
|
||||
|
||||
@@ -160,16 +160,21 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
|
||||
return vmw_fifo_send_fence(dev_priv, &dummy);
|
||||
}
|
||||
|
||||
void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason)
|
||||
void vmw_fifo_ping_host_locked(struct vmw_private *dev_priv, uint32_t reason)
|
||||
{
|
||||
__le32 __iomem *fifo_mem = dev_priv->mmio_virt;
|
||||
|
||||
mutex_lock(&dev_priv->hw_mutex);
|
||||
|
||||
if (unlikely(ioread32(fifo_mem + SVGA_FIFO_BUSY) == 0)) {
|
||||
iowrite32(1, fifo_mem + SVGA_FIFO_BUSY);
|
||||
vmw_write(dev_priv, SVGA_REG_SYNC, reason);
|
||||
}
|
||||
}
|
||||
|
||||
void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason)
|
||||
{
|
||||
mutex_lock(&dev_priv->hw_mutex);
|
||||
|
||||
vmw_fifo_ping_host_locked(dev_priv, reason);
|
||||
|
||||
mutex_unlock(&dev_priv->hw_mutex);
|
||||
}
|
||||
|
||||
@@ -1420,21 +1420,20 @@ void vmw_fence_single_bo(struct ttm_buffer_object *bo,
|
||||
struct vmw_fence_obj *fence)
|
||||
{
|
||||
struct ttm_bo_device *bdev = bo->bdev;
|
||||
struct ttm_bo_driver *driver = bdev->driver;
|
||||
struct vmw_fence_obj *old_fence_obj;
|
||||
struct vmw_private *dev_priv =
|
||||
container_of(bdev, struct vmw_private, bdev);
|
||||
|
||||
if (fence == NULL)
|
||||
if (fence == NULL) {
|
||||
vmw_execbuf_fence_commands(NULL, dev_priv, &fence, NULL);
|
||||
else
|
||||
driver->sync_obj_ref(fence);
|
||||
} else
|
||||
vmw_fence_obj_reference(fence);
|
||||
|
||||
reservation_object_add_excl_fence(bo->resv, &fence->base);
|
||||
|
||||
old_fence_obj = bo->sync_obj;
|
||||
bo->sync_obj = fence;
|
||||
|
||||
|
||||
if (old_fence_obj)
|
||||
vmw_fence_obj_unreference(&old_fence_obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user