libliftoff/example/common.h
Matt Hoosier 0aacfabd31 examples: set crtc/connector properties
The behind-the-scenes manipulation of the per-plane DRM properties
needs to be augmented with some singleton property assignments
too (what CRTC should the connector be driving? what mode should
be used? is the CRC on?).

Also use DRM_MODE_ATOMIC_ALLOW_MODESET in the live commit in
case the new configuration doesn't match with whatever set of
modes and color formats the previous DRM master happened to use.
2019-11-08 14:14:08 -06:00

28 lines
868 B
C

#ifndef EXAMPLE_COMMON_H
#define EXAMPLE_COMMON_H
#include <stdbool.h>
#include <stdint.h>
#include <xf86drmMode.h>
struct dumb_fb {
uint32_t format;
uint32_t width, height, stride, size;
uint32_t handle;
uint32_t id;
};
drmModeConnector *pick_connector(int drm_fd, drmModeRes *drm_res);
drmModeCrtc *pick_crtc(int drm_fd, drmModeRes *drm_res,
drmModeConnector *connector);
void disable_all_crtcs_except(int drm_fd, drmModeRes *drm_res, uint32_t crtc_id);
bool set_global_properties(int drm_fd, drmModeAtomicReq *req,
const drmModeConnector *connector, const drmModeCrtc *crtc,
const drmModeModeInfo *mode);
bool dumb_fb_init(struct dumb_fb *fb, int drm_fd, uint32_t format,
uint32_t width, uint32_t height);
void *dumb_fb_map(struct dumb_fb *fb, int drm_fd);
void dumb_fb_fill(struct dumb_fb *fb, int drm_fd, uint32_t color);
#endif