summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/kdrive/linux/keyboard.c441
-rw-r--r--hw/xfree86/common/xf86Config.c68
-rw-r--r--hw/xfree86/common/xf86Configure.c2
-rw-r--r--hw/xfree86/common/xf86Init.c4
-rw-r--r--hw/xfree86/common/xf86Privstr.h1
-rw-r--r--hw/xfree86/drivers/modesetting/Makefile.am2
-rw-r--r--hw/xfree86/drivers/modesetting/driver.c85
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.c99
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.h2
-rw-r--r--hw/xfree86/drivers/modesetting/present.c9
-rw-r--r--hw/xfree86/drivers/modesetting/sh3224.c140
-rw-r--r--hw/xfree86/drivers/modesetting/sh3224.h7
-rw-r--r--hw/xfree86/int10/xf86x86emu.c2
-rw-r--r--hw/xfree86/man/xorg.conf.man4
-rw-r--r--hw/xfree86/modes/xf86Crtc.c3
-rw-r--r--hw/xfree86/os-support/linux/lnx_init.c10
-rw-r--r--hw/xfree86/x86emu/x86emu/regs.h8
-rw-r--r--hw/xquartz/bundle/Info.plist.cpp23
-rw-r--r--hw/xquartz/bundle/Makefile.am6
-rw-r--r--hw/xwayland/xwayland-cursor.c15
-rw-r--r--hw/xwayland/xwayland-glamor-xv.c2
-rw-r--r--hw/xwayland/xwayland-glamor.c3
-rw-r--r--hw/xwayland/xwayland-output.c17
-rw-r--r--hw/xwayland/xwayland-shm.c10
-rw-r--r--hw/xwayland/xwayland.h2
25 files changed, 389 insertions, 576 deletions
diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
index 9a6ee2d93..5d31b7da3 100644
--- a/hw/kdrive/linux/keyboard.c
+++ b/hw/kdrive/linux/keyboard.c
@@ -43,445 +43,6 @@
extern int LinuxConsoleFd;
-static const KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright, XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace, XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters, XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
-};
-
-/*
- * Getting a keycode from scancode
- *
- * With XKB
- * --------
- *
- * We have to enqueue keyboard events using standard X keycodes which correspond
- * to AT scancode + 8; this means that we need to translate the Linux scancode
- * provided by the kernel to an AT scancode -- this translation is not linear
- * and requires that we use a LUT.
- *
- *
- * Without XKB
- * -----------
- *
- * We can use custom keycodes, which makes things simpler; we define our custom
- * keycodes as Linux scancodes + KD_KEY_OFFSET
-*/
-
-/*
- This LUT translates AT scancodes into Linux ones -- the keymap we create
- for the core X keyboard protocol has to be AT-scancode based so that it
- corresponds to the Xkb keymap.
-*/
-#if 0
-static unsigned char at2lnx[] = {
- 0x0, /* no valid scancode */
- 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
- 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
- 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
- 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
- 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
- 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
- 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
- 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
- 0x11, /* KEY_W */ 0x12, /* KEY_E */
- 0x13, /* KEY_R */ 0x14, /* KEY_T */
- 0x15, /* KEY_Y */ 0x16, /* KEY_U */
- 0x17, /* KEY_I */ 0x18, /* KEY_O */
- 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
- 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
- 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
- 0x1f, /* KEY_S */ 0x20, /* KEY_D */
- 0x21, /* KEY_F */ 0x22, /* KEY_G */
- 0x23, /* KEY_H */ 0x24, /* KEY_J */
- 0x25, /* KEY_K */ 0x26, /* KEY_L */
- 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
- 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
- 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
- 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
- 0x2f, /* KEY_V */ 0x30, /* KEY_B */
- 0x31, /* KEY_N */ 0x32, /* KEY_M */
- 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
- 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
- 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
- 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
- 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
- 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
- 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
- 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
- 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
- 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
- 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
- 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
- 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
- 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
- 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
- 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
- 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
- 0x00, /* 0x55 */ 0x56, /* KEY_Less */
- 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
- 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
- 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
- 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
- 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
- 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
- 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
- 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
- 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
- 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
- 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
- 0x7A, /* KEY_Menu/FOCUS_PF11 */ 0x00, /* 0x6e */
- 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
- 0x00, /* 0x71 */ 0x00, /* 0x72 */
- 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
- 0x00, /* 0x75 */ 0x00, /* 0x76 */
- 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
- 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
- 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
- 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
- 0x00, /* 0x7f */
-};
-
-#define NUM_AT_KEYS (sizeof(at2lnx)/sizeof(at2lnx[0]))
-#define LNX_KEY_INDEX(n) n < NUM_AT_KEYS ? at2lnx[n] : 0
-
-static unsigned char tbl[KD_MAX_WIDTH] = {
- 0,
- 1 << KG_SHIFT,
- (1 << KG_ALTGR),
- (1 << KG_ALTGR) | (1 << KG_SHIFT)
-};
-#endif
-
-static void
-readKernelMapping(KdKeyboardInfo * ki)
-{
-#if 0
- KeySym *k;
- int i, j;
- struct kbentry kbe;
- int minKeyCode, maxKeyCode;
- int row;
- int fd;
-
- if (!ki)
- return;
-
- fd = LinuxConsoleFd;
-
- minKeyCode = NR_KEYS;
- maxKeyCode = 0;
- row = 0;
- ki->keySyms.mapWidth = KD_MAX_WIDTH;
- for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i) {
- kbe.kb_index = LNX_KEY_INDEX(i);
-
- k = ki->keySyms.map + row * ki->keySyms.mapWidth;
-
- for (j = 0; j < ki->keySyms.mapWidth; ++j) {
- unsigned short kval;
-
- k[j] = NoSymbol;
-
- kbe.kb_table = tbl[j];
- kbe.kb_value = 0;
- if (ioctl(fd, KDGKBENT, &kbe))
- continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value)) {
- case KT_LATIN:
- case KT_LETTER:
- k[j] = linux_to_x[kval];
- break;
-
- case KT_FN:
- if (kval <= 19)
- k[j] = XK_F1 + kval;
- else
- switch (kbe.kb_value) {
- case K_FIND:
- k[j] = XK_Home; /* or XK_Find */
- break;
- case K_INSERT:
- k[j] = XK_Insert;
- break;
- case K_REMOVE:
- k[j] = XK_Delete;
- break;
- case K_SELECT:
- k[j] = XK_End; /* or XK_Select */
- break;
- case K_PGUP:
- k[j] = XK_Prior;
- break;
- case K_PGDN:
- k[j] = XK_Next;
- break;
- case K_HELP:
- k[j] = XK_Help;
- break;
- case K_DO:
- k[j] = XK_Execute;
- break;
- case K_PAUSE:
- k[j] = XK_Pause;
- break;
- case K_MACRO:
- k[j] = XK_Menu;
- break;
- default:
- break;
- }
- break;
-
- case KT_SPEC:
- switch (kbe.kb_value) {
- case K_ENTER:
- k[j] = XK_Return;
- break;
- case K_BREAK:
- k[j] = XK_Break;
- break;
- case K_CAPS:
- k[j] = XK_Caps_Lock;
- break;
- case K_NUM:
- k[j] = XK_Num_Lock;
- break;
- case K_HOLD:
- k[j] = XK_Scroll_Lock;
- break;
- case K_COMPOSE:
- k[j] = XK_Multi_key;
- break;
- default:
- break;
- }
- break;
-
- case KT_PAD:
- switch (kbe.kb_value) {
- case K_PPLUS:
- k[j] = XK_KP_Add;
- break;
- case K_PMINUS:
- k[j] = XK_KP_Subtract;
- break;
- case K_PSTAR:
- k[j] = XK_KP_Multiply;
- break;
- case K_PSLASH:
- k[j] = XK_KP_Divide;
- break;
- case K_PENTER:
- k[j] = XK_KP_Enter;
- break;
- case K_PCOMMA:
- k[j] = XK_KP_Separator;
- break;
- case K_PDOT:
- k[j] = XK_KP_Decimal;
- break;
- case K_PPLUSMINUS:
- k[j] = XK_KP_Subtract;
- break;
- default:
- if (kval <= 9)
- k[j] = XK_KP_0 + kval;
- break;
- }
- break;
-
- /*
- * KT_DEAD keys are for accelerated diacritical creation.
- */
- case KT_DEAD:
- switch (kbe.kb_value) {
- case K_DGRAVE:
- k[j] = XK_dead_grave;
- break;
- case K_DACUTE:
- k[j] = XK_dead_acute;
- break;
- case K_DCIRCM:
- k[j] = XK_dead_circumflex;
- break;
- case K_DTILDE:
- k[j] = XK_dead_tilde;
- break;
- case K_DDIERE:
- k[j] = XK_dead_diaeresis;
- break;
- }
- break;
-
- case KT_CUR:
- switch (kbe.kb_value) {
- case K_DOWN:
- k[j] = XK_Down;
- break;
- case K_LEFT:
- k[j] = XK_Left;
- break;
- case K_RIGHT:
- k[j] = XK_Right;
- break;
- case K_UP:
- k[j] = XK_Up;
- break;
- }
- break;
-
- case KT_SHIFT:
- switch (kbe.kb_value) {
- case K_ALTGR:
- k[j] = XK_Mode_switch;
- break;
- case K_ALT:
- k[j] = (kbe.kb_index == 0x64 ? XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- k[j] = (kbe.kb_index == 0x61 ? XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL:
- k[j] = XK_Control_L;
- break;
- case K_CTRLR:
- k[j] = XK_Control_R;
- break;
- case K_SHIFT:
- k[j] = (kbe.kb_index == 0x36 ? XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL:
- k[j] = XK_Shift_L;
- break;
- case K_SHIFTR:
- k[j] = XK_Shift_R;
- break;
- default:
- break;
- }
- break;
-
- /*
- * KT_ASCII keys accumulate a 3 digit decimal number that gets
- * emitted when the shift state changes. We can't emulate that.
- */
- case KT_ASCII:
- break;
-
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK)
- k[j] = XK_Shift_Lock;
- break;
-
-#ifdef KT_X
- case KT_X:
- /* depends on new keyboard symbols in file linux/keyboard.h */
- if (kbe.kb_value == K_XMENU)
- k[j] = XK_Menu;
- if (kbe.kb_value == K_XTELEPHONE)
- k[j] = XK_telephone;
- break;
-#endif
-#ifdef KT_XF
- case KT_XF:
- /* special linux keysyms which map directly to XF86 keysyms */
- k[j] = (kbe.kb_value & 0xFF) + 0x1008FF00;
- break;
-#endif
-
- default:
- break;
- }
- if (i < minKeyCode)
- minKeyCode = i;
- if (i > maxKeyCode)
- maxKeyCode = i;
- }
-
- if (minKeyCode == NR_KEYS)
- continue;
-
- if (k[3] == k[2])
- k[3] = NoSymbol;
- if (k[2] == k[1])
- k[2] = NoSymbol;
- if (k[1] == k[0])
- k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3])
- k[2] = k[3] = NoSymbol;
- if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol)
- k[3] = NoSymbol;
- row++;
- }
- ki->minScanCode = minKeyCode;
- ki->maxScanCode = maxKeyCode;
-#endif
-}
-
/*
* We need these to handle extended scancodes correctly (I could just use the
* numbers below, but this makes the code more readable
@@ -759,8 +320,6 @@ LinuxKeyboardInit(KdKeyboardInfo * ki)
free(ki->name);
ki->name = strdup("Linux console keyboard");
- readKernelMapping(ki);
-
return Success;
}
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 0c067c0c9..26591c66e 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -518,33 +518,54 @@ xf86InputDriverlistFromConfig(void)
return modulearray;
}
+static int
+is_fallback(const char *s)
+{
+ /* later entries are less preferred */
+ const char *fallback[5] = { "modesetting", "fbdev", "vesa", "wsfb", NULL };
+ int i;
+
+ for (i = 0; fallback[i]; i++)
+ if (strstr(s, fallback[i]))
+ return i;
+
+ return -1;
+}
+
+static int
+driver_sort(const void *_l, const void *_r)
+{
+ const char *l = *(const char **)_l;
+ const char *r = *(const char **)_r;
+ int left = is_fallback(l);
+ int right = is_fallback(r);
+
+ /* neither is a fallback, asciibetize */
+ if (left == -1 && right == -1)
+ return strcmp(l, r);
+
+ /* left is a fallback */
+ if (left >= 0)
+ return 1;
+
+ /* right is a fallback */
+ if (right >= 0)
+ return -1;
+
+ /* both are fallbacks, which is worse */
+ return left - right;
+}
+
static void
fixup_video_driver_list(const char **drivers)
{
- static const char *fallback[5] = { "modesetting", "fbdev", "vesa", "wsfb", NULL };
- const char **end, **drv;
- const char *x;
- int i;
+ const char **end;
/* walk to the end of the list */
for (end = drivers; *end && **end; end++);
end--;
- /*
- * for each of the fallback drivers, if we find it in the list,
- * swap it with the last available non-fallback driver.
- */
- for (i = 0; fallback[i]; i++) {
- for (drv = drivers; drv != end; drv++) {
- if (strstr(*drv, fallback[i])) {
- x = *drv;
- *drv = *end;
- *end = x;
- end--;
- break;
- }
- }
- }
+ qsort(drivers, end - drivers, sizeof(const char *), driver_sort);
}
static const char **
@@ -700,6 +721,7 @@ typedef enum {
FLAG_USE_SIGIO,
FLAG_AUTO_ADD_GPU,
FLAG_MAX_CLIENTS,
+ FLAG_IGLX,
} FlagValues;
/**
@@ -761,6 +783,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE},
{FLAG_MAX_CLIENTS, "MaxClients", OPTV_INTEGER,
{0}, FALSE },
+ {FLAG_IGLX, "IndirectGLX", OPTV_BOOLEAN,
+ {0}, FALSE},
{-1, NULL, OPTV_NONE,
{0}, FALSE},
};
@@ -943,6 +967,12 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.aiglx = value;
xf86Info.aiglxFrom = X_CONFIG;
}
+ if (xf86Info.iglxFrom != X_CMDLINE) {
+ if (xf86GetOptValBool(FlagOptions, FLAG_IGLX, &value)) {
+ enableIndirectGLX = value;
+ xf86Info.iglxFrom = X_CONFIG;
+ }
+ }
#endif
/* if we're not hotplugging, force some input devices to exist */
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 1271010fa..59d275ea3 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -264,7 +264,7 @@ configureDeviceSection(int screennum)
ptr->dev_busid = DevToConfig[screennum].GDev.busID;
ptr->dev_driver = DevToConfig[screennum].GDev.driver;
ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac;
- for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++)
+ for (i = 0; i < MAXDACSPEEDS; i++)
ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i];
ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam;
ptr->dev_bios_base = DevToConfig[screennum].GDev.BiosBase;
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index de51497b5..9bade905d 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1457,6 +1457,10 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86Info.ShareVTs = TRUE;
return 1;
}
+ if (!strcmp(argv[i], "-iglx") || !strcmp(argv[i], "+iglx")) {
+ xf86Info.iglxFrom = X_CMDLINE;
+ return 0;
+ }
/* OS-specific processing */
return xf86ProcessArgument(argc, argv, i);
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 58d5a0f13..c5d24eac0 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -89,6 +89,7 @@ typedef struct {
MessageType randRFrom;
Bool aiglx;
MessageType aiglxFrom;
+ MessageType iglxFrom;
XF86_GlxVisuals glxVisuals;
MessageType glxVisualsFrom;
diff --git a/hw/xfree86/drivers/modesetting/Makefile.am b/hw/xfree86/drivers/modesetting/Makefile.am
index 82c4f2f32..ca7e05aac 100644
--- a/hw/xfree86/drivers/modesetting/Makefile.am
+++ b/hw/xfree86/drivers/modesetting/Makefile.am
@@ -51,6 +51,8 @@ modesetting_drv_la_SOURCES = \
dumb_bo.c \
dumb_bo.h \
present.c \
+ sh3224.c \
+ sh3224.h \
vblank.c \
$(NULL)
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 8f60eae57..14f80b36c 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -60,6 +60,7 @@
#endif
#include "driver.h"
+#include "sh3224.h"
static void AdjustFrame(ScrnInfoPtr pScrn, int x, int y);
static Bool CloseScreen(ScreenPtr pScreen);
@@ -501,6 +502,15 @@ dispatch_dirty_region(ScrnInfoPtr scrn,
/* TODO query connector property to see if this is needed */
ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects);
+
+ /* if we're swamping it with work, try one at a time */
+ if (ret == -EINVAL) {
+ for (i = 0; i < num_cliprects; i++) {
+ if ((ret = drmModeDirtyFB(ms->fd, fb_id, &clip[i], 1)) < 0)
+ break;
+ }
+ }
+
free(clip);
DamageEmpty(damage);
}
@@ -624,7 +634,6 @@ FreeRec(ScrnInfoPtr pScrn)
ms = modesettingPTR(pScrn);
if (!ms)
return;
- pScrn->driverPrivate = NULL;
if (ms->fd > 0) {
modesettingEntPtr ms_ent;
@@ -645,6 +654,7 @@ FreeRec(ScrnInfoPtr pScrn)
ms_ent->fd = 0;
}
}
+ pScrn->driverPrivate = NULL;
free(ms->drmmode.Options);
free(ms);
@@ -662,6 +672,11 @@ try_enable_glamor(ScrnInfoPtr pScrn)
ms->drmmode.glamor = FALSE;
#ifdef GLAMOR
+ if (ms->drmmode.force_24_32) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cannot use glamor with 24bpp packed fb\n");
+ return;
+ }
+
if (!do_glamor) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "glamor disabled\n");
return;
@@ -809,23 +824,17 @@ PreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
ms->drmmode.fd = ms->fd;
- pScrn->capabilities = 0;
-#ifdef DRM_CAP_PRIME
- ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value);
- if (ret == 0) {
- if (value & DRM_PRIME_CAP_IMPORT)
- pScrn->capabilities |= RR_Capability_SinkOutput;
-#if GLAMOR_HAS_GBM_LINEAR
- if (value & DRM_PRIME_CAP_EXPORT)
- pScrn->capabilities |= RR_Capability_SourceOutput;
-#endif
- }
-#endif
drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp);
- if (defaultdepth == 24 && defaultbpp == 24)
- bppflags = SupportConvert32to24 | Support24bppFb;
- else
- bppflags = PreferConvert24to32 | SupportConvert24to32 | Support32bppFb;
+ if (defaultdepth == 24 && defaultbpp == 24) {
+ ms->drmmode.force_24_32 = TRUE;
+ ms->drmmode.kbpp = 24;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using 24bpp hw front buffer with 32bpp shadow\n");
+ defaultbpp = 32;
+ } else {
+ ms->drmmode.kbpp = defaultbpp;
+ }
+ bppflags = PreferConvert24to32 | SupportConvert24to32 | Support32bppFb;
if (!xf86SetDepthBpp
(pScrn, defaultdepth, defaultdepth, defaultbpp, bppflags))
@@ -879,23 +888,45 @@ PreInit(ScrnInfoPtr pScrn, int flags)
} else {
Bool prefer_shadow = TRUE;
- ret = drmGetCap(ms->fd, DRM_CAP_DUMB_PREFER_SHADOW, &value);
- if (!ret) {
- prefer_shadow = !!value;
- }
+ if (ms->drmmode.force_24_32) {
+ prefer_shadow = TRUE;
+ ms->drmmode.shadow_enable = TRUE;
+ } else {
+ ret = drmGetCap(ms->fd, DRM_CAP_DUMB_PREFER_SHADOW, &value);
+ if (!ret) {
+ prefer_shadow = !!value;
+ }
- ms->drmmode.shadow_enable = xf86ReturnOptValBool(ms->drmmode.Options,
- OPTION_SHADOW_FB,
- prefer_shadow);
+ ms->drmmode.shadow_enable =
+ xf86ReturnOptValBool(ms->drmmode.Options, OPTION_SHADOW_FB,
+ prefer_shadow);
+ }
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"ShadowFB: preferred %s, enabled %s\n",
prefer_shadow ? "YES" : "NO",
+ ms->drmmode.force_24_32 ? "FORCE" :
ms->drmmode.shadow_enable ? "YES" : "NO");
ms->drmmode.pageflip = FALSE;
}
+ pScrn->capabilities = 0;
+#ifdef DRM_CAP_PRIME
+ ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value);
+ if (ret == 0) {
+ if (value & DRM_PRIME_CAP_IMPORT) {
+ pScrn->capabilities |= RR_Capability_SinkOutput;
+ if (ms->drmmode.glamor)
+ pScrn->capabilities |= RR_Capability_SinkOffload;
+ }
+#if GLAMOR_HAS_GBM_LINEAR
+ if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor)
+ pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload;
+#endif
+ }
+#endif
+
if (drmmode_pre_init(pScrn, &ms->drmmode, pScrn->bitsPerPixel / 8) == FALSE) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS setup failed\n");
goto fail;
@@ -946,7 +977,7 @@ msShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode,
modesettingPtr ms = modesettingPTR(pScrn);
int stride;
- stride = (pScrn->displayWidth * pScrn->bitsPerPixel) / 8;
+ stride = (pScrn->displayWidth * ms->drmmode.kbpp) / 8;
*size = stride;
return ((uint8_t *) ms->drmmode.front_bo.dumb->ptr + row * stride + offset);
@@ -967,6 +998,7 @@ CreateScreenResources(ScreenPtr pScreen)
Bool ret;
void *pixels = NULL;
int err;
+ Bool use_ms_shadow = ms->drmmode.force_24_32 && pScrn->bitsPerPixel == 32;
pScreen->CreateScreenResources = ms->createScreenResources;
ret = pScreen->CreateScreenResources(pScreen);
@@ -998,7 +1030,8 @@ CreateScreenResources(ScreenPtr pScreen)
FatalError("Couldn't adjust screen pixmap\n");
if (ms->drmmode.shadow_enable) {
- if (!shadowAdd(pScreen, rootPixmap, msUpdatePacked,
+ if (!shadowAdd(pScreen, rootPixmap,
+ use_ms_shadow ? ms_shadowUpdate32to24 : msUpdatePacked,
msShadowWindow, 0, 0))
return FALSE;
}
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index bb5f56ed5..9c54310ac 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -344,24 +344,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
int output_count = 0;
Bool ret = TRUE;
int i;
- uint32_t fb_id;
+ uint32_t fb_id = 0;
drmModeModeInfo kmode;
- int height;
-
- height = pScrn->virtualY;
-
- if (drmmode->fb_id == 0) {
- ret = drmModeAddFB(drmmode->fd,
- pScrn->virtualX, height,
- pScrn->depth, pScrn->bitsPerPixel,
- drmmode_bo_get_pitch(&drmmode->front_bo),
- drmmode_bo_get_handle(&drmmode->front_bo),
- &drmmode->fb_id);
- if (ret < 0) {
- ErrorF("failed to add fb %d\n", ret);
- return FALSE;
- }
- }
saved_mode = crtc->mode;
saved_x = crtc->x;
@@ -420,6 +404,22 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
fb_id = drmmode_crtc->rotate_fb_id;
x = y = 0;
}
+
+ if (fb_id == 0) {
+ ret = drmModeAddFB(drmmode->fd,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->depth, drmmode->kbpp,
+ drmmode_bo_get_pitch(&drmmode->front_bo),
+ drmmode_bo_get_handle(&drmmode->front_bo),
+ &drmmode->fb_id);
+ if (ret < 0) {
+ ErrorF("failed to add fb %d\n", ret);
+ ret = FALSE;
+ goto done;
+ }
+ fb_id = drmmode->fb_id;
+ }
+
if (drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
fb_id, x, y, output_ids, output_count, &kmode)) {
xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
@@ -484,7 +484,7 @@ drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
drmModeMoveCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, x, y);
}
-static void
+static Bool
drmmode_set_cursor(xf86CrtcPtr crtc)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
@@ -503,9 +503,9 @@ drmmode_set_cursor(xf86CrtcPtr crtc)
handle, ms->cursor_width, ms->cursor_height,
cursor->bits->xhot, cursor->bits->yhot);
if (!ret)
- return;
- if (ret == -EINVAL)
- use_set_cursor2 = FALSE;
+ return TRUE;
+
+ use_set_cursor2 = FALSE;
}
ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle,
@@ -518,16 +518,28 @@ drmmode_set_cursor(xf86CrtcPtr crtc)
cursor_info->MaxWidth = cursor_info->MaxHeight = 0;
drmmode_crtc->drmmode->sw_cursor = TRUE;
/* fallback to swcursor */
+ return FALSE;
}
+ return TRUE;
}
-static void
-drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
+static void drmmode_hide_cursor(xf86CrtcPtr crtc);
+
+/*
+ * The load_cursor_argb_check driver hook.
+ *
+ * Sets the hardware cursor by calling the drmModeSetCursor2 ioctl.
+ * On failure, returns FALSE indicating that the X server should fall
+ * back to software cursors.
+ */
+static Bool
+drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 *image)
{
modesettingPtr ms = modesettingPTR(crtc->scrn);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
int i;
uint32_t *ptr;
+ static Bool first_time = TRUE;
/* cursor should be mapped already */
ptr = (uint32_t *) (drmmode_crtc->cursor_bo->ptr);
@@ -535,8 +547,14 @@ drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
for (i = 0; i < ms->cursor_width * ms->cursor_height; i++)
ptr[i] = image[i]; // cpu_to_le32(image[i]);
- if (drmmode_crtc->cursor_up)
- drmmode_set_cursor(crtc);
+ if (drmmode_crtc->cursor_up || first_time) {
+ Bool ret = drmmode_set_cursor(crtc);
+ if (!drmmode_crtc->cursor_up)
+ drmmode_hide_cursor(crtc);
+ first_time = FALSE;
+ return ret;
+ }
+ return TRUE;
}
static void
@@ -577,11 +595,17 @@ drmmode_set_scanout_pixmap_gpu(xf86CrtcPtr crtc, PixmapPtr ppix)
PixmapPtr screenpix = screen->GetScreenPixmap(screen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
int c, total_width = 0, max_height = 0, this_x = 0;
if (!ppix) {
- if (crtc->randr_crtc->scanout_pixmap)
+ if (crtc->randr_crtc->scanout_pixmap) {
PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, screenpix);
+ if (drmmode->fb_id) {
+ drmModeRmFB(drmmode->fd, drmmode->fb_id);
+ drmmode->fb_id = 0;
+ }
+ }
drmmode_crtc->prime_pixmap_x = 0;
return TRUE;
}
@@ -679,14 +703,14 @@ drmmode_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
int ret;
if (!drmmode_create_bo(drmmode, &drmmode_crtc->rotate_bo,
- width, height, crtc->scrn->bitsPerPixel)) {
+ width, height, drmmode->kbpp)) {
xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
"Couldn't allocate shadow memory for rotated CRTC\n");
return NULL;
}
ret = drmModeAddFB(drmmode->fd, width, height, crtc->scrn->depth,
- crtc->scrn->bitsPerPixel,
+ drmmode->kbpp,
drmmode_bo_get_pitch(&drmmode_crtc->rotate_bo),
drmmode_bo_get_handle(&drmmode_crtc->rotate_bo),
&drmmode_crtc->rotate_fb_id);
@@ -757,7 +781,7 @@ drmmode_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
rotate_pixmap = drmmode_create_pixmap_header(scrn->pScreen,
width, height,
scrn->depth,
- scrn->bitsPerPixel,
+ drmmode->kbpp,
rotate_pitch,
pPixData);
@@ -799,7 +823,7 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
.set_cursor_position = drmmode_set_cursor_position,
.show_cursor = drmmode_show_cursor,
.hide_cursor = drmmode_hide_cursor,
- .load_cursor_argb = drmmode_load_cursor_argb,
+ .load_cursor_argb_check = drmmode_load_cursor_argb_check,
.gamma_set = drmmode_crtc_gamma_set,
.destroy = NULL, /* XXX */
@@ -1643,6 +1667,7 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
uint32_t old_fb_id;
int i, pitch, old_width, old_height, old_pitch;
int cpp = (scrn->bitsPerPixel + 7) / 8;
+ int kcpp = (drmmode->kbpp + 7) / 8;
PixmapPtr ppix = screen->GetScreenPixmap(screen);
void *new_pixels = NULL;
@@ -1664,14 +1689,14 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
old_front = drmmode->front_bo;
if (!drmmode_create_bo(drmmode, &drmmode->front_bo,
- width, height, scrn->bitsPerPixel))
+ width, height, drmmode->kbpp))
goto fail;
pitch = drmmode_bo_get_pitch(&drmmode->front_bo);
scrn->virtualX = width;
scrn->virtualY = height;
- scrn->displayWidth = pitch / cpp;
+ scrn->displayWidth = pitch / kcpp;
ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth,
scrn->bitsPerPixel, pitch,
@@ -1687,8 +1712,7 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
}
if (drmmode->shadow_enable) {
- uint32_t size = scrn->displayWidth * scrn->virtualY *
- ((scrn->bitsPerPixel + 7) >> 3);
+ uint32_t size = scrn->displayWidth * scrn->virtualY * cpp;
new_pixels = calloc(1, size);
if (new_pixels == NULL)
goto fail;
@@ -1696,7 +1720,8 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
drmmode->shadow_fb = new_pixels;
}
- screen->ModifyPixmapHeader(ppix, width, height, -1, -1, pitch, new_pixels);
+ screen->ModifyPixmapHeader(ppix, width, height, -1, -1,
+ scrn->displayWidth * cpp, new_pixels);
if (!drmmode_glamor_handle_new_screen_pixmap(drmmode))
goto fail;
@@ -1723,7 +1748,7 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
drmmode->front_bo = old_front;
scrn->virtualX = old_width;
scrn->virtualY = old_height;
- scrn->displayWidth = old_pitch / cpp;
+ scrn->displayWidth = old_pitch / kcpp;
drmmode->fb_id = old_fb_id;
return FALSE;
@@ -2079,7 +2104,7 @@ drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int width;
int height;
- int bpp = pScrn->bitsPerPixel;
+ int bpp = ms->drmmode.kbpp;
int i;
int cpp = (bpp + 7) / 8;
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index fca68a6fe..9139ed4c2 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -48,6 +48,7 @@ typedef struct {
unsigned fb_id;
drmModeFBPtr mode_fb;
int cpp;
+ int kbpp;
ScrnInfoPtr scrn;
struct gbm_device *gbm;
@@ -67,6 +68,7 @@ typedef struct {
Bool shadow_enable;
/** Is Option "PageFlip" enabled? */
Bool pageflip;
+ Bool force_24_32;
void *shadow_fb;
/**
diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c
index d65c8c845..9a596de75 100644
--- a/hw/xfree86/drivers/modesetting/present.c
+++ b/hw/xfree86/drivers/modesetting/present.c
@@ -626,6 +626,15 @@ ms_present_unflip(ScreenPtr screen, uint64_t event_id)
if (!crtc->enabled)
continue;
+ /* info->drmmode.fb_id still points to the FB for the last flipped BO.
+ * Clear it, drmmode_set_mode_major will re-create it
+ */
+ if (drmmode_crtc->drmmode->fb_id) {
+ drmModeRmFB(drmmode_crtc->drmmode->fd,
+ drmmode_crtc->drmmode->fb_id);
+ drmmode_crtc->drmmode->fb_id = 0;
+ }
+
if (drmmode_crtc->dpms_mode == DPMSModeOn)
crtc->funcs->set_mode_major(crtc, &crtc->mode, crtc->rotation,
crtc->x, crtc->y);
diff --git a/hw/xfree86/drivers/modesetting/sh3224.c b/hw/xfree86/drivers/modesetting/sh3224.c
new file mode 100644
index 000000000..a64a1031e
--- /dev/null
+++ b/hw/xfree86/drivers/modesetting/sh3224.c
@@ -0,0 +1,140 @@
+/*
+ *
+ * Copyright © 2000 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 Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD 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.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include "dix-config.h"
+#endif
+
+#include "shadow.h"
+#include "fb.h"
+
+#include "sh3224.h"
+#define Get8(a) ((CARD32) READ(a))
+
+#if BITMAP_BIT_ORDER == MSBFirst
+#define Get24(a) ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2))
+#define Put24(a,p) ((WRITE((a+0), (CARD8) ((p) >> 16))), \
+ (WRITE((a+1), (CARD8) ((p) >> 8))), \
+ (WRITE((a+2), (CARD8) (p))))
+#else
+#define Get24(a) (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16))
+#define Put24(a,p) ((WRITE((a+0), (CARD8) (p))), \
+ (WRITE((a+1), (CARD8) ((p) >> 8))), \
+ (WRITE((a+2), (CARD8) ((p) >> 16))))
+#endif
+
+static void
+sh24_32BltLine(CARD8 *srcLine,
+ CARD8 *dstLine,
+ int width)
+{
+ CARD32 *src;
+ CARD8 *dst;
+ int w;
+ CARD32 pixel;
+
+ src = (CARD32 *) srcLine;
+ dst = dstLine;
+ w = width;
+
+ while (((long)dst & 3) && w) {
+ w--;
+ pixel = READ(src++);
+ Put24(dst, pixel);
+ dst += 3;
+ }
+ /* Do four aligned pixels at a time */
+ while (w >= 4) {
+ CARD32 s0, s1;
+
+ s0 = READ(src++);
+ s1 = READ(src++);
+#if BITMAP_BIT_ORDER == LSBFirst
+ WRITE((CARD32 *) dst, (s0 & 0xffffff) | (s1 << 24));
+#else
+ WRITE((CARD32 *) dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
+#endif
+ s0 = READ(src++);
+#if BITMAP_BIT_ORDER == LSBFirst
+ WRITE((CARD32 *) (dst + 4),
+ ((s1 & 0xffffff) >> 8) | (s0 << 16));
+#else
+ WRITE((CARD32 *) (dst + 4),
+ (s1 << 16) | ((s0 & 0xffffff) >> 8));
+#endif
+ s1 = READ(src++);
+#if BITMAP_BIT_ORDER == LSBFirst
+ WRITE((CARD32 *) (dst + 8),
+ ((s0 & 0xffffff) >> 16) | (s1 << 8));
+#else
+ WRITE((CARD32 *) (dst + 8), (s0 << 24) | (s1 & 0xffffff));
+#endif
+ dst += 12;
+ w -= 4;
+ }
+ while (w--) {
+ pixel = READ(src++);
+ Put24(dst, pixel);
+ dst += 3;
+ }
+}
+
+void
+ms_shadowUpdate32to24(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ RegionPtr damage = shadowDamage(pBuf);
+ PixmapPtr pShadow = pBuf->pPixmap;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ FbStride shaStride;
+ int shaBpp;
+ _X_UNUSED int shaXoff, shaYoff;
+ int x, y, w, h;
+ CARD32 winSize;
+ FbBits *shaBase, *shaLine;
+ CARD8 *winBase = NULL, *winLine;
+
+ fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff,
+ shaYoff);
+
+ /* just get the initial window base + stride */
+ winBase = (*pBuf->window)(pScreen, 0, 0, SHADOW_WINDOW_WRITE,
+ &winSize, pBuf->closure);
+
+ while (nbox--) {
+ x = pbox->x1;
+ y = pbox->y1;
+ w = pbox->x2 - pbox->x1;
+ h = pbox->y2 - pbox->y1;
+
+ winLine = winBase + y * winSize + (x * 3);
+ shaLine = shaBase + y * shaStride + ((x * shaBpp) >> FB_SHIFT);
+
+ while (h--) {
+ sh24_32BltLine((CARD8 *)shaLine, (CARD8 *)winLine, w);
+ winLine += winSize;
+ shaLine += shaStride;
+ }
+ pbox++;
+ }
+}
diff --git a/hw/xfree86/drivers/modesetting/sh3224.h b/hw/xfree86/drivers/modesetting/sh3224.h
new file mode 100644
index 000000000..fc301f99d
--- /dev/null
+++ b/hw/xfree86/drivers/modesetting/sh3224.h
@@ -0,0 +1,7 @@
+#ifndef SH3224_H
+#define SH3224_H
+
+void
+ms_shadowUpdate32to24(ScreenPtr pScreen, shadowBufPtr pBuf);
+
+#endif
diff --git a/hw/xfree86/int10/xf86x86emu.c b/hw/xfree86/int10/xf86x86emu.c
index 4b0a13090..1dc695d2c 100644
--- a/hw/xfree86/int10/xf86x86emu.c
+++ b/hw/xfree86/int10/xf86x86emu.c
@@ -7,13 +7,13 @@
#include <xorg-config.h>
#endif
-#include <x86emu.h>
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86Pci.h"
#define _INT10_PRIVATE
#include "xf86int10.h"
#include "int10Defines.h"
+#include <x86emu.h>
#define M _X86EMU_env
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 08eb7a93a..e33114dda 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -644,6 +644,10 @@ Default is disabled.
.BI "Option \*qAIGLX\*q \*q" boolean \*q
enable or disable AIGLX. AIGLX is enabled by default.
.TP 7
+.BI "Option \*qIndirectGLX\*q \*q" boolean \*q
+enable or disable indirect GLX contexts. Indirect GLX contexts are disabled by
+default.
+.TP 7
.BI "Option \*qDRI2\*q \*q" boolean \*q
enable or disable DRI2. DRI2 is disabled by default.
.TP 7
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 6091b5e5b..4a13c1329 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -3285,7 +3285,8 @@ xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon)
}
/* Set the DDC properties for the 'compat' output */
- if (output == xf86CompatOutput(scrn))
+ /* GPU screens don't have a root window */
+ if (output == xf86CompatOutput(scrn) && !scrn->is_gpu)
xf86SetDDCproperties(scrn, edid_mon);
#ifdef RANDR_12_INTERFACE
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 1ed213c00..ca174938d 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -93,7 +93,6 @@ linux_parse_vt_settings(int may_fail)
struct vt_stat vts;
struct stat st;
MessageType from = X_PROBED;
- const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
/* Only do this once */
static int vt_settings_parsed = 0;
@@ -108,14 +107,7 @@ linux_parse_vt_settings(int may_fail)
from = X_CMDLINE;
}
else {
-
- i = 0;
- while (tty0[i] != NULL) {
- if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0)
- break;
- i++;
- }
-
+ fd = open("/dev/tty0", O_WRONLY, 0);
if (fd < 0) {
if (may_fail)
return 0;
diff --git a/hw/xfree86/x86emu/x86emu/regs.h b/hw/xfree86/x86emu/x86emu/regs.h
index c040259fa..3c9469f52 100644
--- a/hw/xfree86/x86emu/x86emu/regs.h
+++ b/hw/xfree86/x86emu/x86emu/regs.h
@@ -158,14 +158,6 @@ struct i386_segment_regs {
#define R_FLG spc.FLAGS
/* special registers */
-#define R_SP spc.SP.I16_reg.x_reg
-#define R_BP spc.BP.I16_reg.x_reg
-#define R_SI spc.SI.I16_reg.x_reg
-#define R_DI spc.DI.I16_reg.x_reg
-#define R_IP spc.IP.I16_reg.x_reg
-#define R_FLG spc.FLAGS
-
-/* special registers */
#define R_ESP spc.SP.I32_reg.e_reg
#define R_EBP spc.BP.I32_reg.e_reg
#define R_ESI spc.SI.I32_reg.e_reg
diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index 06e33f871..374235359 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>2.7.7</string>
+ <string>BUNDLE_VERSION_STRING</string>
<key>CFBundleVersion</key>
- <string>2.7.7</string>
+ <string>BUNDLE_VERSION</string>
<key>CFBundleSignature</key>
<string>x11a</string>
<key>CSResourcesFileMapped</key>
@@ -34,27 +34,14 @@
<key>SUPublicDSAKeyFile</key>
<string>sparkle.pem</string>
<key>SUFeedURL</key>
- <string>http://xquartz.macosforge.org/downloads/sparkle/release.xml</string>
- <key>NSAppTransportSecurity</key>
- <dict>
- <key>NSExceptionDomains</key>
- <dict>
- <key>macosforge.org</key>
- <dict>
- <key>NSIncludesSubdomains</key>
- <true/>
- <key>NSExceptionAllowsInsecureHTTPLoads</key>
- <true/>
- </dict>
- </dict>
- </dict>
+ <string>XQUARTZ_SPARKLE_FEED_URL</string>
#endif
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>
- <string>© 2003-2013 Apple Inc.
+ <string>© 2003-2016 Apple Inc.
© 2003 XFree86 Project, Inc.
-© 2003-2013 X.org Foundation, Inc.
+© 2003-2016 X.org Foundation, Inc.
</string>
<key>NSMainNibFile</key>
<string>main</string>
diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am
index 074075209..424a7475f 100644
--- a/hw/xquartz/bundle/Makefile.am
+++ b/hw/xquartz/bundle/Makefile.am
@@ -1,11 +1,13 @@
include cpprules.in
CPP_FILES_FLAGS = \
+ -DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)" \
-DBUNDLE_ID_PREFIX="$(BUNDLE_ID_PREFIX)" \
- -DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)"
+ -DBUNDLE_VERSION="$(BUNDLE_VERSION)" \
+ -DBUNDLE_VERSION_STRING="$(BUNDLE_VERSION_STRING)"
if XQUARTZ_SPARKLE
-CPP_FILES_FLAGS += -DXQUARTZ_SPARKLE
+CPP_FILES_FLAGS += -DXQUARTZ_SPARKLE -DXQUARTZ_SPARKLE_FEED_URL="$(XQUARTZ_SPARKLE_FEED_URL)"
endif
install-data-hook:
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 76729db9e..74dfe4e7e 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -76,8 +76,20 @@ static Bool
xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
{
PixmapPtr pixmap;
+ struct xwl_seat *xwl_seat;
pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
+ if (!pixmap)
+ return TRUE;
+
+ dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, NULL);
+
+ /* When called from FreeCursor(), device is always NULL */
+ if (device) {
+ xwl_seat = device->public.devicePrivate;
+ if (xwl_seat && cursor == xwl_seat->x_cursor)
+ xwl_seat->x_cursor = NULL;
+ }
return xwl_shm_destroy_pixmap(pixmap);
}
@@ -122,6 +134,9 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
cursor = xwl_seat->x_cursor;
pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
+ if (!pixmap)
+ return;
+
stride = cursor->bits->width * 4;
if (cursor->bits->argb)
memcpy(pixmap->devPrivate.ptr,
diff --git a/hw/xwayland/xwayland-glamor-xv.c b/hw/xwayland/xwayland-glamor-xv.c
index c99418d43..65f93c693 100644
--- a/hw/xwayland/xwayland-glamor-xv.c
+++ b/hw/xwayland/xwayland-glamor-xv.c
@@ -336,7 +336,7 @@ xwl_glamor_xv_add_adaptors(ScreenPtr pScreen)
pa = xnfcalloc(1, sizeof(XvAdaptorRec));
pa->pScreen = pScreen;
- pa->type = (unsigned int) (XvWindowMask | XvInputMask | XvImageMask);
+ pa->type = (unsigned char) (XvInputMask | XvImageMask);
pa->ddStopVideo = xwl_glamor_xv_stop_video;
pa->ddPutImage = xwl_glamor_xv_put_image;
pa->ddSetPortAttribute = xwl_glamor_xv_set_port_attribute;
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index 04aa8f223..a7ae78603 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -298,12 +298,13 @@ xwl_drm_init_egl(struct xwl_screen *xwl_screen)
return;
}
- eglBindAPI(EGL_OPENGL_API);
if (!eglInitialize(xwl_screen->egl_display, &major, &minor)) {
ErrorF("eglInitialize() failed\n");
return;
}
+ eglBindAPI(EGL_OPENGL_API);
+
version = eglQueryString(xwl_screen->egl_display, EGL_VERSION);
ErrorF("glamor: EGL version %s:\n", version);
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 4903062a1..b66da13cb 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -98,7 +98,6 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
int width, int height, int refresh)
{
struct xwl_output *xwl_output = data;
- RRModePtr randr_mode;
if (!(flags & WL_OUTPUT_MODE_CURRENT))
return;
@@ -111,13 +110,7 @@ output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
xwl_output->height = width;
}
- randr_mode = xwayland_cvt(width, height, refresh / 1000.0, 0, 0);
-
- RROutputSetModes(xwl_output->randr_output, &randr_mode, 1, 1);
-
- RRCrtcNotify(xwl_output->randr_crtc, randr_mode,
- xwl_output->x, xwl_output->y,
- xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
+ xwl_output->refresh = refresh;
}
static inline void
@@ -198,6 +191,14 @@ output_handle_done(void *data, struct wl_output *wl_output)
struct xwl_output *it, *xwl_output = data;
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
int width = 0, height = 0, has_this_output = 0;
+ RRModePtr randr_mode;
+
+ randr_mode = xwayland_cvt(xwl_output->width, xwl_output->height,
+ xwl_output->refresh / 1000.0, 0, 0);
+ RROutputSetModes(xwl_output->randr_output, &randr_mode, 1, 1);
+ RRCrtcNotify(xwl_output->randr_crtc, randr_mode,
+ xwl_output->x, xwl_output->y,
+ xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
/* output done event is sent even when some property
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index e8545b3be..c199e5efb 100644
--- a/hw/xwayland/xwayland-shm.c
+++ b/hw/xwayland/xwayland-shm.c
@@ -140,14 +140,20 @@ os_create_anonymous_file(off_t size)
return -1;
#ifdef HAVE_POSIX_FALLOCATE
- ret = posix_fallocate(fd, 0, size);
+ do {
+ ret = posix_fallocate(fd, 0, size);
+ } while (ret == EINTR);
+
if (ret != 0) {
close(fd);
errno = ret;
return -1;
}
#else
- ret = ftruncate(fd, size);
+ do {
+ ret = ftruncate(fd, size);
+ } while (ret == -1 && errno == EINTR);
+
if (ret < 0) {
close(fd);
return -1;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 67b30cb94..232d9f45c 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -147,7 +147,7 @@ struct xwl_output {
struct xwl_screen *xwl_screen;
RROutputPtr randr_output;
RRCrtcPtr randr_crtc;
- int32_t x, y, width, height;
+ int32_t x, y, width, height, refresh;
Rotation rotation;
};