Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1202485rbb; Mon, 26 Feb 2024 01:53:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXAyyf/lsnI/r7pMNjibCKe4of1mIhLZGxnmI7QyFuqh72P5d854VqeTi7Vd4NI0ba9T9xqwfv94r9AZ4iduiF6XItfDUQE7wVEY5ZyOQ== X-Google-Smtp-Source: AGHT+IH90GqGhswJq3ywUv48feK1k6s6vOt0GFDslUtySOzEo5+ocoYZ8+Y4gRy5/K25Mrs/cM6H X-Received: by 2002:a17:902:f80d:b0:1dc:4d63:7a0d with SMTP id ix13-20020a170902f80d00b001dc4d637a0dmr5227401plb.41.1708941193841; Mon, 26 Feb 2024 01:53:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708941193; cv=pass; d=google.com; s=arc-20160816; b=1FEzR8LtiZX21qbGcnKgQ3fL/oPrU3g+cBH3yq2mHUpr9AAkQQmYjKZNyoA5fISkAV F8mAvXlw2PdsC/7ADONj+EWSr4YkA8hPD2ZHvtLEl4wo8tTBxrYrjQuhNsjk4dclmrwX ntRIFwQ7cfG6N6df/R00fSeaZFs4WSYw/g6/zo3aX+l516N0OUSZNWYQ0aCTSUoB7OAb V613iK8cS7isj+3eftU32UQl1gMBJoBBXk9I2FhbcdgcgS/V1EW1s/FyfzNY3gjSikTm tLOoBIB08BAx0XTwvYTJYX7EyEaeV55soP9uZI9nZ09joezW7oL3lkpq5fcYrprxdq48 +D1w== 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=H9vIAXwIOUIWcL2JXzqSsbjPwFVUBmSDwO7BEh2dBj4=; fh=I1mDzpQ2i/fckVIeMd+WKWb14s85mMQWc3/wF4wbFPI=; b=z6O2Qhhyps29q44mdPYZ2BsYkeRCPnho7GdodT37EuwHnpoWsRYdG7UFUClNwrK29p eRMP0h+ZwWiJEjRBuWK9znjJIM3URPj3zWm35T++X9G5rjXyk+G2QaiK4n3z/5s0WLdv M3hRkaV9d8+NQ7G99QsAP368u/XM5S7i7qxAviD3Qq84dLsRxx5F//KqHKU50Qx9yZfm zUrTg3JuBNqMzUc5PAxWcTpLcDZJUj1n7u7v8qnBmWY4SqmmRgyG1wm5gS6TK1f+rcnS Fh9u6/7w6T0s4/jmsKEBPQuBr4mrWu9FtWQ58rTO+S/V+IjsCjpJRiKp8+f8pffpc22i R8+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=nN8TuUL6; 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-80952-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80952-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u10-20020a17090282ca00b001db6f9a9892si3298683plz.582.2024.02.26.01.53.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:53:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80952-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=nN8TuUL6; 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-80952-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80952-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E0B70B286C3 for ; Mon, 26 Feb 2024 09:27:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC8805D739; Mon, 26 Feb 2024 08:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="nN8TuUL6" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 9F2F55B053 for ; Mon, 26 Feb 2024 08:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708937276; cv=none; b=WbLpsWMKLZ0zSx5dnAWx9BWD+sShtZz4BtlOdWXcmAFT80GLm+vq0knXzwMbnzc+mpDcPNNtNTHqDUeR/HVQBx7S5WnOVmgahp0XzPDjHTfHw+eO9nkn5VgpXSJxJAqFND5QJX4NyAPcx1+QGC8L5Fm8qwROLTIZNx7M9oOQAsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708937276; c=relaxed/simple; bh=52wWLXv52UxCcak1ee9ZxfQFyR67YA1n+FDOTYunbls=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DE8nMayZ6sTGUvtNvmkUbxHYi0YwBHfZNUdr1Xn3Faddyinr6UiIAGjlUAB64Tpu3hvdDCrm1FrqtWZzvdPeufBlUSkTlPiHEVmO66YzMqNuw9e3uYL+Wccrc2ZBxPCcx0yAzsQ9iHlQ2rSCNeRd64kE4cxqPUBTdQ9ryaibxno= 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=nN8TuUL6; arc=none smtp.client-ip=217.70.183.196 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 77F77E0009; Mon, 26 Feb 2024 08:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708937267; 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=H9vIAXwIOUIWcL2JXzqSsbjPwFVUBmSDwO7BEh2dBj4=; b=nN8TuUL6adz42hygbOVFWa4jgP7KBBogIYXA6S4gttnyqR8f1KSl2+QF9GZq0FlNLk7+N/ BmgWf0eBzwlbGm5NAuBfmETP5jFUvCTkR53QXAzoLXXwFMtIf/QtURKrUMeVOVB7x/yvUI v3hJ0xNMR9grs/13q4p01e4in7bD9FwCv/zVYNh7sX8GknqQP8BEovTZSWR9s5JNZJMGwe m3/rrKXkd/mkOWttOjNrfOc1liuqynTenGCw1zrm32Kulzx+NNPbFita9oPVKgywhcmsYx tT1mQc+pOZMkAxV90zug2UxjzhLyxTg+FAwQ3SnlLHhBKlSu99G/g3gZEfZA+A== From: Louis Chauvet Date: Mon, 26 Feb 2024 09:46:32 +0100 Subject: [PATCH v3 2/9] 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: <20240226-yuv-v3-2-ff662f0994db@bootlin.com> References: <20240226-yuv-v3-0-ff662f0994db@bootlin.com> In-Reply-To: <20240226-yuv-v3-0-ff662f0994db@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=LCanIMOHanyMsqevo6fpwtNwvVAT/mqVTUFuxMtxwSE=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBl3FAtuiQ6jRmzYIPsTeKSZE8illNBYsEnwQ+gUreK zWIHgHaJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZdxQLQAKCRAgrS7GWxAs4u60EA CUaP/X34+cahIVRsIhdYkZI45wEqbIjim8CgMJfqBKAMArEQboSF06LAZgy2bnZqYIGMnaipJWPe6W hWtOXzCXalmQCpW3S5P9c+/5AraMUs743wICTWerTIfkiPelYBCIYMEUGCltJSuEcVjjcHfJ//wXqG dkVJS3l5S1iijWk8nOTaGxWAc2sMe7cDRSYtt+rrbKul0B0hAiNCUvxiEjbXinuVPOaiYR0+VMiU9s 3GXuAQwq69j54ABCgN5qDEtH/oyZVABLwaiQQClnXinqIsfmtTkVl89lKsRrX0ZWyPXPCG9rPbOy6+ g9ynWpzXtAsN8WdkcuCO2QLYcTYLXxQBYNEF0PQLRw6QrFhfdd/LJSBcCN/bLTAsgpwIjJsriwNcXL dvTlfkohhcPpUHKzr96+4Ebsm72lUZAsXl39sZEDOEciDyQR/SuJRWaxLzyPEcWWtGfVuvOEW21jtL 6g95Zd/fgOtiTS+sC+OBEo2PIQpq72olLG1fl1qDL52SCEbb0fTLv55F9V5hSaj9rq1ogBGJlI/eOW DbafjTZRa1Szk9H67gB3LUn/PB/JtGYP+r1rPlfVlczD3Rf0IPOSLobUa3CbgK/rf0/j0XGp4SNFN1 0Q3BJSFX7rcDUv8mzQXRO6Ot7Y54G/O4JaVyk9ypWP/VfLmmMb3kCLke7q9A== 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 90c09046e0af..d5203f531d96 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -124,9 +124,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