backend/drm: get rid of wlr_drm_fb_type
Since all DRM FBs are backed by a wlr_buffer, there's no need for this anymore.
This commit is contained in:
parent
68a8d99055
commit
8058e338ea
|
@ -377,7 +377,7 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(crtc->pending.active);
|
assert(crtc->pending.active);
|
||||||
assert(plane_get_next_fb(crtc->primary)->type != WLR_DRM_FB_TYPE_NONE);
|
assert(plane_get_next_fb(crtc->primary)->bo);
|
||||||
if (!drm_crtc_commit(conn, DRM_MODE_PAGE_FLIP_EVENT)) {
|
if (!drm_crtc_commit(conn, DRM_MODE_PAGE_FLIP_EVENT)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -650,10 +650,10 @@ static bool drm_connector_export_dmabuf(struct wlr_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_drm_fb *fb = &crtc->primary->queued_fb;
|
struct wlr_drm_fb *fb = &crtc->primary->queued_fb;
|
||||||
if (fb->type == WLR_DRM_FB_TYPE_NONE) {
|
if (fb->bo == NULL) {
|
||||||
fb = &crtc->primary->current_fb;
|
fb = &crtc->primary->current_fb;
|
||||||
}
|
}
|
||||||
if (fb->type == WLR_DRM_FB_TYPE_NONE) {
|
if (fb->bo == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,10 +661,10 @@ static bool drm_connector_export_dmabuf(struct wlr_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane) {
|
struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane) {
|
||||||
if (plane->pending_fb.type != WLR_DRM_FB_TYPE_NONE) {
|
if (plane->pending_fb.bo) {
|
||||||
return &plane->pending_fb;
|
return &plane->pending_fb;
|
||||||
}
|
}
|
||||||
if (plane->queued_fb.type != WLR_DRM_FB_TYPE_NONE) {
|
if (plane->queued_fb.bo) {
|
||||||
return &plane->queued_fb;
|
return &plane->queued_fb;
|
||||||
}
|
}
|
||||||
return &plane->current_fb;
|
return &plane->current_fb;
|
||||||
|
@ -680,7 +680,7 @@ static bool drm_connector_pageflip_renderer(struct wlr_drm_connector *conn) {
|
||||||
|
|
||||||
// drm_crtc_page_flip expects a FB to be available
|
// drm_crtc_page_flip expects a FB to be available
|
||||||
struct wlr_drm_plane *plane = crtc->primary;
|
struct wlr_drm_plane *plane = crtc->primary;
|
||||||
if (plane_get_next_fb(plane)->type == WLR_DRM_FB_TYPE_NONE) {
|
if (!plane_get_next_fb(plane)->bo) {
|
||||||
drm_surface_render_black_frame(&plane->surf);
|
drm_surface_render_black_frame(&plane->surf);
|
||||||
if (!drm_fb_lock_surface(&plane->pending_fb, &plane->surf)) {
|
if (!drm_fb_lock_surface(&plane->pending_fb, &plane->surf)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1507,11 +1507,10 @@ static void page_flip_handler(int fd, unsigned seq,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_drm_plane *plane = conn->crtc->primary;
|
struct wlr_drm_plane *plane = conn->crtc->primary;
|
||||||
if (plane->queued_fb.type != WLR_DRM_FB_TYPE_NONE) {
|
if (plane->queued_fb.bo) {
|
||||||
drm_fb_move(&plane->current_fb, &plane->queued_fb);
|
drm_fb_move(&plane->current_fb, &plane->queued_fb);
|
||||||
}
|
}
|
||||||
if (conn->crtc->cursor &&
|
if (conn->crtc->cursor && conn->crtc->cursor->queued_fb.bo) {
|
||||||
conn->crtc->cursor->queued_fb.type != WLR_DRM_FB_TYPE_NONE) {
|
|
||||||
drm_fb_move(&conn->crtc->cursor->current_fb,
|
drm_fb_move(&conn->crtc->cursor->current_fb,
|
||||||
&conn->crtc->cursor->queued_fb);
|
&conn->crtc->cursor->queued_fb);
|
||||||
}
|
}
|
||||||
|
@ -1522,7 +1521,8 @@ static void page_flip_handler(int fd, unsigned seq,
|
||||||
* data between the GPUs, even if we were using the direct scanout
|
* data between the GPUs, even if we were using the direct scanout
|
||||||
* interface.
|
* interface.
|
||||||
*/
|
*/
|
||||||
if (!drm->parent && plane->current_fb.type == WLR_DRM_FB_TYPE_WLR_BUFFER) {
|
if (!drm->parent && plane->current_fb.wlr_buf &&
|
||||||
|
wlr_client_buffer_get(plane->current_fb.wlr_buf)) {
|
||||||
present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
|
present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,21 +280,15 @@ bool drm_plane_init_surface(struct wlr_drm_plane *plane,
|
||||||
}
|
}
|
||||||
|
|
||||||
void drm_fb_clear(struct wlr_drm_fb *fb) {
|
void drm_fb_clear(struct wlr_drm_fb *fb) {
|
||||||
switch (fb->type) {
|
if (!fb->bo) {
|
||||||
case WLR_DRM_FB_TYPE_NONE:
|
assert(!fb->wlr_buf);
|
||||||
assert(!fb->bo);
|
return;
|
||||||
break;
|
|
||||||
case WLR_DRM_FB_TYPE_SURFACE:
|
|
||||||
abort(); // TODO: remove this case entirely
|
|
||||||
break;
|
|
||||||
case WLR_DRM_FB_TYPE_WLR_BUFFER:
|
|
||||||
gbm_bo_destroy(fb->bo);
|
|
||||||
wlr_buffer_unlock(fb->wlr_buf);
|
|
||||||
fb->wlr_buf = NULL;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fb->type = WLR_DRM_FB_TYPE_NONE;
|
gbm_bo_destroy(fb->bo);
|
||||||
|
wlr_buffer_unlock(fb->wlr_buf);
|
||||||
|
|
||||||
|
fb->wlr_buf = NULL;
|
||||||
fb->bo = NULL;
|
fb->bo = NULL;
|
||||||
|
|
||||||
if (fb->mgpu_bo) {
|
if (fb->mgpu_bo) {
|
||||||
|
@ -376,7 +370,6 @@ bool drm_fb_import_wlr(struct wlr_drm_fb *fb, struct wlr_drm_renderer *renderer,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb->type = WLR_DRM_FB_TYPE_WLR_BUFFER;
|
|
||||||
fb->wlr_buf = wlr_buffer_lock(buf);
|
fb->wlr_buf = wlr_buffer_lock(buf);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -33,20 +33,12 @@ struct wlr_drm_surface {
|
||||||
struct wlr_buffer *back_buffer;
|
struct wlr_buffer *back_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum wlr_drm_fb_type {
|
|
||||||
WLR_DRM_FB_TYPE_NONE,
|
|
||||||
WLR_DRM_FB_TYPE_SURFACE,
|
|
||||||
WLR_DRM_FB_TYPE_WLR_BUFFER
|
|
||||||
};
|
|
||||||
|
|
||||||
struct wlr_drm_fb {
|
struct wlr_drm_fb {
|
||||||
enum wlr_drm_fb_type type;
|
|
||||||
struct gbm_bo *bo;
|
struct gbm_bo *bo;
|
||||||
|
struct wlr_buffer *wlr_buf;
|
||||||
|
|
||||||
struct wlr_drm_surface *mgpu_surf;
|
struct wlr_drm_surface *mgpu_surf;
|
||||||
struct gbm_bo *mgpu_bo;
|
struct gbm_bo *mgpu_bo;
|
||||||
|
|
||||||
struct wlr_buffer *wlr_buf;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool init_drm_renderer(struct wlr_drm_backend *drm,
|
bool init_drm_renderer(struct wlr_drm_backend *drm,
|
||||||
|
|
Loading…
Reference in New Issue