• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright 2016 Advanced Micro Devices, Inc.
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
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 
28 /*
29  * Authors:
30  *      Christian König <christian.koenig@amd.com>
31  *
32  */
33 
34 #ifndef _VDPAU_DMABUF_H_
35 #define _VDPAU_DMABUF_H_
36 
37 #include <vdpau/vdpau.h>
38 
39 /* driver specific functions for NV_vdpau_interop */
40 #ifndef VDP_FUNC_ID_BASE_DRIVER
41 #define VDP_FUNC_ID_BASE_DRIVER 0x2000
42 #endif
43 
44 /* New DMA-buf based implementation */
45 #define VDP_FUNC_ID_VIDEO_SURFACE_DMA_BUF (VDP_FUNC_ID_BASE_DRIVER + 2)
46 #define VDP_FUNC_ID_OUTPUT_SURFACE_DMA_BUF (VDP_FUNC_ID_BASE_DRIVER + 3)
47 
48 /* Define some more internal RGBA formats for more
49  * robust handling of Video Surfaces
50  */
51 #define VDP_RGBA_FORMAT_R8          (-1)
52 #define VDP_RGBA_FORMAT_R8G8        (-2)
53 
54 struct VdpSurfaceDMABufDesc {
55    /* DMA-buf file descriptor */
56    uint32_t handle;
57    /* Width in pixel */
58    uint32_t width;
59    /* Height in pixel */
60    uint32_t height;
61    /* Offset in bytes */
62    uint32_t offset;
63    /* Stride in bytes */
64    uint32_t stride;
65    /* VDP_RGBA_FORMAT_* as defined in the VDPAU spec and above. */
66    uint32_t format;
67 };
68 
69 /**
70  * \brief Video surface planes
71  */
72 typedef uint32_t VdpVideoSurfacePlane;
73 
74 /** \hideinitializer \brief Luma top field */
75 #define VDP_VIDEO_SURFACE_PLANE_LUMA_TOP      ((VdpVideoSurfacePlane)0)
76 /** \hideinitializer \brief Luma bottom field */
77 #define VDP_VIDEO_SURFACE_PLANE_LUMA_BOTTOM   ((VdpVideoSurfacePlane)1)
78 /** \hideinitializer \brief Chroma top field */
79 #define VDP_VIDEO_SURFACE_PLANE_CHROMA_TOP    ((VdpVideoSurfacePlane)2)
80 /** \hideinitializer \brief Chroma bottom field */
81 #define VDP_VIDEO_SURFACE_PLANE_CHROMA_BOTTOM ((VdpVideoSurfacePlane)3)
82 
83 typedef VdpStatus VdpVideoSurfaceDMABuf(
84    VdpVideoSurface               surface,
85    VdpVideoSurfacePlane          plane,
86    struct VdpSurfaceDMABufDesc * result
87 );
88 
89 typedef VdpStatus VdpOutputSurfaceDMABuf(
90    VdpOutputSurface              surface,
91    struct VdpSurfaceDMABufDesc * result
92 );
93 
94 #endif /* _VDPAU_DMABUF_H_ */
95