Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1987404lql; Wed, 13 Mar 2024 14:02:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNYW0zGgpXME3dstX3Hx+3wR9OPruOkxJfX8oG6zg6NtxKo3MoP+qNXCidilmVecjRYh/Ye5GusB8bRxV1Uuzss65Q/3adBm+uIdo7kQ== X-Google-Smtp-Source: AGHT+IHJslJDL0jQwffKFcHRgoKjFWLoSbE1lpCegtL8PugpJRmpzVs8gJxBGDCYhpCycQhgyJEa X-Received: by 2002:a17:902:e5d1:b0:1dd:a2d5:8e84 with SMTP id u17-20020a170902e5d100b001dda2d58e84mr11046866plf.27.1710363749941; Wed, 13 Mar 2024 14:02:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710363749; cv=pass; d=google.com; s=arc-20160816; b=fPLnUSWeiTJ94wHmVFoo/4AmazUIv3EUJGRhlkhpQXzM2TjaFtvjhq4Y8iWD5AYoAt IBWbd0/jc/GnB6lp+yAAYCeh59nJRB9a3ZwXmCDbERB0Z6wCjjrNY5pnAG1gS2v0KbOG 8hFwfU63tXjdHvgfIwZLM4oyxPTqqT4wmEQPNVylEaVbjruuBWOOvUBBZSfaggccO+// YzeAjXGbL0ajOvei/2uf+OLVBM+zUNGNu0zM1PahNDo5IsgTOIs4PMwJ4M3GQSp/Kruv JSW5dPZ+zNmm2LVkIfVEPxD/QCm3xmnfXgUqIUMXEkk/PEMvXmrAVPkDjTV/YxxaE9T8 YJyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=75WVLbdwI+iDn1zwGEAUGq3py3zyrknBJPOCRtfKgus=; fh=F1Pn+XY79ye1ImQHHfUZsNzIUBkbMFVpheGWO9Ctr0c=; b=MK9yOLSgQ65ugq+MAzPLWqzG2tcdzAw9w3TudbCX+DQcL1gke0BUaZhSo6Jfy5qAIR 9p67yqDOrJgHJjE9CH1MIVLv7eYPadv3UIr7Xgl7gjzDa2uXFhUCJDXc2nr1tFYrEoMs l/WO3yHhqvLzrGY5bbds2Fz05KjsngGgF6k6jkauwbIaxqQEA6GSOwg7QeMJ+8y0IIz4 djAJFbw7YsGkv89YJNX3kXtztcjm+EffGcgzOrAfibKHvvX/uDx7Yi83knYtcvbpvshn rd5X0uGBYNhM+6Eh2aDrgeJPCzJcB4foDy5aiwwHYNRpOJPJVy30NUxjAMKa8cMu7hNB kumQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=oqeT8VHO; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-102417-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102417-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h15-20020a170902f54f00b001dd8df74456si66199plf.606.2024.03.13.14.02.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 14:02:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102417-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=oqeT8VHO; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-102417-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102417-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DC91128BF66 for ; Wed, 13 Mar 2024 19:25:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0283559B5A; Wed, 13 Mar 2024 19:21:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="oqeT8VHO" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C21AC59B56 for ; Wed, 13 Mar 2024 19:21:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710357662; cv=none; b=jPgSD+rlsm+eKJ1MQcRngAA9NgOidXBwXSQpLH1JNsnErfAJTMIyi5qbzOrueZKB66G5FjbcZmBK4asffO5QB0yVg3NIdGvSrxLHvrdiFqmVCUac+VN+XR1dSU8pZbdp+BCG5oqd7u5HAqQMP3mzemQOWzYaboMzmyHLa6uSzsE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710357662; c=relaxed/simple; bh=sJAi3yRoC641aj/7aZ+N27cqQw6Y+OQSeV/UsdjL9Yk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gbq8pzAMhpkG+mHLxcUIPf7oK2BD5FISdTOT6EcRNC9v69TA6wxGE4D6uI/rOh3gGexh69u3KW7vc/FHbpvxrwDPBSIQqFK38lFwoPS1m+VPrN/K98v/L1gC0Kc8sjBL7HFCwb7g6aUS88U53WSDoqU2VqUb3GJ3SkPiw80uzwY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=oqeT8VHO; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=75WVLbdwI+iDn1zwGEAUGq3py3zyrknBJPOCRtfKgus=; b=oqeT8VHOM5Ys7DVNGOQYq9T/Qa pQoxGa3NprcqJtXMbujtg5idZDjeTniP60jiiC2TiCTOx1D4CO5Qt/SajoAHJg+Xk4fQeaxMLJz27 JgvpxyjHawliDFL+XKyBeh+l3o/Gb1ZeoMoirQv+DpWxk7qb9Is+wOS6kD2hhYGDydLprhJG3An0p 0NSwjmn/ISlGvXM80dvpc6BXrkuhTpQk1wEukj8RXpsEeCuOEOdiSzPqPh8huOCbiCxv2ez5QgsEj vOJp6bQztpJURPz9GtYin1eeRQmwj4Q6NAu1dAxO2ioQ2FZvlggyYD3H54s/ZoNaEblA/+7623R2e V61Gn5xA==; Received: from [50.53.2.121] (helo=[192.168.254.15]) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkU9p-0000000BZfK-0aN9; Wed, 13 Mar 2024 19:20:57 +0000 Message-ID: Date: Wed, 13 Mar 2024 12:20:56 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 11/16] drm/vkms: Add YUV support Content-Language: en-US To: Louis Chauvet , Rodrigo Siqueira , Melissa Wen , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , arthurgrillo@riseup.net, Jonathan Corbet , pekka.paalanen@haloniitty.fi Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com References: <20240313-yuv-v5-0-e610cbd03f52@bootlin.com> <20240313-yuv-v5-11-e610cbd03f52@bootlin.com> From: Randy Dunlap In-Reply-To: <20240313-yuv-v5-11-e610cbd03f52@bootlin.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, On 3/13/24 10:45, Louis Chauvet wrote: > From: Arthur Grillo > > > Signed-off-by: Arthur Grillo > [Louis Chauvet: > - Adapted Arthur's work > - Implemented the read_line_t callbacks for yuv > - add struct conversion_matrix > - remove struct pixel_yuv_u8 > - update the commit message > - Merge the modifications from Arthur] > Signed-off-by: Louis Chauvet > --- > drivers/gpu/drm/vkms/vkms_drv.h | 22 ++ > drivers/gpu/drm/vkms/vkms_formats.c | 431 ++++++++++++++++++++++++++++++++++++ > drivers/gpu/drm/vkms/vkms_formats.h | 4 + > drivers/gpu/drm/vkms/vkms_plane.c | 17 +- > 4 files changed, 473 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h > index 23e1d247468d..f3116084de5a 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.h > +++ b/drivers/gpu/drm/vkms/vkms_drv.h > @@ -99,6 +99,27 @@ typedef void (*pixel_read_line_t)(const struct vkms_plane_state *plane, int x_st > int y_start, enum pixel_read_direction direction, int count, > struct pixel_argb_u16 out_pixel[]); > > +/** > + * CONVERSION_MATRIX_FLOAT_DEPTH - Number of digits after the point for conversion matrix values This should be + * define CONVERSION_MATRIX_FLOAT_DEPTH - Number of digits after the point for conversion matrix values to conform to kernel-doc format. > + */ > +#define CONVERSION_MATRIX_FLOAT_DEPTH 32 > + > diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c > index 1449a0e6c706..edbf4b321b91 100644 > --- a/drivers/gpu/drm/vkms/vkms_formats.c > +++ b/drivers/gpu/drm/vkms/vkms_formats.c > +/** > + * get_conversion_matrix_to_argb_u16() - Retrieve the correct yuv to rgb conversion matrix for a > + * given encoding and range. > + * > + * If the matrix is not found, return a null pointer. In all other cases, it return a simple > + * diagonal matrix, which act as a "no-op". > + * > + * @format: DRM_FORMAT_* value for which to obtain a conversion function (see [drm_fourcc.h]) > + * @encoding: DRM_COLOR_* value for which to obtain a conversion matrix > + * @range: DRM_COLOR_*_RANGE value for which to obtain a conversion matrix > + */ > +struct conversion_matrix * > +get_conversion_matrix_to_argb_u16(u32 format, enum drm_color_encoding encoding, > + enum drm_color_range range) > +{ > + static struct conversion_matrix no_operation = { > + .matrix = { > + { 4294967296, 0, 0, }, > + { 0, 4294967296, 0, }, > + { 0, 0, 4294967296, }, > + }, > + .y_offset = 0, > + }; > + > + /* > + * Those matrixies were generated using the colour python framework matrices > + * > + * Below are the function calls used to generate eac matrix, go to each > + * https://colour.readthedocs.io/en/develop/generated/colour.matrix_YCbCr.html > + * for more info: > + * > + * numpy.around(colour.matrix_YCbCr(K=colour.WEIGHTS_YCBCR["ITU-R BT.601"], > + * is_legal = False, > + * bits = 8) * 2**32).astype(int) > + */ > + > /** Please convert this comment to kernel-doc format or just use "/*" to begin the comment. > * Retrieve the correct write_pixel function for a specific format. > * If the format is not supported by VKMS a warn is emitted and a dummy "don't do anything" > diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c > index 8875bed76410..987dd2b686a8 100644 > --- a/drivers/gpu/drm/vkms/vkms_plane.c > +++ b/drivers/gpu/drm/vkms/vkms_plane.c thanks. -- #Randy