Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2043680imm; Sat, 2 Jun 2018 15:58:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLuwoek8pWlIDzcIx5Rn3+7pzjYwzRO5OmGhIkZUtC2VTyLs3cvramv/W+IHqQljDlGC25H X-Received: by 2002:a63:6887:: with SMTP id d129-v6mr13094565pgc.128.1527980334435; Sat, 02 Jun 2018 15:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527980334; cv=none; d=google.com; s=arc-20160816; b=LDKJSERQpaEarwDDJmglqC65jDkjzZWHmHDNs7AFdolOs7avIPpHlYXxV4jehKoWuV pgOOIuf8kP9y/f+z77Y2duBrYoa1qn5A0nfST9j4JM1vgOuwPkdpoVNfKWiL9YWDOi1+ K90wlypyJXr8x5vhV9hNdmD8+44/TL0v8irxQX4l3XDFaSf5/86I1YopG09gPiO/6Cn+ DjInI3wMI7ZkTxSgWcWO3gsXaSOlrsI+6ECoBfIEKV+SmE03CE5LQaoPnj/TwIjpa/VY QMg9k05YlGwqTg+PCjfd1/fOjK7V9W3ZDKJ/4+kDJgkhnGdzGaziw7H9CuIFpPlpigP/ E4Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=+RqjZ0ULoThdBqAHzEDDRlJzqNjzSVB8K/tO+JLjIcg=; b=PwxVY7o4W5X66lsshCLMfMRmjVt5pEiGMucCdNSDxaPoLapnjpA9dkl27K8Y98xjwJ Cd4UhnHfogXYAjhS1AHtS+4rX7AxcBEohG+I/TmA5hCnnFtz4RgGyf0Be4HLrrYZgn2r 7UY+kMHIXWllQsJL5AeNw5BAre8xI0C1s6Oxfllj/yU3ThkgRJW9iUIZkrNMwo4TDJhp akfC9R50k2eSI1DWgO8eD06lZL/AZn/RN77CLFtx1RG77oASuz7EMOFQu0aqiclEJtj6 wPLnpEkfHeeOOoCgX7F48TRbtJfQc3Gwbb9Cf+cqpj35MPhSKG1JSjbwV6/X713dGBWS V3Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GAiQbIDu; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4-v6si4806672plt.590.2018.06.02.15.58.01; Sat, 02 Jun 2018 15:58:54 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GAiQbIDu; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbeFBW4x (ORCPT + 99 others); Sat, 2 Jun 2018 18:56:53 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35707 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751802AbeFBW4u (ORCPT ); Sat, 2 Jun 2018 18:56:50 -0400 Received: by mail-lf0-f65.google.com with SMTP id y72-v6so19825510lfd.2; Sat, 02 Jun 2018 15:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+RqjZ0ULoThdBqAHzEDDRlJzqNjzSVB8K/tO+JLjIcg=; b=GAiQbIDurgvAQdEskjRfE4ZNwVs7zFoQsDKA1AGTE771nsCH0XSt1YvyB6BBrbA38O qDZ+T1N2Bb68fzKLF1i2L92pEIUS0CYpuyrH6xj/DjoMFX1ufpzpETz97DUMT5RW2NT3 k4PQ5sjlcVIwQH+JVsclyD+WpLoCeLMwFA1oYHdkGWs6xC/590JyiGx/Wp2nManLFteX lKmIH9+CvQvForqDTyKGWNAOK6Jtkhww00bErciheLQmTfk9nZ+OYhlWRY8IlSy6NIJ9 cPy+MPv6E7DYfPwrb/36SnlWNyvK0qyy5gJ3FESKDEA2GmDScvWujtBezLGKwAWWKCoM KCng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=+RqjZ0ULoThdBqAHzEDDRlJzqNjzSVB8K/tO+JLjIcg=; b=F0aamQtiI0qkz5+8Uwb/MhkOqyy2A6A3a4hHt/Da2yo2gkPcvlSBESyDJqKmiSLC3H +llWw8NApmQ/VaMoTO7HWhG0zTgCfQ2AmbChAN32+w1UQqS8/kSO4oOs2xvrserzO6ES 9fxJTg+GRiLwZPwh1tNp4nO8pG2a9v/TDdlk9ltEXix5+QJq7DfxnJLUiU/p248/6dhe 5YSozmOAGUQYCQ7LDHnrEIARfgWV4qxDPgkmPs+WMYZFBAvLqCAn4ln1PXDK9nmKMglh zQmvonGh+xUAI54J9v0lpOjQ7kk4A5mwIQ7IQKrdRANmeffZ3DCAYeatI5pRNbt/+4MG iYyA== X-Gm-Message-State: ALKqPwfOLlOs0tM98g5QJXC/+oY0bO1L3CiMTq/UL3xhO54S4luNFP/L JgB/lY9Gq7DEKwStxZRg7/fQEc2w X-Received: by 2002:a2e:5d5d:: with SMTP id r90-v6mr5092810ljb.125.1527980208107; Sat, 02 Jun 2018 15:56:48 -0700 (PDT) Received: from [192.168.2.145] ([109.252.91.41]) by smtp.googlemail.com with ESMTPSA id l10-v6sm8934455lja.62.2018.06.02.15.56.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 15:56:47 -0700 (PDT) Subject: Re: [RFC PATCH v2 1/2] drm: Add generic colorkey properties To: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= 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 References: <20180526155623.12610-1-digetx@gmail.com> <20180526155623.12610-2-digetx@gmail.com> <20180529071742.GM23723@intel.com> From: Dmitry Osipenko Openpgp: preference=signencrypt Autocrypt: addr=digetx@gmail.com; prefer-encrypt=mutual; keydata= xsBNBFpX5TwBCADQhg+lBnTunWSPbP5I+rM9q6EKPm5fu2RbqyVAh/W3fRvLyghdb58Yrmjm KpDYUhBIZvAQoFLEL1IPAgJBtmPvemO1XUGPxfYNh/3BlcDFBAgERrI3BfA/6pk7SAFn8u84 p+J1TW4rrPYcusfs44abJrn8CH0GZKt2AZIsGbGQ79O2HHXKHr9V95ZEPWH5AR0UtL6wxg6o O56UNG3rIzSL5getRDQW3yCtjcqM44mz6GPhSE2sxNgqureAbnzvr4/93ndOHtQUXPzzTrYB z/WqLGhPdx5Ouzn0Q0kSVCQiqeExlcQ7i7aKRRrELz/5/IXbCo2O+53twlX8xOps9iMfABEB AAHNIkRtaXRyeSBPc2lwZW5rbyA8ZGlnZXR4QGdtYWlsLmNvbT7CwJQEEwEIAD4WIQSczHcO 3uc4K1eb3yvTNNaPsNRzvAUCWlflPAIbA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ZWTyhuEuhJsOfivDsjKIq7qQ c5eR+JJtyLEA0Jt4cQGhpzHtWB0yB3XxXzHVa4QUp00BNVWyiJ/t9JHT4S5mdyLfcKm7ddc9 Message-ID: Date: Sun, 3 Jun 2018 01:56:46 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180529071742.GM23723@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29.05.2018 10:17, Ville Syrjälä wrote: > 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... > Color keying mode must explicitly define the expected behavior. It is up to a driver to enable HW color keying for an appropriate plane, or whatever needs to be done to provide the behavior. After some more considering, I've reduced the color keying properties and modes to a bare-and-practical minimum, also taking into account your comments. I'll send out a new version of the patch later today, let's continue discussion there.