Skip to content

Commit

Permalink
pal: Add support for VK_FORMAT_R16G16B16A16_UNORM swapchain buffers.
Browse files Browse the repository at this point in the history
Map VK_FORMAT_R16G16B16A16_UNORM to Linux DRM_FORMAT_XBGR16161616
for direct scanout and display.

This is supported by amdgpu-kms DisplayCore since Linux 5.TODO.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
  • Loading branch information
kleinerm committed Feb 23, 2021
1 parent e7714f1 commit a25d480
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/os/amdgpu/amdgpuDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ constexpr SwizzledFormat PresentableSwizzledFormat[] =
ChNumFormat::X10Y10Z10W2_Unorm,
{ ChannelSwizzle::X, ChannelSwizzle::Y, ChannelSwizzle::Z, ChannelSwizzle::W }
},
{
ChNumFormat::X16Y16Z16W16_Unorm,
{ ChannelSwizzle::X, ChannelSwizzle::Y, ChannelSwizzle::Z, ChannelSwizzle::W }
},
};

// 64 bpp formats are supported on more recent supported gpu's and amdgpu kms drivers:
Expand Down
8 changes: 8 additions & 0 deletions src/core/os/amdgpu/display/displayWindowSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ namespace Pal
namespace Amdgpu
{

#ifndef DRM_FORMAT_XBGR16161616
#define DRM_FORMAT_XBGR16161616 fourcc_code('X', 'B', '4', '8') /* [63:0] x:B:G:R 16:16:16:16 little endian */
#endif

// ====================================================================================================================a
// Convert PAL format to Wayland Drm format
static uint32 PalToDrmFormat(
Expand Down Expand Up @@ -70,6 +74,10 @@ static uint32 PalToDrmFormat(

break;

case ChNumFormat::X16Y16Z16W16_Unorm:
drmFormat = DRM_FORMAT_XBGR16161616;
break;

case ChNumFormat::X16Y16Z16W16_Float:
drmFormat = DRM_FORMAT_XBGR16161616F;
break;
Expand Down

0 comments on commit a25d480

Please sign in to comment.