venus: use linear modifier for legacy common wsi path
Towards the renderer, venus better uses VK_EXT_image_drm_format_modifier to force linear with tiling modifier and mod_linear. Doing so won't make any difference on the mesa implementations we care about given we have required VK_EXT_image_drm_format_modifier for wsi support. A lucky side effect of this is to allow common wsi to work with host implementations not supporting dma_buf export. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15993>
This commit is contained in:
parent
09cee71e80
commit
31727f114a
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "vn_wsi.h"
|
||||
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
#include "vk_enum_to_str.h"
|
||||
#include "wsi_common_entrypoints.h"
|
||||
|
||||
|
@ -110,17 +111,29 @@ vn_wsi_create_image(struct vn_device *dev,
|
|||
struct vn_image **out_img)
|
||||
{
|
||||
/* TODO This is the legacy path used by wsi_create_native_image when there
|
||||
* is no modifier support. Instead of forcing VK_IMAGE_TILING_LINEAR, we
|
||||
* should ask wsi to use wsi_create_prime_image instead.
|
||||
* is no modifier support. Instead of forcing linear tiling, we should ask
|
||||
* wsi to use wsi_create_prime_image instead.
|
||||
*
|
||||
* In fact, this is not enough when the image is truely used for scanout by
|
||||
* the host compositor. There can be requirements we fail to meet. We
|
||||
* should require modifier support at some point.
|
||||
*/
|
||||
const uint64_t modifier = DRM_FORMAT_MOD_LINEAR;
|
||||
const VkImageDrmFormatModifierListCreateInfoEXT mod_list_info = {
|
||||
.sType =
|
||||
VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT,
|
||||
.pNext = create_info->pNext,
|
||||
.drmFormatModifierCount = 1,
|
||||
.pDrmFormatModifiers = &modifier,
|
||||
};
|
||||
VkImageCreateInfo local_create_info;
|
||||
if (wsi_info->scanout) {
|
||||
assert(!vk_find_struct_const(
|
||||
create_info->pNext, IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT));
|
||||
|
||||
local_create_info = *create_info;
|
||||
local_create_info.tiling = VK_IMAGE_TILING_LINEAR;
|
||||
local_create_info.pNext = &mod_list_info;
|
||||
local_create_info.tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
|
||||
create_info = &local_create_info;
|
||||
|
||||
if (VN_DEBUG(WSI))
|
||||
|
|
Loading…
Reference in New Issue