summaryrefslogtreecommitdiff
path: root/xserver/hw/xfree86/modes
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/hw/xfree86/modes')
-rw-r--r--xserver/hw/xfree86/modes/Makefile.in6
-rw-r--r--xserver/hw/xfree86/modes/xf86Crtc.c223
-rw-r--r--xserver/hw/xfree86/modes/xf86Crtc.h26
-rw-r--r--xserver/hw/xfree86/modes/xf86Cursors.c29
-rw-r--r--xserver/hw/xfree86/modes/xf86DiDGA.c2
-rw-r--r--xserver/hw/xfree86/modes/xf86RandR12.c90
-rw-r--r--xserver/hw/xfree86/modes/xf86Rotate.c8
7 files changed, 323 insertions, 61 deletions
diff --git a/xserver/hw/xfree86/modes/Makefile.in b/xserver/hw/xfree86/modes/Makefile.in
index 42ea6d2ee..c02b859eb 100644
--- a/xserver/hw/xfree86/modes/Makefile.in
+++ b/xserver/hw/xfree86/modes/Makefile.in
@@ -58,8 +58,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/xorg-tls.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -251,7 +250,6 @@ GLAMOR_LIBS = @GLAMOR_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GLX_SYS_LIBS = @GLX_SYS_LIBS@
-GLX_TLS = @GLX_TLS@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
GREP = @GREP@
@@ -381,8 +379,6 @@ XEPHYR_INCS = @XEPHYR_INCS@
XEPHYR_LIBS = @XEPHYR_LIBS@
XF86CONFIGDIR = @XF86CONFIGDIR@
XF86CONFIGFILE = @XF86CONFIGFILE@
-XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
-XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
diff --git a/xserver/hw/xfree86/modes/xf86Crtc.c b/xserver/hw/xfree86/modes/xf86Crtc.c
index 9d592a7eb..6091b5e5b 100644
--- a/xserver/hw/xfree86/modes/xf86Crtc.c
+++ b/xserver/hw/xfree86/modes/xf86Crtc.c
@@ -118,7 +118,7 @@ xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
/* Preallocate gamma at a sensible size. */
crtc->gamma_size = 256;
- crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof(CARD16));
+ crtc->gamma_red = xallocarray(crtc->gamma_size, 3 * sizeof(CARD16));
if (!crtc->gamma_red) {
free(crtc);
return NULL;
@@ -127,10 +127,10 @@ xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs)
crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
if (xf86_config->crtc)
- crtcs = realloc(xf86_config->crtc,
- (xf86_config->num_crtc + 1) * sizeof(xf86CrtcPtr));
+ crtcs = reallocarray(xf86_config->crtc,
+ xf86_config->num_crtc + 1, sizeof(xf86CrtcPtr));
else
- crtcs = malloc((xf86_config->num_crtc + 1) * sizeof(xf86CrtcPtr));
+ crtcs = xallocarray(xf86_config->num_crtc + 1, sizeof(xf86CrtcPtr));
if (!crtcs) {
free(crtc->gamma_red);
free(crtc);
@@ -368,6 +368,12 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
xf86CrtcSetScreenSubpixelOrder(scrn->pScreen);
if (scrn->ModeSet)
scrn->ModeSet(scrn);
+
+ /* Make sure the HW cursor is hidden if it's supposed to be, in case
+ * it was hidden while the CRTC was disabled
+ */
+ if (!xf86_config->cursor_on)
+ xf86_hide_cursors(scrn);
}
else {
crtc->x = saved_x;
@@ -620,11 +626,12 @@ xf86OutputCreate(ScrnInfoPtr scrn,
}
if (xf86_config->output)
- outputs = realloc(xf86_config->output,
- (xf86_config->num_output +
- 1) * sizeof(xf86OutputPtr));
+ outputs = reallocarray(xf86_config->output,
+ xf86_config->num_output + 1,
+ sizeof(xf86OutputPtr));
else
- outputs = malloc((xf86_config->num_output + 1) * sizeof(xf86OutputPtr));
+ outputs = xallocarray(xf86_config->num_output + 1,
+ sizeof(xf86OutputPtr));
if (!outputs) {
free(output);
return NULL;
@@ -942,7 +949,7 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
if (modes[n] == NULL)
return best_score;
- crtcs = malloc(config->num_output * sizeof(xf86CrtcPtr));
+ crtcs = xallocarray(config->num_output, sizeof(xf86CrtcPtr));
if (!crtcs)
return best_score;
@@ -1123,6 +1130,15 @@ xf86InitialOutputPositions(ScrnInfoPtr scrn, DisplayModePtr * modes)
int o;
int min_x, min_y;
+ /* check for initial right-of heuristic */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ if (output->initial_x || output->initial_y)
+ return TRUE;
+ }
+
for (o = 0; o < config->num_output; o++) {
xf86OutputPtr output = config->output[o];
@@ -2102,6 +2118,118 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
return match;
}
+static int
+numEnabledOutputs(xf86CrtcConfigPtr config, Bool *enabled)
+{
+ int i = 0, p;
+
+ for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++) ;
+
+ return i;
+}
+
+static Bool
+xf86TargetRightOf(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
+ DisplayModePtr *modes, Bool *enabled,
+ int width, int height)
+{
+ int o;
+ int w = 0;
+ Bool has_tile = FALSE;
+ uint32_t configured_outputs;
+
+ if (scrn->preferClone)
+ return FALSE;
+
+ if (numEnabledOutputs(config, enabled) < 2)
+ return FALSE;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ DisplayModePtr mode =
+ xf86OutputHasPreferredMode(config->output[o], width, height);
+
+ if (!mode)
+ return FALSE;
+
+ w += mode->HDisplay;
+ }
+
+ if (w > width)
+ return FALSE;
+
+ w = 0;
+ configured_outputs = 0;
+
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ DisplayModePtr mode =
+ xf86OutputHasPreferredMode(config->output[o], width, height);
+
+ if (configured_outputs & (1 << o))
+ continue;
+
+ if (config->output[o]->tile_info.group_id) {
+ has_tile = TRUE;
+ continue;
+ }
+
+ config->output[o]->initial_x = w;
+ w += mode->HDisplay;
+
+ configured_outputs |= (1 << o);
+ modes[o] = mode;
+ }
+
+ if (has_tile) {
+ for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
+ int ht, vt, ot;
+ int add_x, cur_x = w;
+ struct xf86CrtcTileInfo *tile_info = &config->output[o]->tile_info, *this_tile;
+ if (configured_outputs & (1 << o))
+ continue;
+ if (!tile_info->group_id)
+ continue;
+
+ if (tile_info->tile_h_loc != 0 && tile_info->tile_v_loc != 0)
+ continue;
+
+ for (ht = 0; ht < tile_info->num_h_tile; ht++) {
+ int cur_y = 0;
+ add_x = 0;
+ for (vt = 0; vt < tile_info->num_v_tile; vt++) {
+
+ for (ot = -1; nextEnabledOutput(config, enabled, &ot); ) {
+
+ DisplayModePtr mode =
+ xf86OutputHasPreferredMode(config->output[ot], width, height);
+ if (!config->output[ot]->tile_info.group_id)
+ continue;
+
+ this_tile = &config->output[ot]->tile_info;
+ if (this_tile->group_id != tile_info->group_id)
+ continue;
+
+ if (this_tile->tile_h_loc != ht ||
+ this_tile->tile_v_loc != vt)
+ continue;
+
+ config->output[ot]->initial_x = cur_x;
+ config->output[ot]->initial_y = cur_y;
+
+ if (vt == 0)
+ add_x = this_tile->tile_h_size;
+ cur_y += this_tile->tile_v_size;
+ configured_outputs |= (1 << ot);
+ modes[ot] = mode;
+ }
+ }
+ cur_x += add_x;
+ }
+ w = cur_x;
+ }
+ }
+ return TRUE;
+}
+
static Bool
xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
DisplayModePtr * modes, Bool *enabled,
@@ -2178,14 +2306,10 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
*/
if (!ret)
do {
- int i = 0;
float aspect = 0.0;
DisplayModePtr a = NULL, b = NULL;
- /* count the number of enabled outputs */
- for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++);
-
- if (i != 1)
+ if (numEnabledOutputs(config, enabled) != 1)
break;
p = -1;
@@ -2334,7 +2458,7 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
int i, size = 256;
CARD16 *red, *green, *blue;
- red = malloc(3 * size * sizeof(CARD16));
+ red = xallocarray(size, 3 * sizeof(CARD16));
green = red + size;
blue = green + size;
@@ -2491,6 +2615,8 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
else {
if (xf86TargetUserpref(scrn, config, modes, enabled, width, height))
xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n");
+ else if (xf86TargetRightOf(scrn, config, modes, enabled, width, height))
+ xf86DrvMsg(i, X_INFO, "Using spanning desktop for initial modes\n");
else if (xf86TargetPreferred
(scrn, config, modes, enabled, width, height))
xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n");
@@ -2510,9 +2636,11 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
"Output %s enabled but has no modes\n",
config->output[o]->name);
else
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "Output %s using initial mode %s\n",
- config->output[o]->name, modes[o]->name);
+ xf86DrvMsg (scrn->scrnIndex, X_INFO,
+ "Output %s using initial mode %s +%d+%d\n",
+ config->output[o]->name, modes[o]->name,
+ config->output[o]->initial_x,
+ config->output[o]->initial_y);
}
/*
@@ -2999,6 +3127,12 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
xf86_crtc_notify(pScrn->pScreen);
if (pScrn->ModeSet)
pScrn->ModeSet(pScrn);
+ if (pScrn->pScreen) {
+ if (pScrn->pScreen->isGPU)
+ xf86CursorResetCursor(pScrn->pScreen->current_master);
+ else
+ xf86CursorResetCursor(pScrn->pScreen);
+ }
}
#ifdef RANDR_12_INTERFACE
@@ -3026,6 +3160,27 @@ xf86OutputSetEDIDProperty(xf86OutputPtr output, void *data, int data_len)
}
}
+#define TILE_ATOM_NAME "TILE"
+/* changing this in the future could be tricky as people may hardcode 8 */
+#define TILE_PROP_NUM_ITEMS 8
+static void
+xf86OutputSetTileProperty(xf86OutputPtr output)
+{
+ Atom tile_atom = MakeAtom(TILE_ATOM_NAME, sizeof(TILE_ATOM_NAME) - 1, TRUE);
+
+ /* This may get called before the RandR resources have been created */
+ if (output->randr_output == NULL)
+ return;
+
+ if (output->tile_info.group_id != 0) {
+ RRChangeOutputProperty(output->randr_output, tile_atom, XA_INTEGER, 32,
+ PropModeReplace, TILE_PROP_NUM_ITEMS, (uint32_t *)&output->tile_info, FALSE, TRUE);
+ }
+ else {
+ RRDeleteOutputProperty(output->randr_output, tile_atom);
+ }
+}
+
#endif
/* Pull out a phyiscal size from a detailed timing if available. */
@@ -3071,6 +3226,38 @@ handle_detailed_physical_size(struct detailed_monitor_section
}
}
+Bool
+xf86OutputParseKMSTile(const char *tile_data, int tile_length,
+ struct xf86CrtcTileInfo *tile_info)
+{
+ int ret;
+
+ ret = sscanf(tile_data, "%d:%d:%d:%d:%d:%d:%d:%d",
+ &tile_info->group_id,
+ &tile_info->flags,
+ &tile_info->num_h_tile,
+ &tile_info->num_v_tile,
+ &tile_info->tile_h_loc,
+ &tile_info->tile_v_loc,
+ &tile_info->tile_h_size,
+ &tile_info->tile_v_size);
+ if (ret != 8)
+ return FALSE;
+ return TRUE;
+}
+
+void
+xf86OutputSetTile(xf86OutputPtr output, struct xf86CrtcTileInfo *tile_info)
+{
+ if (tile_info)
+ output->tile_info = *tile_info;
+ else
+ memset(&output->tile_info, 0, sizeof(output->tile_info));
+#ifdef RANDR_12_INTERFACE
+ xf86OutputSetTileProperty(output);
+#endif
+}
+
/**
* Set the EDID information for the specified output
*/
diff --git a/xserver/hw/xfree86/modes/xf86Crtc.h b/xserver/hw/xfree86/modes/xf86Crtc.h
index 54b6e5cd7..8b0160845 100644
--- a/xserver/hw/xfree86/modes/xf86Crtc.h
+++ b/xserver/hw/xfree86/modes/xf86Crtc.h
@@ -70,6 +70,17 @@ typedef enum _xf86OutputStatus {
XF86OutputStatusUnknown
} xf86OutputStatus;
+struct xf86CrtcTileInfo {
+ uint32_t group_id;
+ uint32_t flags;
+ uint32_t num_h_tile;
+ uint32_t num_v_tile;
+ uint32_t tile_h_loc;
+ uint32_t tile_v_loc;
+ uint32_t tile_h_size;
+ uint32_t tile_v_size;
+};
+
typedef struct _xf86CrtcFuncs {
/**
* Turns the crtc on/off, or sets intermediate power levels if available.
@@ -226,7 +237,7 @@ typedef struct _xf86CrtcFuncs {
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
-#define XF86_CRTC_VERSION 5
+#define XF86_CRTC_VERSION 6
struct _xf86Crtc {
/**
@@ -500,7 +511,7 @@ typedef struct _xf86OutputFuncs {
(*destroy) (xf86OutputPtr output);
} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
-#define XF86_OUTPUT_VERSION 2
+#define XF86_OUTPUT_VERSION 3
struct _xf86Output {
/**
@@ -615,6 +626,8 @@ struct _xf86Output {
BoxRec initialTotalArea;
BoxRec initialTrackingArea;
INT16 initialBorder[4];
+
+ struct xf86CrtcTileInfo tile_info;
};
typedef struct _xf86ProviderFuncs {
@@ -883,6 +896,15 @@ extern _X_EXPORT void
xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon);
/**
+ * Set the TILE information for the specified output
+ */
+extern _X_EXPORT void
+xf86OutputSetTile(xf86OutputPtr output, struct xf86CrtcTileInfo *tile_info);
+
+extern _X_EXPORT Bool
+xf86OutputParseKMSTile(const char *tile_data, int tile_length, struct xf86CrtcTileInfo *tile_info);
+
+/**
* Return the list of modes supported by the EDID information
* stored in 'output'
*/
diff --git a/xserver/hw/xfree86/modes/xf86Cursors.c b/xserver/hw/xfree86/modes/xf86Cursors.c
index 379a27a76..5df1ab73a 100644
--- a/xserver/hw/xfree86/modes/xf86Cursors.c
+++ b/xserver/hw/xfree86/modes/xf86Cursors.c
@@ -258,9 +258,7 @@ xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
CARD32 bits;
const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
-#ifdef ARGB_CURSOR
crtc->cursor_argb = FALSE;
-#endif
for (y = 0; y < cursor_info->MaxHeight; y++)
for (x = 0; x < cursor_info->MaxWidth; x++) {
@@ -458,9 +456,7 @@ xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
CARD8 *cursor_image;
const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
-#ifdef ARGB_CURSOR
crtc->cursor_argb = FALSE;
-#endif
if (rotation == RR_Rotate_0)
cursor_image = src;
@@ -519,6 +515,7 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ int c;
cursor = RefCursor(cursor);
if (xf86_config->cursor)
@@ -529,6 +526,16 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
cursor->bits->height > cursor_info->MaxHeight)
return FALSE;
+ for (c = 0; c < xf86_config->num_crtc; c++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (!crtc->enabled)
+ continue;
+
+ if (crtc->transformPresent)
+ return FALSE;
+ }
+
return TRUE;
}
@@ -539,19 +546,13 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- cursor = RefCursor(cursor);
- if (xf86_config->cursor)
- FreeCursor(xf86_config->cursor, None);
- xf86_config->cursor = cursor;
+ if (!xf86_use_hw_cursor(screen, cursor))
+ return FALSE;
/* Make sure ARGB support is available */
if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
return FALSE;
- if (cursor->bits->width > cursor_info->MaxWidth ||
- cursor->bits->height > cursor_info->MaxHeight)
- return FALSE;
-
return TRUE;
}
@@ -632,12 +633,10 @@ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags)
cursor_info->HideCursor = xf86_hide_cursors;
cursor_info->ShowCursor = xf86_show_cursors;
cursor_info->UseHWCursor = xf86_use_hw_cursor;
-#ifdef ARGB_CURSOR
if (flags & HARDWARE_CURSOR_ARGB) {
cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
cursor_info->LoadCursorARGBCheck = xf86_load_cursor_argb;
}
-#endif
xf86_config->cursor = NULL;
xf86_hide_cursors(scrn);
@@ -691,11 +690,9 @@ xf86_reload_cursors(ScreenPtr screen)
void *src =
dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey,
screen);
-#ifdef ARGB_CURSOR
if (cursor->bits->argb && xf86DriverHasLoadCursorARGB(cursor_info))
xf86DriverLoadCursorARGB(cursor_info, cursor);
else if (src)
-#endif
xf86DriverLoadCursorImage(cursor_info, src);
x += scrn->frameX0 + cursor_screen_priv->HotX;
diff --git a/xserver/hw/xfree86/modes/xf86DiDGA.c b/xserver/hw/xfree86/modes/xf86DiDGA.c
index 3f1a3309f..645727441 100644
--- a/xserver/hw/xfree86/modes/xf86DiDGA.c
+++ b/xserver/hw/xfree86/modes/xf86DiDGA.c
@@ -60,7 +60,7 @@ xf86_dga_get_modes(ScreenPtr pScreen)
if (!num)
return FALSE;
- modes = malloc(num * sizeof(DGAModeRec));
+ modes = xallocarray(num, sizeof(DGAModeRec));
if (!modes)
return FALSE;
diff --git a/xserver/hw/xfree86/modes/xf86RandR12.c b/xserver/hw/xfree86/modes/xf86RandR12.c
index 81b679dda..622f4cde4 100644
--- a/xserver/hw/xfree86/modes/xf86RandR12.c
+++ b/xserver/hw/xfree86/modes/xf86RandR12.c
@@ -1054,7 +1054,7 @@ xf86RandR12CrtcNotify(RRCrtcPtr randr_crtc)
DisplayModePtr mode = &crtc->mode;
Bool ret;
- randr_outputs = malloc(config->num_output * sizeof(RROutputPtr));
+ randr_outputs = xallocarray(config->num_output, sizeof(RROutputPtr));
if (!randr_outputs)
return FALSE;
x = crtc->x;
@@ -1146,7 +1146,7 @@ xf86RandR12CrtcSet(ScreenPtr pScreen,
if (!crtc->scrn->vtSema)
return FALSE;
- save_crtcs = malloc(config->num_output * sizeof(xf86CrtcPtr));
+ save_crtcs = xallocarray(config->num_output, sizeof(xf86CrtcPtr));
if ((randr_mode != NULL) != crtc->enabled)
changed = TRUE;
else if (randr_mode && !xf86RandRModeMatches(randr_mode, &crtc->mode))
@@ -1251,9 +1251,8 @@ xf86RandR12CrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
if (randr_crtc->gammaSize != crtc->gamma_size) {
CARD16 *tmp_ptr;
- tmp_ptr =
- realloc(crtc->gamma_red,
- 3 * randr_crtc->gammaSize * sizeof(CARD16));
+ tmp_ptr = reallocarray(crtc->gamma_red,
+ randr_crtc->gammaSize, 3 * sizeof(CARD16));
if (!tmp_ptr)
return FALSE;
crtc->gamma_red = tmp_ptr;
@@ -1294,9 +1293,8 @@ xf86RandR12CrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr randr_crtc)
if (randr_crtc->gammaSize != crtc->gamma_size) {
CARD16 *tmp_ptr;
- tmp_ptr =
- realloc(randr_crtc->gammaRed,
- 3 * crtc->gamma_size * sizeof(CARD16));
+ tmp_ptr = reallocarray(randr_crtc->gammaRed,
+ crtc->gamma_size, 3 * sizeof(CARD16));
if (!tmp_ptr)
return FALSE;
randr_crtc->gammaRed = tmp_ptr;
@@ -1390,7 +1388,7 @@ xf86RROutputSetModes(RROutputPtr randr_output, DisplayModePtr modes)
nmode++;
if (nmode) {
- rrmodes = malloc(nmode * sizeof(RRModePtr));
+ rrmodes = xallocarray(nmode, sizeof(RRModePtr));
if (!rrmodes)
return FALSE;
@@ -1445,8 +1443,8 @@ xf86RandR12SetInfo12(ScreenPtr pScreen)
int o, c, l;
int nclone;
- clones = malloc(config->num_output * sizeof(RROutputPtr));
- crtcs = malloc(config->num_crtc * sizeof(RRCrtcPtr));
+ clones = xallocarray(config->num_output, sizeof(RROutputPtr));
+ crtcs = xallocarray(config->num_crtc, sizeof(RRCrtcPtr));
for (o = 0; o < config->num_output; o++) {
xf86OutputPtr output = config->output[o];
@@ -1560,6 +1558,70 @@ xf86RandR12CreateObjects12(ScreenPtr pScreen)
return TRUE;
}
+static void
+xf86RandR12CreateMonitors(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o, ot;
+ int ht, vt;
+ int ret;
+ char buf[25];
+
+ for (o = 0; o < config->num_output; o++) {
+ xf86OutputPtr output = config->output[o];
+ struct xf86CrtcTileInfo *tile_info = &output->tile_info, *this_tile;
+ RRMonitorPtr monitor;
+ int output_num, num_outputs;
+ if (!tile_info->group_id)
+ continue;
+
+ if (tile_info->tile_h_loc ||
+ tile_info->tile_v_loc)
+ continue;
+
+ num_outputs = tile_info->num_h_tile * tile_info->num_v_tile;
+
+ monitor = RRMonitorAlloc(num_outputs);
+ if (!monitor)
+ return;
+ monitor->pScreen = pScreen;
+ snprintf(buf, 25, "Auto-Monitor-%d", tile_info->group_id);
+ monitor->name = MakeAtom(buf, strlen(buf), TRUE);
+ monitor->primary = 0;
+ monitor->automatic = TRUE;
+ memset(&monitor->geometry.box, 0, sizeof(monitor->geometry.box));
+
+ output_num = 0;
+ for (ht = 0; ht < tile_info->num_h_tile; ht++) {
+ for (vt = 0; vt < tile_info->num_v_tile; vt++) {
+
+ for (ot = 0; ot < config->num_output; ot++) {
+ this_tile = &config->output[ot]->tile_info;
+
+ if (this_tile->group_id != tile_info->group_id)
+ continue;
+
+ if (this_tile->tile_h_loc != ht ||
+ this_tile->tile_v_loc != vt)
+ continue;
+
+ monitor->outputs[output_num] = config->output[ot]->randr_output->id;
+ output_num++;
+
+ }
+
+ }
+ }
+
+ ret = RRMonitorAdd(serverClient, pScreen, monitor);
+ if (ret) {
+ RRMonitorFree(monitor);
+ return;
+ }
+ }
+}
+
static Bool
xf86RandR12CreateScreenResources12(ScreenPtr pScreen)
{
@@ -1575,6 +1637,8 @@ xf86RandR12CreateScreenResources12(ScreenPtr pScreen)
RRScreenSetSizeRange(pScreen, config->minWidth, config->minHeight,
config->maxWidth, config->maxHeight);
+
+ xf86RandR12CreateMonitors(pScreen);
return TRUE;
}
@@ -1785,13 +1849,13 @@ xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
if (provider->output_source == source_provider)
return TRUE;
- SetRootClip(source_provider->pScreen, FALSE);
+ SetRootClip(source_provider->pScreen, ROOT_CLIP_NONE);
DetachUnboundGPU(pScreen);
AttachOutputGPU(source_provider->pScreen, pScreen);
provider->output_source = source_provider;
- SetRootClip(source_provider->pScreen, TRUE);
+ SetRootClip(source_provider->pScreen, ROOT_CLIP_FULL);
return TRUE;
}
diff --git a/xserver/hw/xfree86/modes/xf86Rotate.c b/xserver/hw/xfree86/modes/xf86Rotate.c
index 9c00a443f..4aa8f8d82 100644
--- a/xserver/hw/xfree86/modes/xf86Rotate.c
+++ b/xserver/hw/xfree86/modes/xf86Rotate.c
@@ -43,12 +43,6 @@
#include "X11/extensions/dpmsconst.h"
#include "X11/Xatom.h"
-/* borrowed from composite extension, move to Render and publish? */
-
-#define F(x) IntToxFixed(x)
-
-#define toF(x) ((float) (x) / 65536.0f)
-
static void
xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
{
@@ -366,6 +360,8 @@ xf86CrtcRotate(xf86CrtcPtr crtc)
RRTransformPtr transform = NULL;
Bool damage = FALSE;
+ if (pScreen->isGPU)
+ return TRUE;
if (crtc->transformPresent)
transform = &crtc->transform;