i915.enable_dithering allows to force dithering on all outputs
on (=1) or off (=0). The default is -1 for current automatic
per-pipe selection.

This is useful for debugging and for special case scenarios,
e.g., providing simulated 10 bpc output on 8 bpc digital sinks
if a 10 bpc framebuffer + rendering is in use.

A more flexible solution would be connector properties, like
other drivers (radeon, amdgpu, nouveau) already provide. A
global override via module parameter is useful even with such
connector properties, e.g., for scientific applications which
require strict control over dithering, to have an override
for DE's which may not expose such properties via some standard
protocol in a user-controllable way, e.g., afaik all currently
existing Wayland compositors.

Tested on Ironlake, IvyBridge, Haswell, Skylake.

Signed-off-by: Mario Kleiner <mario.kleiner...@gmail.com>
---
 drivers/gpu/drm/i915/i915_params.c   | 5 +++++
 drivers/gpu/drm/i915/i915_params.h   | 1 +
 drivers/gpu/drm/i915/intel_display.c | 5 +++++
 3 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_params.c 
b/drivers/gpu/drm/i915/i915_params.c
index 8ab003dca113..07ec3a96457c 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -65,6 +65,7 @@ struct i915_params i915 __read_mostly = {
        .inject_load_failure = 0,
        .enable_dpcd_backlight = false,
        .enable_gvt = false,
+       .enable_dithering = -1,
 };
 
 module_param_named(modeset, i915.modeset, int, 0400);
@@ -257,3 +258,7 @@ MODULE_PARM_DESC(enable_dpcd_backlight,
 module_param_named(enable_gvt, i915.enable_gvt, bool, 0400);
 MODULE_PARM_DESC(enable_gvt,
        "Enable support for Intel GVT-g graphics virtualization host 
support(default:false)");
+
+module_param_named(enable_dithering, i915.enable_dithering, int, 0644);
+MODULE_PARM_DESC(enable_dithering,
+       "Enable dithering (-1=auto [default], 0=force off on all outputs, 
1=force on on all outputs)");
diff --git a/drivers/gpu/drm/i915/i915_params.h 
b/drivers/gpu/drm/i915/i915_params.h
index ac844709c97e..7e365cd4fc91 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -54,6 +54,7 @@
        func(int, edp_vswing); \
        func(int, reset); \
        func(unsigned int, inject_load_failure); \
+       func(int, enable_dithering); \
        /* leave bools at the end to not create holes */ \
        func(bool, alpha_support); \
        func(bool, enable_cmd_parser); \
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 0e93ec201fe3..bea471a96820 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10978,6 +10978,11 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
         */
        pipe_config->dither = (pipe_config->pipe_bpp == 6*3) &&
                !pipe_config->dither_force_disable;
+
+       /* Override of auto-selected dither mode via module parameter? */
+       if (i915.enable_dithering != -1)
+               pipe_config->dither = i915.enable_dithering > 0 ? true : false;
+
        DRM_DEBUG_KMS("hw max bpp: %i, pipe bpp: %i, dithering: %i\n",
                      base_bpp, pipe_config->pipe_bpp, pipe_config->dither);
 
-- 
2.13.0.rc1.294.g07d810a77f

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to