[Mesa-dev] [PATCH RFC 2/2] dri: Pass a __DRIcontext to ->set_damage_region()

Michel Dänzer michel at daenzer.net
Fri Aug 30 16:43:59 UTC 2019


On 2019-08-29 1:54 p.m., Boris Brezillon wrote:
> So we can call st_validate_state() from dri2_set_damage_region() in
> order to update the BACK_LEFT attachement before using it. If we don't
> do that, the resource passed to pipe_screen->set_damage_region() might
> be wrong.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> ---
> Hi,
> 
> I honestly don't know if this is the right thing to do. Passing a
> context for somethings that we decided to bind to a surface (and
> the underlying resources attached to it) seems wrong, but at the same
> time I don't see any other option to sync the gallium drawable state
> with the EGL DRI surface one.
> 
> Any ideas/suggestions?
> 
> Regards,
> 
> Boris
> ---
>  include/GL/internal/dri_interface.h   |  5 +++--
>  src/egl/drivers/dri2/egl_dri2.c       |  7 +++++--
>  src/gallium/state_trackers/dri/dri2.c | 11 ++++++++++-
>  3 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
> index 4c60d349ddd5..e04bed689219 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -527,12 +527,13 @@ struct __DRI2bufferDamageExtensionRec {
>      *
>      * Used to implement EGL_KHR_partial_update.
>      *
> +    * \param ctx      context
>      * \param drawable affected drawable
>      * \param nrects   number of rectangles provided
>      * \param rects    the array of rectangles, lower-left origin
>      */
> -   void (*set_damage_region)(__DRIdrawable *drawable, unsigned int nrects,
> -                             int *rects);
> +   void (*set_damage_region)(__DRIcontext *_ctx, __DRIdrawable *drawable,
> +                             unsigned int nrects, int *rects);
>  };

This would break the DRI2_BufferDamage extension version 1 ABI. You'd
need to either add a new hook like set_damage_region2 and bump
__DRI2_BUFFER_DAMAGE_VERSION (and make sure that's handled correctly
everywhere), or add a new extension instead.


-- 
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list