From patchwork Mon Mar 12 00:48:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 7211 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9F83823E00 for ; Mon, 12 Mar 2012 00:48:43 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 67EB3A18384 for ; Mon, 12 Mar 2012 00:48:43 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so7826951iag.11 for ; Sun, 11 Mar 2012 17:48:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=K1ZKHDKYOrM0hLiLMeKyNumpzYOjqL5RbDSYiXYYzls=; b=pNzPHGJVu/CLeU6gwI/MS0SaoZ3rmaeeDgD16pOdi+sTt0uEsSeWzU6XxF+O666H7v bTA9qxXqSfmQV2Rp+uy8OR7pYTCwsShXEn+a87OEiUrQOKZrEqtyBHC71RfnKwky6/pN hGzS/El/CMyuja/NMQuUfqIaOHzMUfIxnY0MCNv3LMG8iamx1/GXirkpXqukmewmVR+v rN9XEFv8blo5ShgeAv80nxlcy80HjSR06k4/jevN3i85z9xRZl6usBfjH3QN82n/M/8R c0MZPRFrSSxH4ydihS5jU120wZpYlOXCKgrBB8QCWLRa9g6ZLs+f7p9rGi8AKZQJuzMy QKkQ== Received: by 10.50.183.137 with SMTP id em9mr15803850igc.58.1331513323216; Sun, 11 Mar 2012 17:48:43 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.53.18 with SMTP id k18csp30738ibg; Sun, 11 Mar 2012 17:48:42 -0700 (PDT) Received: by 10.236.80.74 with SMTP id j50mr11768182yhe.2.1331513322154; Sun, 11 Mar 2012 17:48:42 -0700 (PDT) Received: from mail-gy0-f178.google.com (mail-gy0-f178.google.com [209.85.160.178]) by mx.google.com with ESMTPS id e42si12166536yhh.121.2012.03.11.17.48.42 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Mar 2012 17:48:42 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.160.178 as permitted sender) client-ip=209.85.160.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.160.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-gy0-f178.google.com with SMTP id f1so2464189ghb.37 for ; Sun, 11 Mar 2012 17:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=K1ZKHDKYOrM0hLiLMeKyNumpzYOjqL5RbDSYiXYYzls=; b=eE3OwHA8uJHsQ7frmYWte6NxgBQVBI3ZMSmsur7S8cqEX83dM2aW/rb5pDMB4w3my7 UDxFZzbD8Vvg/3WEcH9o0+HKH0BhQo8aNGjwa03WvpNoMobA2UE9ox0yrIMWpUFcN8Aj vdNEYNHLFFkmGlcRN7drDFvrDt9BGb1EXUYjC/jthufcxjwSmCUsdVJ8Zr05IO5YVVDn bcwr0BqNj4AglgUBmMGPcLT24pnzz75DzMFy+ellRmjUsUyolTqbAG0BJOLE47EqUHQh 6aXqdLVlyFtclpuicUBriKXxqQkFMRDCcjjcHoRrSsf4z6U7D9MSzpcqU0d8NEf4AYBd ZOKQ== Received: by 10.60.4.105 with SMTP id j9mr5870263oej.29.1331513321883; Sun, 11 Mar 2012 17:48:41 -0700 (PDT) Received: from localhost (ppp-70-129-134-19.dsl.rcsntx.swbell.net. [70.129.134.19]) by mx.google.com with ESMTPS id u5sm17617399obk.16.2012.03.11.17.48.40 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Mar 2012 17:48:41 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: wayland-devel@lists.freedesktop.org Cc: patches@linaro.org, Rob Clark Subject: [PATCH 2/5] drm: use page-flip for sprites, in case no vblank event Date: Sun, 11 Mar 2012 19:48:42 -0500 Message-Id: <1331513325-1554-2-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1331513325-1554-1-git-send-email-rob.clark@linaro.org> References: <1331513325-1554-1-git-send-email-rob.clark@linaro.org> X-Gm-Message-State: ALoCoQl6PERHggJ8YMLLrfo60ToY9l1nxOUK5xXPy4DHApVmDQTEAAGn+TBeZPdq/epHzHTmAdCw From: Rob Clark If the output does not support vblank events (possibly the case with USB or DSI command mode displays which do not have a traditional vsync), use instead the page_flip handler to know when the display is finished scanning out a sprite. --- src/compositor-drm.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 67fa500..500ec15 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -117,6 +117,12 @@ struct drm_sprite { uint32_t dest_x, dest_y; uint32_t dest_w, dest_h; + /* + * for displays that don't have a vblank (dsi command-mode displays, + * usb displays, etc), it can be simulated from the page-flip event + */ + int simulate_vblank; + uint32_t formats[]; }; @@ -286,8 +292,7 @@ drm_output_repaint(struct weston_output *output_base, vbl.request.signal = (unsigned long)s; ret = drmWaitVBlank(compositor->drm.fd, &vbl); if (ret) { - fprintf(stderr, "vblank event request failed: %d: %s\n", - ret, strerror(errno)); + s->simulate_vblank = 1; } } @@ -327,6 +332,7 @@ page_flip_handler(int fd, unsigned int frame, struct drm_output *output = (struct drm_output *) data; struct drm_compositor *c = (struct drm_compositor *) output->base.compositor; + struct drm_sprite *s; uint32_t msecs; if (output->scanout_buffer) { @@ -349,6 +355,13 @@ page_flip_handler(int fd, unsigned int frame, msecs = sec * 1000 + usec / 1000; weston_output_finish_frame(&output->base, msecs); + + wl_list_for_each(s, &c->sprite_list, link) { + if (s->simulate_vblank) { + vblank_handler(fd, frame, sec, usec, s); + s->simulate_vblank = 0; + } + } } static int