forked from mirrors/nixpkgs
164 lines
4.8 KiB
Diff
164 lines
4.8 KiB
Diff
|
From b41eafa282a003cde9729e2ff486f55dc54f12c6 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 10/14] 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 5f0044c..85378aa 100644
|
||
|
--- a/amd/amdgpu/dce_v10_0.c
|
||
|
+++ b/amd/amdgpu/dce_v10_0.c
|
||
|
@@ -2671,6 +2671,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)
|
||
|
{
|
||
|
@@ -2685,6 +2703,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 8edc670..0129543 100644
|
||
|
--- a/amd/amdgpu/dce_v11_0.c
|
||
|
+++ b/amd/amdgpu/dce_v11_0.c
|
||
|
@@ -2681,6 +2681,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)
|
||
|
{
|
||
|
@@ -2695,6 +2713,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 57e8014..d0d9267 100644
|
||
|
--- a/amd/amdgpu/dce_v8_0.c
|
||
|
+++ b/amd/amdgpu/dce_v8_0.c
|
||
|
@@ -2525,6 +2525,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)
|
||
|
{
|
||
|
@@ -2539,6 +2557,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 fedf490..c1f3c27 100644
|
||
|
--- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c
|
||
|
+++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c
|
||
|
@@ -995,6 +995,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,
|
||
|
@@ -1002,6 +1009,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;
|
||
|
@@ -1009,6 +1017,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.10.1
|
||
|
|