From patchwork Fri Mar 9 00:53:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schake X-Patchwork-Id: 10269477 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 A795460594 for ; Fri, 9 Mar 2018 00:55:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9854329B81 for ; Fri, 9 Mar 2018 00:55:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88A0C29C2B; Fri, 9 Mar 2018 00:55:03 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 489FD29B81 for ; Fri, 9 Mar 2018 00:55:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB1F86E2B9; Fri, 9 Mar 2018 00:55:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id A232D6E2B9 for ; Fri, 9 Mar 2018 00:54:58 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id i3so1049483wmi.4 for ; Thu, 08 Mar 2018 16:54:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=t0giLmVyFnPE5tdhPZqeXBcAB7HRMVGbgCVPOh101pA=; b=HHzRYJ9WEpG1JlssVmD8+JcjIDJYdwJM6CSJ9dkAQhoKQMa3rPsdjZ2ednN11NC0+F wARqSWv+ko2/LcIKtlcQ06QzUs+uMu6glxIsYLrX1HIrUlMdTR4E6yaQGnET3AVCHHEq 3ZYGlWVjlbKl4uQTcuOJhW9LQ88Puj6hpuUdNPVa1rA1dulMzxgDfe4841f2W2a2OInf is/MrgYDvdA/MR5aMgSRuvRHUzEeAj0MsLvPkr9PpOtVXFuh/VA+LhJZO4Opj/irHvF3 Fh+B3GLBgrVpWQx35sagPrQ0cCgIRZ40P/PPlivoT9kKhKPinG30xmSnkiL+TP0eSsd1 9nAw== 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; bh=t0giLmVyFnPE5tdhPZqeXBcAB7HRMVGbgCVPOh101pA=; b=qW3fJ+5z/1F32OBNhfFA3VoqlhNKh/XCX/xe5UWI/8CivGAR2R5mkVZvsMlsBtpNb4 LsjF99XUtPs+JUUZ2wd036wEmfbPZF8mq+Y/qeQbsaNd581FpkWmKLiqUoXKlHh7wFzL BI/5rEP5URGLsjMvpOG0YW5p5fofjsmS7pMwt1uRjO0sSKoXPv803ZecYmm6wFJKeW7t HQC1RVoRMgUnEPttjqS2lqf2L7RySKc5JT54mTtul5MzuC7COH17rcmhofs3hkoVnuA/ NRU/CPFaSSyrCUgwcuqPTxxlIPRaSEgvh6A5dhuqzARzHNfQxEgi1HtVtZ5eYqgE5Unm Lj4Q== X-Gm-Message-State: AElRT7EFjePGAj+fI/+0979MMJV0yBpsAK2ftSihIIUU1FW6EsnBH/g4 2hhjPtwE2Msej0gZGzEWIa4= X-Google-Smtp-Source: AG47ELvUZw+RThUbtkBGmOoS9E6UQWtDnGrVl0FAprrZA7VwFEBNc/6xCIz+E/opt6Qwj9fVhMkD8A== X-Received: by 10.28.95.139 with SMTP id t133mr552229wmb.88.1520556897257; Thu, 08 Mar 2018 16:54:57 -0800 (PST) Received: from localhost.localdomain (x4e31ef02.dyn.telefonica.de. [78.49.239.2]) by smtp.gmail.com with ESMTPSA id s78sm45884815wrc.93.2018.03.08.16.54.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Mar 2018 16:54:56 -0800 (PST) From: Stefan Schake To: eric@anholt.net Subject: [PATCH v2 1/4] drm/vc4: Set premultiplied for alpha formats Date: Fri, 9 Mar 2018 01:53:34 +0100 Message-Id: <1520556817-97297-2-git-send-email-stschake@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520556817-97297-1-git-send-email-stschake@gmail.com> References: <1520556817-97297-1-git-send-email-stschake@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-rpi-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Stefan Schake MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Alpha formats in DRM are assumed to be premultiplied, so we should be setting the PREMULT bit in the plane configuration for HVS. Changes from v1: - Use correct has_alpha Signed-off-by: Stefan Schake --- drivers/gpu/drm/vc4/vc4_plane.c | 3 ++- drivers/gpu/drm/vc4/vc4_regs.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index c4c7af1..831e195 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -618,13 +618,14 @@ static int vc4_plane_mode_set(struct drm_plane *plane, SCALER_POS1_SCL_HEIGHT)); } - /* Position Word 2: Source Image Size, Alpha Mode */ + /* Position Word 2: Source Image Size, Alpha */ vc4_state->pos2_offset = vc4_state->dlist_count; vc4_dlist_write(vc4_state, VC4_SET_FIELD(fb->format->has_alpha ? SCALER_POS2_ALPHA_MODE_PIPELINE : SCALER_POS2_ALPHA_MODE_FIXED, SCALER_POS2_ALPHA_MODE) | + (fb->format->has_alpha ? SCALER_POS2_ALPHA_PREMULT : 0) | VC4_SET_FIELD(vc4_state->src_w[0], SCALER_POS2_WIDTH) | VC4_SET_FIELD(vc4_state->src_h[0], SCALER_POS2_HEIGHT)); diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h index b9749cb..a141496 100644 --- a/drivers/gpu/drm/vc4/vc4_regs.h +++ b/drivers/gpu/drm/vc4/vc4_regs.h @@ -848,6 +848,7 @@ enum hvs_pixel_format { #define SCALER_POS2_ALPHA_MODE_FIXED 1 #define SCALER_POS2_ALPHA_MODE_FIXED_NONZERO 2 #define SCALER_POS2_ALPHA_MODE_FIXED_OVER_0x07 3 +#define SCALER_POS2_ALPHA_PREMULT BIT(29) #define SCALER_POS2_HEIGHT_MASK VC4_MASK(27, 16) #define SCALER_POS2_HEIGHT_SHIFT 16