From patchwork Wed Dec 6 10:14:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13481400 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y25vgORQ" Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D41F8D44 for ; Wed, 6 Dec 2023 02:14:58 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2ca208940b3so7230491fa.1 for ; Wed, 06 Dec 2023 02:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701857697; x=1702462497; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=70HOTD/cQ7LFZtK322MA1C1lmqh4uEFtx7g2XW2sKm8=; b=y25vgORQI2br72FAF2ij0xzl6bYiFQV7vnunKD+S2PbGs/6Wdmx9fC0kdBe79S87NU 6c21nhDFjTeaMippU7TW2th0Xe9Qt+eFCKNgCLmWhNTjKSXNnj+eWDp9XbX+vSl8W3+s ZAEVm8hr/a8vtmG1YsmYzOA0alwK0eSqZD31qG2CQ+FRnaKCr5z2eZi3ublAWJczkiT2 gB451PZef+MyK7dcZj69LGMIeavnshaGp+Hd4G5pTzhzc3youU0M7j8QoDV9YTfQ1Odl hWi9C8zRxq/T5Izb4SLP2wARoZgftgJm4zG9KM/m1iby9HjCUgDCfRUKFjWbzUMDMu6p G6Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701857697; x=1702462497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=70HOTD/cQ7LFZtK322MA1C1lmqh4uEFtx7g2XW2sKm8=; b=mzRqZ7XbEIFv+pd/PuySFb72mTATrxQJ0a0FnbXTbgS7ieqqx9JjsdrdYxJiDU1Utq smBFAU3wPoMS9pRiiMerRsdIu7RweZyAyAI9TaAeXr6jivRXU9I515niqvUl+r/y23WT z7RGO0H9cw8bpuQVEVzdGlwz+6+OXJ/UuGeJ5yrtJZiea9i2yGx4iU7+qQsmkmUcbbq7 X5X3Fjdle02tP77tuezy07nebwlH4AVT+eDcNCWuonCtL8igfOH39GKlvSjCkQSLXhgo EE+NGUmJ0m9BoJniEn1SK9Th5xoM39U2MyZ6a3/u8GIeLRMqPswcLfGjJSCGtVBAjeiY gBMA== X-Gm-Message-State: AOJu0YwvcKO/zcKrAsZARfpK5K24mF+i1aGpg5+/J96TkBYycGM0ZaCQ 0+K52TeFLfMp4de/FCWwBccs4Q== X-Google-Smtp-Source: AGHT+IG5lnaNCOrVzAPY7gQ6lp3lGWfEendm5wcELXyB0ij2XYr5rj9vMGUe4uWkEY58YD3XbDmdiw== X-Received: by 2002:a2e:87d4:0:b0:2c9:f46d:dbbb with SMTP id v20-20020a2e87d4000000b002c9f46ddbbbmr457953ljj.23.1701857697093; Wed, 06 Dec 2023 02:14:57 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id f1-20020a05651c03c100b002c9e6cbf78esm1519012ljp.19.2023.12.06.02.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 02:14:56 -0800 (PST) From: Dmitry Baryshkov To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed Cc: Rob Clark , Abhinav Kumar , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v3 1/2] drm/atomic-helper: rename drm_atomic_helper_check_wb_encoder_state Date: Wed, 6 Dec 2023 13:14:54 +0300 Message-Id: <20231206101455.1664463-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231206101455.1664463-1-dmitry.baryshkov@linaro.org> References: <20231206101455.1664463-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The drm_atomic_helper_check_wb_encoder_state() function doesn't use encoder for anything other than getting the drm_device instance. The function's description talks about checking the writeback connector state, not the encoder state. Moreover, there is no such thing as an encoder state, encoders generally do not have a state on their own. Rename the function to drm_atomic_helper_check_wb_connector_state() and change arguments to drm_writeback_connector and drm_atomic_state. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_atomic_helper.c | 16 +++++++++------- drivers/gpu/drm/vkms/vkms_writeback.c | 5 ++++- include/drm/drm_atomic_helper.h | 5 ++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index c3f677130def..c98a766ca3bd 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -795,9 +795,9 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, EXPORT_SYMBOL(drm_atomic_helper_check_modeset); /** - * drm_atomic_helper_check_wb_encoder_state() - Check writeback encoder state - * @encoder: encoder state to check - * @conn_state: connector state to check + * drm_atomic_helper_check_wb_connector_state() - Check writeback connector state + * @connector: corresponding connector + * @state: the driver state object * * Checks if the writeback connector state is valid, and returns an error if it * isn't. @@ -806,9 +806,11 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset); * Zero for success or -errno */ int -drm_atomic_helper_check_wb_encoder_state(struct drm_encoder *encoder, - struct drm_connector_state *conn_state) +drm_atomic_helper_check_wb_connector_state(struct drm_connector *connector, + struct drm_atomic_state *state) { + struct drm_connector_state *conn_state = + drm_atomic_get_new_connector_state(state, connector); struct drm_writeback_job *wb_job = conn_state->writeback_job; struct drm_property_blob *pixel_format_blob; struct drm_framebuffer *fb; @@ -827,11 +829,11 @@ drm_atomic_helper_check_wb_encoder_state(struct drm_encoder *encoder, if (fb->format->format == formats[i]) return 0; - drm_dbg_kms(encoder->dev, "Invalid pixel format %p4cc\n", &fb->format->format); + drm_dbg_kms(connector->dev, "Invalid pixel format %p4cc\n", &fb->format->format); return -EINVAL; } -EXPORT_SYMBOL(drm_atomic_helper_check_wb_encoder_state); +EXPORT_SYMBOL(drm_atomic_helper_check_wb_connector_state); /** * drm_atomic_helper_check_plane_state() - Check plane state for validity diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c index d7e63aa14663..23c4f7b61cb6 100644 --- a/drivers/gpu/drm/vkms/vkms_writeback.c +++ b/drivers/gpu/drm/vkms/vkms_writeback.c @@ -34,6 +34,9 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct drm_connector *connector = conn_state->connector; + struct drm_writeback_connector *wb_conn = + drm_connector_to_writeback(connector); struct drm_framebuffer *fb; const struct drm_display_mode *mode = &crtc_state->mode; int ret; @@ -48,7 +51,7 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, return -EINVAL; } - ret = drm_atomic_helper_check_wb_encoder_state(encoder, conn_state); + ret = drm_atomic_helper_check_wb_connector_state(wb_conn, conn_state->state); if (ret < 0) return ret; diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 536a0b0091c3..fea528aacfe2 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -49,9 +49,8 @@ struct drm_private_state; int drm_atomic_helper_check_modeset(struct drm_device *dev, struct drm_atomic_state *state); -int -drm_atomic_helper_check_wb_encoder_state(struct drm_encoder *encoder, - struct drm_connector_state *conn_state); +int drm_atomic_helper_check_wb_connector_state(struct drm_connector *connector, + struct drm_atomic_state *state); int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, const struct drm_crtc_state *crtc_state, int min_scale, From patchwork Wed Dec 6 10:14:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13481401 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aNnfg+ZI" Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6507120 for ; Wed, 6 Dec 2023 02:14:59 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2c9fdf53abcso7253711fa.1 for ; Wed, 06 Dec 2023 02:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701857698; x=1702462498; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TRXp7Tk+V86C1yaIiO+GTt7udFDOuzNm3PPg635Y8sk=; b=aNnfg+ZItEyxFgO65RKQT/J7BYG9cg2hzWcj5M7dyr5rMieQijPgaRba/LnqV8Tv27 pmr6y164wlZMfXtKq0ZhuxkPak5SRKsIVZWiUL80dkEYuvaQLCuKn47SfC04kiOH69ET 3+F0h7fVjzBcZtrDuvwXkTKhwE06rU6xErviZqdfDQ9DFRpgWMQeE9xKXcGtXPSNSjxL 0bpnofLogKzchMQFpTkkLdS0lfDFmOpJgzsYaATg5wk7Vb/6xIdahjbRKaoraePrzU3G Pd9RkRVf+nznQY8l5bUeuwtBqgZpljAug8Ixv6meE9uZDydZ5eunW+xMqpxhsXVi4DKx /VBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701857698; x=1702462498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TRXp7Tk+V86C1yaIiO+GTt7udFDOuzNm3PPg635Y8sk=; b=OJVI6S86SwZ6CYevM8U8wCuk2TSBrHA+wItn9OLNJ5GWXVSCra93GkWcK28KQWoHQ9 AbrtJuDg7JSG+2AAolHLhkfEYK7dHfdHdNlKI5hHnmQGLVRmi+8RrWTKR6YaCBnRyk82 IztBOCPd+VhFcVYx4c9F8hyaJ6EjmFrpKliMtNcItemIyCbyFIRK/qwhcxc82TNSjJuB Vb8aDjQRMMfw5afhMoRe3Pba+NOT02evyYoiR6/eO7DU+FRHgaLDNn08jSo5OVfpiuXT euFA09FXOEWUOYF5hMdbzm9iXOvmWS32Xpo9vRAZl4PfYrgoqQ5ANwmAxUPFzpxFifvo Kr6A== X-Gm-Message-State: AOJu0Yx5/WrYcM4ug7u0QKpsNXZbF5yonApD7ws4UimykyNTWj1SIxiy Kl6MkK4t1mOrZkU/KSphmIMrAg== X-Google-Smtp-Source: AGHT+IGMbYMSqyqDdJKBk/0nGjgxdwMTkaGVRTb1v+YfO6mN8GKGOSE5+h1FhJ1u/6em+Ea/fawNTA== X-Received: by 2002:a2e:6a10:0:b0:2c9:f3d6:e1d with SMTP id f16-20020a2e6a10000000b002c9f3d60e1dmr576604ljc.15.1701857698158; Wed, 06 Dec 2023 02:14:58 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id f1-20020a05651c03c100b002c9e6cbf78esm1519012ljp.19.2023.12.06.02.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 02:14:57 -0800 (PST) From: Dmitry Baryshkov To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed Cc: Rob Clark , Abhinav Kumar , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v3 2/2] drm/vkms: move wb's atomic_check from encoder to connector Date: Wed, 6 Dec 2023 13:14:55 +0300 Message-Id: <20231206101455.1664463-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231206101455.1664463-1-dmitry.baryshkov@linaro.org> References: <20231206101455.1664463-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As the renamed drm_atomic_helper_check_wb_connector_state() now accepts drm_writeback_connector as the first argument (instead of drm_encoder), move the VKMS writeback atomic_check from drm_encoder_helper_funcs to drm_connector_helper_funcs. Also drop the vkms_wb_encoder_helper_funcs, which have become empty now. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vkms/vkms_writeback.c | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c index 23c4f7b61cb6..bc724cbd5e3a 100644 --- a/drivers/gpu/drm/vkms/vkms_writeback.c +++ b/drivers/gpu/drm/vkms/vkms_writeback.c @@ -30,20 +30,25 @@ static const struct drm_connector_funcs vkms_wb_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) +static int vkms_wb_atomic_check(struct drm_connector *connector, + struct drm_atomic_state *state) { - struct drm_connector *connector = conn_state->connector; - struct drm_writeback_connector *wb_conn = - drm_connector_to_writeback(connector); + struct drm_connector_state *conn_state = + drm_atomic_get_new_connector_state(state, connector); + struct drm_crtc_state *crtc_state; struct drm_framebuffer *fb; - const struct drm_display_mode *mode = &crtc_state->mode; + const struct drm_display_mode *mode; int ret; if (!conn_state->writeback_job || !conn_state->writeback_job->fb) return 0; + if (!conn_state->crtc) + return 0; + + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); + mode = &crtc_state->mode; + fb = conn_state->writeback_job->fb; if (fb->width != mode->hdisplay || fb->height != mode->vdisplay) { DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n", @@ -51,17 +56,13 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, return -EINVAL; } - ret = drm_atomic_helper_check_wb_connector_state(wb_conn, conn_state->state); + ret = drm_atomic_helper_check_wb_connector_state(connector, state); if (ret < 0) return ret; return 0; } -static const struct drm_encoder_helper_funcs vkms_wb_encoder_helper_funcs = { - .atomic_check = vkms_wb_encoder_atomic_check, -}; - static int vkms_wb_connector_get_modes(struct drm_connector *connector) { struct drm_device *dev = connector->dev; @@ -164,6 +165,7 @@ static const struct drm_connector_helper_funcs vkms_wb_conn_helper_funcs = { .prepare_writeback_job = vkms_wb_prepare_job, .cleanup_writeback_job = vkms_wb_cleanup_job, .atomic_commit = vkms_wb_atomic_commit, + .atomic_check = vkms_wb_atomic_check, }; int vkms_enable_writeback_connector(struct vkms_device *vkmsdev) @@ -174,7 +176,7 @@ int vkms_enable_writeback_connector(struct vkms_device *vkmsdev) return drm_writeback_connector_init(&vkmsdev->drm, wb, &vkms_wb_connector_funcs, - &vkms_wb_encoder_helper_funcs, + NULL, vkms_wb_formats, ARRAY_SIZE(vkms_wb_formats), 1);