Skip to content

BGRA resource emulation changes

Ryan Neph requested to merge ryanneph/virglrenderer:rn-bgra-fix-mr into master

As discussed in #221 (closed) (and somewhat in #216 (closed)), I've had a go at cleaning up the BGRA resource handling, particularly on GLES hosts, but also for externally-stored resource buffers on both GL and GLES hosts.

The first two commits are sufficient to restore color-correctness to QEMU with gl=es, when GBM allocation is disabled at compile-time. The next four commits are minor cleanups. The last three are my attempt at re-adding BGRA emulation, but only for the case of BGRA resources that use external storage (e.g. gbm or egl images), which applies to both GL and GLES hosts.

These changes restore QEMU on a GLES host to working condition, and also resolve several issues reported on our display stack in Chrome OS' VMs, where scanout framebuffers are GBM-allocated and shared with the host as dma-bufs.

AFAIK, these changes resolve all lingering issues and are passing the gitlab CI. Still, I've left the last three commits as WIP, because I may refine them a bit more on Monday after more testing on the Chrome OS side.


  • no longer manually swizzling bgra->rgba for externally-stored BGR* buffers.
  • force EGL image-backed BGRX resources to vrend_gbm_transfer, since they are 3bpp.
  • simplified/clarified swizzle determination logic in vrend_blit_int()
  • several minor changes
Edited by Ryan Neph

Merge request reports