From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 99188E0070F; Mon, 18 Jan 2016 08:22:46 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (richard.rojfors[at]gmail.com) * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.217.181 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's * domain * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 83E6BE00444 for ; Mon, 18 Jan 2016 08:22:44 -0800 (PST) Received: by mail-lb0-f181.google.com with SMTP id x4so93369576lbm.0 for ; Mon, 18 Jan 2016 08:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:mime-version :content-transfer-encoding; bh=BxhILx9UhZGXrVsaOL63sVoH8um2JkI7Vfur85ud4FI=; b=MSZU/6wP7g1R7C5AkwkHT9xYoa4SH5A97lox0BIFTbfZdct5cw/4l1eWi0WDeD2Bow HJBnotloUtzFjqUEhEIPtn0B4KXwbdt4oN1n2RgU58Np/e8QEAwaaGaQTLD+VYeWCke5 lQginWwNi+HrPWPY3bdS71RSt0PO8/Cn5KnKjKbaGjCuLDV+z+HJ5seKaZAbKbdMufDl 57r5rjV3Z+/NgdQIeP34ZLjC5VD+C8hm35v/Wp8eEy3a5K7fDQ4H7I1WV5Aa9tK5/i0h H15UZMYrB4mt1yVxa/olf3zfs7j6TOrLbmL32ZHrHBxmb9kjE0Y5EAK0XY1PU3z5wAie gOLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:date:content-type :mime-version:content-transfer-encoding; bh=BxhILx9UhZGXrVsaOL63sVoH8um2JkI7Vfur85ud4FI=; b=eGmG1vTjyY61fSf+dRmCBhRnP9QnsUa+RDIu5bV0nYMdf5hZ6NNLKz0IERGuCp3jDM VIYM1dIjX5AyWLgTGwOFHmtHlVp2t6UizSk+KsXQHEUqgsCRjPn3Qqtdq0DHa/froD/z WmsphkBcYfa51j3OvofyyQ4VLVyVCbxwW3Qj19LAH01z2U3jOi8bdo+BxKb7rCVsUPlR BVdEolrYcITvw14rxWHC1pxWRamiU9yqSfpnRfOy/gxm0MuFCSLLWTiekbqzaF3bOdiW QYq7U7ko/2pTT7S6KjDYAVm5u4ecj23DbJHsXGAEvSe47C+h5XIDglY9kS33jbFFqrdX XlBQ== X-Gm-Message-State: ALoCoQkFBj1ovNfWkMLjrlEYM9/4Z773S9ecDk5zeMDEl586RoozhBAQ5FSF6Ouo6qWS0Vjd4OFTPH2Qq9auafFILc3OmImLwg== X-Received: by 10.112.149.230 with SMTP id ud6mr8561510lbb.12.1453134163053; Mon, 18 Jan 2016 08:22:43 -0800 (PST) Received: from [172.16.4.209] ([193.15.208.193]) by smtp.gmail.com with ESMTPSA id o66sm3290465lfi.36.2016.01.18.08.22.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jan 2016 08:22:41 -0800 (PST) Message-ID: <1453134150.16748.1.camel@gmail.com> From: Richard =?ISO-8859-1?Q?R=F6jfors?= To: "meta-freescale@yoctoproject.org" Date: Mon, 18 Jan 2016 17:22:30 +0100 X-Mailer: Evolution 3.18.2-0ubuntu1~wily1 Mime-Version: 1.0 Subject: [meta-fsl-arm][PATCH] weston: gal2d-renderer: Fix deadlock on exit X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2016 16:22:46 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit There is a race between the worker thread flipping the buffers and the main thread on exit, this patch fixes that. Signed-off-by: Richard Röjfors ---  ...002-gal2d-renderer-Avoid-deadlock-on-exit.patch | 69 ++++++++++++++++++++++  recipes-graphics/wayland/weston_%.bbappend         |  5 +-  2 files changed, 73 insertions(+), 1 deletion(-)  create mode 100644 recipes-graphics/wayland/weston/0002-gal2d-renderer-Avoid-deadlock-on-exit.patch diff --git a/recipes-graphics/wayland/weston/0002-gal2d-renderer-Avoid-deadlock-on-exit.patch b/recipes-graphics/wayland/weston/0002-gal2d-renderer-Avoid-deadlock-on-exit.patch new file mode 100644 index 0000000..cb6478d --- /dev/null +++ b/recipes-graphics/wayland/weston/0002-gal2d-renderer-Avoid-deadlock-on-exit.patch @@ -0,0 +1,69 @@ +From e032db2353427d174924f456a39c58de374acb33 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Richard=20R=C3=B6jfors?= +Date: Wed, 13 Jan 2016 21:04:08 +0100 +Subject: [PATCH] gal2d-renderer: Avoid deadlock on exit +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The way the worker thread was shut down was a bit racy. +Make sure to set the flag indicating the thread to stop spinning +before waking up the thread. + +Upstream-Status: Pending + +Signed-off-by: Richard Röjfors +--- + src/gal2d-renderer.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c +index 7ebbf98..d2a29ff 100644 +--- a/src/gal2d-renderer.c ++++ b/src/gal2d-renderer.c +@@ -495,21 +495,21 @@ static void *gal2d_output_worker(void *arg) + { +     struct weston_output *output = (struct weston_output *)arg; +     struct gal2d_output_state *go = get_output_state(output); ++    int go_on = 1; + +-    while(1) ++    while(go_on) +     { +-        if(gcoOS_WaitSignal(gcvNULL, go->signal, gcvINFINITE) == gcvSTATUS_OK ) ++        int ok = gcoOS_WaitSignal(gcvNULL, go->signal, gcvINFINITE) == gcvSTATUS_OK; ++ ++        pthread_mutex_lock(&go->workerMutex); ++        go_on = go->exitWorker == 0; ++        pthread_mutex_unlock(&go->workerMutex); ++ ++        if (ok && go_on) +         { +             gal2d_flip_surface(output); +             gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE); +         } +-        pthread_mutex_lock(&go->workerMutex); +-        if(go->exitWorker == 1) +-        { +-            pthread_mutex_unlock(&go->workerMutex); +-            break; +-        } +-        pthread_mutex_unlock(&go->workerMutex); +     } +     return 0; + } +@@ -1169,10 +1169,10 @@ gal2d_renderer_output_destroy(struct weston_output *output) +  } +     else +     { +-        gcoOS_Signal(gcvNULL,go->signal, gcvTRUE); +         pthread_mutex_lock(&go->workerMutex); +         go->exitWorker = 1; +         pthread_mutex_unlock(&go->workerMutex); ++        gcoOS_Signal(gcvNULL,go->signal, gcvTRUE); +         pthread_join(go->workerId, NULL); +     } + +-- +2.5.0 + diff --git a/recipes-graphics/wayland/weston_%.bbappend b/recipes-graphics/wayland/weston_%.bbappend index a7496da..f41b5af 100644 --- a/recipes-graphics/wayland/weston_%.bbappend +++ b/recipes-graphics/wayland/weston_%.bbappend @@ -1,6 +1,9 @@  FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"   -SRC_URI_append_mx6 = " file://0001-MGS-840-Add-i.MX6-support-for-weston.patch" +SRC_URI_append_mx6 = " \ +    file://0001-MGS-840-Add-i.MX6-support-for-weston.patch \ +    file://0002-gal2d-renderer-Avoid-deadlock-on-exit.patch \ +"    PACKAGECONFIG_append_mx6q = " cairo-glesv2"  PACKAGECONFIG_append_mx6dl = " cairo-glesv2" -- 2.5.0