Unverified Commit 4a9c1b94 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'Ionic-feature/composite-update' into 3.6.x

parents aba2a534 cad9f4ef
......@@ -29,7 +29,7 @@
#define COMPOSITE_NAME "Composite"
#define COMPOSITE_MAJOR 0
#define COMPOSITE_MINOR 2
#define COMPOSITE_MINOR 4
#define CompositeRedirectAutomatic 0
#define CompositeRedirectManual 1
......@@ -41,7 +41,11 @@
#define X_CompositeUnredirectSubwindows 4
#define X_CompositeCreateRegionFromBorderClip 5
#define X_CompositeNameWindowPixmap 6
#define X_CompositeGetOverlayWindow 7
#define X_CompositeReleaseOverlayWindow 8
#define CompositeNumberRequests (X_CompositeNameWindowPixmap + 1)
#define CompositeNumberRequests (X_CompositeReleaseOverlayWindow + 1)
#define CompositeNumberEvents 0
#endif /* _COMPOSITE_H_ */
......@@ -30,6 +30,7 @@
#define Window CARD32
#define Region CARD32
#define Pixmap CARD32
/*
* requests and replies
......@@ -129,7 +130,43 @@ typedef struct {
#define sz_xCompositeNameWindowPixmapReq 12
/* Version 0.3 additions */
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
} xCompositeGetOverlayWindowReq;
#define sz_xCompositeGetOverlayWindowReq sizeof(xCompositeGetOverlayWindowReq)
typedef struct {
BYTE type; /* X_Reply */
BYTE pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
Window overlayWin B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xCompositeGetOverlayWindowReply;
#define sz_xCompositeGetOverlayWindowReply sizeof(xCompositeGetOverlayWindowReply)
typedef struct {
CARD8 reqType;
CARD8 compositeReqType;
CARD16 length B16;
Window window B32;
} xCompositeReleaseOverlayWindowReq;
#define sz_xCompositeReleaseOverlayWindowReq sizeof(xCompositeReleaseOverlayWindowReq)
#undef Window
#undef Region
#undef Pixmap
#endif /* _COMPOSITEPROTO_H_ */
#include <Server.tmpl>
SRCS = compalloc.c compext.c compinit.c compwindow.c
SRCS = compalloc.c compext.c compinit.c compoverlay.c compwindow.c
OBJS = compalloc.o compext.o compinit.o compwindow.o
OBJS = compalloc.o compext.o compinit.o compoverlay.o compwindow.o
INCLUDES = -I../include -I../mi -I../Xext -I../render -I../xfixes \
-I../damageext -I../miext/damage -I$(EXTINCSRC) \
......@@ -11,6 +11,8 @@
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
DEFINES = -DNXAGENT_SERVER
NormalLibraryTarget(composite,$(OBJS))
NormalLibraryObjectRule()
LintLibraryTarget(composite,$(SRCS))
......
......@@ -51,6 +51,7 @@
#include "damageextint.h"
#include "xfixes.h"
#include <nx-X11/extensions/compositeproto.h>
#include "compositeext.h"
#include <assert.h>
/*
......@@ -58,6 +59,7 @@
#define COMPOSITE_DEBUG
*/
#define COMPOSITE_DEBUG
typedef struct _CompClientWindow {
struct _CompClientWindow *next;
......@@ -89,11 +91,19 @@ typedef struct _CompSubwindows {
#define COMP_INCLUDE_RGB24_VISUAL 0
#endif
#if COMP_INCLUDE_RGB24_VISUAL
#define NUM_COMP_ALTERNATE_VISUALS 2
#else
#define NUM_COMP_ALTERNATE_VISUALS 1
#endif
typedef struct _CompOverlayClientRec *CompOverlayClientPtr;
typedef struct _CompOverlayClientRec {
CompOverlayClientPtr pNext;
ClientPtr pClient;
ScreenPtr pScreen;
XID resource;
} CompOverlayClientRec;
typedef struct _CompImplicitRedirectException {
XID parentVisual;
XID winVisual;
} CompImplicitRedirectException;
typedef struct _CompScreen {
PositionWindowProcPtr PositionWindow;
......@@ -102,13 +112,21 @@ typedef struct _CompScreen {
DestroyWindowProcPtr DestroyWindow;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
PaintWindowProcPtr PaintWindowBackground;
ClipNotifyProcPtr ClipNotify;
/*
* Called from ConfigureWindow, these
* three track changes to the offscreen storage
* geometry
*/
/*
* Unsupported by our old Xserver infrastructure, replaced with direct calls to
* compReallocPixmap().
*/
/*
ConfigNotifyProcPtr ConfigNotify;
*/
MoveWindowProcPtr MoveWindow;
ResizeWindowProcPtr ResizeWindow;
ChangeBorderWidthProcPtr ChangeBorderWidth;
......@@ -122,30 +140,79 @@ typedef struct _CompScreen {
*/
InstallColormapProcPtr InstallColormap;
/*
* Fake backing store via automatic redirection
*/
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
ScreenBlockHandlerProcPtr BlockHandler;
CloseScreenProcPtr CloseScreen;
Bool damaged;
XID alternateVisuals[NUM_COMP_ALTERNATE_VISUALS];
Bool damaged;
int numAlternateVisuals;
VisualID *alternateVisuals;
int numImplicitRedirectExceptions;
CompImplicitRedirectException *implicitRedirectExceptions;
WindowPtr pOverlayWin;
Window overlayWid;
CompOverlayClientPtr pOverlayClients;
GetImageProcPtr GetImage;
GetSpansProcPtr GetSpans;
SourceValidateProcPtr SourceValidate;
} CompScreenRec, *CompScreenPtr;
extern int CompScreenPrivateIndex;
extern int CompWindowPrivateIndex;
extern int CompSubwindowsPrivateIndex;
#ifndef NXAGENT_SERVER
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
#define GetCompScreen(s) ((CompScreenPtr) ((s)->devPrivates[CompScreenPrivateIndex].ptr))
#define GetCompWindow(w) ((CompWindowPtr) ((w)->devPrivates[CompWindowPrivateIndex].ptr))
#define GetCompSubwindows(w) ((CompSubwindowsPtr) ((w)->devPrivates[CompSubwindowsPrivateIndex].ptr))
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
extern DevPrivateKeyRec CompWindowPrivateKeyRec;
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
#define GetCompScreen(s) ((CompScreenPtr) \
dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
#define GetCompWindow(w) ((CompWindowPtr) \
dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
#else /* !defined(NXAGENT_SERVER) */
extern int CompScreenPrivIndex;
extern int CompWindowPrivIndex;
extern int CompSubwindowsPrivIndex;
#define GetCompScreen(s) ((CompScreenPtr) (s)->devPrivates[CompScreenPrivIndex].ptr)
#define GetCompWindow(w) ((CompWindowPtr) (w)->devPrivates[CompWindowPrivIndex].ptr)
#define GetCompSubwindows(w) ((CompSubwindowsPtr) (w)->devPrivates[CompSubwindowsPrivIndex].ptr)
#endif /* !defined(NXAGENT_SERVER) */
extern RESTYPE CompositeClientWindowType;
extern RESTYPE CompositeClientSubwindowsType;
extern RESTYPE CompositeClientOverlayType;
/* Shim for less ifdefs within the actual code. */
#ifndef NXAGENT_SERVER
#define FAKE_DIX_SET_PRIVATE_IMPL(obj, privateKey, ptr_val) do { dixSetPrivate(&(obj)->devPrivates, privateKey, ptr_val); } while (0)
#define FAKE_DIX_SET_SCREEN_PRIVATE(pScreen, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pScreen, CompScreenPrivateKey, ptr_val)
#define FAKE_DIX_SET_WINDOW_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompWindowPrivateKey, ptr_val)
#define FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompSubwindowsPrivateKey, ptr_val)
#else /* !defined(NXAGENT_SERVER) */
#define FAKE_DIX_SET_PRIVATE_IMPL(obj, privIndex, ptr_val) do { (obj)->devPrivates[privIndex].ptr = (void *) (ptr_val); } while (0)
#define FAKE_DIX_SET_SCREEN_PRIVATE(pScreen, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pScreen, CompScreenPrivIndex, ptr_val)
#define FAKE_DIX_SET_WINDOW_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompWindowPrivIndex, ptr_val)
#define FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompSubwindowsPrivIndex, ptr_val)
#endif /* !defined(NXAGENT_SERVER) */
/*
* compalloc.c
*/
void
compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure);
Bool
compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
......@@ -174,25 +241,40 @@ Bool
compAllocPixmap (WindowPtr pWin);
void
compFreePixmap (WindowPtr pWin);
compSetParentPixmap(WindowPtr pWin);
void
compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
Bool
compReallocPixmap (WindowPtr pWin, int x, int y,
unsigned int w, unsigned int h, int bw);
/*
* compext.c
* compinit.c
*/
void
CompositeExtensionInit (void);
Bool
compScreenInit(ScreenPtr pScreen);
/*
* compinit.c
* compoverlay.c
*/
void
compFreeOverlayClient(CompOverlayClientPtr pOcToDel);
CompOverlayClientPtr
compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
CompOverlayClientPtr
compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient);
Bool
compScreenInit (ScreenPtr pScreen);
compCreateOverlayWindow(ScreenPtr pScreen);
void
compDestroyOverlayWindow(ScreenPtr pScreen);
/*
* compwindow.c
......@@ -205,6 +287,9 @@ compCheckTree (ScreenPtr pScreen);
#define compCheckTree(s)
#endif
PictFormatPtr
compWindowFormat (WindowPtr pWin);
void
compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap);
......@@ -220,8 +305,6 @@ compRealizeWindow (WindowPtr pWin);
Bool
compUnrealizeWindow (WindowPtr pWin);
void
compPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what);
void
compClipNotify (WindowPtr pWin, int dx, int dy);
......@@ -255,6 +338,25 @@ void
compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
compWindowUpdate (WindowPtr pWin);
compPaintChildrenToWindow(ScreenPtr pScreen, WindowPtr pWin);
WindowPtr
CompositeRealChildHead(WindowPtr pWin);
int
DeleteWindowNoInputDevices(void *value, XID wid);
/*
* Unsupported by our old Xserver infrastructure, replaced with direct calls to
* compReallocPixmap().
*/
/*
int
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
int bw, WindowPtr pSib);
*/
void PanoramiXCompositeInit(void);
void PanoramiXCompositeReset(void);
#endif /* _COMPINT_H_ */
/*
* Copyright © 2009 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _COMPOSITEEXT_H_
#define _COMPOSITEEXT_H_
#include "misc.h"
#include "scrnintstr.h"
extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen,
VisualID * vids,
int nVisuals);
extern _X_EXPORT Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
VisualID parentVisual,
VisualID winVisual);
extern _X_EXPORT RESTYPE CompositeClientWindowType;
#endif /* _COMPOSITEEXT_H_ */
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "compint.h"
#ifndef NXAGENT_SERVER
#include "xace.h"
#endif
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#endif
/*
* Delete the given overlay client list element from its screen list.
*/
void
compFreeOverlayClient(CompOverlayClientPtr pOcToDel)
{
ScreenPtr pScreen = pOcToDel->pScreen;
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr *pPrev, pOc;
for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) {
if (pOc == pOcToDel) {
*pPrev = pOc->pNext;
free(pOc);
break;
}
}
/* Destroy overlay window when there are no more clients using it */
if (cs->pOverlayClients == NULL)
compDestroyOverlayWindow(pScreen);
}
/*
* Return the client's first overlay client rec from the given screen
*/
CompOverlayClientPtr
compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
if (pOc->pClient == pClient)
return pOc;
return NULL;
}
/*
* Create an overlay client object for the given client
*/
CompOverlayClientPtr
compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient)
{
CompScreenPtr cs = GetCompScreen(pScreen);
CompOverlayClientPtr pOc;
pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
if (pOc == NULL)
return NULL;
pOc->pClient = pClient;
pOc->pScreen = pScreen;
pOc->resource = FakeClientID(pClient->index);
pOc->pNext = cs->pOverlayClients;
cs->pOverlayClients = pOc;
/*
* Create a resource for this element so it can be deleted
* when the client goes away.
*/
if (!AddResource(pOc->resource, CompositeClientOverlayType, (void *) pOc))
return NULL;
return pOc;
}
/*
* Create the overlay window and map it
*/
Bool
compCreateOverlayWindow(ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
WindowPtr pRoot = WindowTable[pScreen->myNum];
WindowPtr pWin;
XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
int result;
int w = pScreen->width;
int h = pScreen->height;
int x = 0, y = 0;
/* Unsupported by current architecture, disabled. */
#if 0
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
x = -pScreen->x;
y = -pScreen->y;
w = PanoramiXPixWidth;
h = PanoramiXPixHeight;
}
#endif
#endif
pWin = cs->pOverlayWin =
CreateWindow(cs->overlayWid, pRoot, x, y, w, h, 0,
InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
pRoot->drawable.depth,
serverClient, pScreen->rootVisual, &result);
if (pWin == NULL)
return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin))
return FALSE;
MapWindow(pWin, serverClient);
return TRUE;
}
/*
* Destroy the overlay window
*/
void
compDestroyOverlayWindow(ScreenPtr pScreen)
{
CompScreenPtr cs = GetCompScreen(pScreen);
cs->pOverlayWin = NullWindow;
FreeResource(cs->overlayWid, RT_NONE);
}
......@@ -2791,3 +2791,80 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
DEALLOCATE_LOCAL(pmaps);
return (found);
}
struct colormap_lookup_data {
ScreenPtr pScreen;
VisualPtr visuals;
};
static void
_colormap_find_resource(void *value, XID id, void *cdata)
{
struct colormap_lookup_data *cmap_data = cdata;
VisualPtr visuals = cmap_data->visuals;
ScreenPtr pScreen = cmap_data->pScreen;
ColormapPtr cmap = value;
int j;
if (pScreen != cmap->pScreen)
return;
j = cmap->pVisual - pScreen->visuals;
cmap->pVisual = &visuals[j];
}
/* something has realloced the visuals, instead of breaking
ABI fix it up here - glx and compsite did this wrong */
Bool
ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
{
struct colormap_lookup_data cdata;
int numVisuals;
VisualPtr visuals;
XID *vids, vid;
int first_new_vid, first_new_visual, i;
first_new_vid = depth->numVids;
first_new_visual = pScreen->numVisuals;
#if 0 /* !defined(NXAGENT_SERVER) */
vids = reallocarray(depth->vids, depth->numVids + new_visual_count,
sizeof(XID));
#else
vids = xrealloc(depth->vids, sizeof(XID) *
(depth->numVids + new_visual_count));
#endif
if (!vids)
return FALSE;
/* its realloced now no going back if we fail the next one */
depth->vids = vids;
numVisuals = pScreen->numVisuals + new_visual_count;
#if 0 /* !defined(NXAGENT_SERVER) */
visuals = reallocarray(pScreen->visuals, numVisuals, sizeof(VisualRec));
#else
visuals = xrealloc(pScreen->visuals, sizeof(VisualRec) * numVisuals);
#endif
if (!visuals) {
return FALSE;
}
cdata.visuals = visuals;
cdata.pScreen = pScreen;
FindClientResourcesByType(serverClient, RT_COLORMAP,
_colormap_find_resource, &cdata);
pScreen->visuals = visuals;
for (i = 0; i < new_visual_count; i++) {
vid = FakeClientID(0);
pScreen->visuals[first_new_visual + i].vid = vid;
vids[first_new_vid + i] = vid;
}
depth->numVids += new_visual_count;
pScreen->numVisuals += new_visual_count;
return TRUE;
}
......@@ -535,9 +535,21 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn,
RegionIntersect(Rgn, Rgn, &pWin->winSize);
}
static RealChildHeadProc realChildHeadProc = NULL;
void
RegisterRealChildHeadProc (RealChildHeadProc proc)
{
realChildHeadProc = proc;
}
WindowPtr
RealChildHead(register WindowPtr pWin)
{
if (realChildHeadProc) {
return realChildHeadProc (pWin);
}
if (!pWin->parent &&
(screenIsSaved == SCREEN_SAVER_ON) &&
(HasSaverWindow (pWin->drawable.pScreen->myNum)))
......
......@@ -33,7 +33,7 @@
#define COMPOSITE_NAME "Composite"
#define COMPOSITE_MAJOR 0
#define COMPOSITE_MINOR 2
#define COMPOSITE_MINOR 4
#define CompositeRedirectAutomatic 0
#define CompositeRedirectManual 1
......@@ -45,7 +45,11 @@
#define X_CompositeUnredirectSubwindows 4
#define X_CompositeCreateRegionFromBorderClip 5
#define X_CompositeNameWindowPixmap 6
#define X_CompositeGetOverlayWindow 7
#define X_CompositeReleaseOverlayWindow 8
#define CompositeNumberRequests (X_CompositeNameWindowPixmap + 1)
#define CompositeNumberRequests (X_CompositeReleaseOverlayWindow + 1)
#define CompositeNumberEvents 0
#endif /* _COMPOSITE_H_ */
......@@ -1800,6 +1800,99 @@ FreePictFormat (void * pPictFormat,
return Success;
}
/**
* ReduceCompositeOp is used to choose simpler ops for cases where alpha
* channels are always one and so math on the alpha channel per pixel becomes
* unnecessary. It may also avoid destination reads sometimes if apps aren't
* being careful to avoid these cases.
*/
static CARD8
ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst)
{
Bool no_src_alpha, no_dst_alpha;
no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) &&
PICT_FORMAT_A(pSrc->format) == 0 &&
pSrc->alphaMap == NULL &&
pMask == NULL;
no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) &&
PICT_FORMAT_A(pDst->format) == 0 &&
pDst->alphaMap == NULL;
/* TODO, maybe: Conjoint and Disjoint op reductions? */
/* Deal with simplifications where the source alpha is always 1. */
if (no_src_alpha)
{
switch (op) {
case PictOpOver:
op = PictOpSrc;
break;
case PictOpInReverse:
op = PictOpDst;
break;
case PictOpOutReverse:
op = PictOpClear;
break;
case PictOpAtop:
op = PictOpIn;
break;
case PictOpAtopReverse:
op = PictOpOverReverse;
break;
case PictOpXor:
op = PictOpOut;
break;
default:
break;
}
}
/* Deal with simplifications when the destination alpha is always 1 */
if (no_dst_alpha)
{
switch (op) {
case PictOpOverReverse:
op = PictOpDst;
break;
case PictOpIn:
op = PictOpSrc;
break;
case PictOpOut:
op = PictOpClear;
break;
case PictOpAtop:
op = PictOpOver;
break;
case PictOpXor:
op = PictOpOutReverse;
break;
default:
break;
}
}
/* Reduce some con/disjoint ops to the basic names. */
switch (op) {
case PictOpDisjointClear:
case PictOpConjointClear:
op = PictOpClear;
break;
case PictOpDisjointSrc:
case PictOpConjointSrc:
op = PictOpSrc;
break;
case PictOpDisjointDst:
case PictOpConjointDst:
op = PictOpDst;
break;
default:
break;
}
return op;
}
void
CompositePicture (CARD8 op,
PicturePtr pSrc,
......@@ -1820,6 +1913,11 @@ CompositePicture (CARD8 op,
if (pMask)
ValidatePicture (pMask);
ValidatePicture (pDst);
op = ReduceCompositeOp (op, pSrc, pMask, pDst);
if (op == PictOpDst)
return;
(*ps->Composite) (op,
pSrc,
pMask,
......
......@@ -717,6 +717,14 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn,
RegionIntersect(Rgn, Rgn, &pWin->winSize);
}
static RealChildHeadProc realChildHeadProc = NULL;
void
RegisterRealChildHeadProc (RealChildHeadProc proc)
{
realChildHeadProc = proc;
}
WindowPtr
RealChildHead(register WindowPtr pWin)
{
......
......@@ -181,4 +181,8 @@ extern int IsMapInstalled(
Colormap /*map*/,
WindowPtr /*pWin*/);
extern Bool ResizeVisualArray(ScreenPtr /* pScreen */ ,
int /* new_vis_count */ ,
DepthPtr /* depth */ );
#endif /* CMAP_H */
......@@ -102,6 +102,10 @@ extern void ClippedRegionFromBox(
int /*w*/,
int /*h*/);
typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin);
void RegisterRealChildHeadProc (RealChildHeadProc proc);
extern WindowPtr RealChildHead(
WindowPtr /*pWin*/);
......
......@@ -96,6 +96,33 @@ typedef struct _WindowOpt {
#define BackgroundPixel 2L
#define BackgroundPixmap 3L
/*
* The redirectDraw field can have one of three values:
*
* RedirectDrawNone
* A normal window; painted into the same pixmap as the parent
* and clipping parent and siblings to its geometry. These
* windows get a clip list equal to the intersection of their
* geometry with the parent geometry, minus the geometry
* of overlapping None and Clipped siblings.
* RedirectDrawAutomatic
* A redirected window which clips parent and sibling drawing.
* Contents for these windows are manage inside the server.
* These windows get an internal clip list equal to their
* geometry.
* RedirectDrawManual
* A redirected window which does not clip parent and sibling
* drawing; the window must be represented within the parent
* geometry by the client performing the redirection management.
* Contents for these windows are managed outside the server.
* These windows get an internal clip list equal to their
* geometry.
*/
#define RedirectDrawNone 0
#define RedirectDrawAutomatic 1
#define RedirectDrawManual 2
typedef struct _Window {
DrawableRec drawable;
WindowPtr parent; /* ancestor chain */
......@@ -138,7 +165,7 @@ typedef struct _Window {
unsigned srcBuffer:1; /* source buffer for rendering */
#endif
#ifdef COMPOSITE
unsigned redirectDraw:1; /* rendering is redirected from here */
unsigned redirectDraw:2; /* rendering is redirected from here */
#endif
DevUnion *devPrivates;
} WindowRec;
......
......@@ -1649,6 +1649,99 @@ FreePictFormat (void * pPictFormat,
return Success;
}
/**
* ReduceCompositeOp is used to choose simpler ops for cases where alpha
* channels are always one and so math on the alpha channel per pixel becomes
* unnecessary. It may also avoid destination reads sometimes if apps aren't
* being careful to avoid these cases.
*/
static CARD8
ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst)
{
Bool no_src_alpha, no_dst_alpha;
no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) &&
PICT_FORMAT_A(pSrc->format) == 0 &&
pSrc->alphaMap == NULL &&
pMask == NULL;
no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) &&
PICT_FORMAT_A(pDst->format) == 0 &&
pDst->alphaMap == NULL;
/* TODO, maybe: Conjoint and Disjoint op reductions? */
/* Deal with simplifications where the source alpha is always 1. */
if (no_src_alpha)
{
switch (op) {
case PictOpOver:
op = PictOpSrc;
break;
case PictOpInReverse:
op = PictOpDst;
break;
case PictOpOutReverse:
op = PictOpClear;
break;
case PictOpAtop:
op = PictOpIn;
break;
case PictOpAtopReverse:
op = PictOpOverReverse;
break;
case PictOpXor:
op = PictOpOut;
break;
default:
break;
}
}
/* Deal with simplifications when the destination alpha is always 1 */
if (no_dst_alpha)
{
switch (op) {
case PictOpOverReverse:
op = PictOpDst;
break;
case PictOpIn:
op = PictOpSrc;
break;
case PictOpOut:
op = PictOpClear;
break;
case PictOpAtop:
op = PictOpOver;
break;
case PictOpXor:
op = PictOpOutReverse;
break;
default:
break;
}
}
/* Reduce some con/disjoint ops to the basic names. */
switch (op) {
case PictOpDisjointClear:
case PictOpConjointClear:
op = PictOpClear;
break;
case PictOpDisjointSrc:
case PictOpConjointSrc:
op = PictOpSrc;
break;
case PictOpDisjointDst:
case PictOpConjointDst:
op = PictOpDst;
break;
default:
break;
}
return op;
}
void
CompositePicture (CARD8 op,
PicturePtr pSrc,
......@@ -1669,6 +1762,11 @@ CompositePicture (CARD8 op,
if (pMask)
ValidatePicture (pMask);
ValidatePicture (pDst);
op = ReduceCompositeOp (op, pSrc, pMask, pDst);
if (op == PictOpDst)
return;
(*ps->Composite) (op,
pSrc,
pMask,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment