[PATCH] drm: writeback: Introduce drm managed helpers

Dmitry Baryshkov dmitry.baryshkov at linaro.org
Sun Sep 22 15:31:52 UTC 2024


On Fri, Sep 06, 2024 at 07:28:17PM GMT, Louis Chauvet wrote:
> Currently drm_writeback_connector are created by
> drm_writeback_connector_init or drm_writeback_connector_init_with_encoder.
> Both of the function uses drm_connector_init and drm_encoder_init, but
> there is no way to properly clean those structure from outside. By using
> drm managed variants, we can ensure that the writeback connector is
> properly cleaned.
> 
> This patch introduce drmm_writeback_connector_init, an helper to initialize
> a writeback connector using drm managed helpers. This function allows the
> caller to use its own encoder.

Also it introduces drm_writeback_connector_cleanup(). Ideally that
should be a separate commit with a proper description. You should also
document that existing users should call that function (and maybe add a
WARN_ON that can check if the function wasn't called).

Last, but not least, please don't add API without a user. Please switch
at least one driver into using this API.

> 
> Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
> ---
> Hi Maxime, Jani,
> 
> I tried with this commit to implement the drm-managed version of writeback 
> connector initialization. I tested with the current vkms driver, and it 
> seems to works (at least no crash/warns).
> 
> As suggested by Jani, I only created one function, which takes a 
> NULL-able pointer for encoder/encoder functions/possible_crtc. What do you 
> think about it?
> 
> Regarding the documentation, I think I repeated too much, can I simply add 
> comments like "see documentation of @... for the details / requirements"?
> 
> Good weekend,
> Louis Chauvet
> ---
>  drivers/gpu/drm/drm_writeback.c | 224 ++++++++++++++++++++++++++++++++++------
>  include/drm/drm_writeback.h     |   7 ++
>  2 files changed, 201 insertions(+), 30 deletions(-)
> 

-- 
With best wishes
Dmitry


More information about the dri-devel mailing list