From 6a19ac7b9cf830807a2a870edb681899c59a8604 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Mon, 10 Feb 2014 19:33:31 +0400 Subject: [PATCH] nvidia-drivers-334.16-r4 updated: Fix Optimus. --- .../nvidia-drivers/files/optimus-334.16.patch | 87 +++++++++++++++++++ .../nvidia-drivers-334.16-r4.ebuild | 1 + 2 files changed, 88 insertions(+) create mode 100644 x11-drivers/nvidia-drivers/files/optimus-334.16.patch diff --git a/x11-drivers/nvidia-drivers/files/optimus-334.16.patch b/x11-drivers/nvidia-drivers/files/optimus-334.16.patch new file mode 100644 index 00000000..e05c800f --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/optimus-334.16.patch @@ -0,0 +1,87 @@ +diff -rupN kernel/nv-acpi.c kernel/nv-acpi.c +--- kernel/nv-acpi.c 2014-01-25 09:39:47.126966926 +0100 ++++ kernel/nv-acpi.c 2014-01-26 09:59:45.853427603 +0100 +@@ -1076,10 +1079,17 @@ RM_STATUS NV_API_CALL nv_acpi_dsm_method + NvU8 argument3[4]; /* For all DSM sub functions, input size is 4 */ + NvU32 data_size; + acpi_handle dev_handle = NULL; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + #ifdef DEVICE_ACPI_HANDLE + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + dev_handle = DEVICE_ACPI_HANDLE(&nvl->dev->dev); + #endif ++#else ++#ifdef ACPI_HANDLE ++ nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); ++ dev_handle = ACPI_HANDLE(&nvl->dev->dev); ++#endif ++#endif + + if (!dev_handle) + return RM_ERR_NOT_SUPPORTED; +@@ -1179,12 +1189,21 @@ RM_STATUS NV_API_CALL nv_acpi_ddc_method + NvU32 i; + acpi_handle dev_handle = NULL; + acpi_handle lcd_dev_handle = NULL; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + #ifdef DEVICE_ACPI_HANDLE + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + dev_handle = DEVICE_ACPI_HANDLE(&nvl->dev->dev); + #else + return RM_ERR_NOT_SUPPORTED; + #endif ++#else ++#ifdef ACPI_HANDLE ++ nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); ++ dev_handle = ACPI_HANDLE(&nvl->dev->dev); ++#else ++ return RM_ERR_NOT_SUPPORTED; ++#endif ++#endif + if (!dev_handle) + return RM_ERR_INVALID_ARGUMENT; + +@@ -1294,12 +1313,21 @@ RM_STATUS NV_API_CALL nv_acpi_rom_method + struct acpi_object_list input = { 2, rom_arg }; + acpi_handle dev_handle = NULL; + uint32_t offset, length; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + #ifdef DEVICE_ACPI_HANDLE + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + dev_handle = DEVICE_ACPI_HANDLE(&nvl->dev->dev); + #else + return RM_ERR_NOT_SUPPORTED; + #endif ++#else ++#ifdef ACPI_HANDLE ++ nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); ++ dev_handle = ACPI_HANDLE(&nvl->dev->dev); ++#else ++ return RM_ERR_NOT_SUPPORTED; ++#endif ++#endif + + if (!dev_handle) + return RM_ERR_INVALID_ARGUMENT; +@@ -1364,12 +1392,21 @@ RM_STATUS NV_API_CALL nv_acpi_dod_method + union acpi_object *dod; + acpi_handle dev_handle = NULL; + NvU32 i, count = (*pSize / sizeof(NvU32)); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + #ifdef DEVICE_ACPI_HANDLE + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + dev_handle = DEVICE_ACPI_HANDLE(&nvl->dev->dev); + #else + return RM_ERR_NOT_SUPPORTED; + #endif ++#else ++#ifdef ACPI_HANDLE ++ nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); ++ dev_handle = ACPI_HANDLE(&nvl->dev->dev); ++#else ++ return RM_ERR_NOT_SUPPORTED; ++#endif ++#endif + + if (!dev_handle) + return RM_ERR_INVALID_ARGUMENT; diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-334.16-r4.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-334.16-r4.ebuild index a89da361..cd5f9d66 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-334.16-r4.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-334.16-r4.ebuild @@ -179,6 +179,7 @@ src_prepare() { # fix: Unknown symbol acpi_os_wait_events_complete (err 0) on linux-3.13 if kernel_is ge 3 13 0 ; then epatch "${FILESDIR}"/acpi_os_wait_events_complete-334.16.patch + epatch "${FILESDIR}"/optimus-334.16.patch fi # Allow user patches so they can support RC kernels and whatever else