All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas Stach <dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
To: Mark Zhang <nvmarkzhang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Terje Bergström"
	<tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Thierry Reding"
	<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Subject: Re: First version of host1x intro
Date: Thu, 06 Dec 2012 09:00:36 +0100	[thread overview]
Message-ID: <1354780836.1503.102.camel@tellur> (raw)
In-Reply-To: <50C04E1D.1050702-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Am Donnerstag, den 06.12.2012, 15:49 +0800 schrieb Mark Zhang:
> On 12/06/2012 03:20 PM, Lucas Stach wrote:
> > Am Donnerstag, den 06.12.2012, 15:06 +0800 schrieb Mark Zhang:
> > [...]
> >>> First action taken is taking a reference to all buffers in the command
> >>> stream. This includes the command stream buffers themselves, but also
> >>> the target buffers. We also map each buffer to target hardware to get a
> >>> device virtual address.
> >>>
> >>> After this, relocation information is processed. Each reference to
> >>> target buffers in command stream are replaced with device virtual
> >>> addresses. The relocation information contains the reference to target
> >>> buffer, and to command stream to be able to do this.
> >>
> >> Could you explain more about this "relocation information"? I assume the
> >> "target buffers" here mentioned are some memory saving, e.g, textures,
> >> compressed video data which need to be decoded...
> >> But the userspace should already allocate the memory to save them, why
> >> we need to relocate?
> >>
> > "Relocation" is the term used to express the fixup of addresses in the
> > command buffer. You are right, the memory is allocated and stays the
> > same, but userspace can not know where in the GPU address space a
> > specific buffer is bound (maybe it's even unbound at the time, when
> > userspace stitches together the pushbuf). So userspace dumps some kind
> > of dummy information into the command stream instead of a real buffer
> > address. With the relocation information (which is kind of a sideband
> > buffer to the commandbuf) it then tells the kernel to insert real GPU
> > virtual addresses in the locations of the dummy info. For the kernel to
> > do so, it needs to know:
> > 1. where in the command stream is a dummy address
> > 2. which buffers address should be inserted instead
> > 3. which offset into this buffer should be added to the address to be
> > inserted
> > 
> 
> OK. So these relocation addresses are used to let userspace tells kernel
> which buffers mentioned in the command should be relocated to addresses
> which host1x clients able to reach.
> 
Yep, preferably all buffers referenced by a command stream should
already be set up in such a position (CMA with Tegra2) or the relocation
should be nothing more than setting up IOMMU page tables (Tegra3).

> I'm also wondering that, if our driver understands the stuffs in the
> commands, maybe we can find out all addresses in the command, in that
> way, we will not need userspace tells us which are the addresses need to
> be relocated, right?

No. How will the kernel ever know which buffer gets referenced in a
command stream? All the kernel sees is is a command stream with
something like "blit data to address 0xADDR" in it. The only info that
you can gather from that is that there must be some buffer to blit into.
Neither do you know which buffer the stuff should be going to, nor can
you know if you blit to offset zero in this buffer. It's perfectly valid
to only use a subregion of a buffer.

Or maybe I'm misunderstanding you and you mean it the other way around.
You don't let userspace dictate the addresses, the relocation
information just tells the kernel to find the addresses of the
referenced buffers for you and insert them, instead of the dummy
information, into the command stream.

Regards,
Lucas

  parent reply	other threads:[~2012-12-06  8:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-05  9:47 First version of host1x intro Terje Bergström
     [not found] ` <50BF1831.3060606-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-12-06  7:06   ` Mark Zhang
     [not found]     ` <50C0440D.3000702-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-06  7:20       ` Lucas Stach
2012-12-06  7:49         ` Mark Zhang
     [not found]           ` <50C04E1D.1050702-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-06  8:00             ` Lucas Stach [this message]
2012-12-06  8:13               ` Mark Zhang
     [not found]                 ` <50C053AD.2000802-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-06 11:17                   ` Lucas Stach
2012-12-07  5:26                     ` Mark Zhang
2012-12-06 18:46                   ` Stephen Warren
     [not found]                     ` <50C0E7F4.2090802-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-12-07  5:49                       ` Mark Zhang
2012-12-06 11:36       ` Terje Bergström
     [not found]         ` <50C08338.3070408-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-12-07  5:38           ` Mark Zhang
     [not found]             ` <50C180DA.508-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-07  6:44               ` Terje Bergström
     [not found]                 ` <50C1903C.8040608-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-12-07  7:05                   ` Mark Zhang

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=1354780836.1503.102.camel@tellur \
    --to=dev-8ppwabl0hbeelga04laivw@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nvmarkzhang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.