mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-29 19:20:42 +02:00
vulkan/wsi: Don't open-code vk_format_get_blocksize()
We already have a standard helper to retrieve the texel block size from a VkFormat, let's use it instead of adding a new helper. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Suggested-by: Jason Ekstrand <jason.ekstrand@collabora.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12210>
This commit is contained in:
parent
7c1c6606d0
commit
32c2db1b25
2 changed files with 4 additions and 15 deletions
|
|
@ -58,7 +58,7 @@ wsi_entrypoints = custom_target(
|
|||
libvulkan_wsi = static_library(
|
||||
'vulkan_wsi',
|
||||
[files_vulkan_wsi, wsi_entrypoints],
|
||||
include_directories : [inc_include, inc_src],
|
||||
include_directories : [inc_include, inc_src, inc_gallium],
|
||||
dependencies : [
|
||||
vulkan_wsi_deps, dep_libdrm, dep_libudev, idep_vulkan_util_headers,
|
||||
idep_vulkan_runtime_headers, idep_xmlconfig,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "util/macros.h"
|
||||
#include "util/os_file.h"
|
||||
#include "util/xmlconfig.h"
|
||||
#include "vk_format.h"
|
||||
#include "vk_util.h"
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
|
||||
|
|
@ -114,18 +115,6 @@ select_memory_type(const struct wsi_device *wsi,
|
|||
unreachable("No memory type found");
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
vk_format_size(VkFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case VK_FORMAT_B8G8R8A8_UNORM:
|
||||
case VK_FORMAT_B8G8R8A8_SRGB:
|
||||
return 4;
|
||||
default:
|
||||
unreachable("Unknown WSI Format");
|
||||
}
|
||||
}
|
||||
|
||||
static const struct VkDrmFormatModifierPropertiesEXT *
|
||||
get_modifier_props(const struct wsi_image_info *info, uint64_t modifier)
|
||||
{
|
||||
|
|
@ -563,7 +552,7 @@ wsi_finish_create_prime_image(const struct wsi_swapchain *chain,
|
|||
struct VkBufferImageCopy buffer_image_copy = {
|
||||
.bufferOffset = 0,
|
||||
.bufferRowLength = info->linear_stride /
|
||||
vk_format_size(info->create.format),
|
||||
vk_format_get_blocksize(info->create.format),
|
||||
.bufferImageHeight = 0,
|
||||
.imageSubresource = {
|
||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
|
|
@ -603,7 +592,7 @@ wsi_configure_prime_image(UNUSED const struct wsi_swapchain *chain,
|
|||
info->wsi.prime_blit_src = true,
|
||||
info->prime_use_linear_modifier = use_modifier;
|
||||
|
||||
const uint32_t cpp = vk_format_size(info->create.format);
|
||||
const uint32_t cpp = vk_format_get_blocksize(info->create.format);
|
||||
info->linear_stride = ALIGN_POT(info->create.extent.width * cpp,
|
||||
WSI_PRIME_LINEAR_STRIDE_ALIGN);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue