All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kenneth Graunke <kenneth@whitecape.org>
To: "Zou, Nanhai" <nanhai.zou@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Trying to understand the URB code
Date: Wed, 06 Apr 2011 22:01:06 -0700	[thread overview]
Message-ID: <4D9D4512.8010800@whitecape.org> (raw)

Hi Nanhai,

I'm trying to understand how the Gen6 URB setup works, and I had some 
questions...

    if (IS_GT1(intel->intelScreen->deviceID)) {
         urb_size = 32 * 1024;
         max_urb_entry = 128;
    } else {
         urb_size = 64 * 1024;
         max_urb_entry = 256;
    }

I see in vol5c.5 that GT1 has 32kB of URB space and GT2 has 64kB, so 
urb_size must be the total size of the URB.  But what is max_urb_entry? 
  Where do 128 and 256 come from?

    brw->urb.vs_size = MAX2(brw->vs.prog_data->urb_entry_size, 1);

It looks like brw->vs.prog_data->urb_entry_size is the size of a single 
VUE, which depends on the number of input/outputs in the particular 
vertex shader being used.

So, brw->urb.vs_size is also the size of a VUE, but at least 1.
What are the units here?  The number of 1024-bit blocks?  (I'm looking 
at 3DSTATE_URB in vol2a of the bspec...)

    brw->urb.nr_vs_entries = max_urb_entry;
    brw->urb.nr_gs_entries = max_urb_entry;

    if (2 * brw->urb.vs_size * brw->urb.nr_vs_entries > urb_size)
            brw->urb.nr_vs_entries = brw->urb.nr_gs_entries =
                 (urb_size ) / (2 * brw->urb.vs_size);

Here it looks like you're trying to allocate half of the URB to the VS, 
and half to the GS.  I'm confused by the units, though: if vs_size is in 
1024-bit (128-byte) blocks and urb_size is in bytes, don't we need to 
multiply vs_size by 128?

I think the above code could be simplified to:

int urb_entries = urb_size / (2 * brw->urb.vs_size * 128);
brw->urb.nr_vs_entries = brw->urb.nr_gs_entries = MIN2(urb_entries, 
max_urb_entry);

What do you think?

Thanks for the help.
--Kenneth

             reply	other threads:[~2011-04-07  5:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-07  5:01 Kenneth Graunke [this message]
2011-04-07  8:24 ` Trying to understand the URB code Zou, Nanhai
2011-04-08 19:03   ` Ian Romanick

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=4D9D4512.8010800@whitecape.org \
    --to=kenneth@whitecape.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=nanhai.zou@intel.com \
    /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.