summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-02-23 11:18:12 -0800
committerKeith Packard <keithp@keithp.com>2011-02-23 11:18:12 -0800
commita91d33917befd6719bb7f01007bc253a2aefb0bb (patch)
treedabf61fa7a6245b6417c7fce34d9f1b73a92b1dd /randr
parent3d4ee25a1e2e0ed2463ceaabea8f5a284a6ddd60 (diff)
Revert "randr: Add sprite position transforms"
Diffstat (limited to 'randr')
-rw-r--r--randr/Makefile.am1
-rw-r--r--randr/randrstr.h63
-rw-r--r--randr/rrcrtc.c23
-rw-r--r--randr/rrsprite.c104
-rw-r--r--randr/rrtransform.c64
-rw-r--r--randr/rrtransform.h15
6 files changed, 34 insertions, 236 deletions
diff --git a/randr/Makefile.am b/randr/Makefile.am
index 4b38e524b..de338b972 100644
--- a/randr/Makefile.am
+++ b/randr/Makefile.am
@@ -20,7 +20,6 @@ librandr_la_SOURCES = \
rrproperty.c \
rrscreen.c \
rrsdispatch.c \
- rrsprite.c \
rrtransform.h \
rrtransform.c
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 5e2a3518c..7ea608003 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -55,10 +55,9 @@
#define RANDR_10_INTERFACE 1
#define RANDR_12_INTERFACE 1
#define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */
-#define RANDR_14_INTERFACE 1 /* requires RANDR_13_INTERFACE */
#define RANDR_GET_CRTC_INTERFACE 1
-#define RANDR_INTERFACE_VERSION 0x0104
+#define RANDR_INTERFACE_VERSION 0x0103
typedef XID RRMode;
typedef XID RROutput;
@@ -123,16 +122,9 @@ struct _rrCrtc {
Bool transforms;
RRTransformRec client_pending_transform;
RRTransformRec client_current_transform;
- PictTransform client_sprite_position_transform;
- PictTransform client_sprite_image_transform;
- struct pict_f_transform client_sprite_f_position_transform;
- struct pict_f_transform client_sprite_f_image_transform;
-
PictTransform transform;
struct pict_f_transform f_transform;
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 */
};
struct _rrOutput {
@@ -241,16 +233,6 @@ typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
#endif
-typedef void (*RRSetCrtcSpriteTransformPtr) (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- struct pict_f_transform *position_transform,
- struct pict_f_transform *image_transform);
-
-typedef void (*RRGetCrtcSpriteTransformPtr) (ScreenPtr pScreen,
- RRCrtcPtr randr_crtc,
- struct pict_f_transform *position_transform,
- struct pict_f_transform *image_transform);
-
typedef struct _rrScrPriv {
/*
* 'public' part of the structure; DDXen fill this in
@@ -274,9 +256,7 @@ typedef struct _rrScrPriv {
RRGetPanningProcPtr rrGetPanning;
RRSetPanningProcPtr rrSetPanning;
#endif
- RRSetCrtcSpriteTransformPtr rrSetCrtcSpriteTransform;
- RRGetCrtcSpriteTransformPtr rrGetCrtcSpriteTransform;
-
+
/*
* Private part of the structure; not considered part of the ABI
*/
@@ -626,6 +606,25 @@ extern _X_EXPORT void
RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
/*
+ * Compute the complete transformation matrix including
+ * client-specified transform, rotation/reflection values and the crtc
+ * offset.
+ *
+ * Return TRUE if the resulting transform is not a simple translation.
+ */
+extern _X_EXPORT Bool
+RRTransformCompute (int x,
+ int y,
+ int width,
+ int height,
+ Rotation rotation,
+ RRTransformPtr rr_transform,
+
+ PictTransformPtr transform,
+ struct pict_f_transform *f_transform,
+ struct pict_f_transform *f_inverse);
+
+/*
* Return crtc transform
*/
extern _X_EXPORT RRTransformPtr
@@ -701,19 +700,6 @@ ProcRRGetPanning (ClientPtr client);
int
ProcRRSetPanning (ClientPtr client);
-void
-RRCrtcSpriteTransformSet(RRCrtcPtr crtc,
- PictTransform *position_transform,
- PictTransform *image_transform,
- struct pict_f_transform *f_position_transform,
- struct pict_f_transform *f_image_transform);
-
-int
-ProcRRSetCrtcSpriteTransform (ClientPtr client);
-
-int
-ProcRRGetCrtcSpriteTransform (ClientPtr client);
-
/* rrdispatch.c */
extern _X_EXPORT Bool
RRClientKnowsRates (ClientPtr pClient);
@@ -903,13 +889,6 @@ ProcRRConfigureOutputProperty (ClientPtr client);
extern _X_EXPORT int
ProcRRDeleteOutputProperty (ClientPtr client);
-/* rrsprite.c */
-extern _X_EXPORT int
-ProcRRSetCrtcSpriteTransform (ClientPtr client);
-
-extern _X_EXPORT int
-ProcRRGetCrtcSpriteTransform (ClientPtr client);
-
/* rrxinerama.c */
#ifdef XINERAMA
extern _X_EXPORT void
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index c2f696332..98206a2b9 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -93,8 +93,6 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
pixman_transform_init_identity (&crtc->transform);
pixman_f_transform_init_identity (&crtc->f_transform);
pixman_f_transform_init_identity (&crtc->f_inverse);
- pixman_f_transform_init_identity (&crtc->f_sprite_position);
- pixman_f_transform_init_identity (&crtc->f_sprite_image_inverse);
if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
return NULL;
@@ -233,21 +231,15 @@ RRCrtcNotify (RRCrtcPtr crtc,
RRTransformCopy (&crtc->client_current_transform, transform);
RRCrtcChanged (crtc, TRUE);
}
-
if (crtc->changed && mode)
{
RRTransformCompute (x, y,
mode->mode.width, mode->mode.height,
rotation,
&crtc->client_current_transform,
- &crtc->client_sprite_f_position_transform,
- &crtc->client_sprite_f_image_transform,
&crtc->transform, &crtc->f_transform,
- &crtc->f_inverse, &crtc->f_sprite_position,
- &crtc->f_sprite_image_inverse,
- NULL);
+ &crtc->f_inverse);
}
-
return TRUE;
}
@@ -519,7 +511,7 @@ RRCrtcGammaNotify (RRCrtcPtr crtc)
}
static void
-RRModeGetScanoutSize (RRModePtr mode, struct pixman_f_transform *transform,
+RRModeGetScanoutSize (RRModePtr mode, PictTransformPtr transform,
int *width, int *height)
{
BoxRec box;
@@ -535,7 +527,7 @@ RRModeGetScanoutSize (RRModePtr mode, struct pixman_f_transform *transform,
box.x2 = mode->mode.width;
box.y2 = mode->mode.height;
- pixman_f_transform_bounds (transform, &box);
+ pixman_transform_bounds (transform, &box);
*width = box.x2 - box.x1;
*height = box.y2 - box.y1;
}
@@ -546,7 +538,7 @@ RRModeGetScanoutSize (RRModePtr mode, struct pixman_f_transform *transform,
void
RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height)
{
- RRModeGetScanoutSize (crtc->mode, &crtc->f_transform, width, height);
+ return RRModeGetScanoutSize (crtc->mode, &crtc->transform, width, height);
}
/*
@@ -932,12 +924,9 @@ ProcRRSetCrtcConfig (ClientPtr client)
mode->mode.width, mode->mode.height,
rotation,
&crtc->client_pending_transform,
- &crtc->client_sprite_f_position_transform,
- &crtc->client_sprite_f_image_transform,
- &transform, &f_transform, &f_inverse, NULL, NULL, NULL);
+ &transform, &f_transform, &f_inverse);
- RRModeGetScanoutSize (mode, &f_transform,
- &source_width, &source_height);
+ RRModeGetScanoutSize (mode, &transform, &source_width, &source_height);
if (stuff->x + source_width > pScreen->width)
{
client->errorValue = stuff->x;
diff --git a/randr/rrsprite.c b/randr/rrsprite.c
deleted file mode 100644
index 5bf312ca9..000000000
--- a/randr/rrsprite.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright © 2010 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 the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. The copyright holders make no representations
- * about the suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS 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.
- */
-
-#include "randrstr.h"
-#include "swaprep.h"
-
-void
-RRCrtcSpriteTransformSet(RRCrtcPtr crtc,
- PictTransform *position_transform,
- PictTransform *image_transform,
- struct pict_f_transform *f_position_transform,
- struct pict_f_transform *f_image_transform)
-{
- ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
-
- pScreen = crtc->pScreen;
- pScrPriv = rrGetScrPriv(pScreen);
- crtc->client_sprite_position_transform = *position_transform;
- crtc->client_sprite_image_transform = *image_transform;
- crtc->client_sprite_f_position_transform = *f_position_transform;
- crtc->client_sprite_f_image_transform = *f_image_transform;
- if (pScrPriv->rrSetCrtcSpriteTransform)
- (*pScrPriv->rrSetCrtcSpriteTransform) (pScreen, crtc,
- &crtc->client_sprite_f_position_transform,
- &crtc->client_sprite_f_image_transform);
-}
-
-int
-ProcRRSetCrtcSpriteTransform (ClientPtr client)
-{
- REQUEST(xRRSetCrtcSpriteTransformReq);
- RRCrtcPtr crtc;
- PictTransform position_transform, image_transform;
- struct pixman_f_transform f_position_transform, f_image_transform;
-
- REQUEST_AT_LEAST_SIZE(xRRSetCrtcSpriteTransformReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- PictTransform_from_xRenderTransform (&position_transform, &stuff->positionTransform);
- PictTransform_from_xRenderTransform (&image_transform, &stuff->imageTransform);
- pixman_f_transform_from_pixman_transform (&f_position_transform, &position_transform);
- pixman_f_transform_from_pixman_transform (&f_image_transform, &image_transform);
-
- RRCrtcSpriteTransformSet (crtc, &position_transform, &image_transform,
- &f_position_transform, &f_image_transform);
- return Success;
-}
-
-#define CrtcSpriteTransformExtra (SIZEOF(xRRGetCrtcSpriteTransformReply) - 32)
-
-int
-ProcRRGetCrtcSpriteTransform (ClientPtr client)
-{
- REQUEST(xRRGetCrtcSpriteTransformReq);
- xRRGetCrtcSpriteTransformReply *reply;
- RRCrtcPtr crtc;
- int n;
- char *extra;
-
- REQUEST_SIZE_MATCH (xRRGetCrtcSpriteTransformReq);
- VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
-
- reply = malloc(sizeof (xRRGetCrtcSpriteTransformReply));
- if (!reply)
- return BadAlloc;
-
- extra = (char *) (reply + 1);
- reply->type = X_Reply;
- reply->sequenceNumber = client->sequence;
- reply->length = bytes_to_int32(CrtcSpriteTransformExtra);
-
- xRenderTransform_from_PictTransform(&reply->positionTransform, &crtc->client_sprite_position_transform);
- xRenderTransform_from_PictTransform(&reply->imageTransform, &crtc->client_sprite_image_transform);
-
- if (client->swapped) {
- swaps (&reply->sequenceNumber, n);
- swapl (&reply->length, n);
- SwapLongs((CARD32 *) &reply->positionTransform, bytes_to_int32(sizeof(xRenderTransform)));
- SwapLongs((CARD32 *) &reply->imageTransform, bytes_to_int32(sizeof(xRenderTransform)));
- }
- WriteToClient (client, sizeof (xRRGetCrtcSpriteTransformReply), (char *) reply);
- free(reply);
- return Success;
-}
diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 3eda5f3cd..e1620498b 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -134,24 +134,6 @@ RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
f_transform->m[j][i] *= scale;
}
-#define EPSILON (1e-20)
-#define IS_F_SAME(a,b) (fabs((a)-(b)) < EPSILON)
-#define IS_F_ZERO(a) (fabs(a) < EPSILON)
-
-static Bool
-pict_f_transform_is_identity (const struct pixman_f_transform *t)
-{
- return (IS_F_SAME (t->m[0][0], t->m[1][1]) &&
- IS_F_SAME (t->m[0][0], t->m[2][2]) &&
- !IS_F_ZERO (t->m[0][0]) &&
- IS_F_ZERO (t->m[0][1]) &&
- IS_F_ZERO (t->m[0][2]) &&
- IS_F_ZERO (t->m[1][0]) &&
- IS_F_ZERO (t->m[1][2]) &&
- IS_F_ZERO (t->m[2][0]) &&
- IS_F_ZERO (t->m[2][1]));
-}
-
/*
* Compute the complete transformation matrix including
* client-specified transform, rotation/reflection values and the crtc
@@ -166,39 +148,23 @@ RRTransformCompute (int x,
int height,
Rotation rotation,
RRTransformPtr rr_transform,
- struct pixman_f_transform *sprite_position_transform,
- struct pixman_f_transform *sprite_image_transform,
PictTransformPtr transform,
struct pixman_f_transform *f_transform,
- struct pixman_f_transform *f_inverse,
- struct pixman_f_transform *f_fb_to_sprite,
- struct pixman_f_transform *f_sprite_to_image,
- Bool *sprite_transform_in_use)
+ struct pixman_f_transform *f_inverse)
{
PictTransform t_transform, inverse;
struct pixman_f_transform tf_transform, tf_inverse;
- struct pixman_f_transform sf_position_transform, sf_image_transform;
- struct pixman_f_transform f_image_to_sprite;
Bool overflow = FALSE;
- Bool ret = TRUE;
if (!transform) transform = &t_transform;
if (!f_transform) f_transform = &tf_transform;
if (!f_inverse) f_inverse = &tf_inverse;
- if (!f_fb_to_sprite) f_fb_to_sprite = &sf_position_transform;
- if (!f_sprite_to_image) f_sprite_to_image = &sf_image_transform;
-
- /* invert the sprite image transform to have it go from dest to source */
- if (!pixman_f_transform_invert (&f_image_to_sprite, f_sprite_to_image))
- pixman_f_transform_init_identity(&f_image_to_sprite);
pixman_transform_init_identity (transform);
pixman_transform_init_identity (&inverse);
pixman_f_transform_init_identity (f_transform);
pixman_f_transform_init_identity (f_inverse);
- pixman_f_transform_init_identity (f_fb_to_sprite);
- pixman_f_transform_init_identity (f_sprite_to_image);
if (rotation != RR_Rotate_0)
{
double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
@@ -280,14 +246,7 @@ RRTransformCompute (int x,
pixman_f_transform_translate (f_transform, f_inverse, f_scale_dx, f_scale_dy);
}
- /*
- * Sprite position is affected by the transform matrix,
- * but the image is not
- */
- pixman_f_transform_multiply(f_sprite_to_image,
- f_transform,
- &f_image_to_sprite);
-
+#ifdef RANDR_12_INTERFACE
if (rr_transform)
{
if (!pixman_transform_multiply (transform, &rr_transform->transform, transform))
@@ -295,7 +254,7 @@ RRTransformCompute (int x,
pixman_f_transform_multiply (f_transform, &rr_transform->f_transform, f_transform);
pixman_f_transform_multiply (f_inverse, f_inverse, &rr_transform->f_inverse);
}
-
+#endif
/*
* Compute the class of the resulting transform
*/
@@ -305,7 +264,7 @@ RRTransformCompute (int x,
pixman_f_transform_init_translate (f_transform, x, y);
pixman_f_transform_init_translate (f_inverse, -x, -y);
- ret = FALSE;
+ return FALSE;
}
else
{
@@ -319,19 +278,6 @@ RRTransformCompute (int x,
RRTransformRescale(&f_scaled, 16384.0);
pixman_transform_from_pixman_f_transform(transform, &f_scaled);
}
- ret = TRUE;
+ return TRUE;
}
-
- /*
- * Sprite position is affected by the transform matrix,
- * but the image is not
- */
- pixman_f_transform_multiply(f_fb_to_sprite,
- f_inverse,
- sprite_position_transform);
- if (sprite_transform_in_use)
- *sprite_transform_in_use = ret || !pict_f_transform_is_identity(f_fb_to_sprite);
- return ret;
}
-
-
diff --git a/randr/rrtransform.h b/randr/rrtransform.h
index 5cfcf8d65..561762dfe 100644
--- a/randr/rrtransform.h
+++ b/randr/rrtransform.h
@@ -59,13 +59,6 @@ RRTransformSetFilter (RRTransformPtr dst,
extern _X_EXPORT Bool
RRTransformCopy (RRTransformPtr dst, RRTransformPtr src);
-/*
- * Compute the complete transformation matrix including
- * client-specified transform, rotation/reflection values and the crtc
- * offset.
- *
- * Return TRUE if the resulting transform is not a simple translation.
- */
extern _X_EXPORT Bool
RRTransformCompute (int x,
int y,
@@ -73,14 +66,10 @@ RRTransformCompute (int x,
int height,
Rotation rotation,
RRTransformPtr rr_transform,
- struct pict_f_transform *sprite_position_transform,
- struct pict_f_transform *sprite_image_transform,
PictTransformPtr transform,
struct pict_f_transform *f_transform,
- struct pict_f_transform *f_inverse,
- struct pict_f_transform *f_fb_to_sprite,
- struct pict_f_transform *f_sprite_to_image,
- Bool *sprite_transform_in_use);
+ struct pict_f_transform *f_inverse);
+
#endif /* _RRTRANSFORM_H_ */