From patchwork Mon Aug 29 08:27:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9303297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96931601C0 for ; Mon, 29 Aug 2016 08:28:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 895B328766 for ; Mon, 29 Aug 2016 08:28:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E274287A0; Mon, 29 Aug 2016 08:28:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0193328766 for ; Mon, 29 Aug 2016 08:28:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6AE186E49B; Mon, 29 Aug 2016 08:28:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3BEA6E49B for ; Mon, 29 Aug 2016 08:28:12 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id i138so8427832wmf.3 for ; Mon, 29 Aug 2016 01:28:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yu7AiJ5LngamFkk+d1Nh3j0M11ND+mWYManLRhvMtZ4=; b=BfLPB1xnscpgMGTtEcADNzfyedOIKesEGb55u9pp1OLCaTSN7jIpYOm6xf+exGHkT8 wyxnTt7JgxEEvJGqrjyqj0JRN2hrcQRTd+zbp5pLrgcF21WQXYDA49AB2UyAMVvVyjd2 v/xeErnoUmY9Gy7yGtxzMLpUnKPS4lGkdBN+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yu7AiJ5LngamFkk+d1Nh3j0M11ND+mWYManLRhvMtZ4=; b=GZ9MdKssVAJdDS8i3dyE+j4fmoeMuS9UbQJhnehqXsy3uUcwUOR3XGAJLVEmRarXfm kSXNfaCZvzNwr0WJLmVTkB0Q6WjSd/1E2+75xLenm2uqheccNWeNwzABx7pGs8gGzoCu 0TWUKxrgqDm43t8sl76Yj2pi9KJPEtVwaJdTtujZC8HaG9rGWZ8lNP97m+jDemrs21vc qpkMIidaQWgCtbPSEhuHM/SJaPFGQCWSBNmyxJEuqZoMnTOHi0DRd6zTL+2gUL2bUlhi XG1R8wPGfw4gpc7raL4oLb4LHHf0SLtS+0+zAd/XBPjXVX8Q08lVVXgsnO2APt4/FghS hHuA== X-Gm-Message-State: AE9vXwNrjovELJc0ICqk/8pUYDEeE70aMcSJpRuBJBTBFm2gwOeBGdg5MhJb65EDn7jWpw== X-Received: by 10.194.82.99 with SMTP id h3mr14426644wjy.9.1472459291294; Mon, 29 Aug 2016 01:28:11 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56c9:0:decc:6e78:7e96:b452]) by smtp.gmail.com with ESMTPSA id b128sm12305797wmb.21.2016.08.29.01.28.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Aug 2016 01:28:10 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 6/9] drm: move drm_mode_legacy_fb_format to drm_fourcc.c Date: Mon, 29 Aug 2016 10:27:54 +0200 Message-Id: <20160829082757.17913-6-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160829082757.17913-1-daniel.vetter@ffwll.ch> References: <20160829082757.17913-1-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Laurent Pinchart , Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP It's part of the drm fourcc handling code, mapping the old depth/bpp values to new fourcc codes. Cc: Laurent Pinchart Reviewed-by: Archit Taneja Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 43 ------------------------------------------- drivers/gpu/drm/drm_fourcc.c | 43 +++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 2 -- include/drm/drm_fourcc.h | 1 + 4 files changed, 44 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 7ec9f7e7a077..59491fc843b6 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1666,49 +1666,6 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev, return drm_mode_cursor_common(dev, req, file_priv); } -/** - * drm_mode_legacy_fb_format - compute drm fourcc code from legacy description - * @bpp: bits per pixels - * @depth: bit depth per pixel - * - * Computes a drm fourcc pixel format code for the given @bpp/@depth values. - * Useful in fbdev emulation code, since that deals in those values. - */ -uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth) -{ - uint32_t fmt; - - switch (bpp) { - case 8: - fmt = DRM_FORMAT_C8; - break; - case 16: - if (depth == 15) - fmt = DRM_FORMAT_XRGB1555; - else - fmt = DRM_FORMAT_RGB565; - break; - case 24: - fmt = DRM_FORMAT_RGB888; - break; - case 32: - if (depth == 24) - fmt = DRM_FORMAT_XRGB8888; - else if (depth == 30) - fmt = DRM_FORMAT_XRGB2101010; - else - fmt = DRM_FORMAT_ARGB8888; - break; - default: - DRM_ERROR("bad bpp, assuming x8r8g8b8 pixel format\n"); - fmt = DRM_FORMAT_XRGB8888; - break; - } - - return fmt; -} -EXPORT_SYMBOL(drm_mode_legacy_fb_format); - static bool drm_property_type_valid(struct drm_property *property) { if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index c81546c15c93..29c56b4331e0 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -36,6 +36,49 @@ static char printable_char(int c) } /** + * drm_mode_legacy_fb_format - compute drm fourcc code from legacy description + * @bpp: bits per pixels + * @depth: bit depth per pixel + * + * Computes a drm fourcc pixel format code for the given @bpp/@depth values. + * Useful in fbdev emulation code, since that deals in those values. + */ +uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth) +{ + uint32_t fmt; + + switch (bpp) { + case 8: + fmt = DRM_FORMAT_C8; + break; + case 16: + if (depth == 15) + fmt = DRM_FORMAT_XRGB1555; + else + fmt = DRM_FORMAT_RGB565; + break; + case 24: + fmt = DRM_FORMAT_RGB888; + break; + case 32: + if (depth == 24) + fmt = DRM_FORMAT_XRGB8888; + else if (depth == 30) + fmt = DRM_FORMAT_XRGB2101010; + else + fmt = DRM_FORMAT_ARGB8888; + break; + default: + DRM_ERROR("bad bpp, assuming x8r8g8b8 pixel format\n"); + fmt = DRM_FORMAT_XRGB8888; + break; + } + + return fmt; +} +EXPORT_SYMBOL(drm_mode_legacy_fb_format); + +/** * drm_get_format_name - return a string for drm fourcc format * @format: format to compute name of * diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index b3c3f0c7b449..0c3fa89afd11 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -2164,8 +2164,6 @@ extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, extern int drm_mode_set_config_internal(struct drm_mode_set *set); -extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); - extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev, char topology[8]); extern struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev, diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index b106337de1bf..30c30fa87ee8 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -25,6 +25,7 @@ #include #include +uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth); void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, int *bpp); int drm_format_num_planes(uint32_t format); int drm_format_plane_cpp(uint32_t format, int plane);