|
|
@ -820,6 +820,52 @@ static bool drm_connector_schedule_frame(struct wlr_output *output) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool drm_connector_set_dmabuf(struct wlr_output *output,
|
|
|
|
|
|
|
|
struct wlr_dmabuf_attributes *attribs) {
|
|
|
|
|
|
|
|
struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
|
|
|
|
|
|
|
|
struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend);
|
|
|
|
|
|
|
|
if (!drm->session->active) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
|
|
|
|
|
|
|
if (!crtc) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: check plane input formats
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (attribs->width != output->width || attribs->height != output->height) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct gbm_bo *bo = import_gbm_bo(&drm->renderer, attribs);
|
|
|
|
|
|
|
|
if (bo == NULL) {
|
|
|
|
|
|
|
|
wlr_log(WLR_ERROR, "import_gbm_bo failed");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t fb_id = get_fb_for_bo(bo, gbm_bo_get_format(bo));
|
|
|
|
|
|
|
|
if (fb_id == 0) {
|
|
|
|
|
|
|
|
wlr_log(WLR_ERROR, "get_fb_for_bo failed");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (conn->pageflip_pending) {
|
|
|
|
|
|
|
|
wlr_log(WLR_ERROR, "Skipping pageflip on output '%s'", conn->output.name);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!drm->iface->crtc_pageflip(drm, conn, crtc, fb_id, NULL)) {
|
|
|
|
|
|
|
|
wlr_log(WLR_ERROR, "crtc_pageflip failed");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
conn->pageflip_pending = true;
|
|
|
|
|
|
|
|
wlr_output_update_enabled(output, true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void drm_connector_destroy(struct wlr_output *output) {
|
|
|
|
static void drm_connector_destroy(struct wlr_output *output) {
|
|
|
|
struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
|
|
|
|
struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
|
|
|
|
drm_connector_cleanup(conn);
|
|
|
|
drm_connector_cleanup(conn);
|
|
|
@ -842,6 +888,7 @@ static const struct wlr_output_impl output_impl = {
|
|
|
|
.get_gamma_size = drm_connector_get_gamma_size,
|
|
|
|
.get_gamma_size = drm_connector_get_gamma_size,
|
|
|
|
.export_dmabuf = drm_connector_export_dmabuf,
|
|
|
|
.export_dmabuf = drm_connector_export_dmabuf,
|
|
|
|
.schedule_frame = drm_connector_schedule_frame,
|
|
|
|
.schedule_frame = drm_connector_schedule_frame,
|
|
|
|
|
|
|
|
.set_dmabuf = drm_connector_set_dmabuf,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
bool wlr_output_is_drm(struct wlr_output *output) {
|
|
|
|
bool wlr_output_is_drm(struct wlr_output *output) {
|
|
|
|