From patchwork Fri Dec 8 01:03:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 751699 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BZId2rbP" Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D096810C2 for ; Thu, 7 Dec 2023 17:03:19 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50c0f6b1015so1630103e87.3 for ; Thu, 07 Dec 2023 17:03:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701997398; x=1702602198; 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=w9DXgbpkmRJ+2VgjJ4hvWLaw9hvTcbtDFAwpGMKl3Go=; b=BZId2rbPuNMOz7Gxr+6e1aWNj6LqmKBpkVJ2ouv/XSMgaXSA/C1qOqEgrxNYQM+rRt mQUyt+O+mFZu8o0WZ5puvMNUxdfzJtB0uoGYCqNZKcz7fOGqAlyhx573Hs8Xv9C6kyEI qFgtnfPxQb6jJmKXLCEFA8in6cd88lvRsTIk6OcETSoZWvocCSgyKXwH1sPUd2501+NZ MHr2X0rog1PCII+BXmWcx/IZ/tsMm4JUhulC+Bd0RxHjbvWmdHZ0vtwnreYZFcxs/hmr JcJE+tColbc+063aDHwQ9PO4Z2SNEivqH+pnjTJdvC33OVSa7vaKAmMlf7G+63b2IbSR JpIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701997398; x=1702602198; 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=w9DXgbpkmRJ+2VgjJ4hvWLaw9hvTcbtDFAwpGMKl3Go=; b=Fh6KRgxjV96GIDSUV0UfHeFeqMmqM1LBBCOO6dmYTMJpYhRzfH844PY2zhnNNTmDSr Ox3w5aGZ9+DDvvVUUaoJ1v6BTsxMNTOB9L5n3imS4sTPjYEfNEn5/X8P3RF68QTO5lde RSIRA7lo7RAoSpMA5j04SB6iXwhcoffv1EWm3N6/rgWcSQA7ONro8VolJi0XPPtkkZ9D yrq/bvPHLxEl7y0NNXRZOQpMy6r585rnvlEAw+BnKdN0B/Iz8ZVzq6+g3nbUO2mJm2/x GydNfSQlUt1SI5bspoJshnwFePO6QKo9E9cWqvM0jBEBYrVGeLXRK9t2lZimfxVMz1Jy ZTCg== X-Gm-Message-State: AOJu0Yyu0qnS9ZPRAZ7z2YB1UxlFSBuqyYmaS9OOgtbf7fxs+aoa9JXQ +Fj90XyOgbFkjWq2OGrw7nqRFg== X-Google-Smtp-Source: AGHT+IEwoa8rObk3RPkl1IdUqSsrBBlu3C8pprIzht4HYrPaxeR7uHrTOtRd3Y56wGFYmTYW5YAiiQ== X-Received: by 2002:ac2:4c4a:0:b0:50b:d2b9:180c with SMTP id o10-20020ac24c4a000000b0050bd2b9180cmr2313372lfk.58.1701997397973; Thu, 07 Dec 2023 17:03:17 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id t28-20020ac2549c000000b0050bcb5b443dsm68415lfk.171.2023.12.07.17.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 17:03:16 -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 v4 1/2] drm/atomic-helper: rename drm_atomic_helper_check_wb_encoder_state Date: Fri, 8 Dec 2023 04:03:13 +0300 Message-Id: <20231208010314.3395904-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231208010314.3395904-1-dmitry.baryshkov@linaro.org> References: <20231208010314.3395904-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 | 3 ++- include/drm/drm_atomic_helper.h | 5 ++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index a920fbae714c..39ef0a6addeb 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..fef7f3daf2c9 100644 --- a/drivers/gpu/drm/vkms/vkms_writeback.c +++ b/drivers/gpu/drm/vkms/vkms_writeback.c @@ -34,6 +34,7 @@ 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_framebuffer *fb; const struct drm_display_mode *mode = &crtc_state->mode; int ret; @@ -48,7 +49,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(connector, 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 006b5c977ad7..9aa0a05aa072 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 Fri Dec 8 01:03:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 752353 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kvzECAe+" Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D32D0D59 for ; Thu, 7 Dec 2023 17:03:21 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2c9fe0ef02aso14191141fa.0 for ; Thu, 07 Dec 2023 17:03:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701997400; x=1702602200; 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=KH74X69CknSJEAqKADUYJy0tIjkWf/mm9wfbBS4QRQA=; b=kvzECAe+BjW2AVb2g9KaZrbvKqORN/R8Ha9WL5mOLpW0u/Hr4JxuMa/KiSZjtPsdPe WlUFNXTzRTuP9owMe5uE/bax1Dhj1AAUmNN2L9WbLL5i6JgKM7p3OhKFgs2gxUAOLuD6 GXEz33zPfAdqIedCG0hMm94TLuK2Bh085V6nrcO/9FVfpL3V/1qknwUNRimb9gJyG2pV cS2l/V8fZwOMaWIExFWyDIZjFV0JJUyDogQABiIokjmamemxOtY6U/d7uZ8zle5yvmyY zsQeVDp0pqxThaKraQRKZEnSlMRRNxUZcqHo2G8bBRSfzutLxkpEakHtAoChWKvac/9L FH/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701997400; x=1702602200; 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=KH74X69CknSJEAqKADUYJy0tIjkWf/mm9wfbBS4QRQA=; b=kuFptzLWqJQzHQRBjS1acWbDRP+Jsdk8C4gjzdQXAEIlY3No2vQ1cP+2c8wIwZYVyC 5OyVFR9vTPKwL5rNeYz7ZIKQKV/gm+SXP6ZSrMZjdndM7DkcDERjTzq3Ld6pacYYVc7o Wr/xosrXlYzHqA3HVobqfyan7ko7K1uMfGOcoPwZivU1RdyuFgViuaNSaDhmdyvtOH2U KyJuLgPsgmOnqtakXOQ2bBphTz0Vi0FqcSULpR49WkkTPwWOhSbC6idXSuKt+Pd7e+hM 75wviAom5EJP7wra/XIPBBMVK2RkG9oVewmhI9NhaDoz9V8gHVX7YWTSzE55NWOp6iRz bLQA== X-Gm-Message-State: AOJu0Ywz7adQ0GYur+RAH9+K0Bk5bNJQtmdSQu2yWrbWyJceg32wTpnU JLtauMymZ8+Zk5/GONX3p30rTw== X-Google-Smtp-Source: AGHT+IGp18wUjpiOvhYgSK2UicMqSaBn8WCyD/Y+QwBeT3gAg85czosN3/RcOwKmUieKQg9qE+WKWA== X-Received: by 2002:a05:6512:10d2:b0:50b:efbc:185d with SMTP id k18-20020a05651210d200b0050befbc185dmr50714lfg.18.1701997400242; Thu, 07 Dec 2023 17:03:20 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id t28-20020ac2549c000000b0050bcb5b443dsm68415lfk.171.2023.12.07.17.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 17:03:18 -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 v4 2/2] drm/vkms: move wb's atomic_check from encoder to connector Date: Fri, 8 Dec 2023 04:03:14 +0300 Message-Id: <20231208010314.3395904-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231208010314.3395904-1-dmitry.baryshkov@linaro.org> References: <20231208010314.3395904-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 | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c index fef7f3daf2c9..bc724cbd5e3a 100644 --- a/drivers/gpu/drm/vkms/vkms_writeback.c +++ b/drivers/gpu/drm/vkms/vkms_writeback.c @@ -30,18 +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_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", @@ -49,17 +56,13 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, return -EINVAL; } - ret = drm_atomic_helper_check_wb_connector_state(connector, 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; @@ -162,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) @@ -172,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);