drm: Replace dead code with an assert in plane transform check paths

The caller to drm_plane_state_coords_for_paint_node() has already tested
for valid transforms, so drm_plane_state_coords_for_paint_node() is never
called with a transform that needs to be tested.

Replace the test with an assert() - and this also lets us stop returning
a bool, and drop the debug prints that could never trigger.


Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2025-08-26 13:52:28 -05:00
parent a2a6030902
commit 38e6a292a2
3 changed files with 9 additions and 16 deletions

View file

@ -915,7 +915,7 @@ void
drm_plane_state_free(struct drm_plane_state *state, bool force);
void
drm_plane_state_put_back(struct drm_plane_state *state);
bool
void
drm_plane_state_coords_for_paint_node(struct drm_plane_state *state,
struct weston_paint_node *node,
uint64_t zpos);

View file

@ -216,7 +216,7 @@ drm_plane_state_put_back(struct drm_plane_state *state)
* Given a weston_view, fill the drm_plane_state's co-ordinates to display on
* a given plane.
*/
bool
void
drm_plane_state_coords_for_paint_node(struct drm_plane_state *state,
struct weston_paint_node *node,
uint64_t zpos)
@ -231,8 +231,11 @@ drm_plane_state_coords_for_paint_node(struct drm_plane_state *state,
uint16_t min_alpha = state->plane->alpha_min;
uint16_t max_alpha = state->plane->alpha_max;
if (!drm_paint_node_transform_supported(node, state->plane))
return false;
/* The caller has already checked supported transforms when creating
* a list of candidate planes, so we should only ever get here with
* a supported transform.
*/
assert(drm_paint_node_transform_supported(node, state->plane));
assert(node->valid_transform);
state->rotation = drm_rotation_from_output_transform(state->plane, node->transform);
@ -315,8 +318,6 @@ drm_plane_state_coords_for_paint_node(struct drm_plane_state *state,
* never exceed max_alpha if ev->alpha <= 1.0.
*/
state->alpha = min_alpha + (uint16_t)round((max_alpha - min_alpha) * ev->alpha);
return true;
}
/**

View file

@ -120,11 +120,7 @@ drm_output_try_paint_node_on_plane(struct drm_plane *plane,
assert(!state->fb);
state->output = output;
if (!drm_plane_state_coords_for_paint_node(state, node, zpos)) {
drm_debug(b, "\t\t\t\t[view] not placing view %p on plane: "
"unsuitable transform\n", ev);
goto out;
}
drm_plane_state_coords_for_paint_node(state, node, zpos);
/* Should've been ensured by weston_view_matches_entire_output. */
if (plane->type == WDRM_PLANE_TYPE_PRIMARY) {
@ -243,11 +239,7 @@ drm_output_prepare_cursor_paint_node(struct drm_output_state *output_state,
/* We can't scale with the legacy API, and we don't try to account for
* simple cropping/translation in cursor_bo_update. */
plane_state->output = output;
if (!drm_plane_state_coords_for_paint_node(plane_state, node, zpos)) {
drm_debug(b, "\t\t\t\t[%s] not placing view %p on %s: "
"unsuitable transform\n", p_name, ev, p_name);
goto err;
}
drm_plane_state_coords_for_paint_node(plane_state, node, zpos);
if (plane_state->src_x != 0 || plane_state->src_y != 0 ||
plane_state->src_w > (unsigned) device->cursor_width << 16 ||