linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: l.stach@pengutronix.de (Lucas Stach)
To: linux-arm-kernel@lists.infradead.org
Subject: xf86-video-armada + etnaviv (Was: Re: I.MX6 HDMI support in v4.2)
Date: Tue, 29 Sep 2015 10:28:19 +0200	[thread overview]
Message-ID: <1443515299.3141.4.camel@pengutronix.de> (raw)
In-Reply-To: <20150928165021.GY21513@n2100.arm.linux.org.uk>

Am Montag, den 28.09.2015, 17:50 +0100 schrieb Russell King - ARM Linux:
> On Mon, Sep 28, 2015 at 05:40:13PM +0200, Lucas Stach wrote:
> > Am Montag, den 28.09.2015, 16:24 +0100 schrieb Russell King - ARM Linux:
> > > On Mon, Sep 28, 2015 at 04:48:08PM +0200, Lucas Stach wrote:
> > > > I've looked at that again and the issue here seems to be that GStreamer
> > > > is handing us a pointer to a buffer that isn't aligned to a page. The
> > > > buffers size is properly rounded up to a pagesize, as requested by
> > > > QueryImageAttributes, but if the buffer start pointer isn't aligned to a
> > > > page boundary we end up with an non-mappable buffer anyway.
> > > > 
> > > > Unfortunately there is no obvious way for a driver to request a minimum
> > > > alignment for the buffer. The only possible fix is for the client to
> > > > always align the buffer to a page boundary in hopes that this is enough
> > > > for the hardware to map it directly and allow to skip any unwanted
> > > > copying.
> > > 
> > > We can't just "round up" the size.  We've no idea whether the buffer
> > > came from shmem (for XvShmPutImage), or whether it's part of an internal
> > > X buffer (for XvPutImage).  In the latter case, we've no idea whether
> > > data in the remainder of the page will be read or written by the CPU
> > > when, eg, a signal occurs - and X does use signals.
> > > 
> > I'm not talking about the driver rounding up the size. That is obviously
> > (contrary to what my patch did) the wrong thing to do.
> > 
> > I was talking of the client (as in VLC, GStreamer, whatever) aligning
> > the buffer to a page boundary. As there is no way for the client to
> > query the alignment restrictions, we may still need a fallback path in
> > the driver, so that if an unaligned buffer comes in we don't do a
> > buffer_from_userptr but actually copy client memory to a new buffer.
> 
> You really do _not_ want to do be copying image data.  With large images
> (1080p) that will consume lots of CPU, and tie up the X server doing not
> much other than copying data.  You might as well manually convert and
> copy the data to the screen at that point.
> 
So what other possibilities do we have if the client hands us a non page
aligned buffer, other than failing the PutImage? Converting the image
manually and possibly doubling the amount of bytes to write out
(YUV->RGB) will tie up the X server even longer.

This all doesn't seem to be a problem as long as the client allocates
from XShm, as this seems to hand out page aligned memory. Only if the
client mallocs the image buffer we might end up with unaligned buffers.

Regards,
Lucas
-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |

  reply	other threads:[~2015-09-29  8:28 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07 10:55 I.MX6 HDMI support in v4.2 Krzysztof Hałasa
2015-09-07 11:25 ` Russell King - ARM Linux
2015-09-07 14:04   ` Krzysztof Hałasa
2015-09-08  9:16     ` Russell King - ARM Linux
2015-09-08 11:01       ` Krzysztof Hałasa
2015-09-08 12:57         ` Russell King - ARM Linux
2015-09-08 14:59           ` Krzysztof Hałasa
2015-09-10 10:25           ` Krzysztof Hałasa
2015-09-10 10:49             ` Russell King - ARM Linux
2015-09-10 11:29               ` Krzysztof Hałasa
2015-09-17  7:21               ` Philipp Zabel
2015-09-17  8:38                 ` Krzysztof Hałasa
2015-09-17  9:23                 ` Russell King - ARM Linux
2015-09-08 10:45   ` Krzysztof Hałasa
2015-09-08 10:56     ` Lucas Stach
2015-09-08 11:01       ` Russell King - ARM Linux
2015-09-08 11:07         ` Lucas Stach
2015-09-08 11:29           ` Russell King - ARM Linux
2015-09-08 12:43             ` Lucas Stach
2015-09-08 13:40               ` Russell King - ARM Linux
2015-09-08 14:17               ` Robert Nelson
2015-09-08 14:45                 ` Krzysztof Hałasa
2015-09-08 14:48                 ` Lucas Stach
2015-09-08 15:55                 ` Russell King - ARM Linux
2015-09-08 17:07                   ` Jon Nettleton
2015-09-08 11:06       ` Krzysztof Hałasa
2015-09-14  8:39       ` Krzysztof Hałasa
2015-09-15  8:24         ` Krzysztof Hałasa
2015-09-15 10:12           ` Russell King - ARM Linux
2015-09-15 11:01             ` Krzysztof Hałasa
2015-09-15 14:29               ` Russell King - ARM Linux
2015-09-15 16:53                 ` Krzysztof Hałasa
2015-09-15 15:53         ` Lucas Stach
2015-09-15 16:36           ` Russell King - ARM Linux
2015-09-15 16:53             ` Lucas Stach
2015-09-15 17:04               ` Russell King - ARM Linux
2015-09-15 19:01                 ` Lucas Stach
2015-09-28 14:48                 ` xf86-video-armada + etnaviv (Was: Re: I.MX6 HDMI support in v4.2) Lucas Stach
2015-09-28 15:24                   ` Russell King - ARM Linux
2015-09-28 15:40                     ` Lucas Stach
2015-09-28 16:50                       ` Russell King - ARM Linux
2015-09-29  8:28                         ` Lucas Stach [this message]
2015-09-29  8:41                           ` Russell King - ARM Linux
2015-09-29  9:01                             ` Lucas Stach
2015-09-15 16:57           ` I.MX6 HDMI support in v4.2 Krzysztof Hałasa
2015-09-16  7:57           ` Krzysztof Hałasa
2015-09-16 15:52             ` Lucas Stach

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=1443515299.3141.4.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).