Revert "randr: Add per-crtc pixmaps"

This reverts commit 82612045e1.
This commit is contained in:
Keith Packard 2011-02-23 11:17:42 -08:00
parent 9f47780ecd
commit 9e8c20b0d4
11 changed files with 20 additions and 355 deletions

View File

@ -82,17 +82,6 @@ xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
config->maxHeight = maxHeight; config->maxHeight = maxHeight;
} }
void
xf86CrtcSetScanoutFormats(ScrnInfoPtr scrn,
int num_formats,
xf86CrtcScanoutFormat *formats)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
config->num_scanout_formats = num_formats;
config->scanout_formats = formats;
}
/* /*
* Crtc functions * Crtc functions
*/ */
@ -276,7 +265,6 @@ xf86CrtcSet(xf86CrtcPtr crtc, xf86CrtcSetRec *set)
Rotation saved_rotation; Rotation saved_rotation;
RRTransformRec saved_transform; RRTransformRec saved_transform;
Bool saved_transform_present; Bool saved_transform_present;
PixmapPtr saved_scanout_pixmap;
crtc->enabled = xf86CrtcInUse (crtc); crtc->enabled = xf86CrtcInUse (crtc);
@ -296,7 +284,6 @@ xf86CrtcSet(xf86CrtcPtr crtc, xf86CrtcSetRec *set)
saved_x = crtc->x; saved_x = crtc->x;
saved_y = crtc->y; saved_y = crtc->y;
saved_rotation = crtc->rotation; saved_rotation = crtc->rotation;
saved_scanout_pixmap = crtc->scanoutPixmap;
if (crtc->transformPresent) { if (crtc->transformPresent) {
RRTransformInit (&saved_transform); RRTransformInit (&saved_transform);
RRTransformCopy (&saved_transform, &crtc->transform); RRTransformCopy (&saved_transform, &crtc->transform);
@ -314,8 +301,6 @@ xf86CrtcSet(xf86CrtcPtr crtc, xf86CrtcSetRec *set)
} }
if (set->flags & XF86CrtcSetRotation) if (set->flags & XF86CrtcSetRotation)
crtc->rotation = set->rotation; crtc->rotation = set->rotation;
if (set->flags & XF86CrtcSetScanoutPixmap)
crtc->scanoutPixmap = set->scanout_pixmap;
if (set->flags & XF86CrtcSetTransform) { if (set->flags & XF86CrtcSetTransform) {
if (set->transform) { if (set->transform) {
@ -414,10 +399,6 @@ done:
crtc->active = TRUE; crtc->active = TRUE;
if (scrn->pScreen) if (scrn->pScreen)
xf86CrtcSetScreenSubpixelOrder (scrn->pScreen); xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
if (crtc->scanoutPixmap)
++crtc->scanoutPixmap->refcnt;
if (saved_scanout_pixmap)
(*scrn->pScreen->DestroyPixmap)(saved_scanout_pixmap);
if (scrn->ModeSet) if (scrn->ModeSet)
scrn->ModeSet(scrn); scrn->ModeSet(scrn);
} else { } else {
@ -428,7 +409,6 @@ done:
if (saved_transform_present) if (saved_transform_present)
RRTransformCopy (&crtc->transform, &saved_transform); RRTransformCopy (&crtc->transform, &saved_transform);
crtc->transformPresent = saved_transform_present; crtc->transformPresent = saved_transform_present;
crtc->scanoutPixmap = saved_scanout_pixmap;
} }
if (adjusted_mode) { if (adjusted_mode) {

View File

@ -79,7 +79,6 @@ typedef enum _xf86CrtcSetFlags {
XF86CrtcSetTransform = 8, /* transform */ XF86CrtcSetTransform = 8, /* transform */
XF86CrtcSetRotation = 16, /* rotation */ XF86CrtcSetRotation = 16, /* rotation */
XF86CrtcSetProperty = 32, /* output property */ XF86CrtcSetProperty = 32, /* output property */
XF86CrtcSetScanoutPixmap = 64, /* scanout pixmap */
} xf86CrtcSetFlags; } xf86CrtcSetFlags;
typedef struct _xf86CrtcSet { typedef struct _xf86CrtcSet {
@ -88,7 +87,6 @@ typedef struct _xf86CrtcSet {
Rotation rotation; Rotation rotation;
RRTransformPtr transform; RRTransformPtr transform;
int x, y; int x, y;
PixmapPtr scanout_pixmap;
} xf86CrtcSetRec; } xf86CrtcSetRec;
typedef struct _xf86CrtcFuncs { typedef struct _xf86CrtcFuncs {
@ -279,7 +277,6 @@ struct _xf86Crtc {
Rotation rotation; Rotation rotation;
PixmapPtr rotatedPixmap; PixmapPtr rotatedPixmap;
void *rotatedData; void *rotatedData;
PixmapPtr scanoutPixmap;
/** /**
* Position on screen * Position on screen
@ -673,14 +670,6 @@ typedef struct _xf86CrtcSetConfig {
int pixmap_x, pixmap_y; int pixmap_x, pixmap_y;
} xf86CrtcSetConfigRec, *xf86CrtcSetConfigPtr; } xf86CrtcSetConfigRec, *xf86CrtcSetConfigPtr;
typedef struct _xf86CrtcScanoutFormat {
int depth;
int bitsPerPixel;
int maxWidth, maxHeight;
Rotation rotations;
PictFormatShort format;
} xf86CrtcScanoutFormat;
typedef struct _xf86CrtcConfigFuncs { typedef struct _xf86CrtcConfigFuncs {
/** /**
* Requests that the driver resize the screen. * Requests that the driver resize the screen.
@ -704,17 +693,6 @@ typedef struct _xf86CrtcConfigFuncs {
RRScreenConfigPtr screen_config, RRScreenConfigPtr screen_config,
xf86CrtcSetConfigPtr crtc_configs, xf86CrtcSetConfigPtr crtc_configs,
int num_configs); int num_configs);
/**
* Create a scanout pixmap
*/
PixmapPtr
(*create_scanout_pixmap)(ScrnInfoPtr scrn,
int width,
int height,
Rotation rotations,
xf86CrtcScanoutFormat *format);
} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr; } xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen); typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
@ -774,11 +752,6 @@ typedef struct _xf86CrtcConfig {
/* callback when crtc configuration changes */ /* callback when crtc configuration changes */
xf86_crtc_notify_proc_ptr xf86_crtc_notify; xf86_crtc_notify_proc_ptr xf86_crtc_notify;
/*
* Supported scanout pixmap formats
*/
int num_scanout_formats;
xf86CrtcScanoutFormat *scanout_formats;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr; } xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern _X_EXPORT int xf86CrtcConfigPrivateIndex; extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
@ -824,11 +797,6 @@ xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
int minWidth, int minHeight, int minWidth, int minHeight,
int maxWidth, int maxHeight); int maxWidth, int maxHeight);
extern _X_EXPORT void
xf86CrtcSetScanoutFormats (ScrnInfoPtr scrn,
int num_formats,
xf86CrtcScanoutFormat *formats);
/* /*
* Crtc functions * Crtc functions
*/ */

View File

@ -1083,7 +1083,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
ret = RRCrtcNotify (randr_crtc, randr_mode, x, y, ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
rotation, rotation,
crtc->transformPresent ? &crtc->transform : NULL, crtc->transformPresent ? &crtc->transform : NULL,
numOutputs, randr_outputs, crtc->scanoutPixmap); numOutputs, randr_outputs);
free(randr_outputs); free(randr_outputs);
return ret; return ret;
} }
@ -1126,8 +1126,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
int y, int y,
Rotation rotation, Rotation rotation,
int num_randr_outputs, int num_randr_outputs,
RROutputPtr *randr_outputs, RROutputPtr *randr_outputs)
PixmapPtr scanout_pixmap)
{ {
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@ -1158,9 +1157,6 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
sizeof (transform->transform)) != 0) sizeof (transform->transform)) != 0)
flags |= XF86CrtcSetTransform; flags |= XF86CrtcSetTransform;
if (scanout_pixmap != crtc->scanoutPixmap)
flags |= XF86CrtcSetScanoutPixmap;
if (x != crtc->x || y != crtc->y) if (x != crtc->x || y != crtc->y)
flags |= XF86CrtcSetOrigin; flags |= XF86CrtcSetOrigin;
for (o = 0; o < config->num_output; o++) for (o = 0; o < config->num_output; o++)
@ -1207,7 +1203,6 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
set.transform = transform; set.transform = transform;
set.x = x; set.x = x;
set.y = y; set.y = y;
set.scanout_pixmap = scanout_pixmap;
set.flags = flags; set.flags = flags;
if (!xf86CrtcSet(crtc, &set)) if (!xf86CrtcSet(crtc, &set))
{ {
@ -1737,54 +1732,6 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
return Success; return Success;
} }
static RRScanoutPixmapInfo *
xf86RRQueryScanoutPixmaps(ScreenPtr screen, int *n_info)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
RRScanoutPixmapInfo *info;
int f;
info = calloc(config->num_scanout_formats, sizeof (RRScanoutPixmapInfo));
if (config->num_scanout_formats && !info) {
*n_info = 0;
return NULL;
}
for (f = 0; f < config->num_scanout_formats; f++) {
info[f].maxWidth = config->scanout_formats[f].maxWidth;
info[f].maxHeight = config->scanout_formats[f].maxHeight;
info[f].depth = config->scanout_formats[f].depth;
info[f].rotations = config->scanout_formats[f].rotations;
info[f].format = PictureMatchFormat (screen, info[f].depth,
config->scanout_formats[f].format);
}
*n_info = config->num_scanout_formats;
return info;
}
static PixmapPtr
xf86RRCreateScanoutPixmap(ScreenPtr screen,
int width, int height, int depth,
Rotation rotations,
PictFormatPtr format)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int f;
if (!config->funcs->create_scanout_pixmap)
return NullPixmap;
for (f = 0; f < config->num_scanout_formats; f++)
if (config->scanout_formats[f].depth == depth &&
(config->scanout_formats[f].format & 0xffffff) == format->format) {
return (*config->funcs->create_scanout_pixmap) (scrn, width, height,
rotations,
&config->scanout_formats[f]);
}
return NullPixmap;
}
static void static void
xf86RandR14SetCrtcSpriteTransform(ScreenPtr pScreen, xf86RandR14SetCrtcSpriteTransform(ScreenPtr pScreen,
RRCrtcPtr randr_crtc, RRCrtcPtr randr_crtc,
@ -1946,17 +1893,17 @@ xf86RandR12Init12 (ScreenPtr pScreen)
rp->rrCrtcGetGamma = xf86RandR12CrtcGetGamma; rp->rrCrtcGetGamma = xf86RandR12CrtcGetGamma;
rp->rrOutputSetProperty = xf86RandR12OutputSetProperty; rp->rrOutputSetProperty = xf86RandR12OutputSetProperty;
rp->rrOutputValidateMode = xf86RandR12OutputValidateMode; rp->rrOutputValidateMode = xf86RandR12OutputValidateMode;
#if RANDR_13_INTERFACE
rp->rrOutputGetProperty = xf86RandR13OutputGetProperty; rp->rrOutputGetProperty = xf86RandR13OutputGetProperty;
rp->rrGetPanning = xf86RandR13GetPanning; rp->rrGetPanning = xf86RandR13GetPanning;
rp->rrSetPanning = xf86RandR13SetPanning; rp->rrSetPanning = xf86RandR13SetPanning;
#endif
rp->rrModeDestroy = xf86RandR12ModeDestroy; rp->rrModeDestroy = xf86RandR12ModeDestroy;
rp->rrSetConfig = NULL; rp->rrSetConfig = NULL;
pScrn->PointerMoved = xf86RandR12PointerMoved; pScrn->PointerMoved = xf86RandR12PointerMoved;
pScrn->ChangeGamma = xf86RandR12ChangeGamma; pScrn->ChangeGamma = xf86RandR12ChangeGamma;
rp->rrSetCrtcSpriteTransform = xf86RandR14SetCrtcSpriteTransform; rp->rrSetCrtcSpriteTransform = xf86RandR14SetCrtcSpriteTransform;
rp->rrSetCrtcConfigs = xf86RRSetCrtcConfigs; rp->rrSetCrtcConfigs = xf86RRSetCrtcConfigs;
rp->rrQueryScanoutPixmaps = xf86RRQueryScanoutPixmaps;
rp->rrCreateScanoutPixmap = xf86RRCreateScanoutPixmap;
randrp->orig_EnterVT = pScrn->EnterVT; randrp->orig_EnterVT = pScrn->EnterVT;
pScrn->EnterVT = xf86RandR12EnterVT; pScrn->EnterVT = xf86RandR12EnterVT;

View File

@ -16,7 +16,6 @@ librandr_la_SOURCES = \
rrinfo.c \ rrinfo.c \
rrmode.c \ rrmode.c \
rroutput.c \ rroutput.c \
rrpixmap.c \
rrpointer.c \ rrpointer.c \
rrproperty.c \ rrproperty.c \
rrscreen.c \ rrscreen.c \

View File

@ -66,8 +66,7 @@ miRRSetCrtcConfig(RRCrtcConfigPtr crtc_config)
y, y,
crtc_config->rotation, crtc_config->rotation,
crtc_config->numOutputs, crtc_config->numOutputs,
crtc_config->outputs, crtc_config->outputs);
crtc_config->pixmap);
} }
Bool Bool

View File

@ -98,7 +98,6 @@ RRCloseScreen (int i, ScreenPtr pScreen)
free(pScrPriv->crtcs); free(pScrPriv->crtcs);
free(pScrPriv->outputs); free(pScrPriv->outputs);
free(pScrPriv->scanout_info);
free(pScrPriv); free(pScrPriv);
RRNScreens -= 1; /* ok, one fewer screen with RandR running */ RRNScreens -= 1; /* ok, one fewer screen with RandR running */
return (*pScreen->CloseScreen) (i, pScreen); return (*pScreen->CloseScreen) (i, pScreen);
@ -249,8 +248,6 @@ Bool RRScreenInit(ScreenPtr pScreen)
pScrPriv->rrCrtcSet = NULL; pScrPriv->rrCrtcSet = NULL;
pScrPriv->rrCrtcSetGamma = NULL; pScrPriv->rrCrtcSetGamma = NULL;
#endif #endif
pScrPriv->scanout_info = NULL;
pScrPriv->n_scanout_info = 0;
#if RANDR_10_INTERFACE #if RANDR_10_INTERFACE
pScrPriv->rrSetConfig = 0; pScrPriv->rrSetConfig = 0;
pScrPriv->rotations = RR_Rotate_0; pScrPriv->rotations = RR_Rotate_0;
@ -485,18 +482,6 @@ RRVerticalRefresh (xRRModeInfo *mode)
return (CARD16) refresh; return (CARD16) refresh;
} }
RRScanoutPixmapInfo *
RRQueryScanoutPixmapInfo(ScreenPtr screen, int *n_info)
{
rrScrPriv(screen);
if (!pScrPriv->scanout_info && pScrPriv->rrQueryScanoutPixmaps)
pScrPriv->scanout_info = pScrPriv->rrQueryScanoutPixmaps(screen,
&pScrPriv->n_scanout_info);
*n_info = pScrPriv->n_scanout_info;
return pScrPriv->scanout_info;
}
static int static int
ProcRRDispatch (ClientPtr client) ProcRRDispatch (ClientPtr client)
{ {

View File

@ -123,7 +123,6 @@ struct _rrCrtc {
CARD16 *gammaGreen; CARD16 *gammaGreen;
void *devPrivate; void *devPrivate;
Bool transforms; Bool transforms;
PixmapPtr scanoutPixmap;
RRTransformRec client_pending_transform; RRTransformRec client_pending_transform;
RRTransformRec client_current_transform; RRTransformRec client_current_transform;
PictTransform client_sprite_position_transform; PictTransform client_sprite_position_transform;
@ -199,8 +198,7 @@ typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
int y, int y,
Rotation rotation, Rotation rotation,
int numOutputs, int numOutputs,
RROutputPtr *outputs, RROutputPtr *outputs);
PixmapPtr scanout_pixmap);
typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen,
RRCrtcPtr crtc); RRCrtcPtr crtc);
@ -266,20 +264,6 @@ typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
#endif #endif
typedef struct {
PictFormatPtr format;
int maxWidth, maxHeight;
int depth;
Rotation rotations;
} RRScanoutPixmapInfo;
typedef RRScanoutPixmapInfo *(*RRQueryScanoutPixmapsPtr) (ScreenPtr pScreen,
int *num_info);
typedef PixmapPtr (*RRCreateScanoutPixmapPtr) (ScreenPtr pScreen,
int width, int height, int depth,
Rotation rotations,
PictFormatPtr format);
typedef void (*RRSetCrtcSpriteTransformPtr) (ScreenPtr pScreen, typedef void (*RRSetCrtcSpriteTransformPtr) (ScreenPtr pScreen,
RRCrtcPtr randr_crtc, RRCrtcPtr randr_crtc,
@ -319,8 +303,6 @@ typedef struct _rrScrPriv {
RRGetPanningProcPtr rrGetPanning; RRGetPanningProcPtr rrGetPanning;
RRSetPanningProcPtr rrSetPanning; RRSetPanningProcPtr rrSetPanning;
#endif #endif
RRQueryScanoutPixmapsPtr rrQueryScanoutPixmaps;
RRCreateScanoutPixmapPtr rrCreateScanoutPixmap;
RRSetCrtcSpriteTransformPtr rrSetCrtcSpriteTransform; RRSetCrtcSpriteTransformPtr rrSetCrtcSpriteTransform;
RRGetCrtcSpriteTransformPtr rrGetCrtcSpriteTransform; RRGetCrtcSpriteTransformPtr rrGetCrtcSpriteTransform;
RRSetCrtcConfigsPtr rrSetCrtcConfigs; RRSetCrtcConfigsPtr rrSetCrtcConfigs;
@ -351,8 +333,6 @@ typedef struct _rrScrPriv {
/* Last known pointer position */ /* Last known pointer position */
RRCrtcPtr pointerCrtc; RRCrtcPtr pointerCrtc;
RRScanoutPixmapInfo *scanout_info;
int n_scanout_info;
#ifdef RANDR_10_INTERFACE #ifdef RANDR_10_INTERFACE
/* /*
* Configuration information * Configuration information
@ -367,7 +347,6 @@ typedef struct _rrScrPriv {
int rate; int rate;
int size; int size;
#endif #endif
} rrScrPrivRec, *rrScrPrivPtr; } rrScrPrivRec, *rrScrPrivPtr;
extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec; extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
@ -542,9 +521,6 @@ RRGetRotation (ScreenPtr pScreen);
extern _X_EXPORT CARD16 extern _X_EXPORT CARD16
RRVerticalRefresh (xRRModeInfo *mode); RRVerticalRefresh (xRRModeInfo *mode);
extern _X_EXPORT RRScanoutPixmapInfo *
RRQueryScanoutPixmapInfo(ScreenPtr screen, int *n_info);
#ifdef RANDR_10_INTERFACE #ifdef RANDR_10_INTERFACE
/* /*
* This is the old interface, deprecated but left * This is the old interface, deprecated but left
@ -623,8 +599,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
Rotation rotation, Rotation rotation,
RRTransformPtr transform, RRTransformPtr transform,
int numOutputs, int numOutputs,
RROutputPtr *outputs, RROutputPtr *outputs);
PixmapPtr scanoutPixmap);
extern _X_EXPORT void extern _X_EXPORT void
RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc); RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
@ -639,8 +614,7 @@ RRCrtcSet (RRCrtcPtr crtc,
int y, int y,
Rotation rotation, Rotation rotation,
int numOutput, int numOutput,
RROutputPtr *outputs, RROutputPtr *outputs);
PixmapPtr scanout_pixmap);
/* /*
* Request that the Crtc gamma be changed * Request that the Crtc gamma be changed
@ -669,10 +643,6 @@ RRCrtcGammaGet(RRCrtcPtr crtc);
extern _X_EXPORT Bool extern _X_EXPORT Bool
RRCrtcGammaNotify (RRCrtcPtr crtc); RRCrtcGammaNotify (RRCrtcPtr crtc);
void
RRModeGetScanoutSize (RRModePtr mode, struct pixman_f_transform *transform,
int *width, int *height);
/* /*
* Set the size of the gamma table at server startup time * Set the size of the gamma table at server startup time
*/ */
@ -807,24 +777,12 @@ RRCrtcSpriteTransformSet(RRCrtcPtr crtc,
struct pict_f_transform *f_position_transform, struct pict_f_transform *f_position_transform,
struct pict_f_transform *f_image_transform); struct pict_f_transform *f_image_transform);
int
ProcRRQueryScanoutPixmaps (ClientPtr client);
int
ProcRRCreateScanoutPixmap (ClientPtr client);
int
ProcRRSetCrtcPixmapConfig (ClientPtr client);
int int
ProcRRSetCrtcSpriteTransform (ClientPtr client); ProcRRSetCrtcSpriteTransform (ClientPtr client);
int int
ProcRRGetCrtcSpriteTransform (ClientPtr client); ProcRRGetCrtcSpriteTransform (ClientPtr client);
int
ProcRRSetCrtcConfigs (ClientPtr client);
/* rrdispatch.c */ /* rrdispatch.c */
extern _X_EXPORT Bool extern _X_EXPORT Bool
RRClientKnowsRates (ClientPtr pClient); RRClientKnowsRates (ClientPtr pClient);

View File

@ -138,8 +138,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
Rotation rotation, Rotation rotation,
RRTransformPtr transform, RRTransformPtr transform,
int numOutputs, int numOutputs,
RROutputPtr *outputs, RROutputPtr *outputs)
PixmapPtr scanoutPixmap)
{ {
int i, j; int i, j;
@ -237,15 +236,6 @@ RRCrtcNotify (RRCrtcPtr crtc,
RRCrtcChanged (crtc, TRUE); RRCrtcChanged (crtc, TRUE);
} }
if (scanoutPixmap != crtc->scanoutPixmap)
{
if (scanoutPixmap)
++scanoutPixmap->refcnt;
if (crtc->scanoutPixmap)
(*crtc->scanoutPixmap->drawable.pScreen->DestroyPixmap) (crtc->scanoutPixmap);
crtc->scanoutPixmap = scanoutPixmap;
}
if (crtc->changed && mode) if (crtc->changed && mode)
{ {
RRTransformCompute (x, y, RRTransformCompute (x, y,
@ -322,8 +312,7 @@ RRCrtcSet (RRCrtcPtr crtc,
int y, int y,
Rotation rotation, Rotation rotation,
int numOutputs, int numOutputs,
RROutputPtr *outputs, RROutputPtr *outputs)
PixmapPtr scanout_pixmap)
{ {
ScreenPtr pScreen = crtc->pScreen; ScreenPtr pScreen = crtc->pScreen;
Bool ret = FALSE; Bool ret = FALSE;
@ -337,8 +326,7 @@ RRCrtcSet (RRCrtcPtr crtc,
crtc->numOutputs == numOutputs && crtc->numOutputs == numOutputs &&
!memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) && !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) &&
!RRCrtcPendingProperties (crtc) && !RRCrtcPendingProperties (crtc) &&
!RRCrtcPendingTransform (crtc) && !RRCrtcPendingTransform (crtc))
crtc->scanoutPixmap == scanout_pixmap)
{ {
ret = TRUE; ret = TRUE;
} }
@ -348,7 +336,7 @@ RRCrtcSet (RRCrtcPtr crtc,
if (pScrPriv->rrCrtcSet) if (pScrPriv->rrCrtcSet)
{ {
ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y, ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
rotation, numOutputs, outputs, scanout_pixmap); rotation, numOutputs, outputs);
} }
else else
#endif #endif
@ -361,7 +349,7 @@ RRCrtcSet (RRCrtcPtr crtc,
if (!mode) if (!mode)
{ {
RRCrtcNotify (crtc, NULL, x, y, rotation, NULL, 0, NULL, scanout_pixmap); RRCrtcNotify (crtc, NULL, x, y, rotation, NULL, 0, NULL);
ret = TRUE; ret = TRUE;
} }
else else
@ -387,7 +375,7 @@ RRCrtcSet (RRCrtcPtr crtc,
*/ */
if (ret) if (ret)
{ {
RRCrtcNotify (crtc, mode, x, y, rotation, NULL, 1, outputs, scanout_pixmap); RRCrtcNotify (crtc, mode, x, y, rotation, NULL, 1, outputs);
RRScreenSizeNotify (pScreen); RRScreenSizeNotify (pScreen);
} }
} }
@ -585,10 +573,7 @@ RRCrtcGammaNotify (RRCrtcPtr crtc)
return TRUE; /* not much going on here */ return TRUE; /* not much going on here */
} }
/* static void
* Compute overall scanout buffer requirements for the specified mode
*/
void
RRModeGetScanoutSize (RRModePtr mode, struct pixman_f_transform *transform, RRModeGetScanoutSize (RRModePtr mode, struct pixman_f_transform *transform,
int *width, int *height) int *width, int *height)
{ {
@ -1064,7 +1049,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
} }
if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y, if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y,
rotation, numOutputs, outputs, NULL)) rotation, numOutputs, outputs))
{ {
rep.status = RRSetConfigFailed; rep.status = RRSetConfigFailed;
goto sendReply; goto sendReply;

View File

@ -168,7 +168,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
/* notice current mode */ /* notice current mode */
if (newMode) if (newMode)
RRCrtcNotify (crtc, newMode, 0, 0, pScrPriv->rotation, RRCrtcNotify (crtc, newMode, 0, 0, pScrPriv->rotation,
NULL, 1, &output, NULL); NULL, 1, &output);
} }
#endif #endif

View File

@ -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;
}

View File

@ -794,10 +794,8 @@ ProcRRSetScreenConfig (ClientPtr client)
} }
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
if (rc != Success) { if (rc != Success)
client->errorValue = stuff->drawable;
return rc; return rc;
}
pScreen = pDraw->pScreen; pScreen = pDraw->pScreen;
@ -954,7 +952,7 @@ ProcRRSetScreenConfig (ClientPtr client)
for (c = 0; c < pScrPriv->numCrtcs; c++) for (c = 0; c < pScrPriv->numCrtcs; c++)
{ {
if (!RRCrtcSet (pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0, if (!RRCrtcSet (pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0,
0, NULL, NULL)) 0, NULL))
{ {
rep.status = RRSetConfigFailed; rep.status = RRSetConfigFailed;
/* XXX recover from failure */ /* XXX recover from failure */
@ -970,7 +968,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))
rep.status = RRSetConfigFailed; rep.status = RRSetConfigFailed;
else { else {
pScrPriv->lastSetTime = time; pScrPriv->lastSetTime = time;