Commit Graph

69 Commits

Author SHA1 Message Date
Rob Clark bd46ef14eb i915: Use util_draw_multi() helper
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9742>
2021-03-27 19:30:04 +00:00
Marek Olšák 05f35a50e3 gallium: remove and emulate PIPE_CAP_MULTI_DRAW
To remove PIPE_CAP checking in the common code.

It's better if drivers lower multi draws even if the hardware doesn't
support it beause the multi draw loop can be moved deeper into the driver
to remove more overhead.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7679>
2021-01-04 19:22:33 -05:00
Marek Olšák 1cd455b17b gallium: extend draw_vbo to support multi draws
Essentially rename multi_draw to draw_vbo and remove start and count
from pipe_draw_info.

This is only an interface change. It doesn't add multi draw support
anywhere.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7441>
2020-11-18 01:41:25 +00:00
Marek Olšák abe8ef862f gallium: make pipe_draw_indirect_info * a draw_vbo parameter
This removes 8 bytes from pipe_draw_info (think u_threaded_context)
and a lot of info->indirect pointer indirections.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7441>
2020-11-18 01:41:24 +00:00
Erik Faye-Lund a11945d179 i915: support NULL-resources
It's legal for a buffer-object to have a NULL-resource, but let's just
skip over it, as there's nothing to do.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
2019-04-29 10:28:38 +00:00
Marek Olšák 330d0607ed gallium: remove pipe_index_buffer and set_index_buffer
pipe_draw_info::indexed is replaced with index_size. index_size == 0 means
non-indexed.

Instead of pipe_index_buffer::offset, pipe_draw_info::start is used.
For indexed indirect draws, pipe_draw_info::start is added to the indirect
start. This is the only case when "start" affects indirect draws.

pipe_draw_info::index is a union. Use either index::resource or
index::user depending on the value of pipe_draw_info::has_user_indices.

v2: fixes for nine, svga
2017-05-10 19:00:16 +02:00
Marek Olšák c24c3b94ed gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes 2017-05-10 19:00:16 +02:00
Marek Olšák 707d2e8b3e gallium: fold u_trim_pipe_prim call from st/mesa to drivers
Most drivers don't need it and shouldn't need it because it can't be used
in some cases (indirect draws, primitive restart, count from streamout).

Reviewed-by: Brian Paul <brianp@vmware.com>
2017-04-20 20:11:35 +02:00
Marek Olšák 55ad59d2b7 gallium: set pipe_context uploaders in drivers (v3)
Notes:
- make sure the default size is large enough to handle all state trackers
- pipe wrappers don't receive transfer calls from stream_uploader, because
  pipe_context::stream_uploader points directly to the underlying driver's
  stream_uploader (to keep it simple for now)

v2: add error handling to nv50, nvc0, noop
v3: set const_uploader

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com> (v1)
Tested-by: Charmaine Lee <charmainel@vmware.com>
2017-02-14 21:46:16 +01:00
Marek Olšák e7a73b75a0 gallium: switch drivers to the slab allocator in src/util 2016-09-06 14:24:04 +02:00
Edward O'Callaghan 13eb5f596b gallium/drivers: Sanitize NULL checks into canonical form
Use NULL tests of the form `if (ptr)' or `if (!ptr)'.
They do not depend on the definition of the symbol NULL.
Further, they provide the opportunity for the accidental
assignment, are clear and succinct.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:10:23 +01:00
Marek Olšák 0fc21ecfc0 gallium: add flags parameter to pipe_screen::context_create
This allows creating compute-only and debug contexts.

Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-26 19:25:18 +02:00
José Fonseca 8771285054 s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008.  Leaving the
old copyright name is creating unnecessary confusion, hence this change.

This was the sed script I used:

    $ cat tg2vmw.sed
    # Run as:
    #
    #   git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
    #

    # Rename copyrights
    s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
    /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
    s/TUNGSTEN GRAPHICS/VMWARE/g

    # Rename emails
    s/alanh@tungstengraphics.com/alanh@vmware.com/
    s/jens@tungstengraphics.com/jowen@vmware.com/g
    s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
    s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
    s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
    s/michel@tungstengraphics.com/daenzer@vmware.com/g
    s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
    s/zack@tungstengraphics.com/zackr@vmware.com/

    # Remove dead links
    s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g

    # C string src/gallium/state_trackers/vega/api_misc.c
    s/"Tungsten Graphics, Inc"/"VMware, Inc"/

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 20:00:32 +00:00
Zack Rusin 5104ed3dbf draw: try to prevent overflows on index buffers
Pass in the size of the index buffer, when available, and use it
to handle out of bounds conditions. The behavior in the case of
an overflow needs to be the same as with other overflows in the
vertex processing pipeline meaning that a vertex should still
be generated but all attributes in it set to zero.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2013-05-14 03:10:56 -04:00
Zack Rusin 29853ab7b8 draw: don't crash on vertex buffer overflow
We would crash when stride was bigger than the size of the buffer.
The correct behavior is to just fetch zero's in this case.
Unfortunatly with user_buffer's there's no way to validate the size
because currently we're just not getting it. Adjust the draw interface
to pass the size along the mapped buffer, which works perfectly
for buffer backed vertex_buffers and, in future, it will allow
us to plumb user_buffer sizes through the same interface.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2013-05-14 03:09:32 -04:00
Stéphane Marchesin 6ef37f71b0 i915g: Call draw_set_mapped_vertex_buffer from draw_vbo
This regressed with the draw rework. Fixes glest and vdrift crash.
2012-10-06 13:15:04 -07:00
Stéphane Marchesin 74b6ea49df i915g: Get rid of the fixup state functions.
Now that the saved_* state is gone, we don't need those any longer.
2012-10-05 12:45:02 -07:00
Marek Olšák 6d2f59ce54 i915g: implement blit
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-09-30 18:57:56 +02:00
Brian Paul 185ed21058 draw: simplify index buffer specification
Replace draw_set_index_buffer() and draw_set_mapped_index_buffer() with
draw_set_indexes() which simply takes a pointer and an index size.
2012-05-31 09:40:35 -06:00
Marek Olšák bf469f4edc gallium: add void *user_buffer in pipe_index_buffer
Adapted drivers: i915, llvmpipe, r300, r600, radeonsi, softpipe.

User index buffers have been disabled in nv30, nv50, nvc0 and svga to keep
things working.
2012-04-30 01:14:28 +02:00
Stéphane Marchesin 368878cc5f Revert "i915g: Implement stipple with draw."
This reverts commit 3cff45fdb1.
2012-04-12 18:31:10 -07:00
Marek Olšák 96d882939d gallium: remove unused winsys pointers in pipe_screen and pipe_context
A winsys is already a private object of a driver.
2012-02-21 21:09:16 +01:00
Stéphane Marchesin a2caf952a1 i915g: Remove useless draw calls. 2012-02-12 16:32:15 -08:00
Stéphane Marchesin 3cff45fdb1 i915g: Implement stipple with draw. 2012-02-12 16:32:14 -08:00
Stéphane Marchesin 11cdf24d15 i915g: Add missing draw_flush call.
Fixes a bunch of corruption bugs, especially some missing clipped triangles.
2011-12-28 12:36:26 -08:00
Stéphane Marchesin b1d93d2aa8 i915g: Cleanup the vertex sampler interface a bit. 2011-10-25 14:30:08 -07:00
Stéphane Marchesin 8a22064d31 i915g: Implement vertex textures. 2011-10-08 23:54:53 -07:00
Daniel Vetter ed570cb5e5 i915g: fixup context desdruction
Reported-by: Christopher Egert <cme3000@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-07-13 00:09:36 +02:00
Stéphane Marchesin c191c87c81 i915g: Remove unused cbuf_dirty. 2011-06-27 02:08:44 -07:00
Stéphane Marchesin ac8f59b23e i915g: always upload the vs constants.
This fixes a crash in llvm draw.
2011-06-24 19:59:17 -07:00
Stéphane Marchesin 7b44830ef4 i915g: add fake occlusion queries.
Those always return 0, but at least we don't crash when exposing GL 2.0.
2011-06-24 17:28:54 -07:00
Stéphane Marchesin 1a69b50b3b i915g: Fix point sprites. 2011-06-24 16:30:19 -07:00
Stéphane Marchesin 98ce1373e4 i915g: Add draw point sprites.
It's not that much work; hopefully blend func separate also works and we get GL 2.0 for real.
2011-06-22 16:51:02 -07:00
Daniel Vetter 288504fac7 i915g: split up static state
Early Z support is set in the DST_VARS command. Hence split up static
state emission to avoid reissuing to much on fragment shader changes,
especially the costly dst buffer relocations.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-03-15 18:36:00 +01:00
Daniel Vetter 7735f8c6e5 i915g: fix transfer coherency
The kernel drm takes care of all coherency as long as we don't forget
to submit all outstanding commands in the batchbuffer ...

Also move batchbuffer initialization up because otherwise transfers
for some helper textures fail with a segmentation fault.

And kill the dead code, flushes should now be correct everywhere.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-03-12 22:58:19 +01:00
Daniel Vetter f0c56e2a23 i915g: implement copy_region using u_blitter
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>works
2011-03-12 20:32:29 +01:00
Daniel Vetter fb3b712b84 i915g: implement surface clear functions using hw-clear
Tested by temporarily using util_clear even when not using the blitter.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-03-10 23:04:20 +01:00
Daniel Vetter 6358e6371b i915g: implement hw clear
Benefits:
- spares us a relocation.
- needed for zone rendering (if that ever happens).
- just awesome.

v2: Rename the debug option. Completely disabling the blitter is
required for Y tiling to work, so this option will cover other
code paths in the future.

v3: Implement suggestions by Jakob Bornecrantz.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-03-10 23:04:10 +01:00
Brian Paul 1c9ca21adb i915g: remove extra semicolon 2011-03-01 17:09:15 -07:00
Daniel Vetter d42c9433b0 i915g: implement cache flushing
With an extremely dumb strategy. But it's the same i915c employs.

Also improve the hw_atom code slightly by statically specifying the
required batch space. For extremely variably stuff (shaders, constants)
it would probably be better to add a new parameter to the hw_atom->validate
function.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-02-27 22:10:46 +01:00
Jakob Bornecrantz 052122a8cd i915g: Handle null constants properly 2011-02-26 15:45:47 +01:00
Jakob Bornecrantz 8fb0ecd0cf i915g: Lazy emit dynamic state 2011-02-24 00:26:02 +00:00
Jakob Bornecrantz b9baad2aff i915g: Lazy emit immediate state 2011-02-24 00:26:02 +00:00
Jakob Bornecrantz fe6800a1bb i915g: Use debug get once options 2011-02-21 23:42:53 +00:00
Jakob Bornecrantz 832029e1c1 i915g: Remove draw_flushes and state that we don't need to track 2011-01-24 03:26:59 +01:00
Jakob Bornecrantz 0c3352b6df i915g: Don't do unnecessary copies of constants
Even tho st/mesa use user buffers for constants align buffers
other state trackers doesn't use user buffers.
2011-01-21 20:53:29 +01:00
Jakob Bornecrantz 2e60aa511d i915g: Don't emit FS constants when VS contants change 2011-01-21 20:53:29 +01:00
Jakob Bornecrantz 7287964f94 i915g: Use slab allocator for transfers
Also remove unused i915_transfer struct
2011-01-21 20:53:29 +01:00
Marek Olšák 3c9aa3a7b1 gallium: drivers should reference vertex buffers
So that a state tracker can unreference them after set_vertex_buffers.
2011-01-06 16:16:29 +01:00
Chia-I Wu 22f6026324 gallium: Use draw_set_index_buffer and others.
Update all drivers to use draw_set_index_buffer,
draw_set_mapped_index_buffer, and draw_vbo.  Remove
draw_set_mapped_element_buffer and draw_set_mapped_element_buffer_range.
2010-08-25 16:06:45 +08:00