st/dri: add drisw
[mesa.git] / src / gallium / include / state_tracker / drm_api.h
1
2 #ifndef _DRM_API_H_
3 #define _DRM_API_H_
4
5 #include "pipe/p_compiler.h"
6
7 struct pipe_screen;
8 struct pipe_winsys;
9 struct pipe_buffer;
10 struct pipe_context;
11 struct pipe_texture;
12
13 enum drm_create_screen_mode {
14 DRM_CREATE_NORMAL = 0,
15 DRM_CREATE_DRI1,
16 DRM_CREATE_DRISW,
17 DRM_CREATE_DRIVER = 1024,
18 DRM_CREATE_MAX
19 };
20
21 #define DRM_API_HANDLE_TYPE_SHARED 0
22 #define DRM_API_HANDLE_TYPE_KMS 1
23
24 /**
25 * For use with pipe_screen::{texture_from_handle|texture_get_handle}.
26 */
27 struct winsys_handle
28 {
29 /**
30 * Unused for texture_from_handle, always
31 * DRM_API_HANDLE_TYPE_SHARED. Input to texture_get_handle,
32 * use TEXTURE_USAGE to select handle for kms or ipc.
33 */
34 unsigned type;
35 /**
36 * Input to texture_from_handle.
37 * Output for texture_get_handle.
38 */
39 unsigned handle;
40 /**
41 * Input to texture_from_handle.
42 * Output for texture_get_handle.
43 */
44 unsigned stride;
45 };
46
47 /**
48 * Modes other than DRM_CREATE_NORMAL derive from this struct.
49 */
50 /*@{*/
51 struct drm_create_screen_arg {
52 enum drm_create_screen_mode mode;
53 };
54 /*@}*/
55
56 struct drm_api
57 {
58 void (*destroy)(struct drm_api *api);
59
60 const char *name;
61
62 /**
63 * Kernel driver name, as accepted by drmOpenByName.
64 */
65 const char *driver_name;
66
67 /**
68 * Create a pipe srcreen.
69 */
70 struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd,
71 struct drm_create_screen_arg *arg);
72 };
73
74 extern struct drm_api * drm_api_create(void);
75
76 #endif