Files
UXP-Jihad/widget/headless/GfxInfo.cpp
T
NotAlexNoyle 7d0d7544cd gpu compositor: kept rects all saved before any is written; WebGL off once the GPU path is given up
Review of the T-511/T-517 work. With the daemon's window move (flag 8) the kept rects were copied
one at a time, each saved and written before the next was read: a rect's old rows can be another's
new ones (two stacked sticky bars), which then got the other bar's pixels. All are saved first now,
then all written, as the in-place shift does.

jihad_offscreen_gpu_given_up() (the daemon calls it when it gives the GPU path up) and
jihad_gpu_compositor_on(), which WebGL's EGL choice and the headless GfxInfo now ask: a daemon that
fell back to the software path after a GPU stall made new WebGL contexts on the abandoned GPU. The
environment is left as it is (other threads read it).
2026-11-03 08:53:32 -05:00

89 lines
4.1 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GfxInfo.h"
#include "nsUnicharUtils.h"
#include <stdlib.h> // Jihad T-511: getenv
extern "C" bool jihad_gpu_compositor_on(); // Jihad T-511: widget/PuppetWidget.cpp (the GPU path on, not given up)
namespace mozilla {
namespace widget {
#ifdef DEBUG
NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
// No Direct2D / DirectWrite on a headless unix target.
nsresult GfxInfo::GetD2DEnabled(bool *aEnabled) { return NS_ERROR_FAILURE; }
nsresult GfxInfo::GetDWriteEnabled(bool *aEnabled) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetDWriteVersion(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetCleartypeParameters(nsAString&) { return NS_ERROR_FAILURE; }
// No adapter to describe in a headless build.
NS_IMETHODIMP GfxInfo::GetAdapterDescription(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDescription2(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDriver(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDriver2(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterVendorID(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterVendorID2(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDeviceID(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDeviceID2(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterSubsysID(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterSubsysID2(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterRAM(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterRAM2(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDriverVersion(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDriverVersion2(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDriverDate(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetAdapterDriverDate2(nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::GetIsGPU2Active(bool*) { return NS_ERROR_FAILURE; }
const nsTArray<GfxDriverInfo>&
GfxInfo::GetGfxDriverInfo()
{
// Empty blocklist: nothing to block, we always run software.
if (!mDriverInfo) {
mDriverInfo = new nsTArray<GfxDriverInfo>();
}
return *mDriverInfo;
}
nsresult
GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
int32_t *aStatus,
nsAString & aSuggestedDriverVersion,
const nsTArray<GfxDriverInfo>& aDriverInfo,
nsACString& aFailureId,
OperatingSystem* aOS /* = nullptr */)
{
NS_ENSURE_ARG_POINTER(aStatus);
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
aSuggestedDriverVersion.SetIsVoid(true);
if (aOS) {
*aOS = OperatingSystem::Linux;
}
// Jihad (T-511): on the GPU path (JIHAD_GPU_COMPOSITOR: the device's GPU through EGL, and the
// daemon has not given it up) WebGL's OpenGL context is allowed; UNKNOWN reads as blocklisted
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_OPENGL && jihad_gpu_compositor_on()) {
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
}
// Not blocklisted, not accelerated: leave the decision to the caller's
// software fallback.
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString&) { return NS_ERROR_FAILURE; }
NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t) { return NS_ERROR_FAILURE; }
#endif
} // namespace widget
} // namespace mozilla