compositor-drm: Add support for drm plane FB_DAMAGE_CLIPS property
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/3 compositor-drm: Add support for drm plane FB_DAMAGE_CLIPS property
The plane property FB_DAMAGE_CLIPS provides a way mark damaged regions on the plane in framebuffer coordinates of the framebuffer attached to the plane.
This patch adds a new member "damage" to compositor version of drm_plane_state and set FB_DAMAGE_CLIPS property whenever damage is available.
--- libweston/compositor-drm.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
libweston/compositor-drm.c +35 -0
@@ -129,6 +129,7 @@ enum wdrm_plane_property {WDRM_PLANE_FB_ID ,WDRM_PLANE_CRTC_ID ,WDRM_PLANE_IN_FORMATS , +WDRM_PLANE_FB_DAMAGE_CLIPS , WDRM_PLANE__COUNT };
@@ -171,6 +172,7 @@ static const struct drm_property_info plane_props[] = { [WDRM_PLANE_FB_ID] = { .name = "FB_ID", }, [WDRM_PLANE_CRTC_ID] = { .name = "CRTC_ID", }, [WDRM_PLANE_IN_FORMATS] = { .name = "IN_FORMATS" }, + [WDRM_PLANE_FB_DAMAGE_CLIPS] = { .name = "FB_DAMAGE_CLIPS" }, };/**
@@ -403,6 +405,8 @@ struct drm_plane_state {bool complete; +pixman_region32_t damage;/* damage sent to kernel */ +struct wl_list link;/* drm_output_state::plane_list */ };
@@ -1306,6 +1310,7 @@ drm_plane_state_alloc(struct drm_output_state *state_output,assert (state); state->output_state = state_output; state->plane = plane; +pixman_region32_init (&state->damage);/* Here we only add the plane state to the desired link, and not * set the member. Having an output pointer set means that the
@@ -1336,6 +1341,7 @@ drm_plane_state_free(struct drm_plane_state *state, bool force)wl_list_remove (&state->link);wl_list_init (&state->link); state->output_state =NULL ; +pixman_region32_fini (&state->damage);if (force || state != state->plane->state_cur) {drm_fb_unref (state->fb);
@@ -1373,6 +1379,7 @@ drm_plane_state_duplicate(struct drm_output_state *state_output,if (src->fb) dst->fb =drm_fb_ref (src->fb); dst->output_state = state_output; +pixman_region32_init (&dst->damage); dst->complete = false;return dst;
@@ -2409,6 +2416,33 @@ drm_mode_ensure_blob(struct drm_backend *backend, struct drm_mode *mode)return ret; } +static int +plane_add_damage (drmModeAtomicReq *req,struct drm_backend *backend, +struct drm_plane_state *plane_state) +{ +struct drm_plane *plane = plane_state->plane; +pixman_box32_t *rects; +uint32_t blob_id; +int n_rects; +int ret; + +if (!pixman_region32_not_empty (&plane_state->damage)) +return 0 ; + + rects =pixman_region32_rectangles (&plane_state->damage, &n_rects); + + ret =drmModeCreatePropertyBlob (backend->drm.fd, rects, +sizeof (*rects) * n_rects, &blob_id); +if (ret !=0 ) +return ret; + + ret =plane_add_prop (req, plane,WDRM_PLANE_FB_DAMAGE_CLIPS , blob_id); +if (ret !=0 ) +return ret; + +return 0 ; +} + static int drm_output_apply_state_atomic(struct drm_output_state *state, drmModeAtomicReq *req,
@@ -2477,6 +2511,7 @@ drm_output_apply_state_atomic(struct drm_output_state *state, plane_state->dest_w); ret |=plane_add_prop (req, plane,WDRM_PLANE_CRTC_H , plane_state->dest_h); + ret |=plane_add_damage (req, backend, plane_state);if (ret !=0 ) {weston_log ("couldn't set plane state\n" );
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Deepak Rawat
The plane property
FB_DAMAGE_CLIPSprovides a way mark damaged regions on the plane in framebuffer coordinates of the framebuffer attached to the plane.This patch adds a new member "damage" to compositor version of
drm_plane_stateand setFB_DAMAGE_CLIPSproperty whenever damage is available.Signed-off-by Deepak Rawat <[email protected]>
Note that weston has switched over to gitlab based merge requests:
https://gitlab.freedesktop.org/wayland/weston/blob/master/CONTRIBUTING.md
Cheers, Daniel
Quoted 102 lines
--- libweston/compositor-drm.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)libweston/compositor-drm.c +35
-0@@ -129,6 +129,7 @@ enum wdrm_plane_property {WDRM_PLANE_FB_ID ,WDRM_PLANE_CRTC_ID ,WDRM_PLANE_IN_FORMATS , +WDRM_PLANE_FB_DAMAGE_CLIPS , WDRM_PLANE__COUNT };@@ -171,6 +172,7 @@ static const struct drm_property_info plane_props[] = { [WDRM_PLANE_FB_ID] = { .name = "FB_ID", }, [WDRM_PLANE_CRTC_ID] = { .name = "CRTC_ID", }, [WDRM_PLANE_IN_FORMATS] = { .name = "IN_FORMATS" }, + [WDRM_PLANE_FB_DAMAGE_CLIPS] = { .name = "FB_DAMAGE_CLIPS" }, };/** @@ -403,6 +405,8 @@ struct drm_plane_state {bool complete; +pixman_region32_t damage;/* damage sent to kernel */ +struct wl_list link;/* drm_output_state::plane_list */ };@@ -1306,6 +1310,7 @@ drm_plane_state_alloc(struct drm_output_state *state_output,assert (state); state->output_state = state_output; state->plane = plane; +pixman_region32_init (&state->damage);/* Here we only add the plane state to the desired link, and not * set the member. Having an output pointer set means that the @@ -1336,6 +1341,7 @@ drm_plane_state_free(struct drm_plane_state *state, bool force)wl_list_remove (&state->link);wl_list_init (&state->link); state->output_state =NULL ; +pixman_region32_fini (&state->damage);if (force || state != state->plane->state_cur) {drm_fb_unref (state->fb);@@ -1373,6 +1379,7 @@ drm_plane_state_duplicate(struct drm_output_state *state_output,if (src->fb) dst->fb =drm_fb_ref (src->fb); dst->output_state = state_output; +pixman_region32_init (&dst->damage); dst->complete = false;return dst;@@ -2409,6 +2416,33 @@ drm_mode_ensure_blob(struct drm_backend *backend, struct drm_mode *mode)return ret; } +static int +plane_add_damage (drmModeAtomicReq *req,struct drm_backend *backend, +struct drm_plane_state *plane_state) +{ +struct drm_plane *plane = plane_state->plane; +pixman_box32_t *rects; +uint32_t blob_id; +int n_rects; +int ret; + +if (!pixman_region32_not_empty (&plane_state->damage)) +return 0 ; + + rects =pixman_region32_rectangles (&plane_state->damage, &n_rects); + + ret =drmModeCreatePropertyBlob (backend->drm.fd, rects, +sizeof (*rects) * n_rects, &blob_id); +if (ret !=0 ) +return ret; + + ret =plane_add_prop (req, plane,WDRM_PLANE_FB_DAMAGE_CLIPS , blob_id); +if (ret !=0 ) +return ret; + +return 0 ; +} + static int drm_output_apply_state_atomic(struct drm_output_state *state, drmModeAtomicReq *req,@@ -2477,6 +2511,7 @@ drm_output_apply_state_atomic(struct drm_output_state *state, plane_state->dest_w); ret |=plane_add_prop (req, plane,WDRM_PLANE_CRTC_H , plane_state->dest_h); + ret |=plane_add_damage (req, backend, plane_state);if (ret !=0 ) {weston_log ("couldn't set plane state\n" );Signature · 1 line
2.17.1
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel