aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_format.c
Commit message (Collapse)AuthorAgeFilesLines
* svga: fix size of format_conversion_table[]Neha Bhende2020-02-101-0/+2
| | | | | | | | | | Since we are now using sparse matrix for format_conversion_table, we have to make sure we have last entry in table which gives the sense of required size of format_conversion_table Fixes: 84db6ba7 ("svga: Drop unsupported formats from the format table") Reviewed-by: Charmaine Lee <[email protected]>
* 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]>
* svga: Drop unsupported formats from the format table.Eric Anholt2019-08-191-170/+0
| | | | | | | | | | | Now that we're using the array initializers, we don't need to manually fill out all these stub entries. Produced with "sed -i '/.*INVALID.*INVALID.*INVALID/d' src/gallium/drivers/svga/svga_format.c" Acked-by: Jose Fonseca <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: Remove duplication in the format table.Eric Anholt2019-08-191-329/+322
| | | | | | | | | | | | | By using the [ ] = {} array initializer syntax, we no longer need the entries to be listed in PIPE_FORMAT_* value order. This means that people adding new gallium formats don't need to cargo-cult changes to this driver or regress that non-unit-tested requirement. While I'm here, drop the lines for formats that no longer exist (the numbered ones in the table). Acked-by: Jose Fonseca <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: Factor out the format conversion table entry lookup.Eric Anholt2019-08-191-16/+25
| | | | | | | | | | | Seemed like a sensible cleanup, while I was looking at whether I could make the table sparse. To make the svga table not require fixups on every new gallium format, we may want to change how it's populated. Acked-by: Jose Fonseca <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* gallium: add AYUV and XYUV formatsMike Blumenkrantz2019-07-311-0/+2
| | | | | | this only adds the PIPE_FORMAT members, not any direct handling for them Reviewed-by: Kenneth Graunke <[email protected]>
* gallium: switch boolean -> bool at the interface definitionsIlia Mirkin2019-07-221-16/+16
| | | | | | | | | | | | | | | | | | This is a relatively minimal change to adjust all the gallium interfaces to use bool instead of boolean. I tried to avoid making unrelated changes inside of drivers to flip boolean -> bool to reduce the risk of regressions (the compiler will much more easily allow "dirty" values inside a char-based boolean than a C99 _Bool). This has been build-tested on amd64 with: Gallium drivers: nouveau r300 r600 radeonsi freedreno swrast etnaviv v3d vc4 i915 svga virgl swr panfrost iris lima kmsro Gallium st: mesa xa xvmc xvmc vdpau va Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]>
* gallium: add z24s8_as_r8g8b8a8 formatRob Clark2019-06-151-0/+1
| | | | | | | | | | | | This maps to a special format that recent generations of adreno have, for blitting z24s8. Conceptually it is similar to doing Z and/or S blits by pretending it is r8g8b8a8 (with appropriate writemask). But it differs when bandwidth compression is used, as z24 is a different type from r8g8b8. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* svga: add new ATC formats to the format conversion tableJonathan Marek2019-04-231-0/+3
| | | | | | | Fixes the static assertion error. Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* svga: add new gallium formats to the format conversion tableBrian Paul2019-01-221-0/+4
| | | | | | | | Fixes a static assertion which broke the build. Fixes: 3ee240890 "gallium: add SINT formats to have exact counterparts to SNORM formats" Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Neha Bhende<[email protected]>
* Gallium: Add format PIPE_FORMAT_R8_SRGBGert Wollny2018-11-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This format is needed to support EXT_texture_sRGB_R8. THe patch adds a new format enum, the format entries in Gallium and and svga, the mapping between sRGB and linear formats, and tests. v2: - add mapping to linear format for PIPE_FORMATR_R8_SRGB v3: - Add texture format to svga format table since otherwise building mesa will fail when this driver is enabled. It was not tested whether the extension actually works. v4: - svga: remove the SVGA specific format definitions and table entries and only add correct the location of PIPE_FORMAT_R8_SRGB in the format_conversion_table (Ilia Mirkin) - Split patch (1/2) to separate Gallium part and mesa/st part. (Roland Scheidegger) - Trim the commit message to only contain the relevant parts from the split. v5: - svga: correct location of PIPE_FORMAT_SRGB_R8 (Ilia Mirkin) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* svga: add format conversion for legacy formatsCharmaine Lee2018-09-101-313/+334
| | | | | | | | | | | This patch extends the format_conversion table to support different view formats on texture buffer. For legacy image formats such as INTENSITY, LUMINANCE, LUMINANCE_ALPHA, special swizzle masks will be used on the red or RG channels. This fixes piglit test arb_texture_buffer_object-formats fs|vs arb Reviewed-by: Brian Paul <[email protected]>
* svga: add missing devcap check for texture array supportCharmaine Lee2018-09-101-1/+11
| | | | | | | | The patch checks DXFMT_ARRAY devcap for texture array support. Tested with MTT-piglit. No regressions. Reviewed-by: Brian Paul <[email protected]>
* svga: no need to check MULTISAMPLE devcap for view formatCharmaine Lee2018-09-101-1/+1
| | | | | | | | | | According to the current SVGA contract, any view format can be used on the underlying resource that is multisample. So there is no need to check the MULTISAMPLE devcap for the view format. Fixes black rendering issue with Tropics running with 4xMSAA. Reviewed-by: Brian Paul <[email protected]>
* svga: sync devcap name changes in svga3d_devcaps.hCharmaine Lee2018-09-101-8/+8
| | | | Reviewed-by: Brian Paul <[email protected]>
* svga: explicit set DXFMT_SHADER_SAMPLE for DS format for pre-SM41 deviceCharmaine Lee2018-09-101-5/+6
| | | | | | | Explicit set the DXFMT_SHADER_SAMPLE bit for depth stencil formats for pre-SM41 device only. This bit is now set by the SM41 device. Reviewed-by: Brian Paul <[email protected]>
* svga: remove obsolete comment on format_cap_table[]Brian Paul2018-09-101-10/+0
| | | | | | | | We removed the special cases referred to in this comment in the commit "svga: add a separate function to get dx format capabilities from vgpu10 device". Reviewed-by: Charmaine Lee <[email protected]>
* svga: fix missing format multisample devcap checkCharmaine Lee2018-09-101-0/+1
| | | | | | | | | | | In commit e4048f6cd1, svga_is_dx_format_supported() is supposed to also check the SVGA3D_DXFMT_MULTISAMPLE bit for multisample support of a format. Somehow that code is not included in that commit. This patch fixes it. Fixes piglit test spec@ext_framebuffer_multisample@formats all_samples. Reviewed-by: Brian Paul <[email protected]>
* svga: fix incorrect multisample support in VGPU9 deviceCharmaine Lee2018-09-101-0/+4
| | | | | | | Commit e4048f6cd1 unintentionally allows multisample support for VGPU9 device. This patch fixes this regression. Reviewed-by: Neha Bhende <[email protected]>
* svga: fix the missing devcap for SVGA3D_BC3_UNORM_SRGBCharmaine Lee2018-09-101-0/+1
| | | | | | | Set the devcap to SVGA3D_DEVCAP_DXFMT_BC3_UNORM_SRGB Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
* svga: add a separate function to get dx format capabilities from vgpu10 deviceCharmaine Lee2018-09-101-97/+91
| | | | | | | | | | | | | | | | | | Currently we have one function to get format capabailities and we convert DX10 devcaps back to DX9. This can be confusing. Going forward we will have a separate function for dealing with dx formats. This patch also fixes the depth stencil devcap. Instead of hardcoding the capabilities for the depth stencil formats, we will inquire the device for the capabilities. Note: we will still need to explicity set the SVGA3D_DXFMT_SHADER_SAMPLE bit for SVGA3D_R32_FLOAT_X8X24 and SVGA3D_R24_UNORM_X8 since this bit is not advertised but supported by the device. v2: reapply the patch after svga_is_format_supported is moved to svga_format.c Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
* svga: assign a separate function for is_format_supported() for vgpu10 deviceCharmaine Lee2018-09-101-18/+106
| | | | | | | | | | This patch adds a new function svga_is_dx_format_supported() to check for format support in a VGPU10 device. v2: reapply the patch after svga_is_format_supported is moved to svga_format.c Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
* svga: add some devcap debugging codeBrian Paul2018-09-101-0/+193
| | | | Reviewed-by: Charmaine Lee <[email protected]>
* svga: update device header files from upstreamBrian Paul2018-09-051-1/+1
| | | | | | This is a squash commit of several earlier patches. Signed-off-by: Brian Paul <[email protected]>
* gallium: add storage_sample_count parameter into is_format_supportedMarek Olšák2018-07-311-0/+4
| | | | Tested-by: Dieter Nützel <[email protected]>
* svga: Fix incorrect advertizing of EGL_KHR_gl_colorspaceThomas Hellstrom2018-04-191-1/+1
| | | | | | | | | | | | | | | | | | | When advertizing this extension, egl_dri2 uses the DRI2_RENDERER_QUERY extension to query whether an sRGB format is supported. That extension will query our driver with the BIND flag PIPE_BIND_RENDER_TARGET rather than PIPE_BIND_DISPLAY_TARGET which is used when building the configs. We only return the correct value for PIPE_BIND_DISPLAY_TARGET. The inconsistency causes EGL to crash at surface initialization if sRGB is not supported. Fix this by supporting both bind flags. Testing done: piglit egl_gl_colorspace srgb Cc: <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* gallium: Add a new A4B4G4R4 pipe format for Broadcom.Eric Anholt2018-02-021-0/+1
| | | | | | | | The VC5 HW puts A in the low bits and R in the high bits. We can't just swizzle in the shaders because the blending HW can't pick what channel A is in, so make a new format to match it. Reviewed-by: Marek Olšák <[email protected]>
* svga: move svga_is_format_supported() to svga_format.cBrian Paul2017-11-281-0/+119
| | | | | | where the other format-related functions live. Reviewed-by: Charmaine Lee <[email protected]>
* svga: fix format_conversion_table breakageBrian Paul2017-10-161-2/+7
| | | | | | | | | | The new A1B5G5R5_UNORM, X1B5G5R5_UNORM formats were added in the wrong place in commit ef874ee450b18e. Fixes: ef874ee450b18e "gallium: Add support for 5551 with the 1-bit field in the low bit." Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* gallium: Add support for 5551 with the 1-bit field in the low bit.Eric Anholt2017-10-101-0/+2
| | | | | | | | | | | | This is how VC4 stores 5551 textures, which we need to support for GL_OES_required_internalformat. v2: Extend commit message, fix svga driver build, add BE ordering from Roland. v3: Rebase on PIPE_FORMAT_R10G10B10X2_UNORM addition. Reviewed-by: Marek Olšák <[email protected]> (v2) Reviewed-by: Nicolai Hähnle <[email protected]> (v2)
* svga: fix incorrect case in svga_typeless_format()Brian Paul2017-10-031-2/+1
| | | | | | | | | | | | For the case of SVGA3D_X32_G8X24_UINT we incorrectly returned SVGA3D_R32_FLOAT_X8X24. We should return SVGA3D_R32G8X24_TYPELESS. Note that we never actually use SVGA3D_X32_G8X24_UINT so this has no impact. No Piglit regressions. Reviewed-by: Charmaine Lee <[email protected]>
* svga: add typeless switch cases in svga_typeless_format()Brian Paul2017-10-031-0/+10
| | | | | | | | | | We sometimes pass typeless formats to this function. By adding switch cases we avoid the "Unexpected format XXX in svga_typeless_format" warning messages. No functional change. No Piglit regressions, no above-mentioned warning messages. Reviewed-by: Charmaine Lee <[email protected]>
* gallium: add PIPE_FORMAT_R10G10B10X2_UNORMNicolai Hähnle2017-10-021-0/+1
| | | | Reviewed-by: Marek Olšák <[email protected]>
* svga: update a few surface format namesBrian Paul2017-06-301-16/+16
| | | | | | To sync with in-house changes. Reviewed-by: Neha Bhende <[email protected]>
* svga: clean up format_cap_tableCharmaine Lee2017-06-271-403/+92
| | | | | | | | | | | Per Jose's suggestion, this patch cleans up format_cap_table to remove the unnecessary default cap value for vgpu10 formats since those devcap values can be retrieved from the device. Tested with MTT conform, glretrace, piglit in HWv13 and HWv8. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* svga: fix the default devcap for SVGA3D_Z_D24S8_INTCharmaine Lee2017-06-271-4/+1
| | | | | | | | | | The default devcap for format SVGA3D_Z_D24S8_INT in HWv8 when its devcap is not explicitly advertised should be set to zero to match the default value in the device. Tested with MTT piglit in HW version 8. Reviewed-by: Neha Bhende <[email protected]>
* svga: Allow format differences in 16-bit RGBA surface sharingThomas Hellstrom2017-06-071-1/+5
| | | | | | | | | | | | | For the purpose of surface sharing, treat SVGA3D_R5G6B5 and SVGA3D_B5G6R5_UNORM as identical formats. This fixes the following piglit tests with dri3/xa: glx@glx-visuals-depth -pixmap glx@glx-visuals-stencil -pixmap Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Deepak Singh Rawat <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: add function svga_linear_to_srgb()Neha Bhende2017-04-281-0/+26
| | | | | | | | This function will return compatible svga srgb format for corresponding linear format Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: Add a more elaborate format compatibility determination v2Thomas Hellstrom2017-04-281-0/+70
| | | | | | | | | | | | | | dri3 is a bit sloppy about its format compatibility requirements, so add a possibility to import xrgb surfaces as argb textures and vice versa. At the same time, make the svga_texture_from_handle() function a bit more readable and fix the error path where we leaked a winsys surface. v2: Addressed review comments by Brian. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: fix format for screen targetCharmaine Lee2017-04-261-0/+26
| | | | | | | | | | | | | | | | | | | This patch revises the fix in commit 606f13afa31c9f041a68eb22cc32112ce813f944 to properly translate the surface format for screen target. Instead of changing the svga format for PIPE_FORMAT_B5G6R5_UNORM to SVGA3D_R5G6B5 for all texture surfaces, this patch only restricts SVGA3D_R5G6B5 for screen target surfaces. This avoids rendering failures when specify a non-vgpu10 format in a vgpu10 context with software renderer. Fixes piglit failures spec@!opengl 1.1@draw-pixels, spec@!opengl 1.1@teximage-colors gl_r3_g3_b2 spec@!opengl 1.1@texwrap formats Tested Xorg with 16bits depth. Also tested with MTT piglit, MTT glretrace. Reviewed-by: Brian Paul <[email protected]>
* svga: handle P016 format as wellChristian König2017-03-131-0/+1
| | | | | | Fixes: 62cff793785 ("gallium: add P016 format") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100180 Reviewed-by: Emil Velikov <[email protected]>
* svga: add a helper function to check for typeless formatCharmaine Lee2016-11-031-0/+31
| | | | | | | This patch adds a helper function svga_format_is_typeless() which returns TRUE if the specified format is typeless. Reviewed-by: Brian Paul <[email protected]>
* svga: don't special case caps for SVGA3D_R32_FLOATBrian Paul2016-09-231-6/+2
| | | | | | | This may have been needed years ago during development, but not now. Prevents some regressions after introducing the next patch. Reviewed-by: Charmaine Lee <[email protected]>
* svga: add const qualifier on svga_translate_format()Brian Paul2016-09-231-1/+1
| | | | Reviewed-by: Charmaine Lee <[email protected]>
* svga: add new svga_format_is_uncompressed_snorm() helperBrian Paul2016-06-301-0/+20
| | | | | Acked-by: Roland Scheidegger <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* svga: don't advertise support for R32G32B32_UINT/SINT surface formatsNeha Bhende2016-06-301-2/+2
| | | | | | | | | | | | | | | | | | We want to be able to copy between different 32-bit, 3-channel surface formats for GL_ARB_copy_image but since we don't support R32G32B32_FLOAT for textures (it's not blendable and wouldn't work for render to texture) we can't support 32-bit, 3-channel integer formats. The state tracker will choose 4-channel formats instead. Fixes the piglit arb_copy_image-format test for several cases. Note: This change may need to be revisited if/when the texture_view exension is enabled in driver. Reviewed-by: Brian Paul <[email protected]> Acked-by: Roland Scheidegger <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* Remove wrongly repeated words in commentsGiuseppe Bilotta2016-06-231-1/+1
| | | | | | | | | | | | | | | | | Clean up misrepetitions ('if if', 'the the' etc) found throughout the comments. This has been done manually, after grepping case-insensitively for duplicate if, is, the, then, do, for, an, plus a few other typos corrected in fly-by v2: * proper commit message and non-joke title; * replace two 'as is' followed by 'is' to 'as-is'. v3: * 'a integer' => 'an integer' and similar (originally spotted by Jason Ekstrand, I fixed a few other similar ones while at it) Signed-off-by: Giuseppe Bilotta <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* svga: s/Elements/ARRAY_SIZE/Brian Paul2016-04-251-10/+10
| | | | | | Standardize on the later macro rather than a mix of both. Reviewed-by: Charmaine Lee <[email protected]>
* svga: add DXGenMips command supportCharmaine Lee2016-01-141-23/+30
| | | | | | | | | | | | | For those formats that support hw mipmap generation, use the DXGenMips command. Otherwise fallback to the mipmap generation utility. Tested with piglit, OpenGL apps (Heaven, Turbine, Cinebench) v2: make sure the texture surface was created with the render target bind flag set relocation flag to SVGA_RELOC_WRITE for the texture surface Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* svga: Add ASTC formats to format table.Jose Fonseca2015-11-231-0/+28
| | | | | | Fixes build. Otherwise untested. Trivial.