Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On 03/06/2018 08:08 AM, Daniel Vetter wrote: On Mon, Mar 05, 2018 at 11:01:42AM +0100, Thomas Hellstrom wrote: On 03/05/2018 10:39 AM, Daniel Vetter wrote: On Mon, Mar 05, 2018 at 10:22:09AM +0100, Thomas Hellstrom wrote: On 03/05/2018 09:37 AM, Daniel Vetter wrote: On Wed, Feb 28, 2018 at 09:10:46PM +, Deepak Singh Rawat wrote: -Original Message- From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf Of Daniel Vetter Sent: Thursday, December 21, 2017 5:11 AM To: Ville Syrjälä Cc: airl...@linux.ie; daniel.vet...@intel.com; dri- de...@lists.freedesktop.org; Lukasz Spintzyk Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 Signed-off-by: Lukasz Spintzyk --- drivers/gpu/drm/drm_atomic.c | 10 ++ drivers/gpu/drm/drm_mode_config.c | 6 ++ drivers/gpu/drm/drm_plane.c | 1 + include/drm/drm_mode_config.h | 5 + include/drm/drm_plane.h | 3 +++ 5 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index b76d49218cf1..cd3b4ed7b04c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; } else if (property == plane->zpos_property) { state->zpos = val; + } else if (property == config->dirty_rects_property) { + bool replaced = false; + int ret = drm_atomic_replace_property_blob_from_id(dev, + &state->dirty_blob, + val, + -1, + &replaced); + return ret; } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; } else if (property == plane->zpos_property) { *val = state->zpos; + } else if (property == config->dirty_rects_property) { + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; } else if (plane->funcs->atomic_get_property) { return plane->funcs->atomic_get_property(plane, state, property, val); } else { diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index bc5c46306b3d..d5f1021c6ece 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.prop_crtc_id = prop; + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, + "DIRTY_RECTS", 0); + if (!prop) + return -ENOMEM; + dev->mode_config.dirty_rects_property = prop; + prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, "ACTIVE"); if (!prop) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 37a93cdffb4a..add110f025e5 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, drm_object_attach_property(&plane->base, config- prop_src_y, 0); drm_object_attach_property(&plane->base, config- prop_src_w, 0); drm_object_attach_property(&plane->base, config- prop_src_h, 0); + drm_object_attach_property(&plane->base, config- dirty_rects_property, 0); } if (config->allow_fb_modifiers) diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index e5f3b43014e1..65f64eb04c0c 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -599,6 +599,11 @@ struct drm_mode_config { * &drm_crtc. */ struct drm_property *prop_crtc_id; + /** +* @dirty_rects_property: Optional plane property to mark damaged +* regions on the plane framebuffer. What exactly would the blob contain? The comment seems to be implying these are in fb coordiantes as opposed to plane crtc coordinates? Not sure which would be more convenient. At least if they're fb coordinates then you probably want some helpers to translate/rotate/scale those rects to the crtc coordinates. Actual use depends on the
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On Mon, Mar 05, 2018 at 11:01:42AM +0100, Thomas Hellstrom wrote: > On 03/05/2018 10:39 AM, Daniel Vetter wrote: > > On Mon, Mar 05, 2018 at 10:22:09AM +0100, Thomas Hellstrom wrote: > > > On 03/05/2018 09:37 AM, Daniel Vetter wrote: > > > > On Wed, Feb 28, 2018 at 09:10:46PM +, Deepak Singh Rawat wrote: > > > > > > -Original Message- > > > > > > From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On > > > > > > Behalf > > > > > > Of Daniel Vetter > > > > > > Sent: Thursday, December 21, 2017 5:11 AM > > > > > > To: Ville Syrjälä > > > > > > Cc: airl...@linux.ie; daniel.vet...@intel.com; dri- > > > > > > de...@lists.freedesktop.org; Lukasz Spintzyk > > > > > > > > > > > > Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property > > > > > > for > > > > > > drm_plane > > > > > > > > > > > > On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: > > > > > > > On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: > > > > > > > > Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 > > > > > > > > Signed-off-by: Lukasz Spintzyk > > > > > > > > --- > > > > > > > >drivers/gpu/drm/drm_atomic.c | 10 ++ > > > > > > > >drivers/gpu/drm/drm_mode_config.c | 6 ++ > > > > > > > >drivers/gpu/drm/drm_plane.c | 1 + > > > > > > > >include/drm/drm_mode_config.h | 5 + > > > > > > > >include/drm/drm_plane.h | 3 +++ > > > > > > > >5 files changed, 25 insertions(+) > > > > > > > > > > > > > > > > diff --git a/drivers/gpu/drm/drm_atomic.c > > > > > > b/drivers/gpu/drm/drm_atomic.c > > > > > > > > index b76d49218cf1..cd3b4ed7b04c 100644 > > > > > > > > --- a/drivers/gpu/drm/drm_atomic.c > > > > > > > > +++ b/drivers/gpu/drm/drm_atomic.c > > > > > > > > @@ -759,6 +759,14 @@ static int > > > > > > > > drm_atomic_plane_set_property(struct > > > > > > drm_plane *plane, > > > > > > > > state->rotation = val; > > > > > > > > } else if (property == plane->zpos_property) { > > > > > > > > state->zpos = val; > > > > > > > > + } else if (property == config->dirty_rects_property) { > > > > > > > > + bool replaced = false; > > > > > > > > + int ret = > > > > > > > > drm_atomic_replace_property_blob_from_id(dev, > > > > > > > > + &state->dirty_blob, > > > > > > > > + val, > > > > > > > > + -1, > > > > > > > > + &replaced); > > > > > > > > + return ret; > > > > > > > > } else if (plane->funcs->atomic_set_property) { > > > > > > > > return plane->funcs->atomic_set_property(plane, > > > > > > > > state, > > > > > > > > property, val); > > > > > > > > @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct > > > > > > drm_plane *plane, > > > > > > > > *val = state->rotation; > > > > > > > > } else if (property == plane->zpos_property) { > > > > > > > > *val = state->zpos; > > > > > > > > + } else if (property == config->dirty_rects_property) { > > > > > > > > + *val = (state->dirty_blob) ? > > > > > > > > state->dirty_blob->base.id : 0; > > > > > > > > } else if (plane->funcs->atomic_get_property) { > > > > > > > > return plane->funcs->atomic_get_property(plane, > > > > > > > > state, > > > > > > propert
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On 03/05/2018 10:39 AM, Daniel Vetter wrote: On Mon, Mar 05, 2018 at 10:22:09AM +0100, Thomas Hellstrom wrote: On 03/05/2018 09:37 AM, Daniel Vetter wrote: On Wed, Feb 28, 2018 at 09:10:46PM +, Deepak Singh Rawat wrote: -Original Message- From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf Of Daniel Vetter Sent: Thursday, December 21, 2017 5:11 AM To: Ville Syrjälä Cc: airl...@linux.ie; daniel.vet...@intel.com; dri- de...@lists.freedesktop.org; Lukasz Spintzyk Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 Signed-off-by: Lukasz Spintzyk --- drivers/gpu/drm/drm_atomic.c | 10 ++ drivers/gpu/drm/drm_mode_config.c | 6 ++ drivers/gpu/drm/drm_plane.c | 1 + include/drm/drm_mode_config.h | 5 + include/drm/drm_plane.h | 3 +++ 5 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index b76d49218cf1..cd3b4ed7b04c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; } else if (property == plane->zpos_property) { state->zpos = val; + } else if (property == config->dirty_rects_property) { + bool replaced = false; + int ret = drm_atomic_replace_property_blob_from_id(dev, + &state->dirty_blob, + val, + -1, + &replaced); + return ret; } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; } else if (property == plane->zpos_property) { *val = state->zpos; + } else if (property == config->dirty_rects_property) { + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; } else if (plane->funcs->atomic_get_property) { return plane->funcs->atomic_get_property(plane, state, property, val); } else { diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index bc5c46306b3d..d5f1021c6ece 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.prop_crtc_id = prop; + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, + "DIRTY_RECTS", 0); + if (!prop) + return -ENOMEM; + dev->mode_config.dirty_rects_property = prop; + prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, "ACTIVE"); if (!prop) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 37a93cdffb4a..add110f025e5 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, drm_object_attach_property(&plane->base, config- prop_src_y, 0); drm_object_attach_property(&plane->base, config- prop_src_w, 0); drm_object_attach_property(&plane->base, config- prop_src_h, 0); + drm_object_attach_property(&plane->base, config- dirty_rects_property, 0); } if (config->allow_fb_modifiers) diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index e5f3b43014e1..65f64eb04c0c 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -599,6 +599,11 @@ struct drm_mode_config { * &drm_crtc. */ struct drm_property *prop_crtc_id; + /** +* @dirty_rects_property: Optional plane property to mark damaged +* regions on the plane framebuffer. What exactly would the blob contain? The comment seems to be implying these are in fb coordiantes as opposed to plane crtc coordinates? Not sure which would be more convenient. At least if they're fb coordinates then you probably want some helpers to translate/rotate/scale those rects to the crtc coordinates. Actual use depends on the driver/hw I suppose. Yeah I think we also should add a decoded state to the drm_plane_state, which has the full struct
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On Mon, Mar 05, 2018 at 10:22:09AM +0100, Thomas Hellstrom wrote: > On 03/05/2018 09:37 AM, Daniel Vetter wrote: > > On Wed, Feb 28, 2018 at 09:10:46PM +, Deepak Singh Rawat wrote: > > > > > > > -Original Message- > > > > From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On > > > > Behalf > > > > Of Daniel Vetter > > > > Sent: Thursday, December 21, 2017 5:11 AM > > > > To: Ville Syrjälä > > > > Cc: airl...@linux.ie; daniel.vet...@intel.com; dri- > > > > de...@lists.freedesktop.org; Lukasz Spintzyk > > > > > > > > Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for > > > > drm_plane > > > > > > > > On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: > > > > > On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: > > > > > > Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 > > > > > > Signed-off-by: Lukasz Spintzyk > > > > > > --- > > > > > > drivers/gpu/drm/drm_atomic.c | 10 ++ > > > > > > drivers/gpu/drm/drm_mode_config.c | 6 ++ > > > > > > drivers/gpu/drm/drm_plane.c | 1 + > > > > > > include/drm/drm_mode_config.h | 5 + > > > > > > include/drm/drm_plane.h | 3 +++ > > > > > > 5 files changed, 25 insertions(+) > > > > > > > > > > > > diff --git a/drivers/gpu/drm/drm_atomic.c > > > > b/drivers/gpu/drm/drm_atomic.c > > > > > > index b76d49218cf1..cd3b4ed7b04c 100644 > > > > > > --- a/drivers/gpu/drm/drm_atomic.c > > > > > > +++ b/drivers/gpu/drm/drm_atomic.c > > > > > > @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct > > > > drm_plane *plane, > > > > > > state->rotation = val; > > > > > > } else if (property == plane->zpos_property) { > > > > > > state->zpos = val; > > > > > > + } else if (property == config->dirty_rects_property) { > > > > > > + bool replaced = false; > > > > > > + int ret = drm_atomic_replace_property_blob_from_id(dev, > > > > > > + &state->dirty_blob, > > > > > > + val, > > > > > > + -1, > > > > > > + &replaced); > > > > > > + return ret; > > > > > > } else if (plane->funcs->atomic_set_property) { > > > > > > return plane->funcs->atomic_set_property(plane, state, > > > > > > property, val); > > > > > > @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct > > > > drm_plane *plane, > > > > > > *val = state->rotation; > > > > > > } else if (property == plane->zpos_property) { > > > > > > *val = state->zpos; > > > > > > + } else if (property == config->dirty_rects_property) { > > > > > > + *val = (state->dirty_blob) ? state->dirty_blob->base.id > > > > > > : 0; > > > > > > } else if (plane->funcs->atomic_get_property) { > > > > > > return plane->funcs->atomic_get_property(plane, state, > > > > property, val); > > > > > > } else { > > > > > > diff --git a/drivers/gpu/drm/drm_mode_config.c > > > > b/drivers/gpu/drm/drm_mode_config.c > > > > > > index bc5c46306b3d..d5f1021c6ece 100644 > > > > > > --- a/drivers/gpu/drm/drm_mode_config.c > > > > > > +++ b/drivers/gpu/drm/drm_mode_config.c > > > > > > @@ -293,6 +293,12 @@ static int > > > > drm_mode_create_standard_properties(struct drm_device *dev) > > > > > > return -ENOMEM; > > > > > > dev->mode_config.prop_crtc_id = prop; > > > > > > > > > > > > + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, > > > > > > + "DIRTY_RECTS", 0); > > > > > > + if (!prop) > > > > > > + return -ENOMEM; > > > >
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On 03/05/2018 09:37 AM, Daniel Vetter wrote: On Wed, Feb 28, 2018 at 09:10:46PM +, Deepak Singh Rawat wrote: -Original Message- From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf Of Daniel Vetter Sent: Thursday, December 21, 2017 5:11 AM To: Ville Syrjälä Cc: airl...@linux.ie; daniel.vet...@intel.com; dri- de...@lists.freedesktop.org; Lukasz Spintzyk Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 Signed-off-by: Lukasz Spintzyk --- drivers/gpu/drm/drm_atomic.c | 10 ++ drivers/gpu/drm/drm_mode_config.c | 6 ++ drivers/gpu/drm/drm_plane.c | 1 + include/drm/drm_mode_config.h | 5 + include/drm/drm_plane.h | 3 +++ 5 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index b76d49218cf1..cd3b4ed7b04c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; } else if (property == plane->zpos_property) { state->zpos = val; + } else if (property == config->dirty_rects_property) { + bool replaced = false; + int ret = drm_atomic_replace_property_blob_from_id(dev, + &state->dirty_blob, + val, + -1, + &replaced); + return ret; } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; } else if (property == plane->zpos_property) { *val = state->zpos; + } else if (property == config->dirty_rects_property) { + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; } else if (plane->funcs->atomic_get_property) { return plane->funcs->atomic_get_property(plane, state, property, val); } else { diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index bc5c46306b3d..d5f1021c6ece 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.prop_crtc_id = prop; + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, + "DIRTY_RECTS", 0); + if (!prop) + return -ENOMEM; + dev->mode_config.dirty_rects_property = prop; + prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, "ACTIVE"); if (!prop) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 37a93cdffb4a..add110f025e5 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, drm_object_attach_property(&plane->base, config- prop_src_y, 0); drm_object_attach_property(&plane->base, config- prop_src_w, 0); drm_object_attach_property(&plane->base, config- prop_src_h, 0); + drm_object_attach_property(&plane->base, config- dirty_rects_property, 0); } if (config->allow_fb_modifiers) diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index e5f3b43014e1..65f64eb04c0c 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -599,6 +599,11 @@ struct drm_mode_config { * &drm_crtc. */ struct drm_property *prop_crtc_id; + /** +* @dirty_rects_property: Optional plane property to mark damaged +* regions on the plane framebuffer. What exactly would the blob contain? The comment seems to be implying these are in fb coordiantes as opposed to plane crtc coordinates? Not sure which would be more convenient. At least if they're fb coordinates then you probably want some helpers to translate/rotate/scale those rects to the crtc coordinates. Actual use depends on the driver/hw I suppose. Yeah I think we also should add a decoded state to the drm_plane_state, which has the full structure and all the details. Hi Daniel, I am working on this functionality to implement the helper functions to con
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On Wed, Feb 28, 2018 at 09:10:46PM +, Deepak Singh Rawat wrote: > > > > -Original Message- > > From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf > > Of Daniel Vetter > > Sent: Thursday, December 21, 2017 5:11 AM > > To: Ville Syrjälä > > Cc: airl...@linux.ie; daniel.vet...@intel.com; dri- > > de...@lists.freedesktop.org; Lukasz Spintzyk > > > > Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for > > drm_plane > > > > On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: > > > On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: > > > > Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 > > > > Signed-off-by: Lukasz Spintzyk > > > > --- > > > > drivers/gpu/drm/drm_atomic.c | 10 ++ > > > > drivers/gpu/drm/drm_mode_config.c | 6 ++ > > > > drivers/gpu/drm/drm_plane.c | 1 + > > > > include/drm/drm_mode_config.h | 5 + > > > > include/drm/drm_plane.h | 3 +++ > > > > 5 files changed, 25 insertions(+) > > > > > > > > diff --git a/drivers/gpu/drm/drm_atomic.c > > b/drivers/gpu/drm/drm_atomic.c > > > > index b76d49218cf1..cd3b4ed7b04c 100644 > > > > --- a/drivers/gpu/drm/drm_atomic.c > > > > +++ b/drivers/gpu/drm/drm_atomic.c > > > > @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct > > drm_plane *plane, > > > > state->rotation = val; > > > > } else if (property == plane->zpos_property) { > > > > state->zpos = val; > > > > + } else if (property == config->dirty_rects_property) { > > > > + bool replaced = false; > > > > + int ret = drm_atomic_replace_property_blob_from_id(dev, > > > > + &state->dirty_blob, > > > > + val, > > > > + -1, > > > > + &replaced); > > > > + return ret; > > > > } else if (plane->funcs->atomic_set_property) { > > > > return plane->funcs->atomic_set_property(plane, state, > > > > property, val); > > > > @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct > > drm_plane *plane, > > > > *val = state->rotation; > > > > } else if (property == plane->zpos_property) { > > > > *val = state->zpos; > > > > + } else if (property == config->dirty_rects_property) { > > > > + *val = (state->dirty_blob) ? state->dirty_blob->base.id > > > > : 0; > > > > } else if (plane->funcs->atomic_get_property) { > > > > return plane->funcs->atomic_get_property(plane, state, > > property, val); > > > > } else { > > > > diff --git a/drivers/gpu/drm/drm_mode_config.c > > b/drivers/gpu/drm/drm_mode_config.c > > > > index bc5c46306b3d..d5f1021c6ece 100644 > > > > --- a/drivers/gpu/drm/drm_mode_config.c > > > > +++ b/drivers/gpu/drm/drm_mode_config.c > > > > @@ -293,6 +293,12 @@ static int > > drm_mode_create_standard_properties(struct drm_device *dev) > > > > return -ENOMEM; > > > > dev->mode_config.prop_crtc_id = prop; > > > > > > > > + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, > > > > + "DIRTY_RECTS", 0); > > > > + if (!prop) > > > > + return -ENOMEM; > > > > + dev->mode_config.dirty_rects_property = prop; > > > > + > > > > prop = drm_property_create_bool(dev, > > DRM_MODE_PROP_ATOMIC, > > > > "ACTIVE"); > > > > if (!prop) > > > > diff --git a/drivers/gpu/drm/drm_plane.c > > b/drivers/gpu/drm/drm_plane.c > > > > index 37a93cdffb4a..add110f025e5 100644 > > > > --- a/drivers/gpu/drm/drm_plane.c > > > > +++ b/drivers/gpu/drm/drm_plane.c > > > > @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device > > *dev, struct drm_plane *plane, > > > > drm_object_attach_property(&p
RE: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
> -Original Message- > From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf > Of Daniel Vetter > Sent: Thursday, December 21, 2017 5:11 AM > To: Ville Syrjälä > Cc: airl...@linux.ie; daniel.vet...@intel.com; dri- > de...@lists.freedesktop.org; Lukasz Spintzyk > > Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for > drm_plane > > On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: > > On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: > > > Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 > > > Signed-off-by: Lukasz Spintzyk > > > --- > > > drivers/gpu/drm/drm_atomic.c | 10 ++ > > > drivers/gpu/drm/drm_mode_config.c | 6 ++ > > > drivers/gpu/drm/drm_plane.c | 1 + > > > include/drm/drm_mode_config.h | 5 + > > > include/drm/drm_plane.h | 3 +++ > > > 5 files changed, 25 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/drm_atomic.c > b/drivers/gpu/drm/drm_atomic.c > > > index b76d49218cf1..cd3b4ed7b04c 100644 > > > --- a/drivers/gpu/drm/drm_atomic.c > > > +++ b/drivers/gpu/drm/drm_atomic.c > > > @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct > drm_plane *plane, > > > state->rotation = val; > > > } else if (property == plane->zpos_property) { > > > state->zpos = val; > > > + } else if (property == config->dirty_rects_property) { > > > + bool replaced = false; > > > + int ret = drm_atomic_replace_property_blob_from_id(dev, > > > + &state->dirty_blob, > > > + val, > > > + -1, > > > + &replaced); > > > + return ret; > > > } else if (plane->funcs->atomic_set_property) { > > > return plane->funcs->atomic_set_property(plane, state, > > > property, val); > > > @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct > drm_plane *plane, > > > *val = state->rotation; > > > } else if (property == plane->zpos_property) { > > > *val = state->zpos; > > > + } else if (property == config->dirty_rects_property) { > > > + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; > > > } else if (plane->funcs->atomic_get_property) { > > > return plane->funcs->atomic_get_property(plane, state, > property, val); > > > } else { > > > diff --git a/drivers/gpu/drm/drm_mode_config.c > b/drivers/gpu/drm/drm_mode_config.c > > > index bc5c46306b3d..d5f1021c6ece 100644 > > > --- a/drivers/gpu/drm/drm_mode_config.c > > > +++ b/drivers/gpu/drm/drm_mode_config.c > > > @@ -293,6 +293,12 @@ static int > drm_mode_create_standard_properties(struct drm_device *dev) > > > return -ENOMEM; > > > dev->mode_config.prop_crtc_id = prop; > > > > > > + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, > > > + "DIRTY_RECTS", 0); > > > + if (!prop) > > > + return -ENOMEM; > > > + dev->mode_config.dirty_rects_property = prop; > > > + > > > prop = drm_property_create_bool(dev, > DRM_MODE_PROP_ATOMIC, > > > "ACTIVE"); > > > if (!prop) > > > diff --git a/drivers/gpu/drm/drm_plane.c > b/drivers/gpu/drm/drm_plane.c > > > index 37a93cdffb4a..add110f025e5 100644 > > > --- a/drivers/gpu/drm/drm_plane.c > > > +++ b/drivers/gpu/drm/drm_plane.c > > > @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device > *dev, struct drm_plane *plane, > > > drm_object_attach_property(&plane->base, config- > >prop_src_y, 0); > > > drm_object_attach_property(&plane->base, config- > >prop_src_w, 0); > > > drm_object_attach_property(&plane->base, config- > >prop_src_h, 0); > > > + drm_object_attach_property(&plane->base, config- > >dirty_rects_property, 0); > > > } > > > > > > if (config->allow_fb_modifiers) > > > diff --git a/include/drm/drm_mode_config.h > b/include/drm/drm_mode_config.h > > > index e5f3b43014e1..65f64eb04c0c 100644 > > > --- a/include/drm/drm_mode_config.h > > > +++ b/include/drm/drm_mode_config.h
RE: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
Hi Lukasz, I hope you are doing great. I was busy with some other stuff but now will be working on page-flip damage. At this point I have high level understanding of what changes to make and before I start just wanted to confirm from you, whether you have made any progress to avoid duplicate work. Thanks, Deepak From: Lukasz Spintzyk [mailto:lukasz.spint...@displaylink.com] Sent: Thursday, January 4, 2018 5:53 AM To: Thomas Hellstrom ; dri-devel@lists.freedesktop.org; daniel.vet...@intel.com; gust...@padovan.org; seanp...@chromium.org; airl...@linux.ie; Deepak Singh Rawat Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane On 28/12/2017 10:03, Thomas Hellstrom wrote: Hi, Lukasz! (Sorry for top-posting). We have Deepak from our team working on the same subject. I think he's in over the holidays so I'll add him to the CC list. Great! Adding damage to the plane state is, IMO the correct way to do it. However, from your proposal it's not clear whether damage is given in the plane-, crtc- or framebuffer coordinates. The last conclusion from our email thread discussion was that they should be given in framebuffer coordinates with helpers to compute plane coordinates or crtc coordinates. The reason being that it's easier for user-space apps to send damage that way, and again, we have the full information that we can clip and scale if necessary. Most drivers probably want the damage in clipped plane- or crtc coordinates. Helpers could for example be in the form of region iterators. Personally i don't know the difference between plane rects and framebuffer rects. I don't know what would be better. I was thinking about coordinates of framebuffer that is attached to drm_plane_state. Full (multi-rect) damage regions are OK with us, although we should keep in mind that we won't be able to compute region unions in the kernel (yet?). Implying: Should we forbid overlapping rects at the interface level or should we just recommend rects not to be overlapping? The former would be pretty hard to enforce efficiently. I would be for recommendation. We can add some helper functions to combine rects and set some limits on number of rects to prevent abuse of that interface. Another thing we should think about is how to use this interface for the legacy "dirtyfb" call. Probably we need to clear the damage property on each state-update, or set a flag that "this is a dirtyfb state update". IMO we should also have as an end goal of this work to have gnome-shell on drm sending damage regions on page-flip, which means either porting gnome-shell to atomic or set up a new legacy page-flip-with-atomic ioctl. Can't we reuse dirtyfb ioctl for this purpose? It would be called before page_flip ioctl? /Thomas On 12/21/2017 12:10 PM, Lukasz Spintzyk wrote: Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 Signed-off-by: Lukasz Spintzyk mailto:lukasz.spint...@displaylink.com --- drivers/gpu/drm/drm_atomic.c | 10 ++ drivers/gpu/drm/drm_mode_config.c | 6 ++ drivers/gpu/drm/drm_plane.c | 1 + include/drm/drm_mode_config.h | 5 + include/drm/drm_plane.h | 3 +++ 5 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index b76d49218cf1..cd3b4ed7b04c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; } else if (property == plane->zpos_property) { state->zpos = val; + } else if (property == config->dirty_rects_property) { + bool replaced = false; + int ret = drm_atomic_replace_property_blob_from_id(dev, + &state->dirty_blob, + val, + -1, + &replaced); + return ret; } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; } else if (property == plane->zpos_property) { *val = state->zpos; + } else if (property == config->dirty_rects_property) { + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; } else if (plane->funcs->atomic_get_property) { return plane->funcs->atomic_get_property(plane, state, property, val); } else { diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index bc5c46306b3d..d5f1021c6ece 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -293,6 +293,12 @@ static int drm_mode_create_s
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
Hi, On 01/04/2018 02:52 PM, Lukasz Spintzyk wrote: On 28/12/2017 10:03, Thomas Hellstrom wrote: Hi, Lukasz! (Sorry for top-posting). We have Deepak from our team working on the same subject. I think he's in over the holidays so I'll add him to the CC list. Great! Adding damage to the plane state is, IMO the correct way to do it. However, from your proposal it's not clear whether damage is given in the plane-, crtc- or framebuffer coordinates. The last conclusion from our email thread discussion was that they should be given in framebuffer coordinates with helpers to compute plane coordinates or crtc coordinates. The reason being that it's easier for user-space apps to send damage that way, and again, we have the full information that we can clip and scale if necessary. Most drivers probably want the damage in clipped plane- or crtc coordinates. Helpers could for example be in the form of region iterators. Personally i don't know the difference between plane rects and framebuffer rects. I don't know what would be better. I was thinking about coordinates of framebuffer that is attached to drm_plane_state. A given point with coordinates (0, 0) in the plane coordinate system would have (state->crtc_x, state->crtc_y) in the crtc coordinate system and (state->src_x, state->src_y) in the framebuffer coordinate system. So the question is, which is the suitable coordinate system, and where is the origin for the damage rects? Full (multi-rect) damage regions are OK with us, although we should keep in mind that we won't be able to compute region unions in the kernel (yet?). Implying: Should we forbid overlapping rects at the interface level or should we just recommend rects not to be overlapping? The former would be pretty hard to enforce efficiently. I would be for recommendation. We can add some helper functions to combine rects and set some limits on number of rects to prevent abuse of that interface. I agree. Another thing we should think about is how to use this interface for the legacy "dirtyfb" call. Probably we need to clear the damage property on each state-update, or set a flag that "this is a dirtyfb state update". IMO we should also have as an end goal of this work to have gnome-shell on drm sending damage regions on page-flip, which means either porting gnome-shell to atomic or set up a new legacy page-flip-with-atomic ioctl. Can't we reuse dirtyfb ioctl for this purpose? It would be called before page_flip ioctl? No we can't. The dirtyfb ioctl causes an immediate repaint of the damaged region. /Thomas ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On 28/12/2017 10:03, Thomas Hellstrom wrote: Hi, Lukasz! (Sorry for top-posting). We have Deepak from our team working on the same subject. I think he's in over the holidays so I'll add him to the CC list. Great! Adding damage to the plane state is, IMO the correct way to do it. However, from your proposal it's not clear whether damage is given in the plane-, crtc- or framebuffer coordinates. The last conclusion from our email thread discussion was that they should be given in framebuffer coordinates with helpers to compute plane coordinates or crtc coordinates. The reason being that it's easier for user-space apps to send damage that way, and again, we have the full information that we can clip and scale if necessary. Most drivers probably want the damage in clipped plane- or crtc coordinates. Helpers could for example be in the form of region iterators. Personally i don't know the difference between plane rects and framebuffer rects. I don't know what would be better. I was thinking about coordinates of framebuffer that is attached to drm_plane_state. Full (multi-rect) damage regions are OK with us, although we should keep in mind that we won't be able to compute region unions in the kernel (yet?). Implying: Should we forbid overlapping rects at the interface level or should we just recommend rects not to be overlapping? The former would be pretty hard to enforce efficiently. I would be for recommendation. We can add some helper functions to combine rects and set some limits on number of rects to prevent abuse of that interface. Another thing we should think about is how to use this interface for the legacy "dirtyfb" call. Probably we need to clear the damage property on each state-update, or set a flag that "this is a dirtyfb state update". IMO we should also have as an end goal of this work to have gnome-shell on drm sending damage regions on page-flip, which means either porting gnome-shell to atomic or set up a new legacy page-flip-with-atomic ioctl. Can't we reuse dirtyfb ioctl for this purpose? It would be called before page_flip ioctl? /Thomas On 12/21/2017 12:10 PM, Lukasz Spintzyk wrote: Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 Signed-off-by: Lukasz Spintzyk --- drivers/gpu/drm/drm_atomic.c | 10 ++ drivers/gpu/drm/drm_mode_config.c | 6 ++ drivers/gpu/drm/drm_plane.c | 1 + include/drm/drm_mode_config.h | 5 + include/drm/drm_plane.h | 3 +++ 5 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index b76d49218cf1..cd3b4ed7b04c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; } else if (property == plane->zpos_property) { state->zpos = val; + } else if (property == config->dirty_rects_property) { + bool replaced = false; + int ret = drm_atomic_replace_property_blob_from_id(dev, + &state->dirty_blob, + val, + -1, + &replaced); + return ret; } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; } else if (property == plane->zpos_property) { *val = state->zpos; + } else if (property == config->dirty_rects_property) { + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; } else if (plane->funcs->atomic_get_property) { return plane->funcs->atomic_get_property(plane, state, property, val); } else { diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index bc5c46306b3d..d5f1021c6ece 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.prop_crtc_id = prop; + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, + "DIRTY_RECTS", 0); + if (!prop) + return -ENOMEM; + dev->mode_config.dirty_rects_property = prop; + prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, "ACTIVE"); if (!prop) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 37a93cdffb4a..add110f025e5 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, drm_object_attach_property(&plane->base, config->prop_src_y, 0); drm_object_attach_property(&plane->base, config->prop_src_w, 0); drm_object_attach_property(&plane->ba
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
Hi, Lukasz! (Sorry for top-posting). We have Deepak from our team working on the same subject. I think he's in over the holidays so I'll add him to the CC list. Adding damage to the plane state is, IMO the correct way to do it. However, from your proposal it's not clear whether damage is given in the plane-, crtc- or framebuffer coordinates. The last conclusion from our email thread discussion was that they should be given in framebuffer coordinates with helpers to compute plane coordinates or crtc coordinates. The reason being that it's easier for user-space apps to send damage that way, and again, we have the full information that we can clip and scale if necessary. Most drivers probably want the damage in clipped plane- or crtc coordinates. Helpers could for example be in the form of region iterators. Full (multi-rect) damage regions are OK with us, although we should keep in mind that we won't be able to compute region unions in the kernel (yet?). Implying: Should we forbid overlapping rects at the interface level or should we just recommend rects not to be overlapping? The former would be pretty hard to enforce efficiently. Another thing we should think about is how to use this interface for the legacy "dirtyfb" call. Probably we need to clear the damage property on each state-update, or set a flag that "this is a dirtyfb state update". IMO we should also have as an end goal of this work to have gnome-shell on drm sending damage regions on page-flip, which means either porting gnome-shell to atomic or set up a new legacy page-flip-with-atomic ioctl. /Thomas On 12/21/2017 12:10 PM, Lukasz Spintzyk wrote: Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 Signed-off-by: Lukasz Spintzyk --- drivers/gpu/drm/drm_atomic.c | 10 ++ drivers/gpu/drm/drm_mode_config.c | 6 ++ drivers/gpu/drm/drm_plane.c | 1 + include/drm/drm_mode_config.h | 5 + include/drm/drm_plane.h | 3 +++ 5 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index b76d49218cf1..cd3b4ed7b04c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; } else if (property == plane->zpos_property) { state->zpos = val; + } else if (property == config->dirty_rects_property) { + bool replaced = false; + int ret = drm_atomic_replace_property_blob_from_id(dev, + &state->dirty_blob, + val, + -1, + &replaced); + return ret; } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; } else if (property == plane->zpos_property) { *val = state->zpos; + } else if (property == config->dirty_rects_property) { + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; } else if (plane->funcs->atomic_get_property) { return plane->funcs->atomic_get_property(plane, state, property, val); } else { diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index bc5c46306b3d..d5f1021c6ece 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.prop_crtc_id = prop; + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, + "DIRTY_RECTS", 0); + if (!prop) + return -ENOMEM; + dev->mode_config.dirty_rects_property = prop; + prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, "ACTIVE"); if (!prop) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 37a93cdffb4a..add110f025e5 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, drm_object_attach_property(&plane->base, config->prop_src_y, 0); drm_object_attach_property(&plane->base, config->prop_src_w, 0); drm_object_attach_property(&plane->base, config->prop_src_h, 0); + drm_object_attach_property(&plane->base, config->dirty_rects_property, 0); } if (config->allow_fb_modifiers) diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index e5f3b43014e1..65f64eb04c0c 100644 --
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
Thanks Ville and Daniel for for your response. I will try to come back with something later. thanks Lukasz On 21/12/2017 14:10, Daniel Vetter wrote: On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: > On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: > > Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 > > Signed-off-by: Lukasz Spintzyk > > --- > > drivers/gpu/drm/drm_atomic.c | 10 ++ > > drivers/gpu/drm/drm_mode_config.c | 6 ++ > > drivers/gpu/drm/drm_plane.c | 1 + > > include/drm/drm_mode_config.h | 5 + > > include/drm/drm_plane.h | 3 +++ > > 5 files changed, 25 insertions(+) > > > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > > index b76d49218cf1..cd3b4ed7b04c 100644 > > --- a/drivers/gpu/drm/drm_atomic.c > > +++ b/drivers/gpu/drm/drm_atomic.c > > @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, > > state->rotation = val; > > } else if (property == plane->zpos_property) { > > state->zpos = val; > > + } else if (property == config->dirty_rects_property) { > > + bool replaced = false; > > + int ret = drm_atomic_replace_property_blob_from_id(dev, > > + &state->dirty_blob, > > + val, > > + -1, > > + &replaced); > > + return ret; > > } else if (plane->funcs->atomic_set_property) { > > return plane->funcs->atomic_set_property(plane, state, > > property, val); > > @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, > > *val = state->rotation; > > } else if (property == plane->zpos_property) { > > *val = state->zpos; > > + } else if (property == config->dirty_rects_property) { > > + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; > > } else if (plane->funcs->atomic_get_property) { > > return plane->funcs->atomic_get_property(plane, state, property, val); > > } else { > > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c > > index bc5c46306b3d..d5f1021c6ece 100644 > > --- a/drivers/gpu/drm/drm_mode_config.c > > +++ b/drivers/gpu/drm/drm_mode_config.c > > @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) > > return -ENOMEM; > > dev->mode_config.prop_crtc_id = prop; > > > > + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, > > + "DIRTY_RECTS", 0); > > + if (!prop) > > + return -ENOMEM; > > + dev->mode_config.dirty_rects_property = prop; > > + > > prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, > > "ACTIVE"); > > if (!prop) > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c > > index 37a93cdffb4a..add110f025e5 100644 > > --- a/drivers/gpu/drm/drm_plane.c > > +++ b/drivers/gpu/drm/drm_plane.c > > @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, > > drm_object_attach_property(&plane->base, config->prop_src_y, 0); > > drm_object_attach_property(&plane->base, config->prop_src_w, 0); > > drm_object_attach_property(&plane->base, config->prop_src_h, 0); > > + drm_object_attach_property(&plane->base, config->dirty_rects_property, 0); > > } > > > > if (config->allow_fb_modifiers) > > diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h > > index e5f3b43014e1..65f64eb04c0c 100644 > > --- a/include/drm/drm_mode_config.h > > +++ b/include/drm/drm_mode_config.h > > @@ -599,6 +599,11 @@ struct drm_mode_config { > > * &drm_crtc. > > */ > > struct drm_property *prop_crtc_id; > > + /** > > + * @dirty_rects_property: Optional plane property to mark damaged > > + * regions on the plane framebuffer. > > What exactly would the blob contain? > > The comment seems to be implying these are in fb coordiantes as > opposed to plane crtc coordinates? Not sure which would be more > convenient. At least if they're fb coordinates then you probably > want some helpers to translate/rotate/scale those rects to the > crtc coordinates. Actual use depends on the driver/hw I suppose. Yeah I think we also should add a decoded state to the drm_plane_state, which has the full structure and all the details. Ok. Initially for model I was thinking to take struct drm_drawable_info with simple c style array of struct drm_clip_rect *rects in it. Do you think that something more complex will be needed? And when we discussed this iirc we've identified a clear need for at least some drivers to deal in crtc dirty rectangles. I think the initial core support should include a helper which takes an atomic update for a given crtc, and converts all the plane dirty rectangles into crtc rectangles. Including any full-plane or full-crtc upgrades needed due to e.g. reposition, changed gamma, changed blendign/zpos or anything else really that would affect the entire plane respectively crtc. That would also provide a really good model for what damage actually means. Ok. Plus ofc we need userspace for this, preferrably as a patch to something generic like weston or xfree86-video-modesetting. And an example kernel im
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On Thu, Dec 21, 2017 at 02:46:55PM +0200, Ville Syrjälä wrote: > On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: > > Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 > > Signed-off-by: Lukasz Spintzyk > > --- > > drivers/gpu/drm/drm_atomic.c | 10 ++ > > drivers/gpu/drm/drm_mode_config.c | 6 ++ > > drivers/gpu/drm/drm_plane.c | 1 + > > include/drm/drm_mode_config.h | 5 + > > include/drm/drm_plane.h | 3 +++ > > 5 files changed, 25 insertions(+) > > > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > > index b76d49218cf1..cd3b4ed7b04c 100644 > > --- a/drivers/gpu/drm/drm_atomic.c > > +++ b/drivers/gpu/drm/drm_atomic.c > > @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct > > drm_plane *plane, > > state->rotation = val; > > } else if (property == plane->zpos_property) { > > state->zpos = val; > > + } else if (property == config->dirty_rects_property) { > > + bool replaced = false; > > + int ret = drm_atomic_replace_property_blob_from_id(dev, > > + &state->dirty_blob, > > + val, > > + -1, > > + &replaced); > > + return ret; > > } else if (plane->funcs->atomic_set_property) { > > return plane->funcs->atomic_set_property(plane, state, > > property, val); > > @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, > > *val = state->rotation; > > } else if (property == plane->zpos_property) { > > *val = state->zpos; > > + } else if (property == config->dirty_rects_property) { > > + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; > > } else if (plane->funcs->atomic_get_property) { > > return plane->funcs->atomic_get_property(plane, state, > > property, val); > > } else { > > diff --git a/drivers/gpu/drm/drm_mode_config.c > > b/drivers/gpu/drm/drm_mode_config.c > > index bc5c46306b3d..d5f1021c6ece 100644 > > --- a/drivers/gpu/drm/drm_mode_config.c > > +++ b/drivers/gpu/drm/drm_mode_config.c > > @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct > > drm_device *dev) > > return -ENOMEM; > > dev->mode_config.prop_crtc_id = prop; > > > > + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, > > + "DIRTY_RECTS", 0); > > + if (!prop) > > + return -ENOMEM; > > + dev->mode_config.dirty_rects_property = prop; > > + > > prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, > > "ACTIVE"); > > if (!prop) > > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c > > index 37a93cdffb4a..add110f025e5 100644 > > --- a/drivers/gpu/drm/drm_plane.c > > +++ b/drivers/gpu/drm/drm_plane.c > > @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, > > struct drm_plane *plane, > > drm_object_attach_property(&plane->base, config->prop_src_y, 0); > > drm_object_attach_property(&plane->base, config->prop_src_w, 0); > > drm_object_attach_property(&plane->base, config->prop_src_h, 0); > > + drm_object_attach_property(&plane->base, > > config->dirty_rects_property, 0); > > } > > > > if (config->allow_fb_modifiers) > > diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h > > index e5f3b43014e1..65f64eb04c0c 100644 > > --- a/include/drm/drm_mode_config.h > > +++ b/include/drm/drm_mode_config.h > > @@ -599,6 +599,11 @@ struct drm_mode_config { > > * &drm_crtc. > > */ > > struct drm_property *prop_crtc_id; > > + /** > > +* @dirty_rects_property: Optional plane property to mark damaged > > +* regions on the plane framebuffer. > > What exactly would the blob contain? > > The comment seems to be implying these are in fb coordiantes as > opposed to plane crtc coordinates? Not sure which would be more > convenient. At least if they're fb coordinates then you probably > want some helpers to translate/rotate/scale those rects to the > crtc coordinates. Actual use depends on the driver/hw I suppose. Yeah I think we also should add a decoded state to the drm_plane_state, which has the full structure and all the details. And when we discussed this iirc we've identified a clear need for at least some drivers to deal in crtc dirty rectangles. I think the initial core support should include a helper which takes an atomic update for a given crtc, and converts all the plane dirty rectangles into crtc rectangles. Including any full-plane or full-crtc upgrades needed due to e.g. reposition, changed gamma, changed blendign/zpos or anything else really that would affect the entire plane respectively crtc. That would also provide a really good model for what damage actually m
Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane
On Thu, Dec 21, 2017 at 12:10:08PM +0100, Lukasz Spintzyk wrote: > Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 > Signed-off-by: Lukasz Spintzyk > --- > drivers/gpu/drm/drm_atomic.c | 10 ++ > drivers/gpu/drm/drm_mode_config.c | 6 ++ > drivers/gpu/drm/drm_plane.c | 1 + > include/drm/drm_mode_config.h | 5 + > include/drm/drm_plane.h | 3 +++ > 5 files changed, 25 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index b76d49218cf1..cd3b4ed7b04c 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct > drm_plane *plane, > state->rotation = val; > } else if (property == plane->zpos_property) { > state->zpos = val; > + } else if (property == config->dirty_rects_property) { > + bool replaced = false; > + int ret = drm_atomic_replace_property_blob_from_id(dev, > + &state->dirty_blob, > + val, > + -1, > + &replaced); > + return ret; > } else if (plane->funcs->atomic_set_property) { > return plane->funcs->atomic_set_property(plane, state, > property, val); > @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, > *val = state->rotation; > } else if (property == plane->zpos_property) { > *val = state->zpos; > + } else if (property == config->dirty_rects_property) { > + *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0; > } else if (plane->funcs->atomic_get_property) { > return plane->funcs->atomic_get_property(plane, state, > property, val); > } else { > diff --git a/drivers/gpu/drm/drm_mode_config.c > b/drivers/gpu/drm/drm_mode_config.c > index bc5c46306b3d..d5f1021c6ece 100644 > --- a/drivers/gpu/drm/drm_mode_config.c > +++ b/drivers/gpu/drm/drm_mode_config.c > @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct > drm_device *dev) > return -ENOMEM; > dev->mode_config.prop_crtc_id = prop; > > + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, > + "DIRTY_RECTS", 0); > + if (!prop) > + return -ENOMEM; > + dev->mode_config.dirty_rects_property = prop; > + > prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, > "ACTIVE"); > if (!prop) > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c > index 37a93cdffb4a..add110f025e5 100644 > --- a/drivers/gpu/drm/drm_plane.c > +++ b/drivers/gpu/drm/drm_plane.c > @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, > struct drm_plane *plane, > drm_object_attach_property(&plane->base, config->prop_src_y, 0); > drm_object_attach_property(&plane->base, config->prop_src_w, 0); > drm_object_attach_property(&plane->base, config->prop_src_h, 0); > + drm_object_attach_property(&plane->base, > config->dirty_rects_property, 0); > } > > if (config->allow_fb_modifiers) > diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h > index e5f3b43014e1..65f64eb04c0c 100644 > --- a/include/drm/drm_mode_config.h > +++ b/include/drm/drm_mode_config.h > @@ -599,6 +599,11 @@ struct drm_mode_config { >* &drm_crtc. >*/ > struct drm_property *prop_crtc_id; > + /** > + * @dirty_rects_property: Optional plane property to mark damaged > + * regions on the plane framebuffer. What exactly would the blob contain? The comment seems to be implying these are in fb coordiantes as opposed to plane crtc coordinates? Not sure which would be more convenient. At least if they're fb coordinates then you probably want some helpers to translate/rotate/scale those rects to the crtc coordinates. Actual use depends on the driver/hw I suppose. > + */ > + struct drm_property *dirty_rects_property; > /** >* @prop_active: Default atomic CRTC property to control the active >* state, which is the simplified implementation for DPMS in atomic > diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h > index 8185e3468a23..7d45b164ccce 100644 > --- a/include/drm/drm_plane.h > +++ b/include/drm/drm_plane.h > @@ -131,6 +131,9 @@ struct drm_plane_state { >*/ > struct drm_crtc_commit *commit; > > + /* Optional blob property with damaged regions. */ > + struct drm_property_blob *dirty_blob; > + > struct drm_atomic_state *state; > }; > > -- > 2.15.1 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri