i915g: Fix assert

Now that we support start, assert on start + num < max samplers

Reported by xexaxo
dri: Move i965-specific context flag logic to dri common.

Nobody else yet can do a forward context anyway, but others should be able
to do debug contexts, and those would have just had no effect currently.
i965: Rename brwCreateContext's error parameter to dri_ctx_error.

"error" is a very generic name.  dri_ctx_error is the name used in
intelInitContext(), which is more specific.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Pull out INTEL_DEBUG handling into new intel_debug.[ch] files.

Now that there isn't an intel_context structure, the split between
brw_context.[ch] and intel_context.[ch] is rather awkward and arbitrary.
Removing intel_context.[ch] seems desirable, but not everything really
belongs in brw_context.[ch], either.

Moving INTEL_DEBUG handling into separate intel_debug.[ch] files should
make them relatively easy to find.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Update the comment about viewport hacks.

It wasn't clear that this was necessary for EGL, or why.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Move a bunch of code from intelInitContext to brwCreateContext.

Now that intelInitContext isn't shared between i915 and i965, the split
is fairly arbitrary.  This patch moves a bunch of the basic context
creation and generation checking code up to the top-level function
(and slightly earlier).

More will follow.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Pull most driconf option handling into a centralized function.

Using a helper function clarifies the context initialization code.

I would've liked to completely centralize it, but moving the optionCache
code from intelInitExtensions into here would've required setting flags
in the context, which seems like a waste.

v2: Rebase for the introduction of disable_derivative_optimization.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Remove #define name from PCI ID table.

Nothing uses the #define name, and it's not terribly useful - the
numerical ID serves the same purpose.  The only thing we could really do
with it is generate slightly prettier preprocessed code.  But who looks
at that?

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Add the family name to the PCI ID table.

I removed this a while ago, since we never used it, but I'm finally
resurrecting the idea in the next commits.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Add a new brw_device_info structure.

The idea is that struct brw_device_info should store statically-known
information about hardware features.  Using the new family name in the
PCI ID table, we can easily grab the right structure.

This is basically the equivalent of intel_device_info in the kernel.

This patch also makes the new structure available from intel_screen, but
nothing uses it.  Right now, it looks very redundant with existing
fields, but that will change.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Delete the INTEL_SEPARATE_STENCIL override.

This option was useful during initial development, but it's been ages
since I've heard of anyone using it.  Plus, Gen7+ mandates separate
stencil, so it was really only useful on Sandybridge anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Replace some intel_screen fields with brw_device_info references.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Move hardware limits to brw_device_info.

Since each kind of device has its own brw_device_info structure, we can
simply store the URB and thread limits there.  This eliminates all the
large if-ladders, and simplifies the context initialization code quite a
bit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Move device quirks to brw_device_info.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Move hardware feature flags to brw_device_info.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Remove the brw_context::emit_state_always flag.

This was always set to false, and is only used for debugging.
To enable it, simply change the if (0) block and recompile.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Move state setup from brwCreateContext to brw_init_state().

This seems like a better place for it, and helps clean up
brwCreateContext (which is full of a lot of random stuff).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
i965: Remove has_aa_line_parameters.

This flag is only used in one place, and is only set on one platform.
Just check for original Gen4 in the relevant function.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Move memset of TextureFormatSupported to brw_init_surface_formats.

brw_init_surface_formats already sets entries in TextureFormatsSupported
to true; it may as well take care of initializing it to false too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
i965: Merge intel_context.c into brw_context.c.

There's no point in having two files for context functions.  This patch
moves the code from intel_context.c into brw_context.c unmodified
(other than whitespace fixes).

Right now, this looks silly; future patches will merge functions and
tidy things up.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>