Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2189661imm; Thu, 20 Sep 2018 09:05:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ6qOj/zw8xlew1smlCJYenSnRBk+I5vN2MjlDyl5+96B7EiEbPleaOMgykBhxBRxdWVNu0 X-Received: by 2002:a17:902:22:: with SMTP id 31-v6mr39927946pla.190.1537459527178; Thu, 20 Sep 2018 09:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537459527; cv=none; d=google.com; s=arc-20160816; b=NSvPxvhc6n6SZyrUPOomyzYXC5hS/CYbisG9oMiB9iU81LEbcIOWT2QYfMEWsqOdlb ZkbAoDQXh1R6N6l3geI2ocBRgUJmhbGK2xNB2BkJDVGH2qfFUmrw1k9NZTETfI0i7tJu 5BwCHhU8gINfU2mh1nzMU2clTyf5QSImWL0ZPz9P1/XznvpZuV6r+OS3ujaFBQp8GKNo JL/JlCTG35jDtN2kkNiZT60Kfu//ZtmDnc0f7WzBY0fM9i3piFroyGVp2m1Wd7B/Qwrn MaZhBeHBz18KyG7Zope7D2P8HNixR+ZC8eQRZPrHF3KsJvXSR4km23PkXH0qZAw40net J6nQ== 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:from:references:cc:to:subject:dkim-signature; bh=JDP9a70oXwAQU2VOz2AwH0KOP5KlMsPZLdmFF2Cz+3w=; b=SVHxUaN9qkVI4XENOHD/0WxEGr3Y7SvvparRjFDaZGvZU5B7JXfaSWDFMMevYNPeZF ST2XHcES+vtlUC4TidQkp5IGcA78UbvRX3+O+rVpiYhpBa8CZMVOCaw6h7ZiVzQs/1vi 6wlqsHbpV/vDmUCWo58vdqBkP/4C8wuZQPmA0o926G/BJvopefsudyjp3+S8NTXZhhCH e3FDTN3pY53HJLG14eydUWJN2d3093r7QOfKA6MZCfszMLt9iWCvxWYtvEXBnwUCpOGr 5hOsVdYoLnIhFx2ppnqZSfyxQaxHskOSHe6c1oAxnFV2bwNqawa+BHQI3gPzAnfUK93b 9yjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z2iPxHuW; 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 ca16-v6si27655731plb.9.2018.09.20.09.05.01; Thu, 20 Sep 2018 09:05:27 -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=Z2iPxHuW; 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 S1728016AbeITVs6 (ORCPT + 99 others); Thu, 20 Sep 2018 17:48:58 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33793 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbeITVs6 (ORCPT ); Thu, 20 Sep 2018 17:48:58 -0400 Received: by mail-lj1-f194.google.com with SMTP id f8-v6so8913198ljk.1; Thu, 20 Sep 2018 09:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=JDP9a70oXwAQU2VOz2AwH0KOP5KlMsPZLdmFF2Cz+3w=; b=Z2iPxHuWUbjmR/CzJ6utqFKitkD6Sm1LTA1599TirPJAbue9GdddZZuay0JY91sQ/c HFXm+ok2esmM8QPy+AuCASByKe2E5gFb3RUx+TzEWESDvT6WQ5c1vFOhscf0BsMgmG6q /oJw0EEJMrc/hA2SBw9RnKdrDOofuZtLn70fZjC38FP+kehJGvt0/E5Js65iAbZbItF2 cacG9b2WxGvFlVAjfXnt6x6E4/oqVaEjLUjj/W9QKEDvAkeDkD3VSAN/odF58wW2vlzm BGkGCdOPXSnHK36IbwOexIVkavAkggl09BhuqurS7ZDxtwk2ve9vo0/5zeIdu4ESENrW EISw== 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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JDP9a70oXwAQU2VOz2AwH0KOP5KlMsPZLdmFF2Cz+3w=; b=pdwc/ttR8fM6BC70juwpDOkwD4c9tgKTzkz50CoQxJvMx3Sk6fl49w7IaHlEVsA3QG 1sAEOQXh5pZLCfWvD1NM7YfVsvEpUwA8F4MEZkGVG4ehBBZtgQtTFGzwmivSVKoEq22x dMDtIJDCQ0BeE5376CCAmRi+CRh5eX++oCxj/1y7qGL4EKPg1Z8oIKZTb9xDICyTnEQc ZhaRe5Yfn8QPrKPUsTi5FpZOTjF9mSQXGsQlYnZ/iR34ijdBm09Oes1Xqav0CD3FL9Cu qq4rNBcoSjQ7wHnqyES36evkxp3oUNhuw/K59GJVdaZy/tLe4gsw8DPzWAvlyWNcBmjE riVQ== X-Gm-Message-State: APzg51AXlIPB5JIceG54iPZGdAoJhYbiOWxo/+N+Zr7a2QwZ9eFcmxXc grXAG+sWGimVNq7FoKmnUri173JA X-Received: by 2002:a2e:2b4c:: with SMTP id q73-v6mr2496673lje.128.1537459485229; Thu, 20 Sep 2018 09:04:45 -0700 (PDT) Received: from [192.168.2.145] (109-252-91-213.nat.spd-mgts.ru. [109.252.91.213]) by smtp.googlemail.com with ESMTPSA id x5-v6sm1744630lfi.45.2018.09.20.09.04.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 09:04:44 -0700 (PDT) Subject: Re: [RFC PATCH v4 1/2] drm: Add generic colorkey properties for display planes To: Maarten Lankhorst , Russell King - ARM Linux , Laurent Pinchart , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Thierry Reding , Maxime Ripard , Paul Kocialkowski Cc: Neil Armstrong , dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Ben Skeggs , Sinclair Yeh , Thomas Hellstrom , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180807172202.1961-1-digetx@gmail.com> <20180807172202.1961-2-digetx@gmail.com> <20180808081608.GK30658@n2100.armlinux.org.uk> <2089566.PDTrKWWE8Q@dimapc> From: Dmitry Osipenko Message-ID: Date: Thu, 20 Sep 2018 19:04:43 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/16/18 2:42 PM, Maarten Lankhorst wrote: > Op 08-08-18 om 16:30 schreef Dmitry Osipenko: >> On Wednesday, 8 August 2018 11:16:09 MSK Russell King - ARM Linux wrote: >>> On Tue, Aug 07, 2018 at 08:22:01PM +0300, Dmitry Osipenko wrote: >>>> + * Glossary: >>>> + * >>>> + * Destination plane: >>>> + * Plane to which color keying properties are applied, this planes takes >>>> + * the effect of color keying operation. The effect is determined by a >>>> + * given color keying mode. >>>> + * >>>> + * Source plane: >>>> + * Pixels of this plane are the source for color key matching operation. >>> ... >>> >>>> + /** >>>> + * @DRM_PLANE_COLORKEY_MODE_TRANSPARENT: >>>> + * >>>> + * Destination plane pixels are completely transparent in areas >>>> + * where pixels of a source plane are matching a given color key >>>> + * range, in other cases pixels of a destination plane are >> unaffected. >>>> + * In areas where two or more source planes overlap, the topmost >>>> + * plane takes precedence. >>>> + */ >>> This seems confusing to me. >>> >>> What you seem to be saying is that the "destination" plane would be the >>> one which is (eg0 the graphic plane, and the "source" plane would be the >>> the plane containing (eg) the video. You seem to be saying that the >>> colorkey matches the video and determines whether the pixels in the >>> graphic plane are opaque or transparent. >> Your example is correct. >> >> With the "plane_mask" property we can specify any plane as the "source" for >> color key, so it can been either a video plane or graphic plane and even both >> at the same time. > I'm not sure we should specify plane mask from userspace. It looks like a quite flexible approach. Do you have any other suggestions? > Can't we make major loops? How do you want to handle those? It's up to a specific driver to accept the mask or reject it. You could make a loop if HW allows to do that, I don't see what's the problem. >>> Surely that is the wrong way round - in video overlay, you want to >>> colorkey match the contents of the graphic plane to determine which >>> pixels from the video plane to overlay. >> The "transparent" mode makes the color-matched pixels to become transparent, >> you want the inversion effect and hence that should be called something like a >> "transparent-inverted" mode. Maarten Lankhorst was asking for that mode in his >> comment to v3, I'm leaving for somebody else to add that mode later since >> there is no real use for it on Tegra right now. > I would like it to be described and included, so I can convert the existing intel_sprite_set_colorkey_ioctl to atomic. Okay, I can add it. Though probably better to call that mode "opaque" rather than "transparent-inverted". > Then again, could transparent-inverted also be handled by setting transparent on the primary? If HW allows to do that, then yes. > >> So in your case the graphic plane will be the "source" plane (specified via >> the colorkey.plane_mask property), video plane will be the "destination" plane >> (plane to which the colorkey properties are applied) and the colorkey.mode >> will be "transparent-inverted". Pixels of the "source" plane are being matched >> and "destination" plane takes the effect of color keying operation, i.e. the >> color-matched pixels of graphic plane leave the video plane pixels unaffected >> and the unmatched pixels make the video plane pixels transparent. >> >>> If it's the other way around (source is the graphic, destination is the >>> video) it makes less sense to use the "source" and "destination" terms, >>> I can't see how you could describe a plane that is being overlaid on >>> top of another plane as a "destination". >> Tegra has a bit annoying limitations in regard to a reduced plane blending >> functionality when color keying is enabled. I found that the best variant to >> work around the limitations is to move the graphic plane on top of the video >> plane and to make the graphic plane to match itself. I.e. the matched pixels >> of graphic plane become transparent and hence poked by video plane. >> >>> I guess the terminology has come from a thought about using a GPU to >>> physically do the colorkeying when combining two planes - if the GPU >>> were to write to the "destination" plane, then this would be the wrong >>> way around. For starters, taking the above example, the video plane >>> may well be smaller than the graphic plane. If it's the other way >>> around, that has other problems, like destroying the colorkey in the >>> graphic plane when writing the video plane's contents to it. >> It all depends on a use-case scenario. It won't be easy for userspace to >> generalize the usage of color keying, at best the color keying interface could >> be generalized and then userspace may choose the best fitting variant based on >> available HW capabilities. > There's TEST_ONLY for a reason, though I guess it makes generic color keying slightly more invovled for userspace. :) It is also quite involved for kernel to present a non-standard feature as something generic, pleasing everyone in the same time.