summaryrefslogtreecommitdiff
path: root/src/gallium/include/state_tracker/drm_api.h
blob: 4572c7e04235d78fe3e292f2e8ddee6c19f326fc (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

#ifndef _DRM_API_H_
#define _DRM_API_H_

#include "pipe/p_compiler.h"

struct pipe_screen;
struct pipe_winsys;
struct pipe_context;
struct pipe_resource;

#define DRM_API_HANDLE_TYPE_SHARED 0
#define DRM_API_HANDLE_TYPE_KMS    1

/**
 * For use with pipe_screen::{texture_from_handle|texture_get_handle}.
 */
struct winsys_handle
{
	/**
	 * Unused for texture_from_handle, always
	 * DRM_API_HANDLE_TYPE_SHARED.  Input to texture_get_handle,
	 * use TEXTURE_USAGE to select handle for kms or ipc.
	 */
	unsigned type;
	/**
	 * Input to texture_from_handle.
	 * Output for texture_get_handle.
	 */
	unsigned handle;
	/**
	 * Input to texture_from_handle.
	 * Output for texture_get_handle.
	 */
	unsigned stride;
};

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

        const char *name;

	/**
	 * Kernel driver name, as accepted by drmOpenByName.
	 */
	const char *driver_name;

	/**
	 * Create a pipe srcreen.
	 */
	struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd);
};

extern struct drm_api * drm_api_create(void);

#endif