render: fix ChangePicture when Xinerama is active (v2) (#49170)

ChangePicture takes wire XIDs, but didn't do any Xinerama translation,
which meant setting a clip pixmap or a separate alpha picture would
result in those elements pointing at the instance of the pixmap on
screen 0.  Which is, you know, bad.

v2: This one actually builds.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49170
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Adam Jackson 2014-11-17 15:28:58 -05:00 committed by Keith Packard
parent c299400168
commit 802932d112

View File

@ -41,6 +41,9 @@
#include "servermd.h" #include "servermd.h"
#include "picturestr.h" #include "picturestr.h"
#include "xace.h" #include "xace.h"
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#endif
DevPrivateKeyRec PictureScreenPrivateKeyRec; DevPrivateKeyRec PictureScreenPrivateKeyRec;
DevPrivateKeyRec PictureWindowPrivateKeyRec; DevPrivateKeyRec PictureWindowPrivateKeyRec;
@ -1007,6 +1010,38 @@ CreateConicalGradientPicture(Picture pid, xPointFixed * center, xFixed angle,
return pPicture; return pPicture;
} }
static int
cpAlphaMap(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode)
{
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
PanoramiXRes *res;
int err = dixLookupResourceByType((void **)&res, id, XRT_PICTURE,
client, mode);
if (err != Success)
return err;
id = res->info[screen->myNum].id;
}
#endif
return dixLookupResourceByType(result, id, PictureType, client, mode);
}
static int
cpClipMask(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode)
{
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
PanoramiXRes *res;
int err = dixLookupResourceByType((void **)&res, id, XRT_PIXMAP,
client, mode);
if (err != Success)
return err;
id = res->info[screen->myNum].id;
}
#endif
return dixLookupResourceByType(result, id, RT_PIXMAP, client, mode);
}
#define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val) #define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val)
#define NEXT_PTR(_type) ((_type) ulist++->ptr) #define NEXT_PTR(_type) ((_type) ulist++->ptr)
@ -1053,9 +1088,8 @@ ChangePicture(PicturePtr pPicture,
if (pid == None) if (pid == None)
pAlpha = 0; pAlpha = 0;
else { else {
error = dixLookupResourceByType((void **) &pAlpha, pid, error = cpAlphaMap((void **) &pAlpha, pid, pScreen,
PictureType, client, client, DixReadAccess);
DixReadAccess);
if (error != Success) { if (error != Success) {
client->errorValue = pid; client->errorValue = pid;
break; break;
@ -1112,9 +1146,8 @@ ChangePicture(PicturePtr pPicture,
} }
else { else {
clipType = CT_PIXMAP; clipType = CT_PIXMAP;
error = dixLookupResourceByType((void **) &pPixmap, pid, error = cpClipMask((void **) &pPixmap, pid, pScreen,
RT_PIXMAP, client, client, DixReadAccess);
DixReadAccess);
if (error != Success) { if (error != Success) {
client->errorValue = pid; client->errorValue = pid;
break; break;