aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/randr
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-02-25 07:48:53 +0000
committermarha <marha@users.sourceforge.net>2011-02-25 07:48:53 +0000
commit8268836508edd4ba2a3045c9ba937397df7bf2c5 (patch)
treebc6e4b07e03d57272827f8d7c211c6938880a7ff /xorg-server/randr
parenta7971771a8ab6f6f76a2a8e482dbb3a30901af1c (diff)
downloadvcxsrv-8268836508edd4ba2a3045c9ba937397df7bf2c5.tar.gz
vcxsrv-8268836508edd4ba2a3045c9ba937397df7bf2c5.tar.bz2
vcxsrv-8268836508edd4ba2a3045c9ba937397df7bf2c5.zip
Forgotten in previous commit
Diffstat (limited to 'xorg-server/randr')
-rw-r--r--xorg-server/randr/mirrcrtc.c174
-rw-r--r--xorg-server/randr/rrpixmap.c154
-rw-r--r--xorg-server/randr/rrsprite.c104
3 files changed, 0 insertions, 432 deletions
diff --git a/xorg-server/randr/mirrcrtc.c b/xorg-server/randr/mirrcrtc.c
deleted file mode 100644
index 812b2b68b..000000000
--- a/xorg-server/randr/mirrcrtc.c
+++ /dev/null
@@ -1,174 +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"
-
-Bool
-miRRSetScreenConfig(ScreenPtr screen,
- RRScreenConfigPtr screen_config)
-{
- RRScreenConfigRec old_screen_config;
-
- RRScreenCurrentConfig(screen, &old_screen_config);
-
- /* Check and see if nothing has changed */
- if (old_screen_config.screen_width == screen_config->screen_width &&
- old_screen_config.screen_height == screen_config->screen_height &&
- old_screen_config.screen_pixmap_width == screen_config->screen_pixmap_width &&
- old_screen_config.screen_pixmap_height == screen_config->screen_pixmap_height &&
- old_screen_config.mm_width == screen_config->mm_width &&
- old_screen_config.mm_height == screen_config->mm_height)
- return TRUE;
-
- return RRScreenSizeSet(screen,
- screen_config->screen_width,
- screen_config->screen_height,
- screen_config->screen_pixmap_width,
- screen_config->screen_pixmap_height,
- screen_config->mm_width,
- screen_config->mm_height);
-}
-
-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->rotation,
- crtc_config->numOutputs,
- crtc_config->outputs,
- crtc_config->pixmap))
- return FALSE;
- RRCrtcSpriteTransformSet(crtc_config->crtc,
- &crtc_config->sprite_position_transform,
- &crtc_config->sprite_image_transform,
- &crtc_config->sprite_position_f_transform,
- &crtc_config->sprite_image_f_transform);
- return TRUE;
-}
-
-Bool
-miRRDisableCrtc(RRCrtcPtr crtc)
-{
- RRCrtcConfigRec off_config;
-
- memset(&off_config, '\0', sizeof (RRCrtcConfigRec));
- off_config.crtc = crtc;
- return miRRSetCrtcConfig(&off_config);
-}
-
-/*
- * If the current crtc configuration doesn't fit
- * with the new screen config, disable it
- */
-Bool
-miRRCheckDisableCrtc(RRScreenConfigPtr new_screen_config,
- RRCrtcConfigPtr old_crtc_config)
-{
- RRCrtcPtr crtc = old_crtc_config->crtc;
-
- /* If it's already disabled, we're done */
- if (!old_crtc_config->mode)
- return TRUE;
-
- /* If the crtc isn't scanning from the screen pixmap,
- * we're done
- */
- if (old_crtc_config->pixmap)
- return TRUE;
-
- /* If the new screen configuration covers the existing CRTC space,
- * we're done
- */
- if (RRScreenCoversCrtc(new_screen_config, old_crtc_config,
- &crtc->client_current_transform, NULL))
- return TRUE;
-
- /* Disable the crtc and let it get re-enabled */
- return miRRDisableCrtc(crtc);
-}
-
-Bool
-miRRSetCrtcConfigs(ScreenPtr screen,
- RRScreenConfigPtr screen_config,
- RRCrtcConfigPtr crtc_configs,
- int num_configs)
-{
- RRScreenConfigRec old_screen_config;
- RRCrtcConfigPtr old_crtc_configs;
- int i;
-
- /*
- * Save existing state
- */
-
- RRScreenCurrentConfig(screen, &old_screen_config);
- old_crtc_configs = calloc(num_configs, sizeof (RRCrtcConfigRec));
- if (!old_crtc_configs)
- return FALSE;
-
- for (i = 0; i < num_configs; i++)
- if (!RRCrtcCurrentConfig(crtc_configs[i].crtc, &old_crtc_configs[i]))
- goto fail_save;
- /*
- * Set the new configuration. If anything goes wrong,
- * bail and restore the old configuration
- */
- for (i = 0; i < num_configs; i++)
- if (!miRRCheckDisableCrtc(screen_config, &old_crtc_configs[i]))
- goto fail_disable;
-
- if (!miRRSetScreenConfig(screen, screen_config))
- goto fail_set_screen;
-
- for (i = 0; i < num_configs; i++)
- if (!miRRSetCrtcConfig(&crtc_configs[i]))
- goto fail_set_crtc;
-
- RRFreeCrtcConfigs(old_crtc_configs, num_configs);
- return TRUE;
-
-fail_set_crtc:
- /*
- * Restore the previous configuration. Ignore any errors
- * as we just need to hope that the driver can manage to
- * get back to the previous state without trouble.
- */
- for (i = 0; i < num_configs; i++)
- (void) miRRDisableCrtc(old_crtc_configs[i].crtc);
- (void) miRRSetScreenConfig(screen, &old_screen_config);
-fail_set_screen:
-fail_disable:
- for (i = 0; i < num_configs; i++)
- (void) miRRSetCrtcConfig(&old_crtc_configs[i]);
-fail_save:
- RRFreeCrtcConfigs(old_crtc_configs, num_configs);
- return FALSE;
-}
diff --git a/xorg-server/randr/rrpixmap.c b/xorg-server/randr/rrpixmap.c
deleted file mode 100644
index 5949309c9..000000000
--- a/xorg-server/randr/rrpixmap.c
+++ /dev/null
@@ -1,154 +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 "xace.h"
-
-int
-ProcRRQueryScanoutPixmaps (ClientPtr client)
-{
- REQUEST(xRRQueryScanoutPixmapsReq);
- xRRQueryScanoutPixmapsReply rep;
- RRScanoutPixmapInfo *info;
- xRRScanoutPixmapInfo *x_info;
- int n_info;
- int rc;
- DrawablePtr drawable;
- ScreenPtr screen;
- rrScrPrivPtr screen_priv;
- int n, s;
-
- REQUEST_SIZE_MATCH(xRRQueryScanoutPixmapsReq);
- rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0, DixGetAttrAccess);
- if (rc != Success) {
- client->errorValue = stuff->drawable;
- return rc;
- }
-
- screen = drawable->pScreen;
- screen_priv = rrGetScrPriv(screen);
-
- rep.type = X_Reply;
- /* rep.status has already been filled in */
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- info = RRQueryScanoutPixmapInfo(screen, &n_info);
- x_info = calloc(n_info, sizeof (xRRScanoutPixmapInfo));
- if (n_info && !x_info)
- return BadAlloc;
- rep.length += (n_info * sizeof (xRRScanoutPixmapInfo)) >> 2;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
-
- for (s = 0; s < n_info; s++) {
- x_info[s].format = info[s].format->id;
- x_info[s].maxWidth = info[s].maxWidth;
- x_info[s].maxHeight = info[s].maxHeight;
- x_info[s].rotations = info[s].rotations;
- if (client->swapped) {
- swapl(&x_info[s].format, n);
- swaps(&x_info[s].maxWidth, n);
- swaps(&x_info[s].maxHeight, n);
- swaps(&x_info[s].rotations, n);
- }
- }
-
- WriteToClient(client, sizeof(rep), (char *)&rep);
- if (n_info)
- WriteToClient(client, n_info * sizeof (xRRScanoutPixmapInfo),
- (char *) x_info);
- return Success;
-}
-
-int
-ProcRRCreateScanoutPixmap (ClientPtr client)
-{
- REQUEST(xRRCreateScanoutPixmapReq);
- int rc;
- DrawablePtr drawable;
- ScreenPtr screen;
- rrScrPrivPtr screen_priv;
- PixmapPtr pixmap;
- int n_info;
- RRScanoutPixmapInfo *info;
- int s;
-
- REQUEST_SIZE_MATCH(xRRCreateScanoutPixmapReq);
- client->errorValue = stuff->pid;
- LEGAL_NEW_RESOURCE(stuff->pid, client);
-
- rc = dixLookupDrawable(&drawable, stuff->drawable, client, 0, DixGetAttrAccess);
- if (rc != Success) {
- client->errorValue = stuff->drawable;
- return rc;
- }
- screen = drawable->pScreen;
- screen_priv = rrGetScrPriv(screen);
- if (!screen_priv)
- return BadValue;
-
- info = RRQueryScanoutPixmapInfo(screen, &n_info);
- for (s = 0; s < n_info; s++) {
- if (info[s].format->id == stuff->format)
- break;
- }
- if (s == n_info || !screen_priv->rrCreateScanoutPixmap) {
- client->errorValue = stuff->format;
- return BadValue;
- }
- info = &info[s];
- if (!stuff->width || stuff->width > info->maxWidth) {
- client->errorValue = stuff->width;
- return BadValue;
- }
- if (!stuff->height || stuff->height > info->maxHeight) {
- client->errorValue = stuff->height;
- return BadValue;
- }
- if ((stuff->rotations & info->rotations) != stuff->rotations) {
- client->errorValue = stuff->rotations;
- return BadValue;
- }
-
- pixmap = screen_priv->rrCreateScanoutPixmap (screen,
- stuff->width, stuff->height,
- info->depth,
- stuff->rotations,
- info->format);
- if (!pixmap)
- return BadAlloc;
-
- pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pixmap->drawable.id = stuff->pid;
- rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
- pixmap, RT_NONE, NULL, DixCreateAccess);
- if (rc != Success) {
- screen->DestroyPixmap(pixmap);
- return rc;
- }
- if (!AddResource(stuff->pid, RT_PIXMAP, pixmap))
- return BadAlloc;
- return Success;
-}
diff --git a/xorg-server/randr/rrsprite.c b/xorg-server/randr/rrsprite.c
deleted file mode 100644
index c441e0396..000000000
--- a/xorg-server/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;
-}