backend/drm: Check for mgpu_renderer instead of parent

The presence of the renderer is what matters with respect to blitting.
Having a parent without the need to blit will be allowed later.
This commit is contained in:
Kenny Levinsen 2024-08-30 01:34:29 +02:00
parent 1dd05437bf
commit b2bb111f03
2 changed files with 11 additions and 11 deletions

View File

@ -53,7 +53,7 @@ static void backend_destroy(struct wlr_backend *backend) {
wl_list_remove(&drm->dev_change.link); wl_list_remove(&drm->dev_change.link);
wl_list_remove(&drm->dev_remove.link); wl_list_remove(&drm->dev_remove.link);
if (drm->parent) { if (drm->mgpu_renderer.wlr_rend) {
finish_drm_renderer(&drm->mgpu_renderer); finish_drm_renderer(&drm->mgpu_renderer);
} }
@ -271,7 +271,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wlr_session *session,
} }
} }
if (drm->parent) { if (drm->mgpu_renderer.wlr_rend) {
drm->backend.features.timeline = drm->backend.features.timeline && drm->backend.features.timeline = drm->backend.features.timeline &&
drm->mgpu_renderer.wlr_rend->features.timeline; drm->mgpu_renderer.wlr_rend->features.timeline;
} }

View File

@ -722,7 +722,7 @@ static bool drm_connector_state_update_primary_fb(struct wlr_drm_connector *conn
assert(state->wait_timeline == NULL); assert(state->wait_timeline == NULL);
struct wlr_buffer *local_buf; struct wlr_buffer *local_buf;
if (drm->parent) { if (drm->mgpu_renderer.wlr_rend) {
struct wlr_drm_format format = {0}; struct wlr_drm_format format = {0};
if (!drm_plane_pick_render_format(plane, &format, &drm->mgpu_renderer)) { if (!drm_plane_pick_render_format(plane, &format, &drm->mgpu_renderer)) {
wlr_log(WLR_ERROR, "Failed to pick primary plane format"); wlr_log(WLR_ERROR, "Failed to pick primary plane format");
@ -776,7 +776,7 @@ static bool drm_connector_set_pending_layer_fbs(struct wlr_drm_connector *conn,
struct wlr_drm_backend *drm = conn->backend; struct wlr_drm_backend *drm = conn->backend;
struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_crtc *crtc = conn->crtc;
if (!crtc || drm->parent) { if (!crtc || drm->mgpu_renderer.wlr_rend) {
return false; return false;
} }
@ -835,7 +835,7 @@ static bool drm_connector_prepare(struct wlr_drm_connector_state *conn_state, bo
return false; return false;
} }
if (test_only && conn->backend->parent) { if (test_only && conn->backend->mgpu_renderer.wlr_rend) {
// If we're running as a secondary GPU, we can't perform an atomic // If we're running as a secondary GPU, we can't perform an atomic
// commit without blitting a buffer. // commit without blitting a buffer.
return true; return true;
@ -905,7 +905,7 @@ static bool drm_connector_commit_state(struct wlr_drm_connector *conn,
goto out; goto out;
} }
if (test_only && conn->backend->parent) { if (test_only && conn->backend->mgpu_renderer.wlr_rend) {
// If we're running as a secondary GPU, we can't perform an atomic // If we're running as a secondary GPU, we can't perform an atomic
// commit without blitting a buffer. // commit without blitting a buffer.
ok = true; ok = true;
@ -1102,7 +1102,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
} }
struct wlr_buffer *local_buf; struct wlr_buffer *local_buf;
if (drm->parent) { if (drm->mgpu_renderer.wlr_rend) {
struct wlr_drm_format format = {0}; struct wlr_drm_format format = {0};
if (!drm_plane_pick_render_format(plane, &format, &drm->mgpu_renderer)) { if (!drm_plane_pick_render_format(plane, &format, &drm->mgpu_renderer)) {
wlr_log(WLR_ERROR, "Failed to pick cursor plane format"); wlr_log(WLR_ERROR, "Failed to pick cursor plane format");
@ -1216,7 +1216,7 @@ static const struct wlr_drm_format_set *drm_connector_get_cursor_formats(
if (!plane) { if (!plane) {
return NULL; return NULL;
} }
if (conn->backend->parent) { if (conn->backend->mgpu_renderer.wlr_rend) {
return &conn->backend->mgpu_formats; return &conn->backend->mgpu_formats;
} }
return &plane->formats; return &plane->formats;
@ -1245,7 +1245,7 @@ static const struct wlr_drm_format_set *drm_connector_get_primary_formats(
if (!drm_connector_alloc_crtc(conn)) { if (!drm_connector_alloc_crtc(conn)) {
return NULL; return NULL;
} }
if (conn->backend->parent) { if (conn->backend->mgpu_renderer.wlr_rend) {
return &conn->backend->mgpu_formats; return &conn->backend->mgpu_formats;
} }
return &conn->crtc->primary->formats; return &conn->crtc->primary->formats;
@ -1900,7 +1900,7 @@ bool commit_drm_device(struct wlr_drm_backend *drm,
modeset |= output_state->base.allow_reconfiguration; modeset |= output_state->base.allow_reconfiguration;
} }
if (test_only && drm->parent) { if (test_only && drm->mgpu_renderer.wlr_rend) {
// If we're running as a secondary GPU, we can't perform an atomic // If we're running as a secondary GPU, we can't perform an atomic
// commit without blitting a buffer. // commit without blitting a buffer.
ok = true; ok = true;
@ -1978,7 +1978,7 @@ static void handle_page_flip(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) { if (!drm->mgpu_renderer.wlr_rend) {
present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY; present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
} }