From: <sunpeng.li@amd.com>
To: airlied@gmail.com, amd-gfx@lists.freedesktop.org
Cc: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>, dri-devel@lists.freedesktop.org
Subject: [PATCH v3 1/6] drm/amd/display: Use DRM new-style object iterators.
Date: Fri, 13 Oct 2017 15:29:30 -0400 [thread overview]
Message-ID: <1507922970-22877-1-git-send-email-sunpeng.li@amd.com> (raw)
In-Reply-To: <1507842911-16975-2-git-send-email-sunpeng.li@amd.com>
From: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
Use the correct for_each_new/old_* iterators instead of for_each_*
The following functions were considered:
amdgpu_dm_find_first_crtc_matching_connector: use for_each_new
- Old from_state_var flag was always choosing the new state
amdgpu_dm_display_resume: use for_each_new
- drm_atomic_helper_duplicate_state is called during suspend to
cache the state
- It sets 'state' within the state triplet to 'new_state'
amdgpu_dm_commit_planes: use for_each_old
- Called after the state was swapped (via atomic commit tail)
amdgpu_dm_atomic_commit: use for_each_new
- Called before the state is swapped
amdgpu_dm_atomic_commit_tail: use for_each_old
- Called after the state was swapped
dm_update_crtcs_state: use for_each_new
- Called before the state is swapped (via atomic check)
amdgpu_dm_atomic_check: use for_each_new
- Called before the state is swapped
v2: Split out typo fixes to a new patch.
v3: Say "functions considered" instead of "affected functions". The
latter implies that changes are made to each.
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 ++++++++---------------
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 +--
2 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 9bfe1f9..cc024ab 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -570,23 +570,15 @@ static int dm_suspend(void *handle)
struct amdgpu_dm_connector *amdgpu_dm_find_first_crct_matching_connector(
struct drm_atomic_state *state,
- struct drm_crtc *crtc,
- bool from_state_var)
+ struct drm_crtc *crtc)
{
uint32_t i;
struct drm_connector_state *conn_state;
struct drm_connector *connector;
struct drm_crtc *crtc_from_state;
- for_each_new_connector_in_state(
- state,
- connector,
- conn_state,
- i) {
- crtc_from_state =
- from_state_var ?
- conn_state->crtc :
- connector->state->crtc;
+ for_each_new_connector_in_state(state, connector, conn_state, i) {
+ crtc_from_state = conn_state->crtc;
if (crtc_from_state == crtc)
return to_amdgpu_dm_connector(connector);
@@ -3890,7 +3882,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
unsigned long flags;
/* update planes when needed */
- for_each_new_plane_in_state(state, plane, old_plane_state, i) {
+ for_each_old_plane_in_state(state, plane, old_plane_state, i) {
struct drm_plane_state *plane_state = plane->state;
struct drm_crtc *crtc = plane_state->crtc;
struct drm_framebuffer *fb = plane_state->fb;
@@ -4024,7 +4016,7 @@ void amdgpu_dm_atomic_commit_tail(
dm_state = to_dm_atomic_state(state);
/* update changed items */
- for_each_new_crtc_in_state(state, crtc, old_crtc_state, i) {
+ for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
struct drm_crtc_state *new_state = crtc->state;
@@ -4113,11 +4105,9 @@ void amdgpu_dm_atomic_commit_tail(
new_acrtc_state = to_dm_crtc_state(new_crtcs[i]->base.state);
new_stream = new_acrtc_state->stream;
- aconnector =
- amdgpu_dm_find_first_crct_matching_connector(
+ aconnector = amdgpu_dm_find_first_crct_matching_connector(
state,
- &new_crtcs[i]->base,
- false);
+ &new_crtcs[i]->base);
if (!aconnector) {
DRM_DEBUG_DRIVER("Atomic commit: Failed to find connector for acrtc id:%d "
"skipping freesync init\n",
@@ -4151,7 +4141,7 @@ void amdgpu_dm_atomic_commit_tail(
}
/* Handle scaling and undersacn changes*/
- for_each_new_connector_in_state(state, connector, old_conn_state, i) {
+ for_each_old_connector_in_state(state, connector, old_conn_state, i) {
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
struct dm_connector_state *con_new_state =
to_dm_connector_state(aconnector->base.state);
@@ -4205,7 +4195,7 @@ void amdgpu_dm_atomic_commit_tail(
}
/* update planes when needed per crtc*/
- for_each_new_crtc_in_state(state, pcrtc, old_crtc_state, j) {
+ for_each_old_crtc_in_state(state, pcrtc, old_crtc_state, j) {
new_acrtc_state = to_dm_crtc_state(pcrtc->state);
if (new_acrtc_state->stream)
@@ -4218,7 +4208,7 @@ void amdgpu_dm_atomic_commit_tail(
* mark consumed event for drm_atomic_helper_commit_hw_done
*/
spin_lock_irqsave(&adev->ddev->event_lock, flags);
- for_each_new_crtc_in_state(state, crtc, old_crtc_state, i) {
+ for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
if (acrtc->base.state->event)
@@ -4402,7 +4392,7 @@ static int dm_update_crtcs_state(
new_acrtc_state = to_dm_crtc_state(crtc_state);
acrtc = to_amdgpu_crtc(crtc);
- aconnector = amdgpu_dm_find_first_crct_matching_connector(state, crtc, true);
+ aconnector = amdgpu_dm_find_first_crct_matching_connector(state, crtc);
/* TODO This hack should go away */
if (aconnector) {
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 630e6cd..1c55a0b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -228,8 +228,7 @@ void amdgpu_dm_update_connector_after_detect(
struct amdgpu_dm_connector *amdgpu_dm_find_first_crct_matching_connector(
struct drm_atomic_state *state,
- struct drm_crtc *crtc,
- bool from_state_var);
+ struct drm_crtc *crtc);
struct amdgpu_framebuffer;
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-10-13 19:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 21:15 [PATCH 0/6] Use new DRM API where possible, and cleanups sunpeng.li
2017-10-12 21:15 ` [PATCH v2 1/6] drm/amd/display: Use DRM new-style object iterators sunpeng.li
[not found] ` <1507842911-16975-2-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2017-10-13 15:03 ` Andrey Grodzovsky
[not found] ` <6580524b-7742-f8b8-af69-d08821a4e8d6-5C7GfCeVMHo@public.gmane.org>
2017-10-13 15:41 ` Leo
[not found] ` <a0b3add7-ce55-954a-d563-9c059f51af6a-5C7GfCeVMHo@public.gmane.org>
2017-10-13 15:56 ` Andrey Grodzovsky
[not found] ` <03052486-e1cf-7e99-294e-f65da5de06cf-5C7GfCeVMHo@public.gmane.org>
2017-10-13 16:35 ` Leo
[not found] ` <81425266-acec-7861-5d8d-d505a2eeece2-5C7GfCeVMHo@public.gmane.org>
2017-10-13 17:28 ` Andrey Grodzovsky
2017-10-13 19:29 ` sunpeng.li [this message]
[not found] ` <1507922970-22877-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2017-10-13 19:52 ` [PATCH v3 " Harry Wentland
2017-10-13 20:36 ` Andrey Grodzovsky
[not found] ` <02155b03-81e9-32d1-b06d-b6050882596d-5C7GfCeVMHo@public.gmane.org>
2017-10-13 21:01 ` Leo
2017-10-13 21:17 ` Andrey Grodzovsky
2017-10-12 21:15 ` [PATCH 3/6] drm/amd/display: Unify DRM state variable namings sunpeng.li
2017-10-12 21:15 ` [PATCH 5/6] drm/amd/display: Fix typo sunpeng.li
[not found] ` <1507842911-16975-6-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2017-10-13 16:30 ` Alex Deucher
[not found] ` <1507842911-16975-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2017-10-12 21:15 ` [PATCH 2/6] drm/amd/display: Use new DRM API where possible sunpeng.li-5C7GfCeVMHo
2017-10-13 16:18 ` Harry Wentland
[not found] ` <59c7432a-3109-ed9e-4548-720d04f29600-5C7GfCeVMHo@public.gmane.org>
2017-10-13 17:26 ` Andrey Grodzovsky
2017-10-13 18:31 ` Harry Wentland
2017-10-12 21:15 ` [PATCH 4/6] drm/amd/display: Unify amdgpu_dm state variable namings sunpeng.li-5C7GfCeVMHo
2017-10-12 21:15 ` [PATCH 6/6] drm/amd/display: Remove useless pcrtc pointer sunpeng.li-5C7GfCeVMHo
2017-10-13 16:32 ` Alex Deucher
2017-10-13 16:35 ` [PATCH 0/6] Use new DRM API where possible, and cleanups Harry Wentland
2017-10-13 17:28 ` Maarten Lankhorst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1507922970-22877-1-git-send-email-sunpeng.li@amd.com \
--to=sunpeng.li@amd.com \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).