From patchwork Sun Dec 17 00:17:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10117615 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 9428660231 for ; Sun, 17 Dec 2017 00:17:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82F0B28CEB for ; Sun, 17 Dec 2017 00:17:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77C0E2924F; Sun, 17 Dec 2017 00:17:32 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3968428CEB for ; Sun, 17 Dec 2017 00:17:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756834AbdLQARa (ORCPT ); Sat, 16 Dec 2017 19:17:30 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:50492 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756959AbdLQARX (ORCPT ); Sat, 16 Dec 2017 19:17:23 -0500 Received: from localhost.localdomain (unknown [IPv6:2a02:a03f:62fe:1100:6c1c:56de:3a70:e025]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 4782F20394; Sun, 17 Dec 2017 01:17:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1513469832; bh=PGO/s9D+zXdcDci9yKn3aL4OlRDP77ELxD40APs5F3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j30wVynBF7lCGmMypWfPs+1Y4VqnDpKFHUHw/1d3ZLN4P2kXFRDZqR+IW0a7u6Kae QgqP4oHK5eH8P9V4saCOQIY4ZTL4dwERFrN/5W1241xBzYhp+2XQr674U/qYphBTpf wG6qi+2ws/MJjeGc3O5BZczLQh00Fr4M477fECho= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Alexandru Gheorghe , Russell King , Ben Skeggs , Sinclair Yeh , Thomas Hellstrom , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi Subject: [PATCH/RFC 4/4] drm: rcar-du: Add support for color keying on Gen3 Date: Sun, 17 Dec 2017 02:17:24 +0200 Message-Id: <20171217001724.1348-5-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171217001724.1348-1-laurent.pinchart+renesas@ideasonboard.com> References: <20171217001724.1348-1-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Gen3 hardware supports color keying with replacement of the pixel value. Implement it using the standard KMS colorkey properties. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 882d1f7a328b..54deb9567cd3 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -198,6 +198,13 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) } } + /* Convert the colorkey from 16 bits to 8 bits per component. */ + cfg.colorkey.enabled = state->state.colorkey.mode; + cfg.colorkey.alpha = state->state.colorkey.value >> 56; + cfg.colorkey.key = ((state->state.colorkey.min >> 24) & 0x00ff0000) + | ((state->state.colorkey.min >> 16) & 0x0000ff00) + | ((state->state.colorkey.min >> 8) & 0x000000ff); + vsp1_du_atomic_update(plane->vsp->vsp, crtc->vsp_pipe, plane->index, &cfg); } @@ -383,6 +390,11 @@ static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = { .atomic_get_property = rcar_du_vsp_plane_atomic_get_property, }; +static const struct drm_prop_enum_list colorkey_modes[] = { + { 0, "disabled" }, + { 1, "source" }, +}; + int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, unsigned int crtcs) { @@ -441,6 +453,10 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, rcdu->props.alpha, 255); drm_plane_create_zpos_property(&plane->plane, 1, 1, vsp->num_planes - 1); + drm_plane_create_colorkey_properties(&plane->plane, + colorkey_modes, + ARRAY_SIZE(colorkey_modes), + true); } return 0;