Atomic modesetting

This commit is contained in:
Scott Anderson 2017-08-09 20:43:01 +12:00 committed by Drew DeVault
parent 913829e381
commit af67966d92
11 changed files with 350 additions and 72 deletions

View file

@ -27,8 +27,13 @@ union wlr_drm_crtc_props {
// Neither of these are guranteed to exist
uint32_t rotation;
uint32_t scaling_mode;
// atomic-modesetting only
uint32_t active;
uint32_t mode_id;
};
uint32_t props[2];
uint32_t props[4];
};
union wlr_drm_plane_props {

View file

@ -12,6 +12,8 @@ int32_t calculate_refresh_rate(drmModeModeInfo *mode);
void parse_edid(struct wlr_output *restrict output, size_t len, const uint8_t *data);
// Returns the string representation of a DRM output type
const char *conn_get_name(uint32_t type_id);
// Returns the DRM framebuffer id for a gbm_bo
uint32_t get_fb_for_bo(struct gbm_bo *bo);
// Part of match_obj
enum {

View file

@ -43,6 +43,9 @@ struct wlr_drm_plane {
struct wlr_drm_crtc {
uint32_t id;
uint32_t mode_id; // atomic modesetting only
drmModeAtomicReq *atomic;
union {
struct {
struct wlr_drm_plane *overlay;
@ -76,8 +79,11 @@ struct wlr_drm_renderer {
bool wlr_drm_renderer_init(struct wlr_drm_renderer *renderer, int fd);
void wlr_drm_renderer_free(struct wlr_drm_renderer *renderer);
struct wlr_drm_interface;
struct wlr_backend_state {
struct wlr_backend *base;
const struct wlr_drm_interface *iface;
int fd;
dev_t dev;
@ -150,6 +156,22 @@ struct wlr_output_state {
bool pageflip_pending;
};
// Used to provide atomic or legacy DRM functions
struct wlr_drm_interface {
// Enable or disable DPMS for output
void (*conn_enable)(struct wlr_backend_state *drm, struct wlr_output_state *output,
bool enable);
// Pageflip on crtc. If mode is non-NULL perform a full modeset using it.
bool (*crtc_pageflip)(struct wlr_backend_state *drm, struct wlr_output_state *output,
struct wlr_drm_crtc *crtc, uint32_t fb_id, drmModeModeInfo *mode);
// Enable the cursor buffer on crtc. Set bo to NULL to disable
bool (*crtc_set_cursor)(struct wlr_backend_state *drm, struct wlr_drm_crtc *crtc,
struct gbm_bo *bo);
// Move the cursor on crtc
bool (*crtc_move_cursor)(struct wlr_backend_state *drm, struct wlr_drm_crtc *crtc,
int x, int y);
};
bool wlr_drm_check_features(struct wlr_backend_state *drm);
bool wlr_drm_resources_init(struct wlr_backend_state *drm);
void wlr_drm_resources_free(struct wlr_backend_state *drm);
@ -159,6 +181,5 @@ void wlr_drm_scan_connectors(struct wlr_backend_state *state);
int wlr_drm_event(int fd, uint32_t mask, void *data);
void wlr_drm_output_start_renderer(struct wlr_output_state *output);
bool wlr_drm_crtc_set_cursor(struct wlr_backend_state *drm, struct wlr_drm_crtc *crtc);
#endif