drm: Introduce drm_plane_reset_state() helper function

Introduce a helper function to reset the current state of a drm_plane.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
This commit is contained in:
Alexandros Frantzis 2020-05-18 15:22:49 +03:00 committed by Daniel Stone
parent 85382d394a
commit 9975134593
4 changed files with 19 additions and 8 deletions

View File

@ -260,10 +260,7 @@ drm_output_fini_egl(struct drm_output *output)
if (!b->shutting_down &&
output->scanout_plane->state_cur->fb &&
output->scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE) {
drm_plane_state_free(output->scanout_plane->state_cur, true);
output->scanout_plane->state_cur =
drm_plane_state_alloc(NULL, output->scanout_plane);
output->scanout_plane->state_cur->complete = true;
drm_plane_reset_state(output->scanout_plane);
}
gl_renderer->output_destroy(&output->base);

View File

@ -748,6 +748,8 @@ drm_plane_state_put_back(struct drm_plane_state *state);
bool
drm_plane_state_coords_for_view(struct drm_plane_state *state,
struct weston_view *ev, uint64_t zpos);
void
drm_plane_reset_state(struct drm_plane *plane);
void
drm_assign_planes(struct weston_output *output_base, void *repaint_data);

View File

@ -1272,10 +1272,7 @@ drm_output_fini_pixman(struct drm_output *output)
if (!b->shutting_down &&
output->scanout_plane->state_cur->fb &&
output->scanout_plane->state_cur->fb->type == BUFFER_PIXMAN_DUMB) {
drm_plane_state_free(output->scanout_plane->state_cur, true);
output->scanout_plane->state_cur =
drm_plane_state_alloc(NULL, output->scanout_plane);
output->scanout_plane->state_cur->complete = true;
drm_plane_reset_state(output->scanout_plane);
}
pixman_renderer_output_destroy(&output->base);

View File

@ -261,6 +261,21 @@ drm_plane_state_coords_for_view(struct drm_plane_state *state,
return true;
}
/**
* Reset the current state of a DRM plane
*
* The current state will be freed and replaced by a pristine state.
*
* @param plane The plane to reset the current state of
*/
void
drm_plane_reset_state(struct drm_plane *plane)
{
drm_plane_state_free(plane->state_cur, true);
plane->state_cur = drm_plane_state_alloc(NULL, plane);
plane->state_cur->complete = true;
}
/**
* Return a plane state from a drm_output_state.
*/