mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-19 06:47:02 -04:00
Merge branch 'vk-shm-ycbcr2' into 'master'
Draft: render/vulkan: add support for shm YCbCr textures See merge request wlroots/wlroots!4143
This commit is contained in:
commit
d17418b8f1
3 changed files with 23 additions and 4 deletions
|
|
@ -158,12 +158,24 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
|
|||
.bytes_per_block = 8,
|
||||
.has_alpha = true,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_YUYV,
|
||||
.bytes_per_block = 4,
|
||||
.block_width = 2,
|
||||
.block_height = 1,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_YVYU,
|
||||
.bytes_per_block = 4,
|
||||
.block_width = 2,
|
||||
.block_height = 1,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_UYVY,
|
||||
.bytes_per_block = 4,
|
||||
.block_width = 2,
|
||||
.block_height = 1,
|
||||
},
|
||||
{
|
||||
.drm_format = DRM_FORMAT_VYUY,
|
||||
.bytes_per_block = 4,
|
||||
|
|
|
|||
|
|
@ -437,9 +437,13 @@ void vulkan_format_props_query(struct wlr_vk_device *dev,
|
|||
const struct wlr_pixel_format_info *format_info = drm_get_pixel_format_info(format->drm);
|
||||
|
||||
// non-dmabuf texture properties
|
||||
VkFormatFeatureFlags features = shm_tex_features;
|
||||
if (format->is_ycbcr) {
|
||||
features |= ycbcr_tex_features;
|
||||
}
|
||||
const char *shm_texture_status;
|
||||
if ((fmtp.formatProperties.optimalTilingFeatures & shm_tex_features) == shm_tex_features &&
|
||||
!format->is_ycbcr && format_info != NULL) {
|
||||
if ((fmtp.formatProperties.optimalTilingFeatures & features) == features &&
|
||||
format_info != NULL) {
|
||||
VkPhysicalDeviceImageFormatInfo2 fmti = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
|
||||
.type = VK_IMAGE_TYPE_2D,
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ static struct wlr_texture *vulkan_texture_from_pixels(
|
|||
|
||||
const struct wlr_vk_format_props *fmt =
|
||||
vulkan_format_props_from_drm(renderer->dev, drm_fmt);
|
||||
if (fmt == NULL || fmt->format.is_ycbcr) {
|
||||
if (fmt == NULL) {
|
||||
char *format_name = drmGetFormatName(drm_fmt);
|
||||
wlr_log(WLR_ERROR, "Unsupported pixel format %s (0x%08"PRIX32")",
|
||||
format_name, drm_fmt);
|
||||
|
|
@ -360,7 +360,10 @@ static struct wlr_texture *vulkan_texture_from_pixels(
|
|||
}
|
||||
|
||||
texture->format = &fmt->format;
|
||||
texture->pipeline_layout = &renderer->default_pipeline_layout;
|
||||
texture->pipeline_layout = vulkan_get_pipeline_layout(renderer, texture->format);
|
||||
if (texture->pipeline_layout == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
VkImageCreateInfo img_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue