Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use depth-24 visual as default, but create a XRGB8888 visual too
In commit c0bc3fb we tried to create a
depth 32 visual and set it as the default.

However, it is actually pScrn->depth that is the "default", since that
is what is used by armsoc when creating FBs for our scanout BOs
(see OMAPMapMem() for root window, and drmmode_update_scanouts() for the
drmmode_xf86crtc_resize() / per-crtc scanouts).

Instead, we can go back to using a default depth-24 visual for the
root window and scanouts.  Since they now agree, the drmSetCrtc when
switching from blit-to-flip (or vice versa) will see two FBs with the same
depth, and will just do a fb update instead of a full mode switch.

However, we still let armsoc provide a depth-32 visual so Mali can back
its "EGL Configs with alpha" with a depth-32 XRGB8888 visual instead
of letting the COMPOSITE extension create an "alternate depth-32 visual"
that would trigger implicit redirection.

For example es2gears speeds up from 210 to 250fps and fixes a translucent
background to the expected black.
The egl-sample app [0] even speeds up from around 45fps to 100fps
again also fixing an issue with a transparent background.
WebGL samples are now able to run smoothly as opposed to the original.
And finally the xserver load goes down from 65-100% to a nicer 25-50%.

Picked (and adapted) from the ChromeOS armsoc
commit ea37a0d8450f8e0f49be2f098f75713a10435426
  • Loading branch information
mmind authored and mripard committed Jun 14, 2016
1 parent 1110abc commit d8fc72b
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/armsoc_driver.c
Expand Up @@ -986,7 +986,6 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
xf86CrtcConfigPtr xf86_config;
int j;
const char *fbdev;
int depth;

TRACE_ENTER();

Expand All @@ -996,22 +995,14 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
goto fail;
}

/* We create a single visual with the depth set to the
* screen's bpp as otherwise XComposite will add an alternate
* visual and ARGB8888 windows will be implicitly redirected.
* The initial scanout buffer is created with the same depth
* to match the visual.
*/
depth = pScrn->bitsPerPixel;

/* Allocate initial scanout buffer.*/
DEBUG_MSG("allocating new scanout buffer: %dx%d %d %d",
pScrn->virtualX, pScrn->virtualY,
depth, pScrn->bitsPerPixel);
pScrn->bitsPerPixel, pScrn->bitsPerPixel);
assert(!pARMSOC->scanout);
/* Screen creates and takes a ref on the scanout bo */
pARMSOC->scanout = armsoc_bo_new_with_dim(pARMSOC->dev, pScrn->virtualX,
pScrn->virtualY, depth, pScrn->bitsPerPixel,
pScrn->virtualY, pScrn->bitsPerPixel, pScrn->bitsPerPixel,
ARMSOC_BO_SCANOUT);
if (!pARMSOC->scanout) {
ERROR_MSG("Cannot allocate scanout buffer\n");
Expand Down Expand Up @@ -1042,16 +1033,24 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
/* Reset the visual list. */
miClearVisualTypes();

if (!miSetVisualTypes(depth,
miGetDefaultVisualMask(depth),
if (!miSetVisualTypes(pScrn->depth,
miGetDefaultVisualMask(pScrn->depth),
pScrn->rgbBits, pScrn->defaultVisual)) {
ERROR_MSG(
"Cannot initialize the visual type for %d depth, %d bits per pixel!",
depth,
pScrn->depth,
pScrn->bitsPerPixel);
goto fail2;
}

/* Also add a 32-bit depth XRGB8888 visual */
if (!miSetVisualTypes(32, miGetDefaultVisualMask(pScrn->depth),
pScrn->rgbBits, pScrn->defaultVisual)) {
WARNING_MSG("Cannot initialize a depth-32 visual");
} else {
INFO_MSG("Initialized a depth-32 visual for XRGB8888");
}

if (!miSetPixmapDepths()) {
ERROR_MSG("Cannot initialize the pixmap depth!");
goto fail3;
Expand Down

0 comments on commit d8fc72b

Please sign in to comment.