1 /*
2  * va_drmcommon.h - Common utilities for DRM-based drivers
3  *
4  * Copyright (c) 2012 Intel Corporation. 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 INTEL AND/OR ITS SUPPLIERS 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 #ifndef VA_DRM_COMMON_H
28 #define VA_DRM_COMMON_H
29 
30 /** \brief DRM authentication type. */
31 enum {
32     /** \brief Disconnected. */
33     VA_DRM_AUTH_NONE    = 0,
34     /**
35      * \brief Connected. Authenticated with DRI1 protocol.
36      *
37      * @deprecated
38      * This is a deprecated authentication type. All DRI-based drivers have
39      * been migrated to use the DRI2 protocol. Newly written drivers shall
40      * use DRI2 protocol only, or a custom authentication means. e.g. opt
41      * for authenticating on the VA driver side, instead of libva side.
42      */
43     VA_DRM_AUTH_DRI1    = 1,
44     /**
45      * \brief Connected. Authenticated with DRI2 protocol.
46      *
47      * This is only useful to VA/X11 drivers. The libva-x11 library provides
48      * a helper function VA_DRI2Authenticate() for authenticating the
49      * connection. However, DRI2 conformant drivers don't need to call that
50      * function since authentication happens on the libva side, implicitly.
51      */
52     VA_DRM_AUTH_DRI2    = 2,
53     /**
54      * \brief Connected. Authenticated with some alternate raw protocol.
55      *
56      * This authentication mode is mainly used in non-VA/X11 drivers.
57      * Authentication happens through some alternative method, at the
58      * discretion of the VA driver implementation.
59      */
60     VA_DRM_AUTH_CUSTOM  = 3
61 };
62 
63 /** \brief Base DRM state. */
64 struct drm_state {
65     /** \brief DRM connection descriptor. */
66     int         fd;
67     /** \brief DRM authentication type. */
68     int         auth_type;
69 };
70 
71 /** \brief Kernel DRM buffer memory type.  */
72 #define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM		0x10000000
73 /** \brief DRM PRIME memory type. */
74 #define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME		0x20000000
75 
76 #endif /* VA_DRM_COMMON_H */
77