summaryrefslogtreecommitdiffstats
path: root/src/common_drm.h
blob: b0c3cd4fc2c7be7f57bd5c57914d253a6e4e6d43 (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
69
70
71
72
73
74
#ifndef COMMON_DRM_H
#define COMMON_DRM_H

#include "compat-api.h"
#include "xf86Crtc.h"

struct common_crtc_info {
	int drm_fd;
	unsigned num;
	drmModeCrtcPtr mode_crtc;
	void *cursor_data;
	uint32_t cursor_handle;
	uint32_t rotate_fb_id;
};
#define common_crtc(crtc) \
	((struct common_crtc_info *)(crtc)->driver_private)

struct drm_udev_info {
	struct udev_monitor *monitor;
	pointer *handler;
	dev_t drm_dev;
	CloseScreenProcPtr CloseScreen;
};

struct common_drm_info {
	int fd;
	drmEventContext event_context;
	uint32_t fb_id;
	drmModeResPtr mode_res;

	Bool has_hw_cursor;
	Bool hw_cursor;
	unsigned short cursor_max_width;
	unsigned short cursor_max_height;

#ifdef HAVE_UDEV
	struct drm_udev_info udev;
#endif

	OptionInfoPtr Options;
	CloseScreenProcPtr CloseScreen;

	void *private;
};

#define GET_DRM_INFO(pScrn)		((struct common_drm_info *)(pScrn)->driverPrivate)
#define SET_DRM_INFO(pScrn, ptr)	((pScrn)->driverPrivate = (ptr))

void common_drm_crtc_dpms(xf86CrtcPtr crtc, int mode);
Bool common_drm_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
	Rotation rotation, int x, int y);
void common_drm_crtc_resize(ScrnInfoPtr pScrn, int width, int height,
	int displayWidth, uint32_t fb_id);
void common_drm_crtc_gamma_set(xf86CrtcPtr crtc,
	CARD16 *red, CARD16 *green, CARD16 *blue, int size);
void common_drm_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y);
void common_drm_crtc_show_cursor(xf86CrtcPtr crtc);
void common_drm_crtc_hide_cursor(xf86CrtcPtr crtc);

Bool common_drm_init_mode_resources(ScrnInfoPtr pScrn,
	const xf86CrtcFuncsRec *funcs);

void common_drm_LoadPalette(ScrnInfoPtr pScrn, int num, int *indices,
	LOCO *colors, VisualPtr pVisual);
Bool common_drm_PreScreenInit(ScreenPtr pScreen);
Bool common_drm_PostScreenInit(ScreenPtr pScreen);
Bool common_drm_SwitchMode(SWITCH_MODE_ARGS_DECL);
void common_drm_AdjustFrame(ADJUST_FRAME_ARGS_DECL);
Bool common_drm_EnterVT(VT_FUNC_ARGS_DECL);
void common_drm_LeaveVT(VT_FUNC_ARGS_DECL);

void common_drm_FreeScreen(FREE_SCREEN_ARGS_DECL);

#endif