summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-04-08 10:19:47 +1000
committerDave Airlie <airlied@redhat.com>2011-04-08 10:19:47 +1000
commit7243348b5dea75ee4b66eed7830bdd9a7bc11c8c (patch)
treeef9c129966ebd3136039a146b9f3014f07daef2c
parente786dd37141c32ed8a75d1d4c75edd42d7c0c281 (diff)
imped: start screen section
this start with ChangeWindowAttributes
-rw-r--r--dix/Makefile.am1
-rw-r--r--dix/impedscrn.c31
-rw-r--r--fb/fb.h4
-rw-r--r--fb/fbgc.c1
-rw-r--r--fb/fbscreen.c4
-rw-r--r--fb/fbwindow.c36
-rw-r--r--include/gc.h1
-rw-r--r--include/imped.h9
-rw-r--r--include/scrnintstr.h3
9 files changed, 60 insertions, 30 deletions
diff --git a/dix/Makefile.am b/dix/Makefile.am
index 0a5f3fa9f..677936951 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -29,6 +29,7 @@ libdix_la_SOURCES = \
initatoms.c \
inpututils.c \
impedgc.c \
+ impedscrn.c \
pixmap.c \
privates.c \
property.c \
diff --git a/dix/impedscrn.c b/dix/impedscrn.c
new file mode 100644
index 000000000..9e9735889
--- /dev/null
+++ b/dix/impedscrn.c
@@ -0,0 +1,31 @@
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "windowstr.h"
+
+#include "imped.h"
+
+Bool
+impedChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ if (mask & CWBackPixmap)
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->PixmapWindowFixup)(&pWin->background.pixmap, pWin->drawable.bitsPerPixel);
+
+ if (mask & CWBorderPixmap)
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->PixmapWindowFixup)(&pWin->border.pixmap, pWin->drawable.bitsPerPixel);
+
+ return TRUE;
+}
+
+void
+impedScreenInit(ScreenPtr pScreen)
+{
+ pScreen->ChangeWindowAttributes = impedChangeWindowAttributes;
+}
diff --git a/fb/fb.h b/fb/fb.h
index c892c26cb..b0102641a 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2047,8 +2047,8 @@ fbCopyWindow(WindowPtr pWin,
DDXPointRec ptOldOrg,
RegionPtr prgnSrc);
-extern _X_EXPORT Bool
-fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
+extern _X_EXPORT void
+fbPixmapWindowFixup(PixmapPtr *ppPixmap, int bpp);
extern _X_EXPORT void
fbFillRegionSolid (DrawablePtr pDrawable,
diff --git a/fb/fbgc.c b/fb/fbgc.c
index 190a41896..6c39823ca 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include "fb.h"
+#include "imped.h"
const GCFuncs fbGCFuncs = {
fbValidateGC,
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index e265f8291..103a38574 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -25,6 +25,7 @@
#endif
#include "fb.h"
+#include "imped.h"
Bool
fbCloseScreen (int index, ScreenPtr pScreen)
@@ -112,7 +113,6 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->CreateWindow = fbCreateWindow;
pScreen->DestroyWindow = fbDestroyWindow;
pScreen->PositionWindow = fbPositionWindow;
- pScreen->ChangeWindowAttributes = fbChangeWindowAttributes;
pScreen->RealizeWindow = fbMapWindow;
pScreen->UnrealizeWindow = fbUnmapWindow;
pScreen->CopyWindow = fbCopyWindow;
@@ -136,6 +136,8 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->GetCopyAreaFunction = fbGetCopyAreaFunction;
pScreen->GetCopyPlaneFunction = fbGetCopyPlaneFunction;
+ pScreen->PixmapWindowFixup = fbPixmapWindowFixup;
+ impedScreenInit(pScreen);
return TRUE;
}
diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index 7906f8dd2..fea61343a 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -146,38 +146,22 @@ fbCopyWindow(WindowPtr pWin,
fbValidateDrawable (&pWin->drawable);
}
-static void
-fbFixupWindowPixmap(DrawablePtr pDrawable, PixmapPtr *ppPixmap)
+void
+fbPixmapWindowFixup(PixmapPtr *ppPixmap, int bpp)
{
PixmapPtr pPixmap = *ppPixmap;
- if (pPixmap->drawable.bitsPerPixel != pDrawable->bitsPerPixel)
+ if (pPixmap->drawable.bitsPerPixel != bpp)
{
- pPixmap = fb24_32ReformatTile (pPixmap, pDrawable->bitsPerPixel);
- if (!pPixmap)
- return;
- (*pDrawable->pScreen->DestroyPixmap) (*ppPixmap);
- *ppPixmap = pPixmap;
+ pPixmap = fb24_32ReformatTile (pPixmap, bpp);
+ if (!pPixmap)
+ return;
+ (*pPixmap->drawable.pScreen->DestroyPixmap) (*ppPixmap);
+ *ppPixmap = pPixmap;
}
if (FbEvenTile (pPixmap->drawable.width *
- pPixmap->drawable.bitsPerPixel))
- fbPadPixmap (pPixmap);
-}
-
-Bool
-fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
-{
- if (mask & CWBackPixmap)
- {
- if (pWin->backgroundState == BackgroundPixmap)
- fbFixupWindowPixmap(&pWin->drawable, &pWin->background.pixmap);
- }
- if (mask & CWBorderPixmap)
- {
- if (pWin->borderIsPixel == FALSE)
- fbFixupWindowPixmap(&pWin->drawable, &pWin->border.pixmap);
- }
- return TRUE;
+ pPixmap->drawable.bitsPerPixel))
+ fbPadPixmap (pPixmap);
}
void
diff --git a/include/gc.h b/include/gc.h
index e71393001..2079cfae0 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -160,5 +160,4 @@ extern _X_EXPORT GCPtr GetScratchGC(
extern _X_EXPORT void FreeScratchGC(
GCPtr /*pGC*/);
-extern _X_EXPORT void impedSetGCOps(GCPtr pGC);
#endif /* GC_H */
diff --git a/include/imped.h b/include/imped.h
new file mode 100644
index 000000000..f166d3f6a
--- /dev/null
+++ b/include/imped.h
@@ -0,0 +1,9 @@
+
+#ifndef IMPED_H
+#define IMPED_H
+
+extern _X_EXPORT void impedSetGCOps(GCPtr pGC);
+
+extern _X_EXPORT void impedScreenInit(ScreenPtr pScreen);
+
+#endif
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 4b31996de..7e9f36841 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -205,6 +205,8 @@ typedef miCopyProc (*GetCopyPlaneFunctionProcPtr)(
PixmapPtr pSrc,
PixmapPtr pDst, int bitplane);
+typedef void (* PixmapWindowFixupProcPtr)(PixmapPtr *ppPixmap, int bpp);
+
/* pixmap will exist only for the duration of the current rendering operation */
#define CREATE_PIXMAP_USAGE_SCRATCH 1
/* pixmap will be the backing pixmap for a redirected window */
@@ -553,6 +555,7 @@ typedef struct _Screen {
GetCopyAreaFunctionProcPtr GetCopyAreaFunction;
GetCopyPlaneFunctionProcPtr GetCopyPlaneFunction;
+ PixmapWindowFixupProcPtr PixmapWindowFixup;
/* set it in driver side if X server can copy the framebuffer content.
* Meant to be used together with '-background none' option, avoiding
* malicious users to steal framebuffer's content if that would be the