Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3086969imm; Tue, 29 May 2018 00:18:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqnJfGSrxlLm29zsw14IYcZa/uJ6xd8mka4S4rIfE8Bc5HjdbWVFi5Zshp0n65lEyhL+jFN X-Received: by 2002:a17:902:700a:: with SMTP id y10-v6mr15096299plk.249.1527578317385; Tue, 29 May 2018 00:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527578317; cv=none; d=google.com; s=arc-20160816; b=rG+rJUS1W9Pxjf7Tj3BIy2dyWGG2SZVIZRP+3lPhmKVgZCBDD/CMNKhLoL8wQ7ynka kSAmyo/XeRfw72G2/CqKuxEzLLfNNymK54fLzilYgYHlY2EKYgyXnxe+jSzPhwCdFp6H RIleIeacUiyKxWHd1pgRGefeoSYwdUReFKZW2e8SOMC0Whaq29sMppKBU44g2xdOXEeX ELO2ALTGsinet9j+f5anD+PuXm842SHnj+yuxymr1w6hqUCkNAkIBg+s1nh7Wep6kFR3 BgIWbW/nm2bh+EqOIxkspcV5T+tcbSgwa5mWqYISQy+WySydNE4IISQy55KA1ztCO7p1 2V3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Ag1tkhG4JCdmqCQ9SKn5k4n9R44TJ/qrGnIGf7FUTU4=; b=oDoE5ru4PIpHLM+4uuep9mGbfWIhBhCn1jH0balrQ71r3H3qyz7EzpwzVPjIu/AsnO klKdaKgRLn40totaUg38wPcbHr8KjmTkkjK79Bij5W8zHQuioIeAgXG9bojnq9DSxYZE IbHr0sSr2cHufR3uvld7VJmtcsZvFGgMKDh61SJDsB/P1khujVwrQbt9EjcMA1VDrSkO BSajiBkDyaLA1t9cIqUgkKjc+HAXzrX6QXu0vcFmyi8lnwp79NoBH39qCpZQ7qpt1EOT 1wKxobg3ccwwL4KuezVRehqWzTZjj2VXDKBCbBnl9NDU28XihERx8y1/nu619CT3TR0n oYuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12-v6si3532277pgp.565.2018.05.29.00.18.23; Tue, 29 May 2018 00:18:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754831AbeE2HRv (ORCPT + 99 others); Tue, 29 May 2018 03:17:51 -0400 Received: from mga02.intel.com ([134.134.136.20]:27409 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750831AbeE2HRt (ORCPT ); Tue, 29 May 2018 03:17:49 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2018 00:17:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,455,1520924400"; d="scan'208";a="62508557" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga002.jf.intel.com with SMTP; 29 May 2018 00:17:43 -0700 Received: by stinkbox (sSMTP sendmail emulation); Tue, 29 May 2018 10:17:42 +0300 Date: Tue, 29 May 2018 10:17:42 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Dmitry Osipenko Cc: Laurent Pinchart , Thierry Reding , Neil Armstrong , Maxime Ripard , dri-devel@lists.freedesktop.org, 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 , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 1/2] drm: Add generic colorkey properties Message-ID: <20180529071742.GM23723@intel.com> References: <20180526155623.12610-1-digetx@gmail.com> <20180526155623.12610-2-digetx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180526155623.12610-2-digetx@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 26, 2018 at 06:56:22PM +0300, Dmitry Osipenko wrote: > Color keying is the action of replacing pixels matching a given color > (or range of colors) with transparent pixels in an overlay when > performing blitting. Depending on the hardware capabilities, the > matching pixel can either become fully transparent or gain adjustment > of the pixels component values. > > Color keying is found in a large number of devices whose capabilities > often differ, but they still have enough common features in range to > standardize color key properties. This commit adds nine generic DRM plane > properties related to the color keying to cover various HW capabilities. > > This patch is based on the initial work done by Laurent Pinchart, most of > credits for this patch goes to him. > > Signed-off-by: Dmitry Osipenko > --- > drivers/gpu/drm/drm_atomic.c | 36 ++++++ > drivers/gpu/drm/drm_blend.c | 229 +++++++++++++++++++++++++++++++++++ > include/drm/drm_blend.h | 3 + > include/drm/drm_plane.h | 77 ++++++++++++ > 4 files changed, 345 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index 895741e9cd7d..5b808cb68654 100644 > @@ -124,6 +175,19 @@ struct drm_plane_state { > unsigned int zpos; > unsigned int normalized_zpos; > > + /* Plane colorkey */ > + struct { > + enum drm_plane_colorkey_mode mode; > + u64 min; > + u64 max; > + u64 mask; > + u32 format; > + bool inverted_match; > + u64 replacement_mask; > + u64 replacement_value; > + u32 replacement_format; > + } colorkey; After a quick stab at implementing this for i915 I came to the conclusion that I'd like this struct to have a name so that I can pass it around/consult it easily without having to mess about with the entire plane state. One extra question that came up is how are we going to define the destination color key? Is it to be a) enabled on the plane that has the colorkey painted on it, or is it to be b) enabled on a plane that sits above the plane that is going to be covering up the colorkey? Modern Intel hardware defines it the a) way, whereas older hw used the b) method. Thinking about it I do think the a) method seems nicer because it removes the ambiguity as to which plane's pixels are going to be compared again the colorkey. So kinda matches the src colorkey case better. Oh and this also brings up the question as to which other plane(s) are taking part in the colorkey process. Looks like on modern Intel hw it's supposed to be just the plane immediately above the plane with dst keying enabled. On some really old hw there were some more complicated rules as to which pair of planes are involved. On middle aged hw the situation is simpler a there are only ever two (non-cursor) planes on the same crtc. The cursor doesn't seem to participate in the colorkeing ever. Not sure there's a sane way to fully abstract this all. I should probably poke at the hardware a bit more to figure out how this really works when there are more than two active planes on the crtc. I did poke at one particular class of hw which is a bit of a mix of old and middle aged hw, and there it seems I can also do dst colorkeying the a) way. And in this case there are three planes taking part in the dst colorkey match (the primary that has the colorkey painted on it, and two overlay planes that cover up the matched pixels). So for that case definitely the a) approach in the uapi would make more sense as trying to specify conflicting dst colorkey settings for each of the overlay planes wouldn't make any sense. I'll need to poke at the modern hw a bit more still... -- Ville Syrj?l? Intel