From 1fa92e498e585c0f79d73caff792bbce38876493 Mon Sep 17 00:00:00 2001 From: Randall Wald Date: Thu, 15 Nov 2012 00:04:08 -0500 Subject: Added new version of xf86-video-intel with the Virtual CRTC patch --- x11-drivers/xf86-video-intel/ChangeLog | 11 + x11-drivers/xf86-video-intel/Manifest | 4 + .../xf86-video-intel-2.20.2_virtual_crtc.patch | 331 +++++++++++++++++++++ .../xf86-video-intel-2.20.2-r1.ebuild | 58 ++++ 4 files changed, 404 insertions(+) create mode 100644 x11-drivers/xf86-video-intel/ChangeLog create mode 100644 x11-drivers/xf86-video-intel/Manifest create mode 100644 x11-drivers/xf86-video-intel/files/xf86-video-intel-2.20.2_virtual_crtc.patch create mode 100644 x11-drivers/xf86-video-intel/xf86-video-intel-2.20.2-r1.ebuild diff --git a/x11-drivers/xf86-video-intel/ChangeLog b/x11-drivers/xf86-video-intel/ChangeLog new file mode 100644 index 0000000..8895951 --- /dev/null +++ b/x11-drivers/xf86-video-intel/ChangeLog @@ -0,0 +1,11 @@ +# ChangeLog for x11-drivers/xf86-video-intel +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + +*xf86-video-intel-2.20.2-r1 (15 Nov 2012) + + 15 Nov 2012; Randall Wald + +xf86-video-intel-2.20.2-r1.ebuild, + +files/xf86-video-intel-2.20.2_virtual_crtc.patch: + Ebuild applies Virtual CRTC patch + diff --git a/x11-drivers/xf86-video-intel/Manifest b/x11-drivers/xf86-video-intel/Manifest new file mode 100644 index 0000000..2760d5c --- /dev/null +++ b/x11-drivers/xf86-video-intel/Manifest @@ -0,0 +1,4 @@ +AUX xf86-video-intel-2.20.2_virtual_crtc.patch 8268 SHA256 b78b769624174fb60be96bb1b676f6e88bd04df039d72e68baf557fc59437c4e SHA512 cbc54903b06236dfc9f3c8a149d38497a23630696367cc8218834e16ed0d9331b107a6e03c43425b8bfe3bf82213227fedfe8df38a447d3a801a3d199b8c913c WHIRLPOOL 175092f9bb9675e19bc40ba20f96ab759135c9cfda11356b1556d4da6f3dd233b9da1b460f7822a610047165017ded4512e40c7268b477360c4e9dfbf2653a23 +DIST xf86-video-intel-2.20.2.tar.bz2 1559622 SHA256 4c30cce0b5f7b427d76898c439f2c9fd31a8b45babd8ef82ec4c0004ae0a26a9 SHA512 bbb5bd42a31b67003ef440ce55593bc78feaf20a31bbf68b1152ad4dffbbb7f9a3581e63775024829d21260fc2d4e363fa47d9dba404e7a44bfced418eb6a940 WHIRLPOOL 40bd264ed3636be8117d7e2036bc044a4bdc074997765c851ce2097685e11cd241ff34cbf6611710e20f45210d0a5a81d61c96eaf6d33af48e44ed8104b63247 +EBUILD xf86-video-intel-2.20.2-r1.ebuild 1416 SHA256 1b14ba9d6c2e58bcc90876f4949940dc1308e347981a47cfc6328880fbdb95f5 SHA512 461d49c86faa5637a18ac5bb81252d63c0329e8093f3e25ba4c528f7d618818811bbcaee69e55102be9c030f63014a5b3a2783bae678627a3c75630b89d7211c WHIRLPOOL 4f234b5be0f3177ea2502b31a4a0ebf9b93963ee3ec453da0f19276617052c9e7f17f2523164c3daf03660d5c05dc193438b0a36a0d4ec35ae9d861c93060e7a +MISC ChangeLog 347 SHA256 c6760636966cf9a04d7e205491fab6f2c60517cc4905739fe9f171f70b7a9e41 SHA512 473355673ad3b3df9668cdf5f972caf44eea4d44b0d2145b29c479929086bcee02f0b003708eafba66ad1f9fe2d1122010c73e6ba01cccecfcab72df6c2b2c0d WHIRLPOOL 544b1bd7fe0238347961dbab41769a3d25e7fe0c1e5c490155c28a0b9f6c5d5563232173711279b89e4f665608e5abbfcb47dd263238d6cf39f791fcc9d5f824 diff --git a/x11-drivers/xf86-video-intel/files/xf86-video-intel-2.20.2_virtual_crtc.patch b/x11-drivers/xf86-video-intel/files/xf86-video-intel-2.20.2_virtual_crtc.patch new file mode 100644 index 0000000..a8cacf8 --- /dev/null +++ b/x11-drivers/xf86-video-intel/files/xf86-video-intel-2.20.2_virtual_crtc.patch @@ -0,0 +1,331 @@ +This is a patch that adds a single virtual CRTC to an intel driver. The +motivation is that this output may be turned on and cloned (in userspace) to +another X server, which may be running on a different graphics card. My usecase +is a triple-head (with hotplug) setup on a NVIDIA Optimus laptop. See +. + + -- Tomáš Janoušek + +diff --git a/src/intel_display.c b/src/intel_display.c +index 6580c8c..1ce5835 100644 +--- a/src/intel_display.c ++++ b/src/intel_display.c +@@ -115,6 +115,8 @@ struct intel_output { + struct list link; + }; + ++#include "virtual_display.c" ++ + static void + intel_output_dpms(xf86OutputPtr output, int mode); + +@@ -347,6 +349,9 @@ intel_mode_disable_unused_functions(ScrnInfoPtr scrn) + + /* Force off for consistency between kernel and ddx */ + for (i = 0; i < xf86_config->num_crtc; i++) { ++ if (is_virtual(mode, i)) ++ continue; ++ + xf86CrtcPtr crtc = xf86_config->crtc[i]; + if (!crtc->enabled) + drmModeSetCrtc(mode->fd, crtc_id(crtc->driver_private), +@@ -1366,7 +1371,7 @@ intel_output_init(ScrnInfoPtr scrn, struct intel_mode *mode, int num) + if (is_panel(koutput->connector_type)) + intel_output_backlight_init(output); + +- output->possible_crtcs = kencoder->possible_crtcs; ++ output->possible_crtcs = kencoder->possible_crtcs & ((1 << mode->mode_res->count_crtcs) - 1); + output->possible_clones = kencoder->possible_clones; + output->interlaceAllowed = TRUE; + +@@ -1439,6 +1444,9 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) + if (!crtc->enabled) + continue; + ++ if (is_virtual(mode, i)) ++ continue; ++ + if (!intel_crtc_apply(crtc)) + goto fail; + } +@@ -1508,6 +1516,9 @@ intel_do_pageflip(intel_screen_private *intel, + if (!config->crtc[i]->enabled) + continue; + ++ if (is_virtual(mode, i)) ++ continue; ++ + mode->flip_info = flip_info; + mode->flip_count++; + +@@ -1644,6 +1655,9 @@ Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp) + for (i = 0; i < mode->mode_res->count_connectors; i++) + intel_output_init(scrn, mode, i); + ++ virtual_crtc_init(scrn, mode); ++ virtual_output_init(scrn, mode); ++ + xf86InitialConfiguration(scrn, TRUE); + + mode->event_context.version = DRM_EVENT_CONTEXT_VERSION; +@@ -1754,6 +1768,10 @@ Bool intel_crtc_on(xf86CrtcPtr crtc) + if (!ret) + return FALSE; + ++ /* Virtual CRTC? */ ++ if (intel_crtc->mode_crtc == NULL) ++ return ret; ++ + /* And finally check with the kernel that the fb is bound */ + drm_crtc = drmModeGetCrtc(intel_crtc->mode->fd, crtc_id(intel_crtc)); + if (drm_crtc == NULL) +@@ -1856,6 +1874,10 @@ void intel_copy_fb(ScrnInfoPtr scrn) + fbcon_id = 0; + for (i = 0; i < xf86_config->num_crtc; i++) { + intel_crtc = xf86_config->crtc[i]->driver_private; ++ ++ if (is_virtual(intel_crtc->mode, i)) ++ continue; ++ + if (intel_crtc->mode_crtc->buffer_id) + fbcon_id = intel_crtc->mode_crtc->buffer_id; + } +diff --git a/src/virtual_display.c b/src/virtual_display.c +new file mode 100644 +index 0000000..eb51e45 +--- /dev/null ++++ b/src/virtual_display.c +@@ -0,0 +1,233 @@ ++static void ++virtual_crtc_dpms(xf86CrtcPtr intel_crtc, int mode) ++{ ++ ++} ++ ++static Bool ++virtual_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, ++ Rotation rotation, int x, int y) ++{ ++ return TRUE; ++} ++ ++static void ++virtual_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) ++{ ++ ++} ++ ++static void ++virtual_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) ++{ ++} ++ ++static void ++virtual_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image) ++{ ++} ++ ++static void ++virtual_crtc_hide_cursor(xf86CrtcPtr crtc) ++{ ++} ++ ++static void ++virtual_crtc_show_cursor(xf86CrtcPtr crtc) ++{ ++} ++ ++static void * ++virtual_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height) ++{ ++ return NULL; ++} ++ ++static PixmapPtr ++virtual_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height) ++{ ++ return NULL; ++} ++ ++static void ++virtual_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) ++{ ++} ++ ++static void ++virtual_crtc_gamma_set(xf86CrtcPtr crtc, ++ CARD16 *red, CARD16 *green, CARD16 *blue, int size) ++{ ++} ++ ++static void ++virtual_crtc_destroy(xf86CrtcPtr crtc) ++{ ++ struct intel_crtc *intel_crtc = crtc->driver_private; ++ ++ list_del(&intel_crtc->link); ++ free(intel_crtc); ++ ++ crtc->driver_private = NULL; ++} ++ ++static const xf86CrtcFuncsRec virtual_crtc_funcs = { ++ .dpms = virtual_crtc_dpms, ++ .set_mode_major = virtual_crtc_set_mode_major, ++ .set_cursor_colors = virtual_crtc_set_cursor_colors, ++ .set_cursor_position = virtual_crtc_set_cursor_position, ++ .show_cursor = virtual_crtc_show_cursor, ++ .hide_cursor = virtual_crtc_hide_cursor, ++ .load_cursor_argb = virtual_crtc_load_cursor_argb, ++ .shadow_create = virtual_crtc_shadow_create, ++ .shadow_allocate = virtual_crtc_shadow_allocate, ++ .shadow_destroy = virtual_crtc_shadow_destroy, ++ .gamma_set = virtual_crtc_gamma_set, ++ .destroy = virtual_crtc_destroy, ++}; ++ ++static void ++virtual_crtc_init(ScrnInfoPtr scrn, struct intel_mode *mode) ++{ ++ xf86CrtcPtr crtc; ++ struct intel_crtc *intel_crtc; ++ ++ intel_crtc = calloc(sizeof(struct intel_crtc), 1); ++ if (intel_crtc == NULL) ++ return; ++ ++ crtc = xf86CrtcCreate(scrn, &virtual_crtc_funcs); ++ if (crtc == NULL) { ++ free(intel_crtc); ++ return; ++ } ++ ++ intel_crtc->mode = mode; ++ intel_crtc->crtc = crtc; ++ crtc->driver_private = intel_crtc; ++ list_add(&intel_crtc->link, &mode->crtcs); ++} ++ ++static xf86OutputStatus ++virtual_output_detect(xf86OutputPtr output) ++{ ++ // return XF86OutputStatusConnected; ++ // return XF86OutputStatusDisconnected; ++ return XF86OutputStatusUnknown; ++} ++ ++static Bool ++virtual_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes) ++{ ++ return MODE_OK; ++} ++ ++static DisplayModePtr ++virtual_output_get_modes(xf86OutputPtr output) ++{ ++ DisplayModePtr i, m, p = NULL; ++ int max_x = 1920, max_y = 1200; ++ float max_vrefresh = 60.0; ++ ++#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,0,0) ++ m = xf86GetDefaultModes(); ++#else ++ m = xf86GetDefaultModes(0,0); ++#endif ++ ++ xf86ValidateModesSize(output->scrn, m, max_x, max_y, 0); ++ ++ for (i = m; i; i = i->next) { ++ if (xf86ModeVRefresh(i) > max_vrefresh) ++ i->status = MODE_VSYNC; ++ if (p && i->HDisplay >= p->HDisplay && ++ i->VDisplay >= p->VDisplay && ++ xf86ModeVRefresh(i) >= xf86ModeVRefresh(p)) ++ i->status = MODE_VSYNC; ++ } ++ ++ xf86PruneInvalidModes(output->scrn, &m, FALSE); ++ ++ return m; ++} ++ ++static void ++virtual_output_destroy(xf86OutputPtr output) ++{ ++ struct intel_output *intel_output = output->driver_private; ++ ++ list_del(&intel_output->link); ++ free(intel_output); ++ ++ output->driver_private = NULL; ++} ++ ++static void ++virtual_output_dpms(xf86OutputPtr output, int dpms) ++{ ++} ++ ++static void ++virtual_output_create_resources(xf86OutputPtr output) ++{ ++} ++ ++static Bool ++virtual_output_set_property(xf86OutputPtr output, Atom property, ++ RRPropertyValuePtr value) ++{ ++ return TRUE; ++} ++ ++static Bool ++virtual_output_get_property(xf86OutputPtr output, Atom property) ++{ ++ return FALSE; ++} ++ ++static const xf86OutputFuncsRec virtual_output_funcs = { ++ .create_resources = virtual_output_create_resources, ++#ifdef RANDR_12_INTERFACE ++ .set_property = virtual_output_set_property, ++ .get_property = virtual_output_get_property, ++#endif ++ .dpms = virtual_output_dpms, ++ .detect = virtual_output_detect, ++ .mode_valid = virtual_output_mode_valid, ++ ++ .get_modes = virtual_output_get_modes, ++ .destroy = virtual_output_destroy ++}; ++ ++static void ++virtual_output_init(ScrnInfoPtr scrn, struct intel_mode *mode) ++{ ++ xf86OutputPtr output; ++ struct intel_output *intel_output; ++ char name[32] = "VIRTUAL"; ++ ++ output = xf86OutputCreate (scrn, &virtual_output_funcs, name); ++ if (!output) { ++ return; ++ } ++ ++ intel_output = calloc(sizeof(struct intel_output), 1); ++ if (!intel_output) { ++ xf86OutputDestroy(output); ++ return; ++ } ++ ++ output->subpixel_order = SubPixelHorizontalRGB; ++ output->possible_crtcs = (1 << mode->mode_res->count_crtcs); ++ output->driver_private = intel_output; ++ intel_output->output = output; ++ intel_output->mode = mode; ++ ++ list_add(&intel_output->link, &mode->outputs); ++} ++ ++static Bool ++is_virtual(struct intel_mode *mode, int i) ++{ ++ return i >= mode->mode_res->count_crtcs; ++} diff --git a/x11-drivers/xf86-video-intel/xf86-video-intel-2.20.2-r1.ebuild b/x11-drivers/xf86-video-intel/xf86-video-intel-2.20.2-r1.ebuild new file mode 100644 index 0000000..a474c1c --- /dev/null +++ b/x11-drivers/xf86-video-intel/xf86-video-intel-2.20.2-r1.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/xf86-video-intel/xf86-video-intel-2.20.2.ebuild,v 1.4 2012/10/24 06:24:45 remi Exp $ + +EAPI=4 + +XORG_DRI=dri +inherit linux-info xorg-2 + +DESCRIPTION="X.Org driver for Intel cards" + +KEYWORDS="~amd64 ~ia64 ~x86 ~amd64-fbsd -x86-fbsd" +IUSE="glamor +sna" + +RDEPEND="x11-libs/libXext + x11-libs/libXfixes + x11-libs/libXvMC + >=x11-libs/libxcb-1.5 + >=x11-libs/pixman-0.27.1 + x11-libs/xcb-util + >=x11-libs/libdrm-2.4.29[video_cards_intel] + glamor? ( + x11-libs/glamor + ) + sna? ( + >=x11-base/xorg-server-1.10 + )" +DEPEND="${RDEPEND} + >=x11-proto/dri2proto-2.6" + +src_prepare() { + epatch "${FILESDIR}/${P}_virtual_crtc.patch" +} + +src_configure() { + XORG_CONFIGURE_OPTIONS=( + $(use_enable dri) + $(use_enable glamor) + $(use_enable sna) + --enable-xvmc + ) + xorg-2_src_configure +} + +pkg_postinst() { + if linux_config_exists \ + && ! linux_chkconfig_present DRM_I915_KMS; then + echo + ewarn "This driver requires KMS support in your kernel" + ewarn " Device Drivers --->" + ewarn " Graphics support --->" + ewarn " Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->" + ewarn " <*> Intel 830M, 845G, 852GM, 855GM, 865G (i915 driver) --->" + ewarn " i915 driver" + ewarn " [*] Enable modesetting on intel by default" + echo + fi +} -- cgit v1.2.3-65-gdbad