From patchwork Thu Nov 16 14:22:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 10061337 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 8F717601AE for ; Thu, 16 Nov 2017 14:55:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 819592AAF9 for ; Thu, 16 Nov 2017 14:55:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 769C52AAF5; Thu, 16 Nov 2017 14:55:12 +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 285A92AAF2 for ; Thu, 16 Nov 2017 14:55:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0B5D6E892; Thu, 16 Nov 2017 14:55:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx07-00252a01.pphosted.com (mx07-00252a01.pphosted.com [62.209.51.214]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C1E46E885 for ; Thu, 16 Nov 2017 14:55:06 +0000 (UTC) Received: from pps.filterd (m0102628.ppops.net [127.0.0.1]) by mx07-00252a01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAGENH10008631 for ; Thu, 16 Nov 2017 14:24:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=pp; bh=rQJ/SDE3XGoKeewb4RGp3FlZgjThND7noC/IesKQLp4=; b=DFVt1qRJcvdnv66IQprm7ZL29DFeWBFRGXpBH+a5Dutf4h852euBnnuPKQOBBSJqxZxs jFGa6ZvR4rxizZsWhaL/8bJPQu6Ps83S/haBfCVAWsEn92qftpiV9q98OQjIiR7YF8d6 1h8GZRmcIDrkH+5RQl9eySLaXhTJVRMXO+7m6XwAEfKQQ/M8Ps5a0eVWP3lJXWZXCxIV mCh/Bf09zJQGuDYi5GP7iKEgJc3VNbC4+8gsoEW/gLUdKCst+9O7dQ/9wGFdROof4cQm KA4roT2/S4szaYmGkhsHT1ckrW6Sw+V/JRG++dLwgWFwcnD97/Q+Z+ZSbWy3fvutT9Oi zA== Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by mx07-00252a01.pphosted.com with ESMTP id 2e8dpk0qx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Thu, 16 Nov 2017 14:24:01 +0000 Received: by mail-wm0-f70.google.com with SMTP id 5so377939wmk.0 for ; Thu, 16 Nov 2017 06:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=rQJ/SDE3XGoKeewb4RGp3FlZgjThND7noC/IesKQLp4=; b=CDclfj5RXNWLs/LrYzX0Ou+xYasLiSegYLeWfRrZSJRdTkuo7scUaEJVYzET9WgDCc agyTSUtU/gqfFFeLXblpjUvR6nQ6hSxr+B2nWEHya2TXgAZIdmWlFKyzgroJ6D8IUu9G dC389OZwewcY270rmbNctRoO7aPqN384eEthZQvz3qpkzfjJJmOCMOEpLtQMKh7duexC ZILwwe+zm9ZyXvZP6mohNeZg4DROAzb6LqYeIP7LVNHh/llf4ki2XcNhDszgGnzu34Ub y5ChG7EVLTcCgD5RRIMBUV4eT8PVeM8+yIfmP5nN3icnEOGZXpYqMdYYFxPDteXYrvI8 CvoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=rQJ/SDE3XGoKeewb4RGp3FlZgjThND7noC/IesKQLp4=; b=be6bwobYo/0Db/DjIsd79is9FLkS/sEQAFfgt7FeapFgpooWzFg7pZmqjurDONMKOD uo32fkFaoU2rtMxerH/ehvaCa/WAvagTd/uNdxJNoB4TCv9qwUbTJRZ8x5QgLZdy5/MS jC56tWXulxQxRQq8HJOeeMM6M2k4Wr7tMtmfRwNRhixwijRxH6emd58q+YOn8O1bsIPH F0DXgGLzkmupSmjtOWbtjqWBabQ160KzxvvDWxH0B1a29zkz7mlku+lxTnLBzL7oSexO fq4NEO8ej73QG8x6cCZtK+V533VYSkYhCsdQFGdWMiXfz6ZZphwAGVxhXSpEkzgnDmrP L4Nw== X-Gm-Message-State: AJaThX5nu0eUbppLVM41739RWItktdq5OYcN3TqfwSsnyNprw+zkBK8z azTheyf+FQn7xpaBTt5jFnvLY092oIFWyzP4bxCkqI/kYOgJMDw/eEgFUFiy9TZownhNqr5hUmy TUvDZK2DS7q696ofu3ikfeV+7Uko= X-Received: by 10.223.148.199 with SMTP id 65mr781099wrr.14.1510842240701; Thu, 16 Nov 2017 06:24:00 -0800 (PST) X-Google-Smtp-Source: AGs4zMZrklMBbtUcgslNcdlqdgJxbrV+JvepXQdSG2toS/84IAyF/JkK+11WTZFAoF1fTCpph+JOSQ== X-Received: by 10.223.148.199 with SMTP id 65mr781091wrr.14.1510842240514; Thu, 16 Nov 2017 06:24:00 -0800 (PST) Received: from dave-VirtualBox.pitowers.org ([217.33.127.173]) by smtp.googlemail.com with ESMTPSA id 185sm2463994wmj.33.2017.11.16.06.23.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Nov 2017 06:23:59 -0800 (PST) From: Dave Stevenson To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm/vc4: Use .pixel_order instead of custom .flip_cbcr Date: Thu, 16 Nov 2017 14:22:30 +0000 Message-Id: <563872b69c1e5df142cb15ebfca7f20056b8a64c.1510841336.git.dave.stevenson@raspberrypi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-11-16_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711160196 Cc: David Airlie , Dave Stevenson 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 The hardware has enums for altering the Cr and Cb order, so use this instead of having a flag which swaps the order the pointers are presented to the hardware (that only worked for 3 plane formats anyway). Explicitly sets .pixel_order in each case, rather than relying on then default XYCBCR order being a value 0. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_plane.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 513b4b1..6373fd5 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -86,7 +86,6 @@ static const struct hvs_format { u32 hvs; /* HVS_FORMAT_* */ u32 pixel_order; bool has_alpha; - bool flip_cbcr; } hvs_formats[] = { { .drm = DRM_FORMAT_XRGB8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888, @@ -131,28 +130,32 @@ static const struct hvs_format { { .drm = DRM_FORMAT_YUV422, .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE, + .pixel_order = HVS_PIXEL_ORDER_XYCBCR, }, { .drm = DRM_FORMAT_YVU422, .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE, - .flip_cbcr = true, + .pixel_order = HVS_PIXEL_ORDER_XYCRCB, }, { .drm = DRM_FORMAT_YUV420, .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE, + .pixel_order = HVS_PIXEL_ORDER_XYCBCR, }, { .drm = DRM_FORMAT_YVU420, .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE, - .flip_cbcr = true, + .pixel_order = HVS_PIXEL_ORDER_XYCRCB, }, { .drm = DRM_FORMAT_NV12, .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE, + .pixel_order = HVS_PIXEL_ORDER_XYCBCR, }, { .drm = DRM_FORMAT_NV16, .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE, + .pixel_order = HVS_PIXEL_ORDER_XYCBCR, }, }; @@ -625,15 +628,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane, * The pointers may be any byte address. */ vc4_state->ptr0_offset = vc4_state->dlist_count; - if (!format->flip_cbcr) { - for (i = 0; i < num_planes; i++) - vc4_dlist_write(vc4_state, vc4_state->offsets[i]); - } else { - WARN_ON_ONCE(num_planes != 3); - vc4_dlist_write(vc4_state, vc4_state->offsets[0]); - vc4_dlist_write(vc4_state, vc4_state->offsets[2]); - vc4_dlist_write(vc4_state, vc4_state->offsets[1]); - } + for (i = 0; i < num_planes; i++) + vc4_dlist_write(vc4_state, vc4_state->offsets[i]); /* Pointer Context Word 0/1/2: Written by the HVS */ for (i = 0; i < num_planes; i++)