summaryrefslogtreecommitdiff
path: root/src/gallium/include/state_tracker/drm_api.h
blob: 7a38b508fbe3dcb9be5b0e7f06433a86988b07f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

#ifndef _DRM_API_H_
#define _DRM_API_H_

#include "pipe/p_compiler.h"

struct pipe_screen;
struct pipe_winsys;
struct pipe_buffer;
struct pipe_context;
struct pipe_texture;

enum drm_create_screen_mode {
	DRM_CREATE_NORMAL = 0,
	DRM_CREATE_DRI1,
	DRM_CREATE_DRIVER = 1024,
	DRM_CREATE_MAX
};

/**
 * Modes other than DRM_CREATE_NORMAL derive from this struct.
 */
/*@{*/
struct drm_create_screen_arg {
	enum drm_create_screen_mode mode;
};
/*@}*/

struct drm_api
{
	/**
	 * Special buffer functions
	 */
	/*@{*/
	struct pipe_screen*  (*create_screen)(struct drm_api *api, int drm_fd,
	                                      struct drm_create_screen_arg *arg);
	struct pipe_context* (*create_context)(struct drm_api *api,
	                                       struct pipe_screen *screen);
	/*@}*/

	/**
	 * Special buffer functions
	 */
	/*@{*/
	boolean (*buffer_from_texture)(struct drm_api *api,
	                               struct pipe_texture *texture,
	                               struct pipe_buffer **buffer,
	                               unsigned *stride);
	struct pipe_buffer* (*buffer_from_handle)(struct drm_api *api,
	                                          struct pipe_screen *screen,
                                                  const char *name,
                                                  unsigned handle);
	boolean (*handle_from_buffer)(struct drm_api *api,
	                              struct pipe_screen *screen,
	                              struct pipe_buffer *buffer,
	                              unsigned *handle);
	boolean (*global_handle_from_buffer)(struct drm_api *api,
	                                     struct pipe_screen *screen,
	                                     struct pipe_buffer *buffer,
	                                     unsigned *handle);
	/*@}*/

	void (*destroy)(struct drm_api *api);
};

extern struct drm_api * drm_api_create(void);

#endif