diff options
Diffstat (limited to 'pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch')
-rw-r--r-- | pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch new file mode 100644 index 00000000000..566b7039bb3 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Fix-crtc_gamma-functions-for-4.8.0.patch @@ -0,0 +1,163 @@ +From 12660ae02838f99c0784194908f7a189bc2ab0ae Mon Sep 17 00:00:00 2001 +From: "Luke A. Guest" <laguest@archeia.com> +Date: Sun, 25 Sep 2016 16:56:47 +0100 +Subject: [PATCH 06/11] Fix crtc_gamma functions for 4.8.0 + +--- + amd/amdgpu/dce_v10_0.c | 19 +++++++++++++++++++ + amd/amdgpu/dce_v11_0.c | 19 +++++++++++++++++++ + amd/amdgpu/dce_v8_0.c | 19 +++++++++++++++++++ + amd/dal/amdgpu_dm/amdgpu_dm_types.c | 12 ++++++++++++ + 4 files changed, 69 insertions(+) + +diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c +index b1880ac..53746fa 100644 +--- a/amd/amdgpu/dce_v10_0.c ++++ b/amd/amdgpu/dce_v10_0.c +@@ -2627,6 +2627,24 @@ static void dce_v10_0_cursor_reset(struct drm_crtc *crtc) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, ++ u16 *blue, uint32_t size) ++{ ++ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); ++ int i; ++ ++ /* userspace palettes are always correct as is */ ++ for (i = 0; i < size; i++) { ++ amdgpu_crtc->lut_r[i] = red[i] >> 6; ++ amdgpu_crtc->lut_g[i] = green[i] >> 6; ++ amdgpu_crtc->lut_b[i] = blue[i] >> 6; ++ } ++ dce_v10_0_crtc_load_lut(crtc); ++ ++ return 0; ++} ++#else + static void dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + u16 *blue, uint32_t start, uint32_t size) + { +@@ -2641,6 +2659,7 @@ static void dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green + } + dce_v10_0_crtc_load_lut(crtc); + } ++#endif + + static void dce_v10_0_crtc_destroy(struct drm_crtc *crtc) + { +diff --git a/amd/amdgpu/dce_v11_0.c b/amd/amdgpu/dce_v11_0.c +index b654b64..3edd66d 100644 +--- a/amd/amdgpu/dce_v11_0.c ++++ b/amd/amdgpu/dce_v11_0.c +@@ -2643,6 +2643,24 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, ++ u16 *blue, uint32_t size) ++{ ++ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); ++ int i; ++ ++ /* userspace palettes are always correct as is */ ++ for (i = 0; i < size; i++) { ++ amdgpu_crtc->lut_r[i] = red[i] >> 6; ++ amdgpu_crtc->lut_g[i] = green[i] >> 6; ++ amdgpu_crtc->lut_b[i] = blue[i] >> 6; ++ } ++ dce_v11_0_crtc_load_lut(crtc); ++ ++ return 0; ++} ++#else + static void dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + u16 *blue, uint32_t start, uint32_t size) + { +@@ -2657,6 +2675,7 @@ static void dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green + } + dce_v11_0_crtc_load_lut(crtc); + } ++#endif + + static void dce_v11_0_crtc_destroy(struct drm_crtc *crtc) + { +diff --git a/amd/amdgpu/dce_v8_0.c b/amd/amdgpu/dce_v8_0.c +index b598caa..d203894 100644 +--- a/amd/amdgpu/dce_v8_0.c ++++ b/amd/amdgpu/dce_v8_0.c +@@ -2478,6 +2478,24 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc) + } + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, ++ u16 *blue, uint32_t size) ++{ ++ struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); ++ int i; ++ ++ /* userspace palettes are always correct as is */ ++ for (i = 0; i < size; i++) { ++ amdgpu_crtc->lut_r[i] = red[i] >> 6; ++ amdgpu_crtc->lut_g[i] = green[i] >> 6; ++ amdgpu_crtc->lut_b[i] = blue[i] >> 6; ++ } ++ dce_v8_0_crtc_load_lut(crtc); ++ ++ return 0; ++} ++#else + static void dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + u16 *blue, uint32_t start, uint32_t size) + { +@@ -2492,6 +2510,7 @@ static void dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, + } + dce_v8_0_crtc_load_lut(crtc); + } ++#endif + + static void dce_v8_0_crtc_destroy(struct drm_crtc *crtc) + { +diff --git a/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +index edc8e86..32755a9 100644 +--- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c ++++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c +@@ -998,6 +998,13 @@ void amdgpu_dm_crtc_destroy(struct drm_crtc *crtc) + kfree(crtc); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++static int amdgpu_dm_atomic_crtc_gamma_set(struct drm_crtc *crtc, ++ u16 *red, ++ u16 *green, ++ u16 *blue, ++ uint32_t size) ++#else + static void amdgpu_dm_atomic_crtc_gamma_set( + struct drm_crtc *crtc, + u16 *red, +@@ -1005,6 +1012,7 @@ static void amdgpu_dm_atomic_crtc_gamma_set( + u16 *blue, + uint32_t start, + uint32_t size) ++#endif + { + struct drm_device *dev = crtc->dev; + struct drm_property *prop = dev->mode_config.prop_crtc_id; +@@ -1012,6 +1020,10 @@ static void amdgpu_dm_atomic_crtc_gamma_set( + crtc->state->mode.private_flags |= AMDGPU_CRTC_MODE_PRIVATE_FLAGS_GAMMASET; + + drm_atomic_helper_crtc_set_property(crtc, prop, 0); ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return 0; ++#endif + } + + static int dm_crtc_funcs_atomic_set_property( +-- +2.11.0 + |