8000 xbmc/xbmc-xrandr.c at Leia · AIahmedshrf/xbmc · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
3497 lines (3149 loc) · 87.2 KB

xbmc-xrandr.c

File metadata and controls

3497 lines (3149 loc) · 87.2 KB
/*
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
* Copyright © 2002 Hewlett Packard Company, Inc.
* Copyright © 2006 Intel Corporation
*
* 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.
*
* Thanks to Jim Gettys who wrote most of the client side code,
* and part of the server code for randr.
*/
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/Xrender.h> /* we share subpixel information */
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdint.h>
#include <math.h>
#ifndef _X_NORETURN
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
#define _X_NORETURN __attribute((noreturn))
#else
#define _X_NORETURN
#endif
#endif
static char *program_name;
static Display *dpy;
static Window root;
static int screen = -1;
static Bool verbose = False;
static Bool automatic = False;
static Bool properties = False;
static Bool grab_server = True;
static Bool no_primary = False;
static char *direction[5] = {
"normal",
"left",
"inverted",
"right",
"\n"};
static char *reflections[5] = {
"normal",
"x",
"y",
"xy",
"\n"};
/* subpixel order */
static char *order[6] = {
"unknown",
"horizontal rgb",
"horizontal bgr",
"vertical rgb",
"vertical bgr",
"no subpixels"};
static const struct {
char *string;
unsigned long flag;
} mode_flags[] = {
{ "+HSync", RR_HSyncPositive },
{ "-HSync", RR_HSyncNegative },
{ "+VSync", RR_VSyncPositive },
{ "-VSync", RR_VSyncNegative },
{ "Interlace", RR_Interlace },
{ "DoubleScan", RR_DoubleScan },
{ "CSync", RR_CSync },
{ "+CSync", RR_CSyncPositive },
{ "-CSync", RR_CSyncNegative },
{ NULL, 0 }
};
static void _X_NORETURN
usage(void)
{
fprintf(stderr, "usage: %s [options]\n", program_name);
fprintf(stderr, " where options are:\n");
fprintf(stderr, " -display <display> or -d <display>\n");
fprintf(stderr, " -help\n");
fprintf(stderr, " -o <normal,inverted,left,right,0,1,2,3>\n");
fprintf(stderr, " or --orientation <normal,inverted,left,right,0,1,2,3>\n");
fprintf(stderr, " -q or --query\n");
fprintf(stderr, " -s <size>/<width>x<height> or --size <size>/<width>x<height>\n");
fprintf(stderr, " -r <rate> or --rate <rate> or --refresh <rate>\n");
fprintf(stderr, " -v or --version\n");
fprintf(stderr, " -x (reflect in x)\n");
fprintf(stderr, " -y (reflect in y)\n");
fprintf(stderr, " --screen <screen>\n");
fprintf(stderr, " --verbose\n");
fprintf(stderr, " --current\n");
fprintf(stderr, " --dryrun\n");
fprintf(stderr, " --nograb\n");
fprintf(stderr, " --prop or --properties\n");
fprintf(stderr, " --fb <width>x<height>\n");
fprintf(stderr, " --fbmm <width>x<height>\n");
fprintf(stderr, " --dpi <dpi>/<output>\n");
fprintf(stderr, " --output <output>\n");
fprintf(stderr, " --auto\n");
fprintf(stderr, " --mode <mode>\n");
fprintf(stderr, " --preferred\n");
fprintf(stderr, " --pos <x>x<y>\n");
fprintf(stderr, " --rate <rate> or --refresh <rate>\n");
fprintf(stderr, " --reflect normal,x,y,xy\n");
fprintf(stderr, " --rotate normal,inverted,left,right\n");
fprintf(stderr, " --left-of <output>\n");
fprintf(stderr, " --right-of <output>\n");
fprintf(stderr, " --above <output>\n");
fprintf(stderr, " --below <output>\n");
fprintf(stderr, " --same-as <output>\n");
fprintf(stderr, " --set <property> <value>\n");
fprintf(stderr, " --scale <x>x<y>\n");
fprintf(stderr, " --scale-from <w>x<h>\n");
fprintf(stderr, " --transform <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>\n");
fprintf(stderr, " --off\n");
fprintf(stderr, " --crtc <crtc>\n");
fprintf(stderr, " --panning <w>x<h>[+<x>+<y>[/<track:w>x<h>+<x>+<y>[/<border:l>/<t>/<r>/<b>]]]\n");
fprintf(stderr, " --gamma <r>:<g>:<b>\n");
fprintf(stderr, " --primary\n");
fprintf(stderr, " --noprimary\n");
fprintf(stderr, " --newmode <name> <clock MHz>\n");
fprintf(stderr, " <hdisp> <hsync-start> <hsync-end> <htotal>\n");
fprintf(stderr, " <vdisp> <vsync-start> <vsync-end> <vtotal>\n");
fprintf(stderr, " [flags...]\n");
fprintf(stderr, " Valid flags: +HSync -HSync +VSync -VSync\n");
fprintf(stderr, " +CSync -CSync CSync Interlace DoubleScan\n");
fprintf(stderr, " --rmmode <name>\n");
fprintf(stderr, " --addmode <output> <name>\n");
fprintf(stderr, " --delmode <output> <name>\n");
exit(1);
/*NOTREACHED*/
}
static void _X_NORETURN
fatal (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "%s: ", program_name);
vfprintf (stderr, format, ap);
va_end (ap);
exit (1);
/*NOTREACHED*/
}
static void
warning (const char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "%s: ", program_name);
vfprintf (stderr, format, ap);
va_end (ap);
}
/* Because fmin requires C99 support */
static inline double dmin (double x, double y)
{
return x < y ? x : y;
}
static char *
rotation_name (Rotation rotation)
{
int i;
if ((rotation & 0xf) == 0)
return "normal";
for (i = 0; i < 4; i++)
if (rotation & (1 << i))
return direction[i];
return "invalid rotation";
}
static char *
reflection_name (Rotation rotation)
{
rotation &= (RR_Reflect_X|RR_Reflect_Y);
switch (rotation) {
case 0:
return "none";
case RR_Reflect_X:
return "X axis";
case RR_Reflect_Y:
return "Y axis";
case RR_Reflect_X|RR_Reflect_Y:
return "X and Y axis";
}
return "invalid reflection";
BD0
}
typedef enum _relation {
relation_left_of,
relation_right_of,
relation_above,
relation_below,
relation_same_as,
} relation_t;
typedef struct {
int x, y, width, height;
} rectangle_t;
typedef struct {
int x1, y1, x2, y2;
} box_t;
typedef struct {
int x, y;
} point_t;
typedef enum _changes {
changes_none = 0,
changes_crtc = (1 << 0),
changes_mode = (1 << 1),
changes_relation = (1 << 2),
changes_position = (1 << 3),
changes_rotation = (1 << 4),
changes_reflection = (1 << 5),
changes_automatic = (1 << 6),
changes_refresh = (1 << 7),
changes_property = (1 << 8),
changes_transform = (1 << 9),
changes_panning = (1 << 10),
changes_gamma = (1 << 11),
changes_primary = (1 << 12),
} changes_t;
typedef enum _name_kind {
name_none = 0,
name_string = (1 << 0),
name_xid = (1 << 1),
name_index = (1 << 2),
name_preferred = (1 << 3),
} name_kind_t;
typedef struct {
name_kind_t kind;
char *string;
XID xid;
int index;
} name_t;
typedef struct _crtc crtc_t;
typedef struct _output output_t;
typedef struct _transform transform_t;
typedef struct _umode umode_t;
typedef struct _output_prop output_prop_t;
struct _transform {
XTransform transform;
char *filter;
int nparams;
XFixed *params;
};
struct _crtc {
name_t crtc;
Bool changing;
XRRCrtcInfo *crtc_info;
XRRModeInfo *mode_info;
XRRPanning *panning_info;
int x;
int y;
Rotation rotation;
output_t **outputs;
int noutput;
transform_t current_transform, pending_transform;
};
struct _output_prop {
struct _output_prop *next;
char *name;
char *value;
};
struct _output {
struct _output *next;
changes_t changes;
output_prop_t *props;
name_t output;
XRROutputInfo *output_info;
name_t crtc;
crtc_t *crtc_info;
crtc_t *current_crtc_info;
name_t mode;
double refresh;
XRRModeInfo *mode_info;
name_t addmode;
relation_t relation;
char *relative_to;
int x, y;
Rotation rotation;
XRRPanning panning;
Bool automatic;
int scale_from_w, scale_from_h;
transform_t transform;
struct {
float red;
float green;
float blue;
} gamma;
float brightness;
Bool primary;
Bool found;
};
typedef enum _umode_action {
umode_create, umode_destroy, umode_add, umode_delete
} umode_action_t;
struct _umode {
struct _umode *next;
umode_action_t action;
XRRModeInfo mode;
name_t output;
name_t name;
};
/*
static char *connection[3] = {
"connected",
"disconnected",
"unknown connection"};
*/
static char *connection[3] = {
"true",
"false",
"unknown"};
#define OUTPUT_NAME 1
#define CRTC_OFF 2
#define CRTC_UNSET 3
#define CRTC_INDEX 0x40000000
#define MODE_NAME 1
#define MODE_OFF 2
#define MODE_UNSET 3
#define MODE_PREF 4
#define POS_UNSET -1
static output_t *outputs = NULL;
static output_t **outputs_tail = &outputs;
static crtc_t *crtcs;
static umode_t *umodes;
static int num_crtcs;
static XRRScreenResources *res;
static int fb_width = 0, fb_height = 0;
static int fb_width_mm = 0, fb_height_mm = 0;
static double dpi = 0;
static char *dpi_output = NULL;
static Bool dryrun = False;
static int minWidth, maxWidth, minHeight, maxHeight;
static Bool has_1_2 = False;
static Bool has_1_3 = False;
static int
mode_height (XRRModeInfo *mode_info, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
case RR_Rotate_180:
return mode_info->height;
case RR_Rotate_90:
case RR_Rotate_270:
return mode_info->width;
default:
return 0;
}
}
static int
mode_width (XRRModeInfo *mode_info, Rotation rotation)
{
switch (rotation & 0xf) {
case RR_Rotate_0:
case RR_Rotate_180:
return mode_info->width;
case RR_Rotate_90:
case RR_Rotate_270:
return mode_info->height;
default:
return 0;
}
}
static Bool
transform_point (XTransform *transform, double *xp, double *yp)
{
double vector[3];
double result[3];
int i, j;
double v;
vector[0] = *xp;
vector[1] = *yp;
vector[2] = 1;
for (j = 0; j < 3; j++)
{
v = 0;
for (i = 0; i < 3; i++)
v += (XFixedToDouble (transform->matrix[j][i]) * vector[i]);
result[j] = v;
}
if (!result[2])
return False;
for (j = 0; j < 2; j++) {
vector[j] = result[j] / result[2];
if (vector[j] > 32767 || vector[j] < -32767)
return False;
}
*xp = vector[0];
*yp = vector[1];
return True;
}
static void
path_bounds (XTransform *transform, point_t *points, int npoints, box_t *box)
{
int i;
box_t point;
for (i = 0; i < npoints; i++) {
double x, y;
x = points[i].x;
y = points[i].y;
transform_point (transform, &x, &y);
point.x1 = floor (x);
point.y1 = floor (y);
point.x2 = ceil (x);
point.y2 = ceil (y);
if (i == 0)
*box = point;
else {
if (point.x1 < box->x1) box->x1 = point.x1;
if (point.y1 < box->y1) box->y1 = point.y1;
if (point.x2 > box->x2) box->x2 = point.x2;
if (point.y2 > box->y2) box->y2 = point.y2;
}
}
}
static void
mode_geometry (XRRModeInfo *mode_info, Rotation rotation,
XTransform *transform,
box_t *bounds)
{
point_t rect[4];
int width = mode_width (mode_info, rotation);
int height = mode_height (mode_info, rotation);
rect[0].x = 0;
rect[0].y = 0;
rect[1].x = width;
rect[1].y = 0;
rect[2].x = width;
rect[2].y = height;
rect[3].x = 0;
rect[3].y = height;
path_bounds (transform, rect, 4, bounds);
}
/* v refresh frequency in Hz */
static double
mode_refresh (XRRModeInfo *mode_info)
{
double rate;
if (mode_info->hTotal && mode_info->vTotal)
rate = ((double) mode_info->dotClock /
((double) mode_info->hTotal * (double) mode_info->vTotal));
else
rate = 0;
return rate;
}
/* h sync frequency in Hz */
static double
mode_hsync (XRRModeInfo *mode_info)
{
double rate;
if (mode_info->hTotal)
rate = (double) mode_info->dotClock / (double) mode_info->hTotal;
else
rate = 0;
return rate;
}
static void
init_name (name_t *name)
{
name->kind = name_none;
}
static void
set_name_string (name_t *name, char *string)
{
name->kind |= name_string;
name->string = string;
}
static void
set_name_xid (name_t *name, XID xid)
{
name->kind |= name_xid;
name->xid = xid;
}
static void
set_name_index (name_t *name, int index)
{
name->kind |= name_index;
name->index = index;
}
static void
set_name_preferred (name_t *name)
{
name->kind |= name_preferred;
}
static void
set_name_all (name_t *name, name_t *old)
{
if (old->kind & name_xid)
name->xid = old->xid;
if (old->kind & name_string)
name->string = old->string;
if (old->kind & name_index)
name->index = old->index;
name->kind |= old->kind;
}
static void
set_name (name_t *name, char *string, name_kind_t valid)
{
unsigned int xid; /* don't make it XID (which is unsigned long):
scanf() takes unsigned int */
int index;
if ((valid & name_xid) && sscanf (string, "0x%x", &xid) == 1)
set_name_xid (name, xid);
else if ((valid & name_index) && sscanf (string, "%d", &index) == 1)
set_name_index (name, index);
else if (valid & name_string)
set_name_string (name, string);
else
usage ();
}
static void
init_transform (transform_t *transform)
{
int x;
memset (&transform->transform, '\0', sizeof (transform->transform));
for (x = 0; x < 3; x++)
transform->transform.matrix[x][x] = XDoubleToFixed (1.0);
transform->filter = "";
transform->nparams = 0;
transform->params = NULL;
}
static void
set_transform (transform_t *dest,
XTransform *transform,
char *filter,
XFixed *params,
int nparams)
{
dest->transform = *transform;
dest->filter = strdup (filter);
dest->nparams = nparams;
dest->params = malloc (nparams * sizeof (XFixed));
memcpy (dest->params, params, nparams * sizeof (XFixed));
}
static void
copy_transform (transform_t *dest, transform_t *src)
{
set_transform (dest, &src->transform,
src->filter, src->params, src->nparams);
}
static Bool
equal_transform (transform_t *a, transform_t *b)
{
if (memcmp (&a->transform, &b->transform, sizeof (XTransform)) != 0)
return False;
if (strcmp (a->filter, b->filter) != 0)
return False;
if (a->nparams != b->nparams)
return False;
if (memcmp (a->params, b->params, a->nparams * sizeof (XFixed)) != 0)
return False;
return True;
}
static output_t *
add_output (void)
{
output_t *output = calloc (1, sizeof (output_t));
if (!output)
fatal ("out of memory\n");
output->next = NULL;
output->found = False;
output->brightness = 1.0;
*outputs_tail = output;
outputs_tail = &output->next;
return output;
}
static output_t *
find_output (name_t *name)
{
output_t *output;
for (output = outputs; output; output = output->next)
{
name_kind_t common = name->kind & output->output.kind;
if ((common & name_xid) && name->xid == output->output.xid)
break;
if ((common & name_string) && !strcmp (name->string, output->output.string))
break;
if ((common & name_index) && name->index == output->output.index)
break;
}
return output;
}
static output_t *
find_output_by_xid (RROutput output)
{
name_t output_name;
init_name (&output_name);
set_name_xid (&output_name, output);
return find_output (&output_name);
}
static output_t *
find_output_by_name (char *name)
{
name_t output_name;
init_name (&output_name);
set_name_string (&output_name, name);
return find_output (&output_name);
}
static crtc_t *
find_crtc (name_t *name)
{
int c;
crtc_t *crtc = NULL;
for (c = 0; c < num_crtcs; c++)
{
name_kind_t common;
crtc = &crtcs[c];
common = name->kind & crtc->crtc.kind;
if ((common & name_xid) && name->xid == crtc->crtc.xid)
break;
if ((common & name_string) && !strcmp (name->string, crtc->crtc.string))
break;
if ((common & name_index) && name->index == crtc->crtc.index)
break;
crtc = NULL;
}
return crtc;
}
static crtc_t *
find_crtc_by_xid (RRCrtc crtc)
{
name_t crtc_name;
init_name (&crtc_name);
set_name_xid (&crtc_name, crtc);
return find_crtc (&crtc_name);
}
static XRRModeInfo *
find_mode (name_t *name, double refresh)
{
int m;
XRRModeInfo *best = NULL;
double bestDist = 0;
for (m = 0; m < res->nmode; m++)
{
XRRModeInfo *mode = &res->modes[m];
if ((name->kind & name_xid) && name->xid == mode->id)
{
best = mode;
break;
}
if ((name->kind & name_string) && !strcmp (name->string, mode->name))
{
double dist;
if (refresh)
dist = fabs (mode_refresh (mode) - refresh);
else
dist = 0;
if (!best || dist < bestDist)
{
bestDist = dist;
best = mode;
}
}
}
return best;
}
static XRRModeInfo *
find_mode_by_xid (RRMode mode)
{
name_t mode_name;
init_name (&mode_name);
set_name_xid (&mode_name, mode);
return find_mode (&mode_name, 0);
}
#if 0
static XRRModeInfo *
find_mode_by_name (char *name)
{
name_t mode_name;
init_name (&mode_name);
set_name_string (&mode_name, name);
return find_mode (&mode_name, 0);
}
#endif
static
XRRModeInfo *
find_mode_for_output (output_t *output, name_t *name)
{
XRROutputInfo *output_info = output->output_info;
int m;
XRRModeInfo *best = NULL;
double bestDist = 0;
for (m = 0; m < output_info->nmode; m++)
{
XRRModeInfo *mode;
mode = find_mode_by_xid (output_info->modes[m]);
if (!mode) continue;
if ((name->kind & name_xid) && name->xid == mode->id)
{
best = mode;
break;
}
if ((name->kind & name_string) && !strcmp (name->string, mode->name))
{
double dist;
/* Stay away from doublescan modes unless refresh rate is specified. */
if (!output->refresh && (mode->modeFlags & RR_DoubleScan))
continue;
if (output->refresh)
dist = fabs (mode_refresh (mode) - output->refresh);
else
dist = 0;
if (!best || dist < bestDist)
{
bestDist = dist;
best = mode;
}
}
}
return best;
}
static XRRModeInfo *
preferred_mode (output_t *output)
{
XRROutputInfo *output_info = output->output_info;
int m;
XRRModeInfo *best;
int bestDist;
best = NULL;
bestDist = 0;
for (m = 0; m < output_info->nmode; m++)
{
XRRModeInfo *mode_info = find_mode_by_xid (output_info->modes[m]);
int dist;
if (m < output_info->npreferred)
dist = 0;
else if (output_info->mm_height)
dist = (1000 * DisplayHeight(dpy, screen) / DisplayHeightMM(dpy, screen) -
1000 * mode_info->height / output_info->mm_height);
else
dist = DisplayHeight(dpy, screen) - mode_info->height;
if (dist < 0) dist = -dist;
if (!best || dist < bestDist)
{
best = mode_info;
bestDist = dist;
}
}
return best;
}
static Bool
output_can_use_crtc (output_t *output, crtc_t *crtc)
{
XRROutputInfo *output_info = output->output_info;
int c;
for (c = 0; c < output_info->ncrtc; c++)
if (output_info->crtcs[c] == crtc->crtc.xid)
return True;
return False;
}
static Bool
output_can_use_mode (output_t *output, XRRModeInfo *mode)
{
XRROutputInfo *output_info = output->output_info;
int m;
for (m = 0; m < output_info->nmode; m++)
if (output_info->modes[m] == mode->id)
return True;
return False;
}
static Bool
crtc_can_use_rotation (crtc_t *crtc, Rotation rotation)
{
Rotation rotations = crtc->crtc_info->rotations;
Rotation dir = rotation & (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270);
Rotation reflect = rotation & (RR_Reflect_X|RR_Reflect_Y);
if (((rotations & dir) != 0) && ((rotations & reflect) == reflect))
return True;
return False;
}
#if 0
static Bool
crtc_can_use_transform (crtc_t *crtc, XTransform *transform)
{
int major, minor;
XRRQueryVersion (dpy, &major, &minor);
if (major > 1 || (major == 1 && minor >= 3))
return True;
return False;
}
/*
* Report only rotations that are supported by all crtcs
*/
static Rotation
output_rotations (output_t *output)
{
Bool found = False;
Rotation rotation = RR_Rotate_0;
XRROutputInfo *output_info = output->output_info;
int c;
for (c = 0; c < output_info->ncrtc; c++)
{
crtc_t *crtc = find_crtc_by_xid (output_info->crtcs[c]);
if (crtc)
{
if (!found) {
rotation = crtc->crtc_info->rotations;
found = True;
} else
rotation &= crtc->crtc_info->rotations;
}
}
return rotation;
}
#endif
static Bool
output_can_use_rotation (output_t *output, Rotation rotation)
{
XRROutputInfo *output_info = output->output_info;
int c;
/* make sure all of the crtcs can use this rotation.
* yes, this is not strictly necessary, but it is
* simpler,and we expect most drivers to either
* support rotation everywhere or nowhere
*/
for (c = 0; c < output_info->ncrtc; c++)
{
crtc_t *crtc = find_crtc_by_xid (output_info->crtcs[c]);
if (crtc && !crtc_can_use_rotation (crtc, rotation))
return False;
}
return True;
}
static Bool
output_is_primary(output_t *output)
{
if (has_1_3)
return XRRGetOutputPrimary(dpy, root) == output->output.xid;
return False;
}
/* Returns the index of the last value in an array < 0xffff */
static int
find_last_non_clamped(CARD16 array[], int size) {
int i;
for (i = size - 1; i > 0; i--) {
if (array[i] < 0xffff)
return i;
}
return 0;
}
static void
set_gamma_info(output_t *output)
{
XRRCrtcGamma *gamma;
double i1, v1, i2, v2;
int size, middle, last_best, last_red, last_green, last_blue;
CARD16 *best_array;
if (!output->crtc_info)
return;
size = XRRGetCrtcGammaSize(dpy, output->crtc_info->crtc.xid);
if (!size) {
warning("Failed to get size of gamma for output %s\n", output->output.string);
return;
}
gamma = XRRGetCrtcGamma(dpy, output->crtc_info->crtc.xid);
if (!gamma) {
warning("Failed to get gamma for output %s\n", output->output.string);
return;
}
0