[Xf86-video-armsoc] [PATCH 1/1] Removed 24 bit visual - we use 32 bit visuals for RGB888.
armsoc-bugs at arm.com
armsoc-bugs at arm.com
Tue May 27 07:06:08 PDT 2014
From: Dave Barnish <dave.barnish at arm.com>
Change-Id: Ie9464b9dd9bbe4c1f13bbb2e6a327f2424d4b937
---
src/armsoc_driver.c | 44 ++++++++++++++++++++++----------------------
src/armsoc_dumb.c | 6 ++++++
src/armsoc_dumb.h | 1 +
src/drmmode_display.c | 20 ++++++++++++++------
4 files changed, 43 insertions(+), 28 deletions(-)
diff --git a/src/armsoc_driver.c b/src/armsoc_driver.c
index 590352e..3181ed3 100644
--- a/src/armsoc_driver.c
+++ b/src/armsoc_driver.c
@@ -760,7 +760,7 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->monitor = pScrn->confScreen->monitor;
- /* Get the current depth, and set it for XFree86: */
+ /* Get the current color depth & bpp, and set it for XFree86: */
default_depth = 24; /* TODO: MIDEGL-1445: get from kernel */
fbbpp = 32; /* TODO: MIDEGL-1445: get from kernel */
@@ -880,7 +880,7 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
/* Let XFree86 calculate or get (from command line) the display DPI: */
xf86SetDpi(pScrn, 0, 0);
- /* Ensure we have a supported depth: */
+ /* Ensure we have a supported bitsPerPixel: */
switch (pScrn->bitsPerPixel) {
case 16:
case 24:
@@ -893,9 +893,7 @@ ARMSOCPreInit(ScrnInfoPtr pScrn, int flags)
goto fail2;
}
-
/* Load external sub-modules now: */
-
if (!(xf86LoadSubModule(pScrn, "dri2") &&
xf86LoadSubModule(pScrn, "exa") &&
xf86LoadSubModule(pScrn, "fb"))) {
@@ -952,6 +950,7 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
xf86CrtcConfigPtr xf86_config;
int j;
char *fbdev;
+ int depth;
TRACE_ENTER();
@@ -960,12 +959,22 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
ERROR_MSG("Cannot get DRM master: %s", strerror(errno));
goto fail;
}
- /* Allocate initial scanout buffer */
- DEBUG_MSG("allocating new scanout buffer: %dx%d",
- pScrn->virtualX, pScrn->virtualY);
+
+ /* 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);
assert(!pARMSOC->scanout);
pARMSOC->scanout = armsoc_bo_new_with_dim(pARMSOC->dev, pScrn->virtualX,
- pScrn->virtualY, pScrn->depth, pScrn->bitsPerPixel,
+ pScrn->virtualY, depth, pScrn->bitsPerPixel,
ARMSOC_BO_SCANOUT);
if (!pARMSOC->scanout) {
ERROR_MSG("Cannot allocate scanout buffer\n");
@@ -995,26 +1004,17 @@ ARMSOCScreenInit(SCREEN_INIT_ARGS_DECL)
/* Reset the visual list. */
miClearVisualTypes();
- if (!miSetVisualTypes(pScrn->bitsPerPixel,
- miGetDefaultVisualMask(pScrn->depth),
+
+ if (!miSetVisualTypes(depth,
+ miGetDefaultVisualMask(depth),
pScrn->rgbBits, pScrn->defaultVisual)) {
ERROR_MSG(
- "Cannot initialize the visual type for %d bits per pixel!",
+ "Cannot initialize the visual type for %d depth, %d bits per pixel!",
+ depth,
pScrn->bitsPerPixel);
goto fail2;
}
- if (pScrn->bitsPerPixel == 32 && pScrn->depth == 24) {
- /* Also add a 24 bit depth visual */
- if (!miSetVisualTypes(24, miGetDefaultVisualMask(pScrn->depth),
- pScrn->rgbBits, pScrn->defaultVisual)) {
- WARNING_MSG(
- "Cannot initialize a 24 depth visual for 32bpp");
- } else {
- INFO_MSG("Initialized a 24 depth visual for 32bpp");
- }
- }
-
if (!miSetPixmapDepths()) {
ERROR_MSG("Cannot initialize the pixmap depth!");
goto fail3;
diff --git a/src/armsoc_dumb.c b/src/armsoc_dumb.c
index 33f9b44..eee8904 100644
--- a/src/armsoc_dumb.c
+++ b/src/armsoc_dumb.c
@@ -266,6 +266,12 @@ uint32_t armsoc_bo_height(struct armsoc_bo *bo)
return bo->height;
}
+uint8_t armsoc_bo_depth(struct armsoc_bo *bo)
+{
+ assert(bo->refcnt > 0);
+ return bo->depth;
+}
+
uint32_t armsoc_bo_bpp(struct armsoc_bo *bo)
{
assert(bo->refcnt > 0);
diff --git a/src/armsoc_dumb.h b/src/armsoc_dumb.h
index c510c18..a299ccf 100644
--- a/src/armsoc_dumb.h
+++ b/src/armsoc_dumb.h
@@ -76,6 +76,7 @@ struct armsoc_bo *armsoc_bo_new_with_dim(struct armsoc_device *dev,
enum armsoc_buf_type buf_type);
uint32_t armsoc_bo_width(struct armsoc_bo *bo);
uint32_t armsoc_bo_height(struct armsoc_bo *bo);
+uint8_t armsoc_bo_depth(struct armsoc_bo *bo);
uint32_t armsoc_bo_bpp(struct armsoc_bo *bo);
uint32_t armsoc_bo_pitch(struct armsoc_bo *bo);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b9e59f1..27d5ab6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1430,22 +1430,30 @@ static Bool resize_scanout_bo(ScrnInfoPtr pScrn, int width, int height)
struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
ScreenPtr pScreen = pScrn->pScreen;
uint32_t pitch;
+ uint8_t depth, bpp;
TRACE_ENTER();
- DEBUG_MSG("Resize: %dx%d", width, height);
+
+ depth = armsoc_bo_depth(pARMSOC->scanout);
+ bpp = armsoc_bo_bpp(pARMSOC->scanout);
+ DEBUG_MSG("Resize: %dx%d %d,%d", width, height, depth, bpp );
+
+ /* We don't expect the depth and bpp to change for the screen
+ * assert this here as a check */
+ assert( depth == pScrn->bitsPerPixel );
+ assert( bpp == pScrn->bitsPerPixel );
pScrn->virtualX = width;
pScrn->virtualY = height;
- if ((width != armsoc_bo_width(pARMSOC->scanout))
- || (height != armsoc_bo_height(pARMSOC->scanout))
- || (pScrn->bitsPerPixel != armsoc_bo_bpp(pARMSOC->scanout))) {
+ if ((width != armsoc_bo_width(pARMSOC->scanout)) ||
+ (height != armsoc_bo_height(pARMSOC->scanout))) {
struct armsoc_bo *new_scanout;
/* allocate new scanout buffer */
new_scanout = armsoc_bo_new_with_dim(pARMSOC->dev,
width, height,
- pScrn->depth, pScrn->bitsPerPixel,
+ depth, bpp,
ARMSOC_BO_SCANOUT);
if (!new_scanout) {
/* Try to use the previous buffer if the new resolution
@@ -1521,7 +1529,7 @@ static Bool resize_scanout_bo(ScrnInfoPtr pScrn, int width, int height)
pScreen->ModifyPixmapHeader(rootPixmap,
pScrn->virtualX, pScrn->virtualY,
- pScrn->depth, pScrn->bitsPerPixel, pitch,
+ depth, bpp, pitch,
armsoc_bo_map(pARMSOC->scanout));
/* Bump the serial number to ensure that all existing DRI2
--
1.7.9.5
More information about the Xf86-video-armsoc
mailing list