summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/virgl/virgl_screen.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-29gallium: add a nboxes param to flush_frontbufferMike Blumenkrantz1-2/+2
this allows conveying damage regions through the sw presentation interface Acked-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27703>
2024-02-05virgl: Pass cmd_buf to flush_frontbufferMax R1-1/+1
Required by gdi virgl winsys. Reviewed-by: Feng Jiang <jiangfeng@kylinos.cn> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27308>
2024-02-05virgl: Fix compilation on MSVCMax R1-2/+5
* Cast to uint8_t* before doing pointer arithmetics * Add zero to initializer list to initialize zeroed structs * Don't include linux sepcific headers on WIN32 * Don't use build_id when it isn't available Reviewed-by: Feng Jiang <jiangfeng@kylinos.cn> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27308>
2024-01-29virgl: Use better reporting for mirror_clamp featuresGert Wollny1-0/+2
Fixes: 9efe50c83bfa3678fe7ad3cfcd94cf73d900be22 virgl: report MIRROR_CLAMP features better Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27106>
2024-01-08virgl: Assert build_id_note before dereferencing itCorentin Noël1-1/+3
Fix defect reported by Coverity Scan. Dereference null return value If the function actually returns a null value, a null pointer dereference will occur. CID: 1492763 Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26924>
2023-10-31virgl: Use host reported limits for max outputsGert Wollny1-2/+13
Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24136>
2023-10-17virgl: Fix logic for reporting PIPE_MIRROR_CLAMPGert Wollny1-1/+1
Fixes: 9efe50c83 (virgl: report MIRROR_CLAMP features better) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25755>
2023-09-25virgl: report MIRROR_CLAMP features betterGert Wollny1-3/+5
The new host version checks the support of these features better, so report here accordingly. This fixes a number of texwrap piglit tests on Intel. v2: Stick to old test for PIPE_CAP_TEXTURE_MIRROR_CLAMP because host has to be backward compatible. Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25343>
2023-08-30virgl: Do not expose EXT_texture_mirror_clamp when using a GLES hostCorentin Noël1-0/+2
The GL_MIRROR_CLAMP_EXT wrap parameter is never available in GLES. This fixes the `spec@!opengl 1.1@texwrap 2d proj` piglit test when using a GLES host. Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Reviewed-by: Filip Gawin <filip.gawin@collabora.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24935>
2023-08-09virgl/video: Enable AV1 decodingFeng Jiang1-0/+1
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23386>
2023-07-19virgl: Enable vp9 hardware decodeHonglei Huang1-0/+1
Add vp9 fill function in fill_picture_desc to enable vp9 decoding. Signed-off-by: Honglei Huang <honglei1.huang@amd.com> Reviewed-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Boyuan Zhang <boyuan.zhang@amd.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Feng Jiang <jiangfeng@kylinos.cn> Signed-off-by: Huang Rui <ray.huang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22108>
2023-07-19virgl/video: Add support for jpeg decodingHonglei Huang1-0/+1
Implement for virgl jpeg decoding. Signed-off-by: Honglei Huang <honghuan@amd.com> Reviewed-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Boyuan Zhang <boyuan.zhang@amd.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Feng Jiang <jiangfeng@kylinos.cn> Signed-off-by: Huang Rui <ray.huang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22108>
2023-07-19virgl/video: Add support for vc1 decodingHonglei Huang1-0/+1
Implement for virgl vc1 decoding. Signed-off-by: Honglei Huang <honglei1.huang@amd.com> Reviewed-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Boyuan Zhang <boyuan.zhang@amd.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Feng Jiang <jiangfeng@kylinos.cn> Signed-off-by: Huang Rui <ray.huang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22108>
2023-07-19virgl/video: Add support for mpeg12 decodingHonglei Huang1-0/+3
Implement for mpeg12 virgl video decoding. Signed-off-by: Honglei Huang <honglei1.huang@amd.com> Reviewed-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Boyuan Zhang <boyuan.zhang@amd.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Feng Jiang <jiangfeng@kylinos.cn> Signed-off-by: Huang Rui <ray.huang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22108>
2023-07-10gallium: remove PIPE_CAP_CLEAR_TEXTUREItalo Nicola1-2/+0
ARB_clear_texture is now implemented in common code. Signed-off-by: Italo Nicola <italonicola@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23735>
2023-06-27treewide: Replace the usage of TRUE/FALSE with true/falseYonggang Luo1-1/+1
this is a separate patch as it's won't affect the code style Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23577>
2023-06-27treewide: style fixes after replace usage of boolean to boolYonggang Luo1-3/+3
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23577>
2023-06-27treewide: replace usage of boolean to boolYonggang Luo1-1/+1
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23577>
2023-06-20virgl: don't allow vertex input arrays on GLES hostsGert Wollny1-1/+6
v2: - use new HOST_IS_GLES flag (Corentin) - drop stray fprintf (Emma) - reorder cases to avoid code replication Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15550>
2023-06-12gallium: Drop PIPE_SHADER_CAP_PREFERRED_IR.Emma Anholt1-2/+0
Now everyone's saying NIR, and doing any NTT internally. The only returns of TGSI were in gallivm_get_shader_param() and tgsi_exec_get_shader_param(), but the drivers were returning NIR instead of calling down to them. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23114>
2023-06-12virgl: Drop the VIRGL_DEBUG=use_tgsi debug var.Emma Anholt1-6/+2
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23114>
2023-06-03compiler: Rename shader_prim to mesa_prim and replace all usage of ↵Yonggang Luo1-3/+3
pipe_prim_type with mesa_prim This is a prepare step to remove depends on p_defines.h in src/util/* This is done by: replace pipe_prim_type with mesa_prim replace shader_prim with mesa_prim replace PIPE_PRIM_MAX with MESA_PRIM_COUNT replace SHADER_PRIM_ with MESA_PRIM_ replace PIPE_PRIM_ with MESA_PRIM_ This patch only replace code only Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23369>
2023-05-26virgl: enable ARB_gl_spirvGert Wollny1-0/+1
This is handled in the guest and can just be enabled. Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23196>
2023-05-26virgl: signal support for group vote and draw parametersGert Wollny1-0/+4
Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23196>
2023-05-25virgl: remove unused tgsi includesThomas H.P. Andersen1-2/+0
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22838>
2023-05-23virgl: Add support for ARB_pipeline_statisticsGert Wollny1-1/+2
v2: make sure the PIPE enums map corretly to the VIRGL enums (Tintou) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23121>
2023-05-02virgl: check a debug option again at context creationRyan Neph1-12/+12
Android apps commonly use HWUI (a GLES-based UI framework provided by the system), that generally performs eglInitialize() before the app can do the same for its custom rendering needs. If an app is going to set VIRGL_DEBUG to enable case-by-case driver behaviors (e.g. experimental shader_sync option), it should be checked again during context creation. Signed-off-by: Ryan Neph <ryanneph@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22744>
2023-04-19virgl: add debug flag to force synchronous GL shader compilationRyan Neph1-0/+4
This does two things: 1. Flush the command buffer and associate a fence with each glLinkProgram(). 2. Force the application calling glLinkProgram() to wait on the associated fence, matching the semantics of native drivers. This important for some workloads and some environments. For example, on ChromeOS devices supporting VM-based android (ARCVM), an app's HWUI thread may be configured to use skiagl, while the app may create its own GLES context for custom rendering. Virgl+virtio_gpu supports a single fencing timeline, so all guest GL/GLES contexts are serialized by submission order to the guest kernel. If the app's submits multiple heavy shaders for compliation+linking (glCompileShader + glLinkProgram()), these are batched into a single virtgpu execbuffer (with one fence). Then rendering performed by the HWUI thread is blocked until the unrelated heavy host-side work is finished. To the user, the app appears completely frozen until finished. With this change, the app is throttled in its calls to glLinkProgram(), and the HWUI work can fill in the gaps between each while hitting most display update deadlines. To the user, the UI may render at reduced framerate, but remains mostly responsive to interaction. Signed-off-by: Ryan Neph <ryanneph@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22341>
2023-04-06glsl: Retire ldexp lowering in favor of the nir lowering flag.Emma Anholt1-0/+1
Compilers need to set the nir flag anyway for vulkan, so just pass ldexp through to NIR and let that handle it. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22083>
2023-03-31virgl: Add support for `get_screen_fd`Lucas Fryzek1-0/+13
Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21654>
2023-03-16virgl: Enable AMD_vertex_shader_(layer|viewport_index) when host supports itGert Wollny1-1/+2
This increase the number of cases when the texture upload from buffer can use the PBO upload code path. v2: Fix logic combination (Corentin) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21586>
2023-02-13virgl: enable timer queries only if host supports itosy1-2/+3
Timer queries is tied to GL_ARB_timer_query/GL_EXT_disjoint_timer_query support on the host. We have a flag that detects this so lets use it. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20380>
2023-01-17virgl: Request setting the atomic offset in the range_baseGert Wollny1-0/+1
With that NTT can encode the array base of atomic arrays separately so that the host driver can address the arrays correctly. Fixes GL-CTS: KHR-Single-GL43.arrays_of_arrays_gl.AtomicUsage Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19980>
2023-01-17virgl: lower image variable offsets into the intrinsic range_base valueGert Wollny1-0/+1
With that we get the correct base offset when accessing image arrays. This is required if there a various images with different access specifiers, because only with the correct base offset the host driver is able to pick the right array. Fixes GL-CTS: KHR-GL43.shading_language_420pack.binding_image_array Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19980>
2023-01-10Return 'Mesa' for GL_VENDOR for community driversDaniel Stone1-1/+1
Rather than a grab-bag of random values, return 'Mesa' as the GL_VENDOR string for all community-supported drivers. Drivers which are primarily developed/maintained by the hardware vendor retain that vendor's name as the GL_VENDOR string. Signed-off-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16064>
2023-01-07virgl: Use virgl host side shader stage IDs when reading capsGert Wollny1-4/+6
The ordering of enum pipe_shader_type changed, but not all locations where the host uses the original ordering were changed to translate to the new ordering, namely reading the shader caps was not fixed up so do this now. v2: - inline virgl_shader_stage_convert (Corentin) - encapuslate use of host shader stage when reading array elements of host caps Fixes: a26543f6368fed1604cfde7fffce2024e9d8abab gallium: reorder the shader stage enum to match Mesa Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8023 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20544>
2022-12-08virgl: lower FMA and MULADDGert Wollny1-0/+2
On the host we emit this as separate ops anyway, so avoid wired optimizations in the guest that might introduce difficult to optimize dependencies. v2: update trace expectations - some minor accuracy changes are to be expected when fma is handled differently Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20182>
2022-12-02virgl: Use get_first_non_void_channel more oftenKonstantin Seurer1-16/+4
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18634>
2022-11-18virgl/video: Check driver supported profiles and entrypointsFeng Jiang1-5/+21
Since the support of video by the device and the driver may be different, it is necessary to check on the driver side as well. Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18831>
2022-10-29gallium/util: add a helper for get_timestampYusuf Khan1-7/+1
Signed-off-by: Yusuf Khan <yusisamerican@gmail.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19334>
2022-10-15mesa/st: rip out point-sprite capErik Faye-Lund1-2/+0
All current drivers reports supporting this cap, let's just assume it's always supported. It seems better to lower this in the drivers, like we already do for etnaviv, panfrost and zink... Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Begrudgingly-reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19049>
2022-09-29virgl: Add nir_lower_tex passCorentin Noël1-0/+2
In GLES hosts that do not support EXT_texture_shadow_lod we need to lower the shadow texture calls with offset. Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18296>
2022-09-29virgl: Add TEXTURE_SHADOW_LOD capability supportCorentin Noël1-1/+1
Bind PIPE_CAP_TEXTURE_SHADOW_LOD with its value so that we are not using non-existing GLSL on host side. Rename VIRGL_CAP_FAKE_FP64 into VIRGL_CAP_HOST_IS_GLES Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18296>
2022-09-10virgl: Report CONSTANT_BUFFER_SIZE according to GL_MAX_UNIFORM_BLOCK_SIZEGert Wollny1-0/+4
GL_MAX_FRAGMENT_UNIFORM_COMPONENTS may not report a size that is useful to calculate the supported UBO size. Use the value GL_MAX_UNIFORM_BLOCK_SIZE instead when the host supports this. Related: https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/286 Fixes: 5b683ba19ac77d6c7dfd8de478678d0b90ba764f virgl: Only progagate the uniform numbers if the numbers are actually right Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18512>
2022-08-29virgl: Fix ubsan warnings:Gert Wollny1-1/+1
virgl_screen.c:313:55: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' virgl_screen.c:682:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' virgl_encode.c:481:7: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18231>
2022-08-11virgl: add support for hardware video accelerationFeng Jiang1-0/+80
Currently H.264 and H.265 decoding is supported, and other profiles and encodings will be added in the future. This function relies on the virglrenderer commit: a92fed821f5ac173ca82c011a5d7e5b25e7bd0eb Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Signed-off-by: Ming Xie <xieming@kylinos.cn> Signed-off-by: Liming Sun <sunliming@kylinos.cn> Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17157>
2022-08-04gallium: fixup some inconsistent uses of enum pipe_shader_type.Dave Airlie1-1/+1
These should be the enum not unsigned. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> (panfrost) Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com> (v3d) Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17747>
2022-08-01virgl: honor host caps in shader cash sha evaluationGert Wollny1-0/+4
This is needed because when we switch between GLES and GL on the host, we have to lower atomics to ssbo, and with that the shaders can't be pulled from the cache anymore. Likewise when we move the disk image with a shader cache to a different host, other features might change that will need lowering. To avoid using stale shaders in this case, merge the caps into into the shader cache sha. Fixes: d6db4d2e08100b12fe6ac539f419768b3b412643 virgl: Add simple disk cache Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17798>
2022-07-28virgL: lower fneg and fabsGert Wollny1-0/+1
The host doesn't currently handle source mods on immediate values correctly, so lower the ops that would create these source mods. v2: update trace checksum Fixes: c5cc9ed29b50ada77f875ad0d999678021678922 virgl: Switch to nir-to-tgsi by default. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6929 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Italo Nicola <italonicola@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17765>
2022-07-21virgl: Remove format desc null checksKonstantin Seurer1-4/+0
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17490>