Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1922083lql; Wed, 13 Mar 2024 11:56:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkvNWqT/rAf1FYqcEoNLg3PEoothWInPh39F1xvZln2BBES/yaa4jF190jP1l88SS7c/rObMkYdmqnhP9BvYfk80w3YJI9FgvxwoiZsw== X-Google-Smtp-Source: AGHT+IFYx+gzGNXaOQzDl+zrCV+7LQWpblAlkp2pRHvJQt8aBRcHOrhEebAqFgdZzfzGOvpzIXhz X-Received: by 2002:a05:6870:1c8:b0:21f:1705:d5b0 with SMTP id n8-20020a05687001c800b0021f1705d5b0mr13534401oad.52.1710356186782; Wed, 13 Mar 2024 11:56:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710356186; cv=pass; d=google.com; s=arc-20160816; b=oQdmj4dBAMUTuIm1o1K3bQ5nf/cQ4XRnoT97zfgpX6my/FjU0dN8PyWnPwGzu+Shqt bDGYVWm1uwXSKNC6gplPu+k9k5gsoFKHG+3rkEKvP4af844EGiC7NEkD0FhKuJeZ8BgN HRZ+cytvFLeABD4O7SAdZvkchoK1kngNaPYURFvmEY3BB9E/jKkPyS3oooKMqkg5mn4v WNbVuyRSLVFjvJucDy0mdJ4KxQlz0qc3HB3pAQOTq22R7iW00Yu1BB8IzZjJ2a9iOMpx tiIjfHm5kmeDQYeVQwSpcBIx9p8B6Ww86CHx4Uo9bfoM3+WIC2oldEd+gPNZOBl3NUk6 J0Hg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=jiFoWvvgAV8DiexHt8SOwI23FzpgbcJPyIxwHbI/8Nc=; fh=I1mDzpQ2i/fckVIeMd+WKWb14s85mMQWc3/wF4wbFPI=; b=ZqoAnzyvL+RaWM2IT6O1k4/YNJ8Ol/y4DXSxrGR/ldONGkxSyLvllVPmftJtTOQjm4 z+WkalmL7dnACPxjorpjsLWQGYV1OxvkbonU6/OFmsYDTStTSC18VEt7k1mjQ6tT8DAL MfvZ3MFLSHsxrXAK4ANeU/yUDpOSFtM1NjiKK9+KGzD5HuJ5jzIVsvWCgx+Mt+pU79aj kclr1y4BdRt0KIMEakw3gpWW1FgEU6JXcJAQyWuNTzdoG4pC475OaP1nCd+JbpDShM9N xKB5mQvNIrCf+/wNlRM70SPVrB+TfJPa69wW3uyGFfAS+oK3e6nwYTWZtdPlp9LkJwsS EC/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Ky2Wirqz; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-102298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q68-20020a634347000000b005d2520bdefbsi9640381pga.208.2024.03.13.11.56.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 11:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Ky2Wirqz; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-102298-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102298-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 84ED328D871 for ; Wed, 13 Mar 2024 18:48:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7EB0B66B5B; Wed, 13 Mar 2024 17:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Ky2Wirqz" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (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 5367B664BF for ; Wed, 13 Mar 2024 17:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710351939; cv=none; b=emHN7koBP77nUT340E4TAW32bH1VsxR+kC8653O6vOyN5pXUTv28USBZPiUUAlLHsAuvYmTBtuilJoRkWhYAHSvChK90Z7szfNHK83ztZXrkiIUKtubf0pIkkpJA3qpSL8wTM+EF/Bt6dY78JO/UJ8wur+/HWRZEnelI19HjL9s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710351939; c=relaxed/simple; bh=C6OwiZbsA/r07rj3x3/MPs0wZMApQBIBXozZofHUEd8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KpKeW9eXeRXYtgn3lhI8KBSrnElRwxc8KCAQMwCIcOAtNCDjMmld67EoZ10bxZNb8DHTI17fzDoTgoPz+6VFu35Ky9bNlWDMbNVw+qnwx+j1SJ4GVXstfUr4lAOMtpzdaP4MNI3095ij2ANIvwyOnZwm2LVGKUZgkDJDGqU3Srs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Ky2Wirqz; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id C528B40009; Wed, 13 Mar 2024 17:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1710351929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jiFoWvvgAV8DiexHt8SOwI23FzpgbcJPyIxwHbI/8Nc=; b=Ky2WirqzXeIoJNa/WIFP3+Exy5REnzJ1Z7sr+vUwTBWE5nW5AVcLT824dSlSQ2LlqiZyOU wdMBGM2qKnzIVDuB3vhRiXuJXs9vwMgchsUmAGW0qbZK8nBacxuE0csBP/RUkNLtHFoUnU KCRbXOCzsNrUx0PeIU82Mj4Zhx/fOKmjdxD7jgmyaVOoYj2CcZvMlMqj2Tp1vYY7iGFwRf gX/C46k+Kbi34tHjjcbXrJMfHp2OTtblG5UNvFJBlnZ1mgws32Hzek23DSS5qts9FL2lqb nu3k5PVjmJDrqs9PPTBmfCNlx4mweZKLkT7I6CpKRkTeROOoWy6G2ZEFHwQWRA== From: Louis Chauvet Date: Wed, 13 Mar 2024 18:44:56 +0100 Subject: [PATCH v5 02/16] drm/vkms: Use drm_frame directly Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240313-yuv-v5-2-e610cbd03f52@bootlin.com> References: <20240313-yuv-v5-0-e610cbd03f52@bootlin.com> In-Reply-To: <20240313-yuv-v5-0-e610cbd03f52@bootlin.com> To: 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, Louis Chauvet X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4080; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=N7pM5FLs21FNL8hsQWxNphWYncmcUeuWyWea5GV/zSA=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBl8eYySjdIDO0IEapq4icOYEIqSrn1vtEEN6kMxiNo OzMxKl+JAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZfHmMgAKCRAgrS7GWxAs4gO5D/ 9KYM+FUJvh7eqVuT1QqqYkzCvJ9iAbKtPiLOSqwI9ObI8kaq1fr41xD6UR9Pxt+dbHcVDVd0rO1Fq+ WDi3iGFO6uv/G7Mqajg66IgHn4T2VXtfFW9aiKXcJuofm+5H380R7fdSSY2f3wDbezTANBCkJym7SP +qrF0zY4/g9OO3Us/MkzDRWuWT23RKQ53+aB7MXPpuWzmA9BhCAvVEkRzTC9lQRY7bxDkw0cySZlHQ QsQ/9bG8KFX0MWFifOwQM8QUYzlmfhPrOsfscsWKBCR2OeTf29DQvgI8KnuBR14huhJ2kNUnMDU5Q8 X4Qhzv2J53PbVCJk60vGK3UZmjZgTIMo3/DfdRItF/TULeYtguXFCzjxBBG8S31/cF88hZeGNYPi8E BLQOcM/Xi6QS9szKpGH8eK/hPqvejUBo0Sk4Z5XcGxfXotEK+GHibz8KFnYxPJf1SnuVCwpTOEJ8+k nJmxLTX3vInfn9eaekM1BYmJVTjalbQwcSkVRkIqSnHFU1tChvImIAPwqxgmrgvNKNC71qMogbnhZ2 vIC7E5pYMA3KV/45vIYsR6vxd7u+3dq+dM3O6cZtVPCyxVq2B15/gncZfjtvkycMynSfr18WZJVF9a jpIAHjo3v7CxixqumT5h8eQcEL6qb67vNLj3U57mL274X0Db6/6qO28txt4Q== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com From: Arthur Grillo Remove intermidiary variables and access the variables directly from drm_frame. These changes should be noop. Signed-off-by: Arthur Grillo Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_drv.h | 3 --- drivers/gpu/drm/vkms/vkms_formats.c | 12 +++++++----- drivers/gpu/drm/vkms/vkms_plane.c | 3 --- drivers/gpu/drm/vkms/vkms_writeback.c | 5 ----- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index 8f5710debb1e..b4b357447292 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -31,9 +31,6 @@ struct vkms_frame_info { struct drm_rect rotated; struct iosys_map map[DRM_FORMAT_MAX_PLANES]; unsigned int rotation; - unsigned int offset; - unsigned int pitch; - unsigned int cpp; }; struct pixel_argb_u16 { diff --git a/drivers/gpu/drm/vkms/vkms_formats.c b/drivers/gpu/drm/vkms/vkms_formats.c index 36046b12f296..172830a3936a 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -11,8 +11,10 @@ static size_t pixel_offset(const struct vkms_frame_info *frame_info, int x, int y) { - return frame_info->offset + (y * frame_info->pitch) - + (x * frame_info->cpp); + struct drm_framebuffer *fb = frame_info->fb; + + return fb->offsets[0] + (y * fb->pitches[0]) + + (x * fb->format->cpp[0]); } /* @@ -131,12 +133,12 @@ void vkms_compose_row(struct line_buffer *stage_buffer, struct vkms_plane_state u8 *src_pixels = get_packed_src_addr(frame_info, y); int limit = min_t(size_t, drm_rect_width(&frame_info->dst), stage_buffer->n_pixels); - for (size_t x = 0; x < limit; x++, src_pixels += frame_info->cpp) { + for (size_t x = 0; x < limit; x++, src_pixels += frame_info->fb->format->cpp[0]) { int x_pos = get_x_position(frame_info, limit, x); if (drm_rotation_90_or_270(frame_info->rotation)) src_pixels = get_packed_src_addr(frame_info, x + frame_info->rotated.y1) - + frame_info->cpp * y; + + frame_info->fb->format->cpp[0] * y; plane->pixel_read(src_pixels, &out_pixels[x_pos]); } @@ -223,7 +225,7 @@ void vkms_writeback_row(struct vkms_writeback_job *wb, struct pixel_argb_u16 *in_pixels = src_buffer->pixels; int x_limit = min_t(size_t, drm_rect_width(&frame_info->dst), src_buffer->n_pixels); - for (size_t x = 0; x < x_limit; x++, dst_pixels += frame_info->cpp) + for (size_t x = 0; x < x_limit; x++, dst_pixels += frame_info->fb->format->cpp[0]) wb->pixel_write(dst_pixels, &in_pixels[x]); } diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c index 5a8d295e65f2..21b5adfb44aa 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -125,9 +125,6 @@ static void vkms_plane_atomic_update(struct drm_plane *plane, drm_rect_rotate(&frame_info->rotated, drm_rect_width(&frame_info->rotated), drm_rect_height(&frame_info->rotated), frame_info->rotation); - frame_info->offset = fb->offsets[0]; - frame_info->pitch = fb->pitches[0]; - frame_info->cpp = fb->format->cpp[0]; vkms_plane_state->pixel_read = get_pixel_conversion_function(fmt); } diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c index bc724cbd5e3a..c8582df1f739 100644 --- a/drivers/gpu/drm/vkms/vkms_writeback.c +++ b/drivers/gpu/drm/vkms/vkms_writeback.c @@ -149,11 +149,6 @@ static void vkms_wb_atomic_commit(struct drm_connector *conn, crtc_state->active_writeback = active_wb; crtc_state->wb_pending = true; spin_unlock_irq(&output->composer_lock); - - wb_frame_info->offset = fb->offsets[0]; - wb_frame_info->pitch = fb->pitches[0]; - wb_frame_info->cpp = fb->format->cpp[0]; - drm_writeback_queue_job(wb_conn, connector_state); active_wb->pixel_write = get_pixel_write_function(wb_format); drm_rect_init(&wb_frame_info->src, 0, 0, crtc_width, crtc_height); -- 2.43.0