зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1776800 - Let zero copy hardware decoded video to release on intel GPU on Windows r=jrmuizel,gfx-reviewers
Reuse decoder device also to release on intel GPU on Windows, since it is also necessary for zero copy hardware decoded video. Reuse decoder device handling is also updated as aligned to FEATURE_HW_DECODED_VIDEO_ZERO_COPY. Differential Revision: https://phabricator.services.mozilla.com/D150448
This commit is contained in:
Родитель
091dc0483c
Коммит
b15ea105d5
|
@ -44,7 +44,8 @@ namespace gfx {
|
|||
_(HW_DECODED_VIDEO_ZERO_COPY, Feature, "Hardware decoded video zero copy") \
|
||||
_(VP8_HW_DECODE, Feature, "VP8 hardware decoding") \
|
||||
_(VP9_HW_DECODE, Feature, "VP9 hardware decoding") \
|
||||
_(DMABUF_SURFACE_EXPORT, Feature, "WebGL DMABuf surface export")
|
||||
_(DMABUF_SURFACE_EXPORT, Feature, "WebGL DMABuf surface export") \
|
||||
_(REUSE_DECODER_DEVICE, Feature, "Reuse decoder device")
|
||||
/* Add new entries above this comment */
|
||||
|
||||
enum class Feature : uint32_t {
|
||||
|
|
|
@ -92,7 +92,8 @@ class gfxVarReceiver;
|
|||
_(UseVP8HwDecode, bool, false) \
|
||||
_(UseVP9HwDecode, bool, false) \
|
||||
_(HwDecodedVideoZeroCopy, bool, false) \
|
||||
_(UseDMABufSurfaceExport, bool, true)
|
||||
_(UseDMABufSurfaceExport, bool, true) \
|
||||
_(ReuseDecoderDevice, bool, false)
|
||||
|
||||
/* Add new entries above this line. */
|
||||
|
||||
|
|
|
@ -892,14 +892,11 @@ RefPtr<ID3D11Device> DeviceManagerDx::CreateDecoderDevice(
|
|||
}
|
||||
|
||||
bool reuseDevice = false;
|
||||
if (StaticPrefs::gfx_direct3d11_reuse_decoder_device() < 0) {
|
||||
// Use the default logic, which is to allow reuse of devices on AMD, but
|
||||
// create separate devices everywhere else.
|
||||
if (isAMD) {
|
||||
reuseDevice = true;
|
||||
}
|
||||
} else if (StaticPrefs::gfx_direct3d11_reuse_decoder_device() > 0) {
|
||||
if (gfxVars::ReuseDecoderDevice()) {
|
||||
reuseDevice = true;
|
||||
} else if (isAMD) {
|
||||
reuseDevice = true;
|
||||
gfxCriticalNoteOnce << "Always have to reuse decoder device on AMD";
|
||||
}
|
||||
|
||||
if (reuseDevice) {
|
||||
|
|
|
@ -2692,6 +2692,43 @@ void gfxPlatform::InitWebRenderConfig() {
|
|||
gfxVars::SetHwDecodedVideoZeroCopy(true);
|
||||
}
|
||||
|
||||
bool reuseDecoderDevice = false;
|
||||
if (StaticPrefs::gfx_direct3d11_reuse_decoder_device_AtStartup()) {
|
||||
reuseDecoderDevice = true;
|
||||
|
||||
if (reuseDecoderDevice &&
|
||||
!StaticPrefs::
|
||||
gfx_direct3d11_reuse_decoder_device_force_enabled_AtStartup()) {
|
||||
nsCString failureId;
|
||||
int32_t status;
|
||||
const nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service();
|
||||
if (NS_FAILED(gfxInfo->GetFeatureStatus(
|
||||
nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE, failureId, &status))) {
|
||||
FeatureState& feature =
|
||||
gfxConfig::GetFeature(Feature::REUSE_DECODER_DEVICE);
|
||||
feature.DisableByDefault(FeatureStatus::BlockedNoGfxInfo,
|
||||
"gfxInfo is broken",
|
||||
"FEATURE_FAILURE_WR_NO_GFX_INFO"_ns);
|
||||
reuseDecoderDevice = false;
|
||||
} else {
|
||||
if (status != nsIGfxInfo::FEATURE_ALLOW_ALWAYS) {
|
||||
FeatureState& feature =
|
||||
gfxConfig::GetFeature(Feature::REUSE_DECODER_DEVICE);
|
||||
feature.DisableByDefault(FeatureStatus::Blocked,
|
||||
"Blocklisted by gfxInfo", failureId);
|
||||
reuseDecoderDevice = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reuseDecoderDevice) {
|
||||
FeatureState& feature =
|
||||
gfxConfig::GetFeature(Feature::REUSE_DECODER_DEVICE);
|
||||
feature.EnableByDefault();
|
||||
gfxVars::SetReuseDecoderDevice(true);
|
||||
}
|
||||
|
||||
if (Preferences::GetBool("gfx.webrender.flip-sequential", false)) {
|
||||
if (UseWebRender() && gfxVars::UseWebRenderANGLE()) {
|
||||
gfxVars::SetUseWebRenderFlipSequentialWin(true);
|
||||
|
|
|
@ -5452,13 +5452,14 @@
|
|||
mirror: always
|
||||
|
||||
- name: gfx.direct3d11.reuse-decoder-device
|
||||
type: RelaxedAtomicInt32
|
||||
#if defined(EARLY_BETA_OR_EARLIER)
|
||||
value: 1
|
||||
#else
|
||||
value: -1
|
||||
#endif
|
||||
mirror: always
|
||||
type: bool
|
||||
value: true
|
||||
mirror: once
|
||||
# Enable reuse decoder device even when it is blocked.
|
||||
- name: gfx.direct3d11.reuse-decoder-device-force-enabled
|
||||
type: bool
|
||||
value: false
|
||||
mirror: once
|
||||
|
||||
- name: gfx.direct3d11.allow-keyed-mutex
|
||||
type: RelaxedAtomicBool
|
||||
|
|
|
@ -257,6 +257,9 @@ static const char* GetPrefNameForFeature(int32_t aFeature) {
|
|||
case nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT:
|
||||
name = BLOCKLIST_PREF_BRANCH "dmabuf.surface-export";
|
||||
break;
|
||||
case nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE:
|
||||
name = BLOCKLIST_PREF_BRANCH "reuse-decoder-device";
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
|
||||
break;
|
||||
|
@ -519,6 +522,9 @@ static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) {
|
|||
if (aFeature.EqualsLiteral("HW_DECODED_VIDEO_ZERO_COPY")) {
|
||||
return nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY;
|
||||
}
|
||||
if (aFeature.EqualsLiteral("REUSE_DECODER_DEVICE")) {
|
||||
return nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE;
|
||||
}
|
||||
if (aFeature.EqualsLiteral("WEBRENDER_PARTIAL_PRESENT")) {
|
||||
return nsIGfxInfo::FEATURE_WEBRENDER_PARTIAL_PRESENT;
|
||||
}
|
||||
|
@ -1258,7 +1264,8 @@ bool GfxInfoBase::DoesDriverVendorMatch(const nsAString& aBlocklistVendor,
|
|||
bool GfxInfoBase::IsFeatureAllowlisted(int32_t aFeature) const {
|
||||
return aFeature == nsIGfxInfo::FEATURE_WEBRENDER ||
|
||||
aFeature == nsIGfxInfo::FEATURE_VIDEO_OVERLAY ||
|
||||
aFeature == nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY;
|
||||
aFeature == nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY ||
|
||||
aFeature == nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE;
|
||||
}
|
||||
|
||||
nsresult GfxInfoBase::GetFeatureStatusImpl(
|
||||
|
@ -1402,6 +1409,7 @@ void GfxInfoBase::EvaluateDownloadedBlocklist(
|
|||
nsIGfxInfo::FEATURE_WEBGPU,
|
||||
nsIGfxInfo::FEATURE_VIDEO_OVERLAY,
|
||||
nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
|
||||
nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
|
||||
nsIGfxInfo::FEATURE_WEBRENDER_PARTIAL_PRESENT,
|
||||
0};
|
||||
|
||||
|
|
|
@ -178,8 +178,10 @@ interface nsIGfxInfo : nsISupports
|
|||
const long FEATURE_HW_DECODED_VIDEO_ZERO_COPY = 40;
|
||||
/* Whether DMABUF export is supported, starting in 103. */
|
||||
const long FEATURE_DMABUF_SURFACE_EXPORT = 41;
|
||||
/* Whether reuse decoder device is supported, starting in 104. */
|
||||
const long FEATURE_REUSE_DECODER_DEVICE = 42;
|
||||
/* the maximum feature value. */
|
||||
const long FEATURE_MAX_VALUE = FEATURE_HW_DECODED_VIDEO_ZERO_COPY;
|
||||
const long FEATURE_MAX_VALUE = FEATURE_REUSE_DECODER_DEVICE;
|
||||
|
||||
/*
|
||||
* A set of return values from GetFeatureStatus
|
||||
|
|
|
@ -1797,6 +1797,34 @@ const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
|
|||
nsIGfxInfo::FEATURE_ALLOW_ALWAYS,
|
||||
DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0),
|
||||
"FEATURE_ROLLOUT_ALL");
|
||||
#else
|
||||
APPEND_TO_DRIVER_BLOCKLIST2(
|
||||
OperatingSystem::Windows, DeviceFamily::IntelAll,
|
||||
nsIGfxInfo::FEATURE_HW_DECODED_VIDEO_ZERO_COPY,
|
||||
nsIGfxInfo::FEATURE_ALLOW_ALWAYS, DRIVER_COMPARISON_IGNORED,
|
||||
V(0, 0, 0, 0), "FEATURE_ROLLOUT_ALL");
|
||||
#endif
|
||||
|
||||
////////////////////////////////////
|
||||
// FEATURE_REUSE_DECODER_DEVICE - ALLOWLIST
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows, DeviceFamily::All,
|
||||
nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
|
||||
nsIGfxInfo::FEATURE_ALLOW_ALWAYS,
|
||||
DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0),
|
||||
"FEATURE_ROLLOUT_ALL");
|
||||
#else
|
||||
APPEND_TO_DRIVER_BLOCKLIST2(
|
||||
OperatingSystem::Windows, DeviceFamily::IntelAll,
|
||||
nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
|
||||
nsIGfxInfo::FEATURE_ALLOW_ALWAYS, DRIVER_COMPARISON_IGNORED,
|
||||
V(0, 0, 0, 0), "FEATURE_ROLLOUT_INTEL");
|
||||
// ATI/AMD always requires reuse decoder device.
|
||||
APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Windows, DeviceFamily::AtiAll,
|
||||
nsIGfxInfo::FEATURE_REUSE_DECODER_DEVICE,
|
||||
nsIGfxInfo::FEATURE_ALLOW_ALWAYS,
|
||||
DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0),
|
||||
"FEATURE_ROLLOUT_INTEL");
|
||||
#endif
|
||||
|
||||
////////////////////////////////////
|
||||
|
|
Загрузка…
Ссылка в новой задаче