aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_encode.c
Commit message (Collapse)AuthorAgeFilesLines
* virgl: Use ETC2 formats directly when possible.Lepton Wu2020-04-161-0/+10
| | | | | | | | | Don't emulate them with uncompressed formats if the host support them since uncompressed formats like GL_R16 could be not available on GLES hosts. Signed-off-by: Lepton Wu <[email protected]> Reviewed-by: Gert Wollny <[email protected]>
* virgl: Increase the shader transfer buffer by doubling the sizeGert Wollny2019-12-171-2/+3
| | | | | | | | | | | | | | | | | | | | | With only linearly increasing the size of the shader transfer buffer the transfer of very large shaders may fail, so with each attempt double the size of the buffer. CTS: dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.48 for VTK-GL-CTS b5dcfb9c5 and newer virglrenderer bug: https://gitlab.freedesktop.org/virgl/virglrenderer/issues/150 Fixes: a8987b88ff1db4ac00720a9b56c4bc3aeb666537 virgl: add driver for virtio-gpu 3D (v2) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3121> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3121>
* util: Move gallium's PIPE_FORMAT utils to /util/format/Eric Anholt2019-11-141-1/+1
| | | | | | | | | | | | | | | To make PIPE_FORMATs usable from non-gallium parts of Mesa, I want to move their helpers out of gallium. Since u_format used util_copy_rect(), I moved that in there, too. I've put it in a separate directory in util/ because it's a big chunk of related code, and it's not clear to me whether we might want it as a separate library from libmesa_util at some point. Closes: #1905 Acked-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
* virgl: support emulating planar image samplingDavid Stevens2019-11-081-1/+6
| | | | | | | | | | Mesa emulates planar format sampling with per-plane samplers. Virgl now supports this by allowing the plane index to be passed when creating a sampler view from a planar image. With this change, mesa now passes that information to virgl. Signed-off-by: David Stevens <[email protected]> Reviewed-by: Lepton Wu <[email protected]>
* gallium: add PIPE_RESOURCE_FLAG_SINGLE_THREAD_USE to skip util_range lockMarek Olšák2019-10-071-3/+3
| | | | | | | | | u_upload_mgr sets it, so that util_range_add can skip the lock. The time spent in tc_transfer_flush_region decreases from 0.8% to 0.2% in torcs on radeonsi. Reviewed-by: Kenneth Graunke <[email protected]>
* virgl: fix format conversion for recent gallium changes.Dave Airlie2019-08-261-6/+225
| | | | | | | | | | | | | | | | | | The virgl formats are fixed in time snapshots of the gallium ones, we just need to provide a translation table between them when we enter the hardware. This fixes a regression since Eric renumbered the gallium table. Fixes: c45c33a5a2 (gallium: Remove manual defining of PIPE_FORMAT enum values.) Bugzilla: https://bugs.freedesktop.org/111454 v1 by Dave Airlie <[email protected]> v2: virgl: Add a number of formats to the table that are used, e.g. for vertex attributes v3: cover some more missing formats from a piglit run Signed-off-by: Gert Wollny <[email protected]>
* virgl: Store the virgl_hw_res for copy transfersAlexandros Frantzis2019-06-281-2/+3
| | | | | | | | | Store the virgl_hw_res instead of the pipe_resource for copy transfer sources. This prepares the codebase for a change to provide only the virgl_hw_res for the staging buffers in upcoming commits. Signed-off-by: Alexandros Frantzis <[email protected]> Reviewed-by: Chia-I Wu <[email protected]>
* virgl: Add skeleton to evaluate cap and send tweaksGert Wollny2019-06-201-0/+9
| | | | | Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
* virgl: save virgl_hw_res in virgl_transferChia-I Wu2019-06-171-2/+6
| | | | | | | | | | When PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE is properly supported, virgl_transfer might refer to a different virgl_hw_res than virgl_resource does. We need to save the virgl_hw_res and use the saved one. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Alexandros Frantzis <[email protected]>
* virgl: Support copy transfersAlexandros Frantzis2019-06-071-5/+49
| | | | | | | | | | | | | | | Support transfers that use a different resource as the source of data to transfer. This will be used in upcoming commits to send data to host buffers through a transfer upload buffer, in order to avoid waiting when the buffer resource is busy. Note that we don't support queueing copy transfers in the transfer queue. Copy transfers should be emitted directly in the command queue, allowing us to avoid flushes before them and leads to better performance. Signed-off-by: Alexandros Frantzis <[email protected]> Reviewed-by: Chia-I Wu <[email protected]>
* virgl: track valid buffer range for transfer syncChia-I Wu2019-05-221-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | virgl_transfer_queue_is_queued was used to avoid flushing. That fails when the resource is being accessed by previous cmdbufs but not the current one. The new approach of tracking the valid buffer range does not apply to textures however. But hopefully it is fine because the goal is to avoid waiting for this scenario glBufferSubData(..., offset, size, data1); glDrawArrays(...); // append new vertex data glBufferSubData(..., offset+size, size, data2); glDrawArrays(...); If glTex(Sub)Image* turns out to be an issue, we will need to track valid level/layer ranges as well. v2: update virgl_buffer_transfer_extend as well v3: do not remove virgl_transfer_queue_is_queued Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Alexandros Frantzis <[email protected]> (v1) Reviewed-by: Gurchetan Singh <[email protected]> (v2)
* virgl: remove support for buffer surfacesChia-I Wu2019-05-221-7/+4
| | | | | | | | | | st/mesa does not need it and virglrenderer does not really support it. Remove the support so that we are sure pipe_surface never refers to a buffer resource. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Alexandros Frantzis <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
* virgl: handle NULL shader resource explicitlyChia-I Wu2019-05-221-3/+3
| | | | | | | | | | When shader images/buffers are set, do not rely on virgl_encoder_write_res and virgl_resource_dirty to do the implicit NULL check. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Alexandros Frantzis <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
* virgl: add support for ARB_multi_draw_indirectDave Airlie2019-04-091-4/+7
| | | | | | | This will pass the multi draw through to the host if it has support for it instead of using the st to emulate it Reviewed-By: Gert Wollny <[email protected]>
* virgl: remove unused variableErik Faye-Lund2019-03-071-1/+0
| | | | | | | This variable is now unused, so let's remove it. Fixes: 9c4930946a5 (virgl: add encoder functions for new protocol) Reviewed-by: Gurchetan Singh <[email protected]>
* virgl: add encoder functions for new protocolGurchetan Singh2019-02-151-0/+22
| | | | | | Let's encode the new protocol with new helper functions. Reviewed-by: Gert Wollny <[email protected]>
* virgl: limit command length to 16 bitsGurchetan Singh2019-02-151-5/+7
| | | | | | | | | | | Much of our logic is based around the idea the upper 16 bits of a command dword can encode the length of the command. Now that the command buffer >= 2^16 - 1, we should check for this. v2: alignment, and only check VIRGL_ENCODE_MAX_DWORDS Reviewed-by: Gert Wollny <[email protected]>
* virgl: use virgl_transfer in inline writeGurchetan Singh2019-02-151-26/+40
| | | | | | | | | | | | | Let's define a helper function and use it. This commit also allows resources to be emitted into different command buffers. Like the ioctls, send 0 for layer_stride and stride. If we actually send the real values, there are various assumptions in virglrenderer for non-1D buffers that may need to be modified. Reviewed-by: Gert Wollny <[email protected]>
* virgl: track level cleanliness rather than resource cleanlinessGurchetan Singh2019-02-151-2/+1
| | | | | | This allows a minor optimization for texture upload. Reviewed-by: Gert Wollny <[email protected]>
* virgl: use virgl_resource_dirty helperGurchetan Singh2019-02-151-10/+4
| | | | Reviewed-by: Gert Wollny <[email protected]>
* virgl: add ability to do finer grain dirty trackingGurchetan Singh2019-02-151-1/+1
| | | | | | There are levels to cleanliness. Reviewed-by: Gert Wollny <[email protected]>
* virgl: ARB_query_buffer_object supportDave Airlie2019-01-311-0/+16
| | | | | | v1.1: fix size define. Reviewed-by: Gurchetan Singh <[email protected]>
* virgl: fix const warning on debug flags.Dave Airlie2018-12-041-2/+2
| | | | Fixes: 8d4bb6e5c (virgl: Add command and flags to initiate debugging on the host (v2))
* virgl: don't mark buffers as unclean after a writeGurchetan Singh2018-11-301-0/+10
| | | | | | | | | | | | | | | | | We can mark the buffer unclean if it's ever bound as a TBO, SSBO, ABO, or image. This improves dEQP-GLES3.performance.buffer.data_upload.function_call.map_buffer_range.new_specified_buffer.flag_write_full.stream_draw from 9.58 MB/s to 451.17 MB/s. v2: Track buffer cleanliness as a function of bindings (Ilia). v3: virgl_modify_clean --> virgl_dirty_res (Erik) Tested-By: Gert Wollny <[email protected]> Reviewed-by: Erik Faye-Lund <[email protected]>
* virgl: Add command and flags to initiate debugging on the host (v2)Gert Wollny2018-11-131-0/+24
| | | | | | | | | | | | On the host VREND_DEBUG=guestallow must be set to let the guest override the debug flags. v2: Send flag string instead of flags, this avoids the need to keep the flags in sync. v3: Only request host logging if the host actually understands the command Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Erik Faye-Lund <[email protected]>
* virgl: don't send a shader create with no data. (v2)Dave Airlie2018-09-101-1/+1
| | | | | | | | | | | | | This fixes the situation where we'd send a shader with just the header and no data. piglit/glsl-max-varyings test was causing this to happen, and the renderer fix was breaking it. v2: drop fprintf Fixes: a8987b88ff1d "virgl: add driver for virtio-gpu 3D (v2)" Reviewed-by: Erik Faye-Lund <[email protected]>
* gallium: split depth_clip into depth_clip_near & depth_clip_farMarek Olšák2018-09-061-1/+1
| | | | for AMD_depth_clamp_separate.
* virgl: use hw-atomics instead of in-ssbo onesTomeu Vizoso2018-09-051-0/+23
| | | | | | | | Emulating atomics on top of ssbos can lead to too small max SSBO count, so let's use the hw-atomics mechanism to expose atomic buffers instead. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
* virgl: add debug-switch to output TGSIErik Faye-Lund2018-08-281-0/+3
| | | | | | | | This is quite useful for debugging shader-transpiling issues in virglrenderer. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-By: Gert Wollny <[email protected]>
* virgl: introduce $VIRGL_DEBUG=verboseErik Faye-Lund2018-08-281-1/+2
| | | | | | | | | | This adds an environment-varaible that can be used for driver-specific flags, as well as a flag for it to enable verbose output. While we're at it, quiet some overly chatty debug-output by default. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-By: Gert Wollny <[email protected]>
* virgl: replace fprintf-call with debug_printfErik Faye-Lund2018-08-281-1/+1
| | | | | | | | This is the only direct call-site for fprintf in virgl; all other call-sites call debug_printf instead. So let's follow in style here. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-By: Gert Wollny <[email protected]>
* virgl: ARB_enhanced_layouts supportDave Airlie2018-08-221-1/+1
| | | | | | | We need to handle the gaps in the streamout bindings on the guest side and enable if it the host has the rest enabled. Reviewed-by: Jakob Bornecrantz <[email protected]>
* virgl: ARB_texture_barrier supportDave Airlie2018-08-141-0/+8
| | | | Reviewed-by: Tomeu Vizoso <[email protected]>
* virgl: Support ARB_framebuffer_no_attachmentsDave Airlie2018-08-011-0/+6
| | | | | | This uses new protocol to send the default sizes to the host. Reviewed-by: Gurchetan Singh <[email protected]>
* virgl: add initial ARB_compute_shader supportDave Airlie2018-08-011-1/+24
| | | | | | This hooks up compute shader creation and launch grid support. Reviewed-by: Gurchetan Singh <[email protected]>
* virgl: add memory barrier supportDave Airlie2018-08-011-0/+8
| | | | Reviwed-by: Gert Wollny <[email protected]>
* virgl: add initial images support (v2)Dave Airlie2018-08-011-0/+29
| | | | | | v2: add max image samples support Reviwed-by: Gert Wollny <[email protected]>
* virgl: add initial shader_storage_buffer_object support. (v2)Dave Airlie2018-07-241-0/+25
| | | | | | | | | | | This adds the guest side support for ARB_shader_storage_buffer_object. Co-authors: Gurchetan Singh <[email protected]> v2: move to using separate maximums (fixup macros) Reviewed-By: Gert Wollny <[email protected]>
* virgl: Fix flush in virgl_encoder_inline_write.Lepton Wu2018-07-171-1/+1
| | | | | | | | | The current code is buggy: if there are only 12 dwords left in cbuf, we emit a zero data length command which will be rejected by virglrenderer. Fix it by calling flush in this case. Cc: [email protected] Reviewed-by: Dave Airlie <[email protected]>
* virgl: implement set_min_samplesErik Faye-Lund2018-07-171-0/+7
| | | | | | | | This allows us to implement glMinSampleShading correctly, which up until now just got ignored. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* virgl: add ARB_texture_view supportDave Airlie2018-06-271-2/+5
| | | | Reviewed-By: Gert Wollny <[email protected]>
* virgl: add ARB_tessellation_shader support. (v2)Dave Airlie2018-06-141-2/+19
| | | | | | | | | | This should add all the pieces to enable tess shaders on virgl. v2: fixup transform to handle tess and strip out precise. set default for max patch varyings to work around issue when tess gets enabled from v1 caps but v2 caps aren't in place. (Elie) Reviewed-by: Elie Tournier <[email protected]>
* virgl: enable vertex streams when glsl level is high enough.Dave Airlie2018-05-151-1/+1
| | | | | This enabled the vertex streams out when the host supports GL4.0.
* virgl: Implement seamless cube mapsStéphane Marchesin2018-03-211-1/+2
| | | | | | | | | | This was previously ignored. Along with the virglrenderer patch, this fixes ~100 dEQP tests: dEQP-GLES3.functional.texture.filtering.cube.* Signed-off-by: Stéphane Marchesin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* virgl: add ARB_sample_shading support.Dave Airlie2018-02-141-1/+2
| | | | | | This enable ARB_sample_shading if the renderer supports it. Signed-off-by: Dave Airlie <[email protected]>
* virgl: add ARB_draw_indirect support.Dave Airlie2018-02-141-1/+14
| | | | | | This relies on the renderer code landing first. Signed-off-by: Dave Airlie <[email protected]>
* virgl: encode index buffer offset.Dave Airlie2017-07-271-1/+1
| | | | | | | Fixes arb_vertex_buffer_object-combined-vertex-index Cc: [email protected] Signed-off-by: Dave Airlie <[email protected]>
* gallium: remove pipe_index_buffer and set_index_bufferMarek Olšák2017-05-101-3/+3
| | | | | | | | | | | | | | 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
* gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytesMarek Olšák2017-05-101-1/+1
|
* gallium: s/uint/enum pipe_render_cond_flag/ for set_render_condition()Brian Paul2017-03-081-1/+1
| | | | Reviewed-by: Edward O'Callaghan <[email protected]>