From patchwork Thu Feb 21 21:35:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 2173281 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id BA6AF3FCA4 for ; Thu, 21 Feb 2013 21:38:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90DA9E618E for ; Thu, 21 Feb 2013 13:38:03 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id C332CE5CE7; Thu, 21 Feb 2013 13:35:27 -0800 (PST) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 21 Feb 2013 13:35:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,711,1355126400"; d="scan'208";a="205058114" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.168]) by AZSMGA002.ch.intel.com with SMTP; 21 Feb 2013 13:35:25 -0800 Received: by stinkbox (sSMTP sendmail emulation); Thu, 21 Feb 2013 23:35:24 +0200 From: ville.syrjala@linux.intel.com To: intel-gfx@lists.freedesktop.org Subject: [PATCH 3/4] drm: Add drm_region_debug() Date: Thu, 21 Feb 2013 23:35:02 +0200 Message-Id: <1361482503-3268-4-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1361482503-3268-1-git-send-email-ville.syrjala@linux.intel.com> References: <1361482503-3268-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Ville Syrjälä Add a debug function to print the region in a human readable format. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_region.c | 22 ++++++++++++++++++++++ include/drm/drm_region.h | 1 + 2 files changed, 23 insertions(+) diff --git a/drivers/gpu/drm/drm_region.c b/drivers/gpu/drm/drm_region.c index c694424..82e1043 100644 --- a/drivers/gpu/drm/drm_region.c +++ b/drivers/gpu/drm/drm_region.c @@ -24,6 +24,7 @@ #include #include #include +#include #include /** @@ -266,3 +267,24 @@ int drm_calc_vscale_relaxed(struct drm_region *src, struct drm_region *dst, return vscale; } EXPORT_SYMBOL(drm_calc_vscale_relaxed); + +/** + * drm_region_debug - print the region information + * @r: region to print + * @fixed_point: is the region in 16.16 fixed point format + */ +void drm_region_debug(const struct drm_region *r, bool fixed_point) +{ + int w = drm_region_width(r); + int h = drm_region_height(r); + + if (fixed_point) + DRM_DEBUG_KMS("%d.%06ux%d.%06u+%d.%06u+%d.%06u\n", + w >> 16, ((w & 0xffff) * 15625) >> 10, + h >> 16, ((h & 0xffff) * 15625) >> 10, + r->x1 >> 16, ((r->x1 & 0xffff) * 15625) >> 10, + r->y1 >> 16, ((r->y1 & 0xffff) * 15625) >> 10); + else + DRM_DEBUG_KMS("%ux%u+%d+%d\n", w, h, r->x1, r->y1); +} +EXPORT_SYMBOL(drm_region_debug); diff --git a/include/drm/drm_region.h b/include/drm/drm_region.h index c12d953..10591f5 100644 --- a/include/drm/drm_region.h +++ b/include/drm/drm_region.h @@ -136,5 +136,6 @@ int drm_calc_hscale_relaxed(struct drm_region *src, struct drm_region *dst, int min_hscale, int max_hscale); int drm_calc_vscale_relaxed(struct drm_region *src, struct drm_region *dst, int min_vscale, int max_vscale); +void drm_region_debug(const struct drm_region *r, bool fixed_point); #endif