From patchwork Wed Sep 3 11:55:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 4834841 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A9804C033A for ; Wed, 3 Sep 2014 13:43:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72430201FB for ; Wed, 3 Sep 2014 13:43:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 34211200C6 for ; Wed, 3 Sep 2014 13:43:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37D226E598; Wed, 3 Sep 2014 06:43:13 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by gabe.freedesktop.org (Postfix) with ESMTP id CA98F6E541 for ; Wed, 3 Sep 2014 04:55:33 -0700 (PDT) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s83BtUHl017155; Wed, 3 Sep 2014 06:55:30 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s83BtUFB017575; Wed, 3 Sep 2014 06:55:30 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Wed, 3 Sep 2014 06:55:30 -0500 Received: from deskari.lan (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s83BtNQE004347; Wed, 3 Sep 2014 06:55:29 -0500 From: Tomi Valkeinen To: Rob Clark , Subject: [PATCH 4/9] drm/omap: make modesetting synchronous Date: Wed, 3 Sep 2014 14:55:05 +0300 Message-ID: <1409745310-19092-4-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409745310-19092-1-git-send-email-tomi.valkeinen@ti.com> References: <1409745310-19092-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 03 Sep 2014 06:43:10 -0700 Cc: Tomi Valkeinen X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently modesetting is not done synchronously, but it queues work that is done later. In theory this is fine, but the driver doesn't handle it at properly. This means that if an application first does a full modeset, then immediately afterwards starts page flipping, the page flipping will not work properly as there's modeset work still in the queue. The result with my test application was that a backbuffer was shown on the screen. Fixing this properly would be rather big undertaking. Thus this patch fixes the issue by making the modesetting synchronous, by waiting for the queued work to be done at the end of omap_crtc->commit(). The ugly part here is that the background work takes crtc->mutex, and the modesetting also holds that lock, which means that the background work never gets done. To get around this, we unclock, wait, and lock again. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 193979f97bdb..3261fbf94957 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -277,8 +277,13 @@ static void omap_crtc_prepare(struct drm_crtc *crtc) static void omap_crtc_commit(struct drm_crtc *crtc) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); + struct drm_device *dev = crtc->dev; DBG("%s", omap_crtc->name); omap_crtc_dpms(crtc, DRM_MODE_DPMS_ON); + + drm_modeset_unlock_all(dev); + omap_crtc_flush(crtc); + drm_modeset_lock_all(dev); } static int omap_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,