From d68920120d712136cc1538e5f4f8e119f2d4f43a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 7 Nov 2017 20:13:43 +0100 Subject: [PATCH] drm/cma-helper: Add drm_gem_cma_print_info() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add drm_gem_cma_print_info() for debugfs printing struct drm_gem_cma_object specific info. Reviewed-by: Daniel Vetter Signed-off-by: Noralf Trønnes Link: https://patchwork.freedesktop.org/patch/msgid/20171107191348.17555-8-noralf@tronnes.org --- drivers/gpu/drm/drm_gem_cma_helper.c | 19 +++++++++++++++++++ include/drm/drm_gem_cma_helper.h | 3 +++ 2 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 020e7668dfab..29f7b0fd3ad4 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -423,6 +423,25 @@ void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj, EXPORT_SYMBOL_GPL(drm_gem_cma_describe); #endif +/** + * drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs + * @p: DRM printer + * @indent: Tab indentation level + * @gem: GEM object + * + * This function can be used as the &drm_driver->gem_print_info callback. + * It prints paddr and vaddr for use in e.g. debugfs output. + */ +void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, + const struct drm_gem_object *obj) +{ + const struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj); + + drm_printf_indent(p, indent, "paddr=%pad\n", &cma_obj->paddr); + drm_printf_indent(p, indent, "vaddr=%p\n", cma_obj->vaddr); +} +EXPORT_SYMBOL(drm_gem_cma_print_info); + /** * drm_gem_cma_prime_get_sg_table - provide a scatter/gather table of pinned * pages for a CMA GEM object diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 7a3dcf0cf289..40435f3480e5 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -91,6 +91,9 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); #endif +void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, + const struct drm_gem_object *obj); + struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj); struct drm_gem_object * drm_gem_cma_prime_import_sg_table(struct drm_device *dev, -- 2.30.2