Home | History | Annotate | Download | only in drm
      1 /**************************************************************************
      2  *
      3  * Copyright 2006-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA
      4  * All Rights Reserved.
      5  * Copyright (c) 2009 VMware, Inc., Palo Alto, CA., USA
      6  * All Rights Reserved.
      7  *
      8  * This program is free software; you can redistribute it and/or modify it
      9  * under the terms and conditions of the GNU General Public License,
     10  * version 2, as published by the Free Software Foundation.
     11  *
     12  * This program is distributed in the hope it will be useful, but WITHOUT
     13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
     15  * more details.
     16  *
     17  * You should have received a copy of the GNU General Public License along with
     18  * this program; if not, write to the Free Software Foundation, Inc.,
     19  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
     20  *
     21  **************************************************************************/
     22 /*
     23  * Authors
     24  * Thomas Hellstrm <thomas-at-tungstengraphics-dot-com>
     25  */
     26 
     27 #ifndef TTM_FENCE_USER_H
     28 #define TTM_FENCE_USER_H
     29 
     30 #if !defined(__KERNEL__) && !defined(_KERNEL)
     31 #include <stdint.h>
     32 #endif
     33 
     34 #define TTM_FENCE_MAJOR 0
     35 #define TTM_FENCE_MINOR 1
     36 #define TTM_FENCE_PL    0
     37 #define TTM_FENCE_DATE  "080819"
     38 
     39 /**
     40  * struct ttm_fence_signaled_req
     41  *
     42  * @handle: Handle to the fence object. Input.
     43  *
     44  * @fence_type: Fence types we want to flush. Input.
     45  *
     46  * @flush: Boolean. Flush the indicated fence_types. Input.
     47  *
     48  * Argument to the TTM_FENCE_SIGNALED ioctl.
     49  */
     50 
     51 struct ttm_fence_signaled_req {
     52 	uint32_t handle;
     53 	uint32_t fence_type;
     54 	int32_t flush;
     55 	uint32_t pad64;
     56 };
     57 
     58 /**
     59  * struct ttm_fence_rep
     60  *
     61  * @signaled_types: Fence type that has signaled.
     62  *
     63  * @fence_error: Command execution error.
     64  * Hardware errors that are consequences of the execution
     65  * of the command stream preceding the fence are reported
     66  * here.
     67  *
     68  * Output argument to the TTM_FENCE_SIGNALED and
     69  * TTM_FENCE_FINISH ioctls.
     70  */
     71 
     72 struct ttm_fence_rep {
     73 	uint32_t signaled_types;
     74 	uint32_t fence_error;
     75 };
     76 
     77 union ttm_fence_signaled_arg {
     78 	struct ttm_fence_signaled_req req;
     79 	struct ttm_fence_rep rep;
     80 };
     81 
     82 /*
     83  * Waiting mode flags for the TTM_FENCE_FINISH ioctl.
     84  *
     85  * TTM_FENCE_FINISH_MODE_LAZY: Allow for sleeps during polling
     86  * wait.
     87  *
     88  * TTM_FENCE_FINISH_MODE_NO_BLOCK: Don't block waiting for GPU,
     89  * but return -EBUSY if the buffer is busy.
     90  */
     91 
     92 #define TTM_FENCE_FINISH_MODE_LAZY     (1 << 0)
     93 #define TTM_FENCE_FINISH_MODE_NO_BLOCK (1 << 1)
     94 
     95 /**
     96  * struct ttm_fence_finish_req
     97  *
     98  * @handle: Handle to the fence object. Input.
     99  *
    100  * @fence_type: Fence types we want to finish.
    101  *
    102  * @mode: Wait mode.
    103  *
    104  * Input to the TTM_FENCE_FINISH ioctl.
    105  */
    106 
    107 struct ttm_fence_finish_req {
    108 	uint32_t handle;
    109 	uint32_t fence_type;
    110 	uint32_t mode;
    111 	uint32_t pad64;
    112 };
    113 
    114 union ttm_fence_finish_arg {
    115 	struct ttm_fence_finish_req req;
    116 	struct ttm_fence_rep rep;
    117 };
    118 
    119 /**
    120  * struct ttm_fence_unref_arg
    121  *
    122  * @handle: Handle to the fence object.
    123  *
    124  * Argument to the TTM_FENCE_UNREF ioctl.
    125  */
    126 
    127 struct ttm_fence_unref_arg {
    128 	uint32_t handle;
    129 	uint32_t pad64;
    130 };
    131 
    132 /*
    133  * Ioctl offsets frome extenstion start.
    134  */
    135 
    136 #define TTM_FENCE_SIGNALED 0x01
    137 #define TTM_FENCE_FINISH   0x02
    138 #define TTM_FENCE_UNREF    0x03
    139 
    140 #endif
    141