Linux Audio

Check our new training course

Loading...
v6.13.7
  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
 42/**
 43 *
 44 *
 45 */
 46enum vmw_action_type {
 47	VMW_ACTION_EVENT = 0,
 48	VMW_ACTION_MAX
 49};
 50
 51struct vmw_fence_action {
 52	struct list_head head;
 53	enum vmw_action_type type;
 54	void (*seq_passed) (struct vmw_fence_action *action);
 55	void (*cleanup) (struct vmw_fence_action *action);
 56};
 57
 58struct vmw_fence_obj {
 59	struct dma_fence base;
 60
 61	struct list_head head;
 62	struct list_head seq_passed_actions;
 63	void (*destroy)(struct vmw_fence_obj *fence);
 64};
 65
 66extern struct vmw_fence_manager *
 67vmw_fence_manager_init(struct vmw_private *dev_priv);
 68
 69extern void vmw_fence_manager_takedown(struct vmw_fence_manager *fman);
 70
 71static inline void
 72vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p)
 73{
 74	struct vmw_fence_obj *fence = *fence_p;
 75
 76	*fence_p = NULL;
 77	if (fence)
 78		dma_fence_put(&fence->base);
 79}
 80
 81static inline struct vmw_fence_obj *
 82vmw_fence_obj_reference(struct vmw_fence_obj *fence)
 83{
 84	if (fence)
 85		dma_fence_get(&fence->base);
 86	return fence;
 87}
 88
 89extern void vmw_fences_update(struct vmw_fence_manager *fman);
 90
 91extern bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence);
 92
 93extern int vmw_fence_obj_wait(struct vmw_fence_obj *fence,
 94			      bool lazy,
 95			      bool interruptible, unsigned long timeout);
 96
 
 
 97extern int vmw_fence_create(struct vmw_fence_manager *fman,
 98			    uint32_t seqno,
 99			    struct vmw_fence_obj **p_fence);
100
101extern int vmw_user_fence_create(struct drm_file *file_priv,
102				 struct vmw_fence_manager *fman,
103				 uint32_t sequence,
104				 struct vmw_fence_obj **p_fence,
105				 uint32_t *p_handle);
 
 
 
106
107extern void vmw_fence_fifo_up(struct vmw_fence_manager *fman);
108
109extern void vmw_fence_fifo_down(struct vmw_fence_manager *fman);
110
111extern int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
112				    struct drm_file *file_priv);
113
114extern int vmw_fence_obj_signaled_ioctl(struct drm_device *dev, void *data,
115					struct drm_file *file_priv);
116
117extern int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data,
118				     struct drm_file *file_priv);
119extern int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
120				 struct drm_file *file_priv);
121extern int vmw_event_fence_action_queue(struct drm_file *filee_priv,
122					struct vmw_fence_obj *fence,
123					struct drm_pending_event *event,
124					uint32_t *tv_sec,
125					uint32_t *tv_usec,
126					bool interruptible);
127#endif /* _VMWGFX_FENCE_H_ */
v4.17
 
  1/**************************************************************************
  2 *
  3 * Copyright © 2011-2012 VMware, Inc., Palo Alto, CA., USA
  4 * All Rights Reserved.
  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 vmw_private;
 36
 37struct vmw_fence_manager;
 38
 39/**
 40 *
 41 *
 42 */
 43enum vmw_action_type {
 44	VMW_ACTION_EVENT = 0,
 45	VMW_ACTION_MAX
 46};
 47
 48struct vmw_fence_action {
 49	struct list_head head;
 50	enum vmw_action_type type;
 51	void (*seq_passed) (struct vmw_fence_action *action);
 52	void (*cleanup) (struct vmw_fence_action *action);
 53};
 54
 55struct vmw_fence_obj {
 56	struct dma_fence base;
 57
 58	struct list_head head;
 59	struct list_head seq_passed_actions;
 60	void (*destroy)(struct vmw_fence_obj *fence);
 61};
 62
 63extern struct vmw_fence_manager *
 64vmw_fence_manager_init(struct vmw_private *dev_priv);
 65
 66extern void vmw_fence_manager_takedown(struct vmw_fence_manager *fman);
 67
 68static inline void
 69vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p)
 70{
 71	struct vmw_fence_obj *fence = *fence_p;
 72
 73	*fence_p = NULL;
 74	if (fence)
 75		dma_fence_put(&fence->base);
 76}
 77
 78static inline struct vmw_fence_obj *
 79vmw_fence_obj_reference(struct vmw_fence_obj *fence)
 80{
 81	if (fence)
 82		dma_fence_get(&fence->base);
 83	return fence;
 84}
 85
 86extern void vmw_fences_update(struct vmw_fence_manager *fman);
 87
 88extern bool vmw_fence_obj_signaled(struct vmw_fence_obj *fence);
 89
 90extern int vmw_fence_obj_wait(struct vmw_fence_obj *fence,
 91			      bool lazy,
 92			      bool interruptible, unsigned long timeout);
 93
 94extern void vmw_fence_obj_flush(struct vmw_fence_obj *fence);
 95
 96extern int vmw_fence_create(struct vmw_fence_manager *fman,
 97			    uint32_t seqno,
 98			    struct vmw_fence_obj **p_fence);
 99
100extern int vmw_user_fence_create(struct drm_file *file_priv,
101				 struct vmw_fence_manager *fman,
102				 uint32_t sequence,
103				 struct vmw_fence_obj **p_fence,
104				 uint32_t *p_handle);
105
106extern int vmw_wait_dma_fence(struct vmw_fence_manager *fman,
107			      struct dma_fence *fence);
108
109extern void vmw_fence_fifo_up(struct vmw_fence_manager *fman);
110
111extern void vmw_fence_fifo_down(struct vmw_fence_manager *fman);
112
113extern int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
114				    struct drm_file *file_priv);
115
116extern int vmw_fence_obj_signaled_ioctl(struct drm_device *dev, void *data,
117					struct drm_file *file_priv);
118
119extern int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data,
120				     struct drm_file *file_priv);
121extern int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
122				 struct drm_file *file_priv);
123extern int vmw_event_fence_action_queue(struct drm_file *filee_priv,
124					struct vmw_fence_obj *fence,
125					struct drm_pending_event *event,
126					uint32_t *tv_sec,
127					uint32_t *tv_usec,
128					bool interruptible);
129#endif /* _VMWGFX_FENCE_H_ */