summaryrefslogtreecommitdiff
path: root/src/drm.h
blob: 3b20df7772cf4e18cbec074f6b1bd492a3193404 (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
#ifndef XXX_DRM_H
#define XXX_DRM_H

#include <xf86drm.h>
#include <xf86drmMode.h>
#include <gbm.h>

#include "egl.h"

/**
 * ..
 */
struct drm_fb {
	uint32_t fb_id;
	struct gbm_bo * bo;
};

/**
 * Creates a framebuffer object for the gbm bo
 * extracted from the gbm surface. The life-time of the
 * returned framebuffer object attached to the gbm bo
 * is handled by gbm for us.
 */
struct drm_fb * drm_fb_get_from_bo(struct gbm_bo *bo);


struct drm {
	int fd;

	int crtc_index;

	drmModeModeInfo *mode;
	uint32_t crtc_id;
	uint32_t connector_id;

	/* deal with swapping front and back render buffers */
	int (*run)(const struct gbm *gbm, const struct egl *egl);
};

const struct drm * init_drm_runner(const char *device);
void deinit_drm(const struct drm * drm);

#endif /* XXX_DRM_H */