Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1976884lqe; Tue, 9 Apr 2024 06:26:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWL56o2Dbv4DrDrake1ooR+QUjZ1XtH8yYu06mW5mZMD/s31VeRf8QT1Z6O6klSa8plpzmLJRqnw9Wyoh6eHRUm9Pahx/1kmVJG+g+fwQ== X-Google-Smtp-Source: AGHT+IEZC/VkpTNBNNS7d/zRBQaUcw1S+Apa4OEH8GARRac5lXziEOPXJWpSkRzsD/t7ySF/Nc9s X-Received: by 2002:a17:902:d491:b0:1e4:124:6940 with SMTP id c17-20020a170902d49100b001e401246940mr8872301plg.56.1712669165496; Tue, 09 Apr 2024 06:26:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712669165; cv=pass; d=google.com; s=arc-20160816; b=XNonVgBPcym/WUhr5CRV2AOv5+k/KROqDbWYRUdgsm/5q0PZDMh5Srb9UD/6q9ufpD RAjGcE86nv0TVrKn/9gvQURxNG1xGBxumFlB4ROfMIpwYkqMYdGW6gnCYpzHODXCVdvv 1JkDLuJjw4LplDcwIzP/2J2ken7fZhJ7CILHSCwZTkhA9lVbpYZa7g0yK1kevTG2ZaTE do5Ny2hITOKxqpa8ViVK0LNI5pz297IqQbPMCVmx2ni4xCYwIUzvaEhpEMlPCGVFwcxZ AtuUAyOeYfVIyanrKqucNX3rU0waaRV0N89mNy7YJaeCqiE9f1vYPHk/ZH9/6PsSu2ss Ag0w== 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=Oi7GyBKm/1sZhqvwqoQ6b5yrUzjVC/wNzft01alK/6w=; fh=VAOzQyCZUIkIVRfkT59kO+F4O4ceAQVh6KAZCdsXYJ4=; b=sFsJx8eZJaHAfxRgssa1ur1dEx/svia6EnSOcU7wysQiQKfKHDp3oU/pLJ6l2FLVz8 klp0QM6+Dbvxlw0W+pAemfmWxNuuqlan0M1jr3A6TnOxbAvpng4iV7C4LXeEEIHKQfrD 9El9XaDlhq0EgftJJspyK4dOoB/bRcKunwqehp3EmD8OBoLCT4ZT5Ah7SYtv01xGaoM0 o0tF/zvlKZ0rCMjazSwdTlQPSlVUjhOUWcEvF1vK/3yZKznEHSZeiJScY9rJssG1Ex99 coohEtKTLjgpk2lntgathm71pN794MDaR9cxfT59yQQFoJ/GU9aZVtb39M9rVxTtrqF7 575Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="lwQj/0fV"; 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-136940-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136940-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 x7-20020a170902a38700b001e3d68b3bf8si6626680pla.594.2024.04.09.06.26.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 06:26:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136940-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="lwQj/0fV"; 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-136940-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136940-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 00EB6285D30 for ; Tue, 9 Apr 2024 13:26:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A045A12F5AE; Tue, 9 Apr 2024 13:25:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="lwQj/0fV" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (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 8900412EBD6 for ; Tue, 9 Apr 2024 13:25:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712669149; cv=none; b=JVOb6xhiheCdMeesRvexxETzgKR6284cssOuiNQvwLCbRDPALAkoidNZAHKMuCqO9ncsGdl93am0EakXpAb5UHsrvuc/J8TvICRKuYl7lJFVEyg9Fr9AGVGfWgkQ1BGN2EtzY4B8XICVzjUggQohL+wHQvhKR1AWixrUVY7hseI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712669149; c=relaxed/simple; bh=iLgFxzpnknV1Bn4h2afKr7VkutzzUEt3tRKTBTlmMMA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d9F+PL6wA8zkCbDVQMAdkE5D5uzKvhiiLTKFiFtv7A0IAnE3aeqc7a14Q0NnGuArD9t4feTtqmIlk8npaqfZSGq6h+Ee/W5sJjRj+upmt5zMZWjdhD9+PP36/ZKuygaIxR8zOvog31k7dHjaK2LZRcL0M68b9NEifNrvRUgH4rk= 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=lwQj/0fV; arc=none smtp.client-ip=217.70.183.193 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 835DE240011; Tue, 9 Apr 2024 13:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712669145; 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=Oi7GyBKm/1sZhqvwqoQ6b5yrUzjVC/wNzft01alK/6w=; b=lwQj/0fVX0QprDSVhQmQWMFBbITaVosfjSOJd6IfydVaOuOwuUBIRxQSjMnmkbtWjpa9uz OQPWu5oPHMyN+lGcx3FpfhM5TJ67xCs70TmfvDXF4jVE0giGoyHpkdE5LBw54n0jjeuUOU GU1y7q/v9E+/7ZKZx7qEdHF8m9cdH+a5pU96b14rGu0fFk9ycCrvLCApBkjR7tn5vSumc8 JTPh/SU9v66IUFw5nuhx6AGst5QZmeictJeULAQACIO2Nka68Byg1osavIPAhnPu6VMO49 LVt3GaVGtcnooacg0HQwhiI4lO8qQy/lZEt9CLvD/payun5+4d8v5kuG10YE5w== From: Louis Chauvet Date: Tue, 09 Apr 2024 15:25:20 +0200 Subject: [PATCH v6 02/17] 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: 8bit Message-Id: <20240409-yuv-v6-2-de1c5728fd70@bootlin.com> References: <20240409-yuv-v6-0-de1c5728fd70@bootlin.com> In-Reply-To: <20240409-yuv-v6-0-de1c5728fd70@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 , rdunlap@infradead.org, 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 , Pekka Paalanen , =?utf-8?q?Ma=C3=ADra_Canal?= X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=4272; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=P538Lnjn6stqlM903i7YJicw7rzokxcvfQ5Tjel3y4I=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmFUHRw8F7cP2+JyqWuZPhNLWy9PUY5CeyIw9Cj WmfxkV5PxOJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZhVB0QAKCRAgrS7GWxAs 4m4+D/4j4woHHXNs2iL/hOVZNAu/SFEu/ecWEOKLdVntYRs5eSMjQf6rihg014v4uZZEo9XMoSR tTgRoP6Y8m4Vufq+fTV7l56VTlL1a1UJ40o/LvCSD5BIcjcZl78zlkFpUBFMg3we7vHaM2/eR/R QxQ1V0yqW9HEoysyL7svkGZbEXz12Y7ylbxvLXgzdpR5HGaFVPknQiKN1rRkG27iLNKabVjNMIB tVM4117TheKc9MUK8D9T0Z+v1hi4PcQpZBcdh0dAQOo/x4YIoVG/8Rf1i2cLIXgQM99BH4I8yw+ jfc6M/wejQfEBUPQqKwmobg4rjXqYkqJMxX0u3HD7fHM6qLfqNHTbeChNmfRSE8uLbDmmJCGz5f JgGw5zTipnenhlgiyxnenqxyK3IDyaG/EmilTpH5MmsS/p5DFxAwp0OCLqegLd1CKUhjCUQmgrP ti5S/vpAMpTxmslSlb6HnyzXTOnPcKhRp8DAUMnOBpbxXb/Eewjaa3Ia1dOY84Q9sHlqKXAUY7H 1F7iOPx+R4C8lKRM4pR9FzQU9c2tOtv/EJaVrlk07aTojnBdsg2eVUBc3XNJ0KOYsQDomyek4L8 8L6zpZ2yQWwnxasbrVLDjSb2n3n9423P16zG+yYWVjHMxCzuH3JCi5muSCulWPBZvgwEGYFw7kY 8rdsy3VAxvJm+VA== 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 Acked-by: Pekka Paalanen Reviewed-by: Maíra Canal Reviewed-by: Louis Chauvet [Louis Chauvet: Applied review from Maíra] Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_drv.h | 3 --- drivers/gpu/drm/vkms/vkms_formats.c | 11 ++++++----- drivers/gpu/drm/vkms/vkms_plane.c | 3 --- drivers/gpu/drm/vkms/vkms_writeback.c | 5 ----- 4 files changed, 6 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..d597c48452ac 100644 --- a/drivers/gpu/drm/vkms/vkms_formats.c +++ b/drivers/gpu/drm/vkms/vkms_formats.c @@ -11,8 +11,9 @@ 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 +132,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 +224,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