Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reimplement legacy modesetting #99

Merged
merged 5 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/compositor.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,17 @@ struct rendertarget {
int height,
int zpos
);
int (*present_legacy)(
struct rendertarget *target,
struct drmdev *drmdev,
uint32_t drm_plane_id,
int offset_x,
int offset_y,
int width,
int height,
int zpos,
bool set_mode
);
};

struct flutterpi_backing_store {
Expand Down
61 changes: 61 additions & 0 deletions include/modesetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct drmdev {
int fd;

pthread_mutex_t mutex;
bool supports_atomic_modesetting;

size_t n_connectors;
struct drm_connector *connectors;
Expand Down Expand Up @@ -88,6 +89,11 @@ int drmdev_configure(
const drmModeModeInfo *mode
);

int drmdev_plane_get_type(
struct drmdev *drmdev,
uint32_t plane_id
);

int drmdev_plane_supports_setting_rotation_value(
struct drmdev *drmdev,
uint32_t plane_id,
Expand Down Expand Up @@ -166,6 +172,61 @@ int drmdev_atomic_req_commit(
void *userdata
);

int drmdev_legacy_set_mode_and_fb(
struct drmdev *drmdev,
uint32_t fb_id
);

/**
* @brief Do a nonblocking, vblank-synced framebuffer swap.
*/
int drmdev_legacy_primary_plane_pageflip(
struct drmdev *drmdev,
uint32_t fb_id,
void *userdata
);

/**
* @brief Do a blocking, vblank-synced framebuffer swap.
* Using this in combination with @ref drmdev_legacy_primary_plane_pageflip
* is not a good idea, since it will block until the primary plane pageflip is complete,
* and then block even longer till the overlay plane pageflip completes the vblank after.
*/
int drmdev_legacy_overlay_plane_pageflip(
struct drmdev *drmdev,
uint32_t plane_id,
uint32_t fb_id,
int32_t crtc_x,
int32_t crtc_y,
int32_t crtc_w,
int32_t crtc_h,
uint32_t src_x,
uint32_t src_y,
uint32_t src_w,
uint32_t src_h
);

int drmdev_legacy_set_connector_property(
struct drmdev *drmdev,
const char *name,
uint64_t value
);

int drmdev_legacy_set_crtc_property(
struct drmdev *drmdev,
const char *name,
uint64_t value
);

int drmdev_legacy_set_plane_property(
struct drmdev *drmdev,
uint32_t plane_id,
const char *name,
uint64_t value
);

float mode_get_vrefresh(const drmModeModeInfo *mode);

inline static struct drm_connector *__next_connector(const struct drmdev *drmdev, const struct drm_connector *connector) {
bool found = connector == NULL;
for (int i = 0; i < drmdev->n_connectors; i++) {
Expand Down
Loading