Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2784296lqp; Mon, 25 Mar 2024 09:07:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlI0jJr0YRTf2mTSCgs9NNiI+zi6RhPScqnvQZ4uLoN84YFm9r/mMQeB+kRYIpDgMxbzhpN9kH8+9urlnHyFeBWObalPf4wRNDrIA8sQ== X-Google-Smtp-Source: AGHT+IHmDrnWbpFiBuILIsUHH3F0cXAla1tbw9l445u6NXUuWH70a6nALZu5ht/WXTHDE1LNuqFY X-Received: by 2002:a92:cf0a:0:b0:368:6558:def7 with SMTP id c10-20020a92cf0a000000b003686558def7mr7060269ilo.6.1711382847708; Mon, 25 Mar 2024 09:07:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711382847; cv=pass; d=google.com; s=arc-20160816; b=jA/gGX6/7zLUSwqpdayD/kG0R6i7/mwNzA8lKb5jrtp9rBUW2Zu3D/F3pVGcu3iu/g AO//GnbC1mkNrwR1GIDYJTP3Dmac6Kpg+h0FYpovuKP7iIpIilwIi0D5CUeQO/ZSys+H 1LrFAnetre6O5svszgOPTF22M31JboftxrSWWDti1b7riwkAhRErnacCIVHeneoalgqp VSKJlXDYfxVsSnGbnG6N7Qevi5K8aSYdVQjOe4plCZPv3MuBg7ymFPrLhZoticcT8Pqt qffMMgbVkp/1NWzXpmS5teiLUBt0zOis4UJIcSF4QdPtYnye+G9GcI4DQBEq7wBWGF6h UcFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=xUK65ABO5JIGVfyGhzrrtYRdlqu3DNIId6jsPmQspIs=; fh=LEGVttrEe3EZzL8pWHKr59dCooiiMJK7UIxJnC6gzwU=; b=WAClnIVsPidPKAWlkykK/Gwk+UzWgJcYKS+pJhUWCCWDz8O1piZho17OkQl2cjz4i6 IRP3tjAHDDV/ZgBx1XrsSKY2KdlEq7JJ5BCY1K1pfrcemN02QihUAAug7u591Q3W2Szl 45thcL+QOHBDuzxw+PZRy26oHqSQJk7tHLA/+yQojZjgayTgc0g/j3w0qqfYorq4heQ3 xz+keyrOfvMMbTZ5jNfRDI2lVN7P/APeQ+yoZGPTrrKAeH+Ddz7/53ZG63tuBV6xcXup GWudKWtsaE98B8nEXMEW6Juo7/q4Fx8EgkDvz+LWnsly1/G53vd+Gx1aZXA3qQg1oSd4 kAYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=r4Vpbein; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-117137-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117137-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f22-20020a635116000000b005e4dce697c0si7983340pgb.655.2024.03.25.09.07.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 09:07:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117137-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=fail header.i=@igalia.com header.s=20170329 header.b=r4Vpbein; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-117137-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117137-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 AC2F9327B38 for ; Mon, 25 Mar 2024 15:54:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A857D7319F; Mon, 25 Mar 2024 13:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="r4Vpbein" Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 E04EC13BACC for ; Mon, 25 Mar 2024 13:20:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711372827; cv=none; b=WzJqNRgONd8hza71f68vGgqaVIkxHCq4IqdXKPwbhQo9g70NpvmDCNQ+GwVQoQWPkXUg7j7yZnunYZwSyaS8tguzwBwpyduKhiCmpGUmw6X4mJmepE9YXIdFElDrdpvhfoemUw9XOV1aiawn1T9Z9Lx2ONgno/wVezlKWz/e2qU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711372827; c=relaxed/simple; bh=rOPUZgSaBBcCHJ+2lXm2gct6krqlLyRAgLa9zf5RrFw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kdz+77nFVCFaE+SXVp7Me1DIrurBtSHIZeb4uvpmm/JoytRlfK82VIHd/nhmFB1unypnAjO+waI8O2wNt3kiSKxJJP6b5+4cal8jp8re7TobgFShygrl3RgQdqBGDJZ9Dp/1eaJ6L7hg/C5wQSxRD6Z5gBSSckeiag4Y8h8MCeA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=r4Vpbein; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; 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:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xUK65ABO5JIGVfyGhzrrtYRdlqu3DNIId6jsPmQspIs=; b=r4VpbeinWaV3SwuuhIVUZWECrM hwa7uBSe9dqOhvKZwmhmUnyNo0OkfRus2b9JexMcuLFm7Qoe9WmR3D5tPJj45IyWwElXboBu/Htd+ 9HY0+6OtilTclzMbwTcoEAiuDwhTWlUNmNSgtZC9UJMy5YeDkvmgOv6uWUZIaJjgYC3kX2zSCsyja 5iaFJJ+7QWetTSzOGYYEEn8i90OUUhEiXVKX4RPyyy9u4u3r21TVfgezzAFXGqhzc+1dwu1th46fS GFbTZzBOsV1UqzkLbt1PAGOjHdf0W1JtwzdXfx5/5AcpHq6OhXIoV+sZgL9UwjQu3Y7MKDQ3JgMUo YjCeJRXg==; Received: from [177.34.169.255] (helo=[192.168.0.139]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1rokFF-00F4gm-Rv; Mon, 25 Mar 2024 14:20:10 +0100 Message-ID: <3f577a73-3daa-44e4-ab3c-ead1df422cfd@igalia.com> Date: Mon, 25 Mar 2024 10:20:02 -0300 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 02/16] drm/vkms: Use drm_frame directly To: Louis Chauvet , Rodrigo Siqueira , Melissa Wen , 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-2-e610cbd03f52@bootlin.com> Content-Language: en-US From: =?UTF-8?Q?Ma=C3=ADra_Canal?= Autocrypt: addr=mcanal@igalia.com; keydata= xjMEZIsaeRYJKwYBBAHaRw8BAQdAGU6aY8oojw61KS5rGGMrlcilFqR6p6ID45IZ6ovX0h3N H01haXJhIENhbmFsIDxtY2FuYWxAaWdhbGlhLmNvbT7CjwQTFggANxYhBDMCqFtIvFKVRJZQ hDSPnHLaGFVuBQJkixp5BQkFo5qAAhsDBAsJCAcFFQgJCgsFFgIDAQAACgkQNI+cctoYVW5u GAEAwpaC5rI3wD8zqETKwGVoXd6+AbmGfZuVD40xepy7z/8BAM5w95/oyPsHUqOsg/xUTlNp rlbhA+WWoaOXA3XgR+wCzjgEZIsaeRIKKwYBBAGXVQEFAQEHQGoOK0jgh0IorMAacx6WUUWb s3RLiJYWUU6iNrk5wWUbAwEIB8J+BBgWCAAmFiEEMwKoW0i8UpVEllCENI+cctoYVW4FAmSL GnkFCQWjmoACGwwACgkQNI+cctoYVW6cqwD/Q9R98msvkhgRvi18fzUPFDwwogn+F+gQJJ6o pwpgFkAA/R2zOfla3IT6G3SBoV5ucdpdCpnIXFpQLbmfHK7dXsAC In-Reply-To: <20240313-yuv-v5-2-e610cbd03f52@bootlin.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3/13/24 14:44, Louis Chauvet wrote: > 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]); Nitpicking: Could this be packed into a single line? Anyway, Reviewed-by: Maíra Canal Best Regards, - Maíra > } > > /* > @@ -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); >