File Index
Files and directories
Sign in
FILE

vmwgfx_fence.h

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h C
  1/* SPDX-License-Identifier: GPL-2.0 OR MIT */
  2/**************************************************************************
  3 *
  4 * Copyright 2011-2012 VMware, Inc., Palo Alto, CA., USA
  5 *
  6 * Permission is hereby granted, free of charge, to any person obtaining a
  7 * copy of this software and associated documentation files (the
  8 * "Software"), to deal in the Software without restriction, including
  9 * without limitation the rights to use, copy, modify, merge, publish,
 10 * distribute, sub license, and/or sell copies of the Software, and to
 11 * permit persons to whom the Software is furnished to do so, subject to
 12 * the following conditions:
 13 *
 14 * The above copyright notice and this permission notice (including the
 15 * next paragraph) shall be included in all copies or substantial portions
 16 * of the Software.
 17 *
 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
 22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
 25 *
 26 **************************************************************************/
 27
 28#ifndef _VMWGFX_FENCE_H_
 29
 30#include <linux/dma-fence.h>
 31#include <linux/dma-fence-array.h>
 32
 33#define VMW_FENCE_WAIT_TIMEOUT (5*HZ)
 34
 35struct drm_device;
 36struct drm_file;
 37struct drm_pending_event;
 38
 39struct vmw_private;
 40struct vmw_fence_manager;
 41
 42struct vmw_fence_obj {
 43	struct dma_fence base;
 44	bool   waiter_added;
 45	struct list_head head;
 46	void (*destroy)(struct vmw_fence_obj *fence);
 47};
 48
 49extern struct vmw_fence_manager *
 50vmw_fence_manager_init(struct vmw_private *dev_priv);
 51
 52extern void vmw_fence_manager_takedown(struct vmw_fence_manager *fman);
 53
 54static inline void
 55vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p)
 56{
 57	struct vmw_fence_obj *fence = *fence_p;
 58
 59	*fence_p = NULL;
 60	if (fence)
 61		dma_fence_put(&fence->base);
 62}
 63
 64static inline struct vmw_fence_obj *
 65vmw_fence_obj_reference(struct vmw_fence_obj *fence)
 66{
 67	if (fence)
 68		dma_fence_get(&fence->base);
 69	return fence;
 70}
 71
 72u32 vmw_fences_update(struct vmw_fence_manager *fman);
 73
 74extern bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence);
 75
 76extern int vmw_fence_obj_wait(struct vmw_fence_obj *fence,
 77			      bool lazy,
 78			      bool interruptible, unsigned long timeout);
 79
 80extern int vmw_fence_create(struct vmw_fence_manager *fman,
 81			    uint32_t seqno,
 82			    struct vmw_fence_obj **p_fence);
 83
 84extern int vmw_user_fence_create(struct drm_file *file_priv,
 85				 struct vmw_fence_manager *fman,
 86				 uint32_t sequence,
 87				 struct vmw_fence_obj **p_fence,
 88				 uint32_t *p_handle);
 89
 90extern void vmw_fence_fifo_up(struct vmw_fence_manager *fman);
 91
 92extern void vmw_fence_fifo_down(struct vmw_fence_manager *fman);
 93
 94extern int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
 95				    struct drm_file *file_priv);
 96
 97extern int vmw_fence_obj_signaled_ioctl(struct drm_device *dev, void *data,
 98					struct drm_file *file_priv);
 99
100extern int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data,
101				     struct drm_file *file_priv);
102extern int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
103				 struct drm_file *file_priv);
104extern int vmw_event_fence_action_queue(struct drm_file *filee_priv,
105					struct vmw_fence_obj *fence,
106					struct drm_pending_event *event,
107					uint32_t *tv_sec,
108					uint32_t *tv_usec,
109					bool interruptible);
110#endif /* _VMWGFX_FENCE_H_ */
~/ Read-only file preview.