protonscr

SteamOS `pParam->pBGRA` in `onNeedsPaint(HTML_NeedsPaint_t *pParam)` results in black screen

steamclosed Distro Family: SteamOSWeb Component
ValveSoftware/steam-for-linux#9994 · opened 2023-08-17 by lmptg · updated 2023-10-07 · 4 comments · github
Llmptg 2023-08-17 github

Your system information

  • Steam client version (build number or date): 1691097434
  • Distribution (e.g. Ubuntu): SteamOS
  • Opted into Steam client beta?: No
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

NOTE
The issue is specific to SteamOS but only in "Gaming Mode" - it works in Desktop mode in fullscreen (via SDL_WINDOW_FULLSCREEN).

Rendering the data in pParam->pBGRA on SteamOS in Gaming Mode results in a black screen, the below
code works as intended on both Linux, Windows and in Desktop Mode, but not in Gaming Mode:

void BrowserView::onNeedsPaint(HTML_NeedsPaint_t *pParam) {
	tg_u32 paintWidth = pParam->unWide;
	tg_u32 paintHeight = pParam->unTall;
	if (paintWidth != mViewWidth) {
		SteamHTMLSurface()->SetSize(mBrowserHandle, mViewWidth, mViewHeight);
		return;
	}
	if (paintHeight != mViewHeight) {
		SteamHTMLSurface()->SetSize(mBrowserHandle, mViewWidth, mViewHeight);
		return;
	}

	if (mSurfaceTexture == nullptr) {
		mSurfaceTexture =
				SDL_CreateTexture(mSdlRenderer,
						SDL_PIXELFORMAT_BGRA32,
						SDL_TEXTUREACCESS_STREAMING, mViewWidth, mViewHeight);
		assert(mSurfaceTexture != nullptr);
	}

	unsigned char *textureData = nullptr;
	int texturePitch = 1;

	SDL_LockTexture(mSurfaceTexture, nullptr, (void **)&textureData,
									&texturePitch);
	size_t textureSize = static_cast<size_t>(mViewWidth * mViewHeight * 4);
	memcpy(textureData, pParam->pBGRA, textureSize);
	SDL_UnlockTexture(mSurfaceTexture);
}

Steps for reproducing this issue:

  1. Switch SteamOS to Gaming Mode
  2. Copy the pBGRA data to a an SDL2 Texture
  3. Let SDL2 render it as normal
  4. Black screen
Llmptg 2023-08-18 github

Turns out HTML_NeedsPaint_t *pParam dimensions is reported as size +1??
pParam->unWide // 1201
pParam->unTall // 801

TTTimo 2023-08-23 github

Hello @lmptg, thank you for your report. This will be fixed in next steam beta update (after 1692824614 that just shipped, the fix didn't make it in time).

Llmptg 2023-08-24 github

Awesome, thanks :heart:

Kkisak-valve maintainer 2023-10-07 github

Closing as fixed.

Launch options