All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
To: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	Alexander.Deucher@amd.com, daniel.vetter@intel.com
Subject: [PATCH 4/4] drm/nouveau/kms/nv50: Switch to using atomic helper for flip.
Date: Mon, 16 Jan 2017 10:44:58 -0500	[thread overview]
Message-ID: <1484581498-32309-5-git-send-email-Andrey.Grodzovsky@amd.com> (raw)
In-Reply-To: <1484581498-32309-1-git-send-email-Andrey.Grodzovsky@amd.com>

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
---
 drivers/gpu/drm/nouveau/nv50_display.c | 77 +++-------------------------------
 1 file changed, 5 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 2c2c645..419e00c 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -846,6 +846,10 @@ struct nv50_wndw_func {
 	asyw->image.w = fb->base.width;
 	asyw->image.h = fb->base.height;
 	asyw->image.kind = (fb->nvbo->tile_flags & 0x0000ff00) >> 8;
+
+	asyw->interval =
+			asyw->state.pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? 0 : 1;
+
 	if (asyw->image.kind) {
 		asyw->image.layout = 0;
 		if (drm->device.info.chipset >= 0xc0)
@@ -2221,77 +2225,6 @@ struct nv50_base {
 	.atomic_check = nv50_head_atomic_check,
 };
 
-/* This is identical to the version in the atomic helpers, except that
- * it supports non-vblanked ("async") page flips.
- */
-static int
-nv50_head_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
-		    struct drm_pending_vblank_event *event, u32 flags)
-{
-	struct drm_plane *plane = crtc->primary;
-	struct drm_atomic_state *state;
-	struct drm_plane_state *plane_state;
-	struct drm_crtc_state *crtc_state;
-	int ret = 0;
-
-	state = drm_atomic_state_alloc(plane->dev);
-	if (!state)
-		return -ENOMEM;
-
-	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
-retry:
-	crtc_state = drm_atomic_get_crtc_state(state, crtc);
-	if (IS_ERR(crtc_state)) {
-		ret = PTR_ERR(crtc_state);
-		goto fail;
-	}
-	crtc_state->event = event;
-
-	plane_state = drm_atomic_get_plane_state(state, plane);
-	if (IS_ERR(plane_state)) {
-		ret = PTR_ERR(plane_state);
-		goto fail;
-	}
-
-	ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
-	if (ret != 0)
-		goto fail;
-	drm_atomic_set_fb_for_plane(plane_state, fb);
-
-	/* Make sure we don't accidentally do a full modeset. */
-	state->allow_modeset = false;
-	if (!crtc_state->active) {
-		DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n",
-				 crtc->base.id);
-		ret = -EINVAL;
-		goto fail;
-	}
-
-	if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
-		nv50_wndw_atom(plane_state)->interval = 0;
-
-	ret = drm_atomic_nonblocking_commit(state);
-fail:
-	if (ret == -EDEADLK)
-		goto backoff;
-
-	drm_atomic_state_put(state);
-	return ret;
-
-backoff:
-	drm_atomic_state_clear(state);
-	drm_atomic_legacy_backoff(state);
-
-	/*
-	 * Someone might have exchanged the framebuffer while we dropped locks
-	 * in the backoff code. We need to fix up the fb refcount tracking the
-	 * core does for us.
-	 */
-	plane->old_fb = plane->fb;
-
-	goto retry;
-}
-
 static int
 nv50_head_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
 		    uint32_t size)
@@ -2386,7 +2319,7 @@ struct nv50_base {
 	.gamma_set = nv50_head_gamma_set,
 	.destroy = nv50_head_destroy,
 	.set_config = drm_atomic_helper_set_config,
-	.page_flip = nv50_head_page_flip,
+	.page_flip = drm_atomic_helper_page_flip,
 	.set_property = drm_atomic_helper_crtc_set_property,
 	.atomic_duplicate_state = nv50_head_atomic_duplicate_state,
 	.atomic_destroy_state = nv50_head_atomic_destroy_state,
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-01-16 15:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 15:44 [PATCH 0/4] Allow ASYNC flip with atomic helpers Andrey Grodzovsky
2017-01-16 15:44 ` [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state Andrey Grodzovsky
     [not found]   ` <1484581498-32309-2-git-send-email-Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-01-16 20:21     ` Gustavo Padovan
2017-01-16 20:53       ` Grodzovsky, Andrey
2017-01-23  8:54     ` Daniel Vetter
2017-01-23 19:48       ` Cheng, Tony
     [not found]         ` <MWHPR12MB14066404FBCEF3C03EF24BF998720-Gy0DoCVfaSXS1+HfpYZxvgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-26  5:01           ` Grodzovsky, Andrey
     [not found]             ` <DM5PR12MB1147AEF3F8CFFAD4B69E114EEA770-2J9CzHegvk9IwjGPM8RDJwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-26  9:40               ` Daniel Vetter
2017-01-26  9:39         ` Daniel Vetter
2017-01-16 22:18   ` Laurent Pinchart
2017-01-17  4:03     ` Grodzovsky, Andrey
     [not found]       ` <DM5PR12MB1147FF9E484370F1572CB9C3EA7C0-2J9CzHegvk9IwjGPM8RDJwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-17  9:03         ` Laurent Pinchart
2017-01-17  8:14   ` Ville Syrjälä
     [not found] ` <1484581498-32309-1-git-send-email-Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-01-16 15:44   ` [PATCH 2/4] drm/amdgpu: Remove flip_flag from amdgpu_crtc Andrey Grodzovsky
2017-01-16 22:15     ` Laurent Pinchart
2017-01-16 15:44   ` [PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip Andrey Grodzovsky
2017-01-16 22:16     ` Laurent Pinchart
2017-01-18  1:50       ` Michel Dänzer
2017-01-18 12:02         ` Laurent Pinchart
2017-01-18 22:18         ` Grodzovsky, Andrey
     [not found]           ` <DM5PR12MB1147CFCD90203061E0F2EB95EA7F0-2J9CzHegvk9IwjGPM8RDJwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-19  2:14             ` Michel Dänzer
2017-01-19  4:57         ` [PATCH v3 2/3] " Andrey Grodzovsky
2017-01-16 15:44 ` Andrey Grodzovsky [this message]
2017-01-16 20:39 ` [PATCH 0/4] Allow ASYNC flip with atomic helpers Laurent Pinchart
2017-01-16 21:13   ` Harry Wentland
2017-01-16 22:14     ` Laurent Pinchart
2017-01-23  8:53       ` Daniel Vetter

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=1484581498-32309-5-git-send-email-Andrey.Grodzovsky@amd.com \
    --to=andrey.grodzovsky@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nouveau@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.