summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-02-23 11:15:36 -0800
committerKeith Packard <keithp@keithp.com>2011-02-23 11:15:36 -0800
commit0541ab1646b2b4734e1707df1d3d01896aef2706 (patch)
tree83181389bcffc6d26156afdacdce8d2aa6c1483c
parent8988f765d2b9f770a15b4f330ad8a8a9629df12f (diff)
randr: Pass pixmap positions through full randr API stackrandr-fixes
Pixmap and screen positions are separate and need to be passed through the api seperately. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--hw/xfree86/modes/xf86Crtc.c24
-rw-r--r--hw/xfree86/modes/xf86Crtc.h5
-rw-r--r--hw/xfree86/modes/xf86RandR12.c25
-rw-r--r--randr/mirrcrtc.c14
-rw-r--r--randr/randr.c25
-rw-r--r--randr/randrstr.h39
-rw-r--r--randr/rrcrtc.c128
-rw-r--r--randr/rrinfo.c2
-rw-r--r--randr/rrpixmap.c16
-rw-r--r--randr/rrscreen.c4
10 files changed, 244 insertions, 38 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index b5e9dc26f..df3893d01 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -273,10 +273,13 @@ xf86CrtcSet(xf86CrtcPtr crtc, xf86CrtcSetRec *set)
DisplayModePtr adjusted_mode = NULL;
DisplayModeRec saved_mode;
int saved_x, saved_y;
+ int saved_pixmap_x, saved_pixmap_y;
Rotation saved_rotation;
RRTransformRec saved_transform;
Bool saved_transform_present;
PixmapPtr saved_scanout_pixmap;
+ int origin_x, origin_y;
+ Bool origin_only;
crtc->enabled = xf86CrtcInUse (crtc);
@@ -295,6 +298,8 @@ xf86CrtcSet(xf86CrtcPtr crtc, xf86CrtcSetRec *set)
saved_mode = crtc->mode;
saved_x = crtc->x;
saved_y = crtc->y;
+ saved_pixmap_x = crtc->pixmap_x;
+ saved_pixmap_y = crtc->pixmap_y;
saved_rotation = crtc->rotation;
saved_scanout_pixmap = crtc->scanoutPixmap;
if (crtc->transformPresent) {
@@ -312,11 +317,24 @@ xf86CrtcSet(xf86CrtcPtr crtc, xf86CrtcSetRec *set)
crtc->x = set->x;
crtc->y = set->y;
}
+ if (set->flags & XF86CrtcSetPixmapOrigin) {
+ crtc->pixmap_x = set->pixmap_x;
+ crtc->pixmap_y = set->pixmap_y;
+ }
if (set->flags & XF86CrtcSetRotation)
crtc->rotation = set->rotation;
if (set->flags & XF86CrtcSetScanoutPixmap)
crtc->scanoutPixmap = set->scanout_pixmap;
+ if (crtc->scanoutPixmap) {
+ origin_only = (set->flags == XF86CrtcSetPixmapOrigin);
+ origin_x = crtc->pixmap_x;
+ origin_y = crtc->pixmap_y;
+ } else {
+ origin_only = (set->flags == XF86CrtcSetOrigin);
+ origin_x = crtc->x;
+ origin_y = crtc->y;
+ }
if (set->flags & XF86CrtcSetTransform) {
if (set->transform) {
RRTransformCopy (&crtc->transform, set->transform);
@@ -330,17 +348,17 @@ xf86CrtcSet(xf86CrtcPtr crtc, xf86CrtcSetRec *set)
goto done;
}
- if (set->flags == XF86CrtcSetOrigin && crtc->funcs->set_origin) {
+ if (origin_only && crtc->funcs->set_origin) {
ret = xf86CrtcRotate(crtc);
if (ret)
- crtc->funcs->set_origin(crtc, crtc->x, crtc->y);
+ crtc->funcs->set_origin(crtc, origin_x, origin_y);
goto done;
}
if (crtc->funcs->set_mode_major) {
ret = crtc->funcs->set_mode_major(crtc, &crtc->mode,
crtc->rotation,
- crtc->x, crtc->y);
+ origin_x, origin_y);
goto done;
}
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 9a520fc4d..5ed517a3f 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -80,6 +80,7 @@ typedef enum _xf86CrtcSetFlags {
XF86CrtcSetRotation = 16, /* rotation */
XF86CrtcSetProperty = 32, /* output property */
XF86CrtcSetScanoutPixmap = 64, /* scanout pixmap */
+ XF86CrtcSetPixmapOrigin = 128, /* scanout pixmap x/y */
} xf86CrtcSetFlags;
typedef struct _xf86CrtcSet {
@@ -89,6 +90,7 @@ typedef struct _xf86CrtcSet {
RRTransformPtr transform;
int x, y;
PixmapPtr scanout_pixmap;
+ int pixmap_x, pixmap_y;
} xf86CrtcSetRec;
typedef struct _xf86CrtcFuncs {
@@ -404,6 +406,9 @@ struct _xf86Crtc {
/* The user-specified portion of the cursor to hardware transform */
struct pixman_f_transform user_sprite_image_transform;
+
+ /* Location within scanout pixmap (if separate) */
+ int pixmap_x, pixmap_y;
};
typedef struct _xf86OutputFuncs {
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 407bf3567..f7794f4c5 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1128,7 +1128,8 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
rotation,
crtc->transformPresent ? &crtc->transform : NULL,
- numOutputs, randr_outputs, crtc->scanoutPixmap);
+ numOutputs, randr_outputs, crtc->scanoutPixmap,
+ crtc->pixmap_x, crtc->pixmap_y);
free(randr_outputs);
return ret;
}
@@ -1172,7 +1173,9 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
Rotation rotation,
int num_randr_outputs,
RROutputPtr *randr_outputs,
- PixmapPtr scanout_pixmap)
+ PixmapPtr scanout_pixmap,
+ int pixmap_x,
+ int pixmap_y)
{
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -1183,6 +1186,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
int o, ro;
xf86CrtcPtr *save_crtcs;
Bool save_enabled = crtc->enabled;
+ int driver_x, driver_y;
if (!crtc->scrn->vtSema)
return FALSE;
@@ -1206,8 +1210,17 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
if (scanout_pixmap != crtc->scanoutPixmap)
flags |= XF86CrtcSetScanoutPixmap;
- if (x != crtc->x || y != crtc->y)
- flags |= XF86CrtcSetOrigin;
+ if (scanout_pixmap) {
+ driver_x = pixmap_x;
+ driver_y = pixmap_y;
+ if (pixmap_x != crtc->pixmap_x || pixmap_y != crtc->pixmap_y)
+ flags |= XF86CrtcSetOrigin;
+ } else {
+ driver_x = x;
+ driver_y = y;
+ if (x != crtc->x || y != crtc->y)
+ flags |= XF86CrtcSetOrigin;
+ }
for (o = 0; o < config->num_output; o++)
{
xf86OutputPtr output = config->output[o];
@@ -1250,8 +1263,8 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
set.mode = &mode;
set.rotation = rotation;
set.transform = transform;
- set.x = x;
- set.y = y;
+ set.x = driver_x;
+ set.y = driver_y;
set.scanout_pixmap = scanout_pixmap;
set.flags = flags;
if (!xf86CrtcSet(crtc, &set))
diff --git a/randr/mirrcrtc.c b/randr/mirrcrtc.c
index a9ee6b445..d8bde3414 100644
--- a/randr/mirrcrtc.c
+++ b/randr/mirrcrtc.c
@@ -51,20 +51,16 @@ miRRSetScreenConfig(ScreenPtr screen,
Bool
miRRSetCrtcConfig(RRCrtcConfigPtr crtc_config)
{
- int x = crtc_config->x, y = crtc_config->y;
-
- if (crtc_config->pixmap) {
- x = crtc_config->pixmap_x;
- y = crtc_config->pixmap_y;
- }
if (!RRCrtcSet(crtc_config->crtc,
crtc_config->mode,
- x,
- y,
+ crtc_config->x,
+ crtc_config->y,
crtc_config->rotation,
crtc_config->numOutputs,
crtc_config->outputs,
- crtc_config->pixmap))
+ crtc_config->pixmap,
+ crtc_config->pixmap_x,
+ crtc_config->pixmap_y))
return FALSE;
RRCrtcSpriteTransformSet(crtc_config->crtc,
&crtc_config->sprite_position_transform,
diff --git a/randr/randr.c b/randr/randr.c
index c22657ee2..836dde0b3 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -58,6 +58,8 @@ DevPrivateKeyRec RRClientPrivateKeyRec;
DevPrivateKeyRec rrPrivKeyRec;
+RESTYPE RRPixmapType;
+
static void
RRClientCallback (CallbackListPtr *list,
pointer closure,
@@ -326,6 +328,26 @@ RRFreeEvents (pointer data, XID id)
return 1;
}
+/*ARGSUSED*/
+static int
+RRFreePixmap (pointer data, XID id)
+{
+ RRPixmapPtr rr_pixmap = (RRPixmapPtr) data;
+ PixmapPtr pixmap = rr_pixmap->pixmap;
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ rrScrPrivPtr scr_priv = rrGetScrPriv(screen);
+ int c;
+
+ for (c = 0; c < scr_priv->numCrtcs; c++) {
+ RRCrtcPtr crtc = scr_priv->crtcs[c];
+
+ if (crtc->scanoutPixmap == pixmap)
+ RRCrtcLostPixmap(crtc);
+ }
+ free(data);
+ return 1;
+}
+
void
RRExtensionInit (void)
{
@@ -346,6 +368,9 @@ RRExtensionInit (void)
RREventType = CreateNewResourceType(RRFreeEvents, "RandREvent");
if (!RREventType)
return;
+ RRPixmapType = CreateNewResourceType(RRFreePixmap, "RandRPixmap");
+ if (!RRPixmapType)
+ return;
extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
ProcRRDispatch, SProcRRDispatch,
NULL, StandardMinorOpcode);
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 7c553f21f..10dd46d46 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -81,6 +81,7 @@ typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
typedef struct _rrScreenConfig RRScreenConfigRec, *RRScreenConfigPtr;
typedef struct _rrCrtcConfig RRCrtcConfigRec, *RRCrtcConfigPtr;
typedef struct _rrOutput RROutputRec, *RROutputPtr;
+typedef struct _rrPixmap RRPixmapRec, *RRPixmapPtr;
struct _rrMode {
int refcnt;
@@ -107,6 +108,12 @@ struct _rrProperty {
RRPropertyValueRec current, pending;
};
+struct _rrPixmap {
+ XID id;
+ PixmapPtr pixmap;
+ Rotation rotations;
+};
+
struct _rrCrtc {
RRCrtc id;
ScreenPtr pScreen;
@@ -136,6 +143,7 @@ struct _rrCrtc {
struct pict_f_transform f_inverse;
struct pict_f_transform f_sprite_position; /* crtc from screen */
struct pict_f_transform f_sprite_image_inverse; /* image from crtc */
+ int pixmap_x, pixmap_y;
};
struct _rrScreenConfig {
@@ -204,7 +212,9 @@ typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
Rotation rotation,
int numOutputs,
RROutputPtr *outputs,
- PixmapPtr scanout_pixmap);
+ PixmapPtr scanout_pixmap,
+ int pixmap_x,
+ int pixmap_y);
typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
RRCrtcPtr crtc);
@@ -448,6 +458,18 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
#define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey))
#define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient)
+extern _X_EXPORT RESTYPE RRPixmapType;
+
+#define VERIFY_RR_PIXMAP(id, ptr, a) \
+ { \
+ int rc = dixLookupResourceByType((pointer *)&(ptr), id, \
+ RRPixmapType, client, a); \
+ if (rc != Success) { \
+ client->errorValue = (id); \
+ return rc; \
+ } \
+ }
+
/* Initialize the extension */
extern _X_EXPORT void
RRExtensionInit (void);
@@ -630,7 +652,9 @@ RRCrtcNotify (RRCrtcPtr crtc,
RRTransformPtr transform,
int numOutputs,
RROutputPtr *outputs,
- PixmapPtr scanoutPixmap);
+ PixmapPtr scanoutPixmap,
+ int pixmap_x,
+ int pixmap_y);
extern _X_EXPORT void
RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
@@ -646,7 +670,9 @@ RRCrtcSet (RRCrtcPtr crtc,
Rotation rotation,
int numOutput,
RROutputPtr *outputs,
- PixmapPtr scanout_pixmap);
+ PixmapPtr scanout_pixmap,
+ int pixmap_x,
+ int pixmap_y);
/*
* Request that the Crtc gamma be changed
@@ -729,6 +755,13 @@ RRCrtcTransformSet (RRCrtcPtr crtc,
int nparams);
/*
+ * The pixmap associated with this CRTC has been destroyed,
+ * reconfigure the screen so that this crtc shows something
+ */
+void
+RRCrtcLostPixmap(RRCrtcPtr crtc);
+
+/*
* Initialize crtc type
*/
extern _X_EXPORT Bool
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 123c9e3fa..8be78db99 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -23,6 +23,12 @@
#include "randrstr.h"
#include "swaprep.h"
+static int
+RRConvertCrtcConfig(ClientPtr client, ScreenPtr screen,
+ RRScreenConfigPtr screen_config,
+ RRCrtcConfigPtr config, xRRCrtcConfig *x,
+ RROutput *outputIds);
+
RESTYPE RRCrtcType;
/*
@@ -139,7 +145,9 @@ RRCrtcNotify (RRCrtcPtr crtc,
RRTransformPtr transform,
int numOutputs,
RROutputPtr *outputs,
- PixmapPtr scanoutPixmap)
+ PixmapPtr scanoutPixmap,
+ int pixmap_x,
+ int pixmap_y)
{
int i, j;
@@ -323,7 +331,9 @@ RRCrtcSet (RRCrtcPtr crtc,
Rotation rotation,
int numOutputs,
RROutputPtr *outputs,
- PixmapPtr scanout_pixmap)
+ PixmapPtr scanout_pixmap,
+ int pixmap_x,
+ int pixmap_y)
{
ScreenPtr pScreen = crtc->pScreen;
Bool ret = FALSE;
@@ -338,7 +348,9 @@ RRCrtcSet (RRCrtcPtr crtc,
!memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) &&
!RRCrtcPendingProperties (crtc) &&
!RRCrtcPendingTransform (crtc) &&
- crtc->scanoutPixmap == scanout_pixmap)
+ crtc->scanoutPixmap == scanout_pixmap &&
+ crtc->pixmap_x == pixmap_x &&
+ crtc->pixmap_y == pixmap_y)
{
ret = TRUE;
}
@@ -347,8 +359,14 @@ RRCrtcSet (RRCrtcPtr crtc,
#if RANDR_12_INTERFACE
if (pScrPriv->rrCrtcSet)
{
- ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
- rotation, numOutputs, outputs, scanout_pixmap);
+ int ddx_x = x, ddx_y = y;
+ if (scanout_pixmap) {
+ ddx_x = pixmap_x;
+ ddx_y = pixmap_y;
+ }
+ ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, ddx_x, ddx_y,
+ rotation, numOutputs, outputs, scanout_pixmap,
+ pixmap_x, pixmap_y);
}
else
#endif
@@ -361,7 +379,7 @@ RRCrtcSet (RRCrtcPtr crtc,
if (!mode)
{
- RRCrtcNotify (crtc, NULL, x, y, rotation, NULL, 0, NULL, scanout_pixmap);
+ RRCrtcNotify (crtc, NULL, x, y, rotation, NULL, 0, NULL, scanout_pixmap, pixmap_x, pixmap_y);
ret = TRUE;
}
else
@@ -387,7 +405,7 @@ RRCrtcSet (RRCrtcPtr crtc,
*/
if (ret)
{
- RRCrtcNotify (crtc, mode, x, y, rotation, NULL, 1, outputs, scanout_pixmap);
+ RRCrtcNotify (crtc, mode, x, y, rotation, NULL, 1, outputs, scanout_pixmap, pixmap_x, pixmap_y);
RRScreenSizeNotify (pScreen);
}
}
@@ -436,12 +454,11 @@ RRCrtcCurrentConfig(RRCrtcPtr crtc,
crtc_config->sprite_image_f_transform = crtc->client_sprite_f_image_transform;
crtc_config->pixmap = crtc->scanoutPixmap;
- crtc_config->pixmap_x = crtc->x;
- crtc_config->pixmap_y = crtc->y;
+ crtc_config->pixmap_x = crtc->pixmap_x;
+ crtc_config->pixmap_y = crtc->pixmap_y;
return TRUE;
}
-
/*
* Request that a set of crtcs be configured at the same
* time on a single screen
@@ -739,6 +756,64 @@ RRScreenCoversCrtc(RRScreenConfigPtr screen_config,
return TRUE;
}
+static void
+set_identity_transform(xRenderTransform *t)
+{
+ memset(t, 0, sizeof (xRenderTransform));
+ t->matrix11 = t->matrix22 = t->matrix33 = xFixed1;
+}
+
+/*
+ * The pixmap associated with this CRTC has been destroyed,
+ * reconfigure the screen so that this crtc shows something
+ */
+void
+RRCrtcLostPixmap(RRCrtcPtr crtc)
+{
+ xRRCrtcConfig x_crtc_config;
+ RRScreenConfigRec screen_config;
+ RRCrtcConfigRec crtc_config;
+ ScreenPtr screen = crtc->pScreen;
+ PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
+ WindowPtr root = screen->root;
+ int width, height;
+
+ screen_config.screen_pixmap_width = screen_pixmap->drawable.width;
+ screen_config.screen_pixmap_height = screen_pixmap->drawable.height;
+ screen_config.screen_width = root->drawable.width;
+ screen_config.screen_height = root->drawable.height;
+ screen_config.mm_width = screen->mmWidth;
+ screen_config.mm_height = screen->mmHeight;
+
+ if (crtc->mode) {
+ width = crtc->mode->mode.width;
+ height = crtc->mode->mode.height;
+ if (width > screen_config.screen_pixmap_width)
+ screen_config.screen_pixmap_width = width;
+ if (height > screen_config.screen_pixmap_height)
+ screen_config.screen_pixmap_height = height;
+ }
+
+ x_crtc_config.crtc = crtc->id;
+ x_crtc_config.set = (RR_SetCrtcPosition |
+ RR_SetCrtcRotation |
+ RR_SetCrtcSpritePositionTransform |
+ RR_SetCrtcSpriteImageTransform |
+ RR_SetCrtcPixmap);
+ x_crtc_config.x = 0;
+ x_crtc_config.y = 0;
+ x_crtc_config.rotation = RR_Rotate_0;
+ set_identity_transform(&x_crtc_config.spritePositionTransform);
+ set_identity_transform(&x_crtc_config.spriteImageTransform);
+ x_crtc_config.pixmap = None;
+ RRConvertCrtcConfig(serverClient, screen,
+ &screen_config,
+ &crtc_config, &x_crtc_config,
+ NULL);
+
+ (void) RRSetCrtcConfigs(screen, &screen_config, &crtc_config, 1);
+}
+
/*
* Initialize crtc type
*/
@@ -1065,7 +1140,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
}
if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y,
- rotation, numOutputs, outputs, NULL))
+ rotation, numOutputs, outputs, NULL, 0, 0))
{
rep.status = RRSetConfigFailed;
goto sendReply;
@@ -1480,6 +1555,7 @@ RRConvertCrtcConfig(ClientPtr client, ScreenPtr screen,
RROutputPtr *outputs;
rrScrPrivPtr scr_priv;
RRModePtr mode;
+ RRPixmapPtr rr_pixmap = NULL;
PixmapPtr pixmap;
int rc, i, j;
Rotation rotation;
@@ -1529,10 +1605,25 @@ RRConvertCrtcConfig(ClientPtr client, ScreenPtr screen,
free(outputs);
return rc;
}
- /* XXX check to make sure this is a scanout pixmap */
+ rc = dixLookupResourceByType((pointer *) &rr_pixmap, x->pixmap,
+ RRPixmapType, client, DixGetAttrAccess);
+ if (rc != Success) {
+ free(outputs);
+ client->errorValue = x->pixmap;
+ return BadValue;
+ }
}
- } else
+ } else {
pixmap = crtc->scanoutPixmap;
+ if (pixmap) {
+ rc = dixLookupResourceByType((pointer *) &rr_pixmap, pixmap->drawable.id,
+ RRPixmapType, client, DixGetAttrAccess);
+ if (rc != Success) {
+ free(outputs);
+ return BadImplementation;
+ }
+ }
+ }
if (x->set & RR_SetCrtcOutputs) {
for (i = 0; i < numOutputs; i++)
@@ -1621,6 +1712,17 @@ RRConvertCrtcConfig(ClientPtr client, ScreenPtr screen,
free(outputs);
return BadValue;
}
+
+ /*
+ * If this crtc will use a scanout pixmap, then
+ * make sure the requested rotation is supported by the
+ * underlying pixmap
+ */
+ if (rr_pixmap && (rotation & rr_pixmap->rotations) == 0) {
+ client->errorValue = x->rotation;
+ free(outputs);
+ return BadValue;
+ }
}
scr_priv = rrGetScrPriv(screen);
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index 549ebcc8d..1fddeb01c 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -168,7 +168,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
/* notice current mode */
if (newMode)
RRCrtcNotify (crtc, newMode, 0, 0, pScrPriv->rotation,
- NULL, 1, &output, NULL);
+ NULL, 1, &output, NULL, 0, 0);
}
#endif
diff --git a/randr/rrpixmap.c b/randr/rrpixmap.c
index 7d4543c22..a13e99b08 100644
--- a/randr/rrpixmap.c
+++ b/randr/rrpixmap.c
@@ -91,6 +91,7 @@ ProcRRCreateScanoutPixmap (ClientPtr client)
ScreenPtr screen;
rrScrPrivPtr screen_priv;
PixmapPtr pixmap;
+ RRPixmapPtr rr_pixmap;
int n_info;
RRScanoutPixmapInfo *info;
int s;
@@ -132,6 +133,15 @@ ProcRRCreateScanoutPixmap (ClientPtr client)
return BadValue;
}
+ rr_pixmap = calloc(1, sizeof (RRPixmapRec));
+ if (!rr_pixmap)
+ return BadAlloc;
+ rr_pixmap->id = stuff->pid;
+ rr_pixmap->pixmap = NULL;
+ rr_pixmap->rotations = stuff->rotations;
+ if (!AddResource(stuff->pid, RRPixmapType, rr_pixmap))
+ return BadAlloc;
+
pixmap = screen_priv->rrCreateScanoutPixmap (screen,
stuff->width, stuff->height,
info->depth,
@@ -145,10 +155,14 @@ ProcRRCreateScanoutPixmap (ClientPtr client)
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pixmap, RT_NONE, NULL, DixCreateAccess);
if (rc != Success) {
+ FreeResource(stuff->pid, RT_NONE);
screen->DestroyPixmap(pixmap);
return rc;
}
- if (!AddResource(stuff->pid, RT_PIXMAP, pixmap))
+ if (!AddResource(stuff->pid, RT_PIXMAP, pixmap)) {
+ FreeResource(stuff->pid, RT_NONE);
return BadAlloc;
+ }
+ rr_pixmap->pixmap = pixmap;
return Success;
}
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 0efc62e87..9c141fe07 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -958,7 +958,7 @@ ProcRRSetScreenConfig (ClientPtr client)
for (c = 0; c < pScrPriv->numCrtcs; c++)
{
if (!RRCrtcSet (pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0,
- 0, NULL, NULL))
+ 0, NULL, NULL, 0, 0))
{
rep.status = RRSetConfigFailed;
/* XXX recover from failure */
@@ -974,7 +974,7 @@ ProcRRSetScreenConfig (ClientPtr client)
}
}
- if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output, NULL))
+ if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output, NULL, 0, 0))
rep.status = RRSetConfigFailed;
else {
pScrPriv->lastSetTime = time;