From owner-freebsd-ports@FreeBSD.ORG Wed Apr 23 13:05:32 2014 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71A5079A; Wed, 23 Apr 2014 13:05:32 +0000 (UTC) Received: from mail-yk0-x229.google.com (mail-yk0-x229.google.com [IPv6:2607:f8b0:4002:c07::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1510C13D5; Wed, 23 Apr 2014 13:05:32 +0000 (UTC) Received: by mail-yk0-f169.google.com with SMTP id 142so758546ykq.0 for ; Wed, 23 Apr 2014 06:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=84R2yIVykUcBnFf+RkKL7s0xi+PgBG5iKpuzU9e8Ofo=; b=UIuBr9tVGVaWdU05cxUiIQQzal+x9Rc7wc16OkAMOnM6i4vcYZBBX3hcsthRePA2i8 uNIRC1Sei8RkS6fEMT74GOqeGQIMCNoi4A2A3JnGYDn8l9oZsL2HigU4rCvi++mWGpQi ydAaXOeZJBIa8oYXmQ/VrJhGmnRmXP7yghyEj6Gq7golejE5Rh5aYUGo030vz5KzGWrx gjZb5ORAk4j2rKnIXdNZZSJ3E7A8ayype7azD8DC6qnxpO8W/9/I3/Q7S12b0je6QUGq g3TQl+5weG8fewt7jKyxZaOSJqmBTY+5gOGxu17UuJM5pdO4gptlFUuAtRFEOjGFh9iO HcMQ== MIME-Version: 1.0 X-Received: by 10.236.78.168 with SMTP id g28mr9663816yhe.157.1398258331182; Wed, 23 Apr 2014 06:05:31 -0700 (PDT) Received: by 10.170.130.79 with HTTP; Wed, 23 Apr 2014 06:05:31 -0700 (PDT) In-Reply-To: <20140423152625.5bb692b9@nonamehost.local> References: <20140420200534.72226779@nonamehost.local> <20140423065824.GE63561@ivaldir.etoilebsd.net> <20140423152625.5bb692b9@nonamehost.local> Date: Wed, 23 Apr 2014 06:05:31 -0700 Message-ID: Subject: Re: [CFT] x11-servers/xorg-server with initial (GCD) Grand Central Dispatch support From: Neil Schroeder To: Ivan Klymenko Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: "ports@freebsd.org" , Baptiste Daroussin , "x11@freebsd.org" X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Apr 2014 13:05:32 -0000 You'd be surprised where you can apply a dispatch - anywhere there is an iterator, a thread forked, or a read from/to file, network, or io you can - for almost no cost - just wrap that call in a block (my brain wants to call it an nsoperation queue ) and dispatch it. Basically anything you don't expect to come back right away, you can benefit from dispatching it. Also a single queue can be read or write from multiple threads without locking - it just works. So if you have a bunch of calls to basically anything that isn't directly in ram right then, you could benefit from dispatching. This is ESPECIALLY beneficial for user io and ui updates - like a button click. You should immediately dispatch the action from that button click so you can move on to updating the UI. Gives the perception of hugely Improved performance and frees up the main thread for doing what the main thread does - basically starts the program and refreshes the UI. I'll see about patching 1.15 - this does beg one question however - X is a major piece of infrastructure and is single threaded after 30 years. If such benefits are huge, why has nobody at least threaded it yet? Keep in mind that most functionality has been moved out of X and into libraries and the kernel - if X actually has to render something, it's an exception these days... Everyone speaks EGL or OpenGL to the display rendering manager directly... So I wonder, how much actual benefit does this have? I'm truly asking from a metrics perspective. What percentage of total cycles spent does this impact vs what is being handled in the Display driver, window manager, etc? On Wednesday, April 23, 2014, Ivan Klymenko wrote: > =D0=92 Wed, 23 Apr 2014 08:58:24 +0200 > Baptiste Daroussin =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > > > > Thank you for those patches, imho that is something we really do > > need. > > I would just have a couple of side notes: > > Wouldn't it be possible to use callbacks in the dispatch call rather > > than blocks? > > If I understand you correctly... > Unfortunately not for all areas of the code it is possible ... > I, in fact, only parallelize loops for "for" operator. > The remaining sections of code where this is possible, I have not > looked. > If translate to the use of GCD more significantly - then need to > rewrite a lot of code. > > > that will make the patch work on FreeBSD 8, 9, 10 and > > head with clang AND gcc, which will greatly improves the chances to > > see those patch well tested and used enough to finally be > > incorporated in the ports. > > > > I started doing what I know how and what I can :) > If there is help, examples and comments from others - I'm just glad :) > > > regards, > > Bapt > > _______________________________________________ > freebsd-x11@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-x11 > To unsubscribe, send any mail to "freebsd-x11-unsubscribe@freebsd.org > "