mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
add videoout DCC
This commit is contained in:
@@ -300,7 +300,8 @@ void ValidateVideoOut(GraphicContext* ctx, const VideoOutInfo& info) {
|
|||||||
const auto compression =
|
const auto compression =
|
||||||
ClassifyVideoOutCompression(info.compression != VideoOutCompression::Uncompressed,
|
ClassifyVideoOutCompression(info.compression != VideoOutCompression::Uncompressed,
|
||||||
info.metadata_address, info.dcc_control, 0);
|
info.metadata_address, info.dcc_control, 0);
|
||||||
const bool metadata_invalid = compression == VideoOutCompression::Dcc256_64_64 &&
|
const bool metadata_invalid = compression != VideoOutCompression::Uncompressed &&
|
||||||
|
compression != VideoOutCompression::Unsupported &&
|
||||||
(info.metadata_address >= TRACKER_ADDRESS_SIZE ||
|
(info.metadata_address >= TRACKER_ADDRESS_SIZE ||
|
||||||
(info.metadata_address >= info.address &&
|
(info.metadata_address >= info.address &&
|
||||||
info.metadata_address < info.address + info.size));
|
info.metadata_address < info.address + info.size));
|
||||||
|
|||||||
@@ -225,7 +225,12 @@ FindGuestDepthFormatPolicy(uint32_t guest_format) noexcept {
|
|||||||
: info.format == policy->depth_attachment_format);
|
: info.format == policy->depth_attachment_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class VideoOutCompression : uint8_t { Uncompressed, Dcc256_64_64, Unsupported };
|
enum class VideoOutCompression : uint8_t {
|
||||||
|
Uncompressed,
|
||||||
|
Dcc256_256_0,
|
||||||
|
Dcc256_64_64,
|
||||||
|
Unsupported
|
||||||
|
};
|
||||||
|
|
||||||
struct VideoOutInfo {
|
struct VideoOutInfo {
|
||||||
uint64_t address = 0;
|
uint64_t address = 0;
|
||||||
@@ -246,22 +251,28 @@ struct VideoOutInfo {
|
|||||||
[[nodiscard]] inline VideoOutCompression
|
[[nodiscard]] inline VideoOutCompression
|
||||||
ClassifyVideoOutCompression(bool compressed, uint64_t metadata_address, uint32_t dcc_control,
|
ClassifyVideoOutCompression(bool compressed, uint64_t metadata_address, uint32_t dcc_control,
|
||||||
uint64_t dcc_clear_color) noexcept {
|
uint64_t dcc_clear_color) noexcept {
|
||||||
|
constexpr uint32_t VIDEO_OUT_DCC_CONTROL_256_256_0 = 0x00000048u;
|
||||||
constexpr uint32_t VIDEO_OUT_DCC_CONTROL_256_64_64 = 0x00000208u;
|
constexpr uint32_t VIDEO_OUT_DCC_CONTROL_256_64_64 = 0x00000208u;
|
||||||
if (!compressed) {
|
if (!compressed) {
|
||||||
return metadata_address == 0 && dcc_control == 0 && dcc_clear_color == 0
|
return metadata_address == 0 && dcc_control == 0 && dcc_clear_color == 0
|
||||||
? VideoOutCompression::Uncompressed
|
? VideoOutCompression::Uncompressed
|
||||||
: VideoOutCompression::Unsupported;
|
: VideoOutCompression::Unsupported;
|
||||||
}
|
}
|
||||||
return metadata_address != 0 && (metadata_address & 0xffu) == 0 &&
|
if (metadata_address == 0 || (metadata_address & 0xffu) != 0 || dcc_clear_color != 0) {
|
||||||
dcc_control == VIDEO_OUT_DCC_CONTROL_256_64_64 && dcc_clear_color == 0
|
return VideoOutCompression::Unsupported;
|
||||||
? VideoOutCompression::Dcc256_64_64
|
}
|
||||||
: VideoOutCompression::Unsupported;
|
switch (dcc_control) {
|
||||||
|
case VIDEO_OUT_DCC_CONTROL_256_256_0: return VideoOutCompression::Dcc256_256_0;
|
||||||
|
case VIDEO_OUT_DCC_CONTROL_256_64_64: return VideoOutCompression::Dcc256_64_64;
|
||||||
|
default: return VideoOutCompression::Unsupported;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline constexpr bool
|
[[nodiscard]] inline constexpr bool
|
||||||
CanUseVideoOutNativeWithoutUpload(VideoOutCompression compression, bool render_target,
|
CanUseVideoOutNativeWithoutUpload(VideoOutCompression compression, bool render_target,
|
||||||
bool gpu_modified, bool guest_modified) noexcept {
|
bool gpu_modified, bool guest_modified) noexcept {
|
||||||
return compression == VideoOutCompression::Dcc256_64_64 && !guest_modified &&
|
return compression != VideoOutCompression::Uncompressed &&
|
||||||
|
compression != VideoOutCompression::Unsupported && !guest_modified &&
|
||||||
(render_target || gpu_modified);
|
(render_target || gpu_modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11945,6 +11945,10 @@ void CheckImageOverlapResolution() {
|
|||||||
"host-backed fill aliased a sampled image on another page");
|
"host-backed fill aliased a sampled image on another page");
|
||||||
|
|
||||||
constexpr uint64_t video_metadata = 0x1020c10000ull;
|
constexpr uint64_t video_metadata = 0x1020c10000ull;
|
||||||
|
Require("ImageOverlapResolution", "video-out DCC 256/256/0",
|
||||||
|
ClassifyVideoOutCompression(true, video_metadata, 0x48u, 0) ==
|
||||||
|
VideoOutCompression::Dcc256_256_0,
|
||||||
|
"Prospero video-out DCC 256/256/0 mode was rejected");
|
||||||
Require("ImageOverlapResolution", "video-out DCC 256/64/64",
|
Require("ImageOverlapResolution", "video-out DCC 256/64/64",
|
||||||
ClassifyVideoOutCompression(true, video_metadata, 0x208u, 0) ==
|
ClassifyVideoOutCompression(true, video_metadata, 0x208u, 0) ==
|
||||||
VideoOutCompression::Dcc256_64_64,
|
VideoOutCompression::Dcc256_64_64,
|
||||||
@@ -11970,6 +11974,10 @@ void CheckImageOverlapResolution() {
|
|||||||
VideoOutCompression::Dcc256_64_64, false, true, false) &&
|
VideoOutCompression::Dcc256_64_64, false, true, false) &&
|
||||||
!CanUseVideoOutNativeWithoutUpload(
|
!CanUseVideoOutNativeWithoutUpload(
|
||||||
VideoOutCompression::Dcc256_64_64, false, false, false) &&
|
VideoOutCompression::Dcc256_64_64, false, false, false) &&
|
||||||
|
CanUseVideoOutNativeWithoutUpload(
|
||||||
|
VideoOutCompression::Dcc256_256_0, true, false, false) &&
|
||||||
|
!CanUseVideoOutNativeWithoutUpload(
|
||||||
|
VideoOutCompression::Dcc256_256_0, false, false, true) &&
|
||||||
!CanUseVideoOutNativeWithoutUpload(
|
!CanUseVideoOutNativeWithoutUpload(
|
||||||
VideoOutCompression::Dcc256_64_64, true, false, true) &&
|
VideoOutCompression::Dcc256_64_64, true, false, true) &&
|
||||||
!CanUseVideoOutNativeWithoutUpload(
|
!CanUseVideoOutNativeWithoutUpload(
|
||||||
|
|||||||
Reference in New Issue
Block a user