Francisco Jerez
2009-Aug-17 15:24 UTC
[Nouveau] [PATCHv2 1/6] drm/i2c/ch7006: Fix some sparse warnings.
Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- drivers/gpu/drm/i2c/ch7006_drv.c | 2 +- drivers/gpu/drm/i2c/ch7006_mode.c | 2 +- drivers/gpu/drm/i2c/ch7006_priv.h | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c index c2594a1..7df4b86 100644 --- a/drivers/gpu/drm/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/i2c/ch7006_drv.c @@ -351,7 +351,7 @@ static int ch7006_encoder_set_property(struct drm_encoder *encoder, return 0; } -struct drm_encoder_slave_funcs ch7006_encoder_funcs = { +static struct drm_encoder_slave_funcs ch7006_encoder_funcs = { .set_config = ch7006_encoder_set_config, .destroy = ch7006_encoder_destroy, .dpms = ch7006_encoder_dpms, diff --git a/drivers/gpu/drm/i2c/ch7006_mode.c b/drivers/gpu/drm/i2c/ch7006_mode.c index e8f6db3..7ffe0bd 100644 --- a/drivers/gpu/drm/i2c/ch7006_mode.c +++ b/drivers/gpu/drm/i2c/ch7006_mode.c @@ -330,7 +330,7 @@ void ch7006_setup_properties(struct drm_encoder *encoder) struct drm_display_mode *mode = &ch_mode->mode; uint8_t *regs = state->regs; int flicker, contrast, hpos, vpos; - fixed scale, aspect; + uint64_t scale, aspect; flicker = interpolate(0, 2, 3, priv->flicker); regs[CH7006_FFILTER] = bitf(CH7006_FFILTER_TEXT, flicker) | diff --git a/drivers/gpu/drm/i2c/ch7006_priv.h b/drivers/gpu/drm/i2c/ch7006_priv.h index 608ddab..7ebb073 100644 --- a/drivers/gpu/drm/i2c/ch7006_priv.h +++ b/drivers/gpu/drm/i2c/ch7006_priv.h @@ -141,9 +141,8 @@ void ch7006_state_save(struct i2c_client *client, #define bitf(bitfield, x) __bitf(bitfield, x) #define bitfs(bitfield, s) __bitf(bitfield, bitfield##_##s) #define setbitf(state, reg, bitfield, x) \ - state->regs[reg] = (state->regs[reg] & \ - (typeof(*state->regs)) ~mask(reg##_##bitfield)) | \ - bitf(reg##_##bitfield, x) + state->regs[reg] = (state->regs[reg] & ~mask(reg##_##bitfield)) \ + | bitf(reg##_##bitfield, x) #define __unbitf(src, bitfield, x) ((x & __mask(src, bitfield)) \ >> (0?bitfield) << (src)) -- 1.6.3.3
Francisco Jerez
2009-Aug-17 15:24 UTC
[Nouveau] [PATCHv2 2/6] drm/nouveau: Fix some sparse warnings in the TV-out code.
Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- drivers/gpu/drm/nouveau/nv17_tv_modes.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv17_tv_modes.c b/drivers/gpu/drm/nouveau/nv17_tv_modes.c index 17adb8d..85f55b3 100644 --- a/drivers/gpu/drm/nouveau/nv17_tv_modes.c +++ b/drivers/gpu/drm/nouveau/nv17_tv_modes.c @@ -322,16 +322,15 @@ static void tv_setup_filter(struct drm_encoder *encoder) &tv_enc->state.vfilter}; int i, j, k; int32_t overscan = calc_overscan(tv_enc->overscan); - int64_t flicker = (tv_enc->flicker - 50) * id3; - int64_t rs[] = {mode->hdisplay * id3, - mode->vdisplay * id3}; + int64_t flicker = (tv_enc->flicker - 50) * (id3 / 100); + uint64_t rs[] = {mode->hdisplay * id3, + mode->vdisplay * id3}; - do_div(flicker, 100); do_div(rs[0], overscan * tv_norm->tv_enc_mode.hdisplay); do_div(rs[1], overscan * tv_norm->tv_enc_mode.vdisplay); for (k = 0; k < 2; k++) { - rs[k] = max(rs[k], id2); + rs[k] = max((int64_t)rs[k], id2); for (j = 0; j < 4; j++) { struct filter_params *p = &fparams[k][j]; -- 1.6.3.3
Francisco Jerez
2009-Aug-17 15:24 UTC
[Nouveau] [PATCHv2 3/6] drm/nouveau: Don't initialize two CRTCs on single head cards.
Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- drivers/gpu/drm/nouveau/nv04_display.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv04_display.c b/drivers/gpu/drm/nouveau/nv04_display.c index ed16e8d..b20ab01 100644 --- a/drivers/gpu/drm/nouveau/nv04_display.c +++ b/drivers/gpu/drm/nouveau/nv04_display.c @@ -125,8 +125,9 @@ nv04_display_create(struct drm_device *dev) dev->mode_config.fb_base = dev_priv->fb_phys; - for (i = 0; i < 2; i++) - nv04_crtc_create(dev, i); + nv04_crtc_create(dev, 0); + if (nv_two_heads(dev)) + nv04_crtc_create(dev, 1); for (i = 0; i < dcb->entries; i++) { struct dcb_entry *dcbent = &dcb->entry[i]; -- 1.6.3.3
Francisco Jerez
2009-Aug-17 15:24 UTC
[Nouveau] [PATCHv2 4/6] drm/nouveau: Fix some bandwidth problems on nv11 with TV and VGA enabled.
The VGA output was showing some flashing pixels when TV was enabled and the pixel clock was high enough. Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- drivers/gpu/drm/nouveau/nouveau_calc.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_calc.c b/drivers/gpu/drm/nouveau/nouveau_calc.c index e2b78d2..3f80db8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_calc.c +++ b/drivers/gpu/drm/nouveau/nouveau_calc.c @@ -174,7 +174,7 @@ nv10CalcArbitration(struct nv_fifo_info *fifo, struct nv_sim_state *arb) int us_m, us_m_min, us_n, us_p, crtc_drain_rate; int vus_m; int vpm_us, us_video, cpm_us, us_crt, clwm; - int clwm_rnd_down; + int clwm_rnd_down, min_clwm; int m2us, us_pipe_min, p1clk, p2; int min_mclk_extra; int us_min_mclk_extra; @@ -323,8 +323,12 @@ nv10CalcArbitration(struct nv_fifo_info *fifo, struct nv_sim_state *arb) min_mclk_extra--; } - if (clwm < (1024 - cbs + 8)) - clwm = 1024 - cbs + 8; + /* This correction works around a slight snow effect + * when the TV and VGA outputs are enabled simultaneously. */ + min_clwm = 1024 - cbs + 128 * pclk_freq / 100000; + if (clwm < min_clwm) + clwm = min_clwm; + /* printf("CRT LWM: prog: 0x%x, bs: 256\n", clwm); */ fifo->graphics_lwm = clwm; fifo->graphics_burst_size = cbs; -- 1.6.3.3
Francisco Jerez
2009-Aug-17 15:24 UTC
[Nouveau] [PATCHv2 5/6] drm/nouveau: Reject TV norm changes when there is a mode set.
Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- drivers/gpu/drm/nouveau/nv17_tv.c | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv17_tv.c b/drivers/gpu/drm/nouveau/nv17_tv.c index fdc28b1..9d8e678 100644 --- a/drivers/gpu/drm/nouveau/nv17_tv.c +++ b/drivers/gpu/drm/nouveau/nv17_tv.c @@ -508,8 +508,10 @@ static int nv17_tv_set_property(struct drm_encoder *encoder, uint64_t val) { struct drm_mode_config *conf = &encoder->dev->mode_config; + struct drm_crtc *crtc = encoder->crtc; struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); + bool modes_changed = false; if (property == conf->tv_overscan_property) { tv_enc->overscan = val; @@ -543,8 +545,12 @@ static int nv17_tv_set_property(struct drm_encoder *encoder, nv17_tv_update_rescaler(encoder); } else if (property == conf->tv_mode_property) { + if (connector->dpms != DRM_MODE_DPMS_OFF) + return -EINVAL; + tv_enc->tv_norm = val; - drm_helper_probe_single_connector_modes(connector, 0, 0); + + modes_changed = true; } else if (property == conf->tv_select_subconnector_property) { if (tv_norm->kind != TV_ENC_MODE) @@ -557,6 +563,20 @@ static int nv17_tv_set_property(struct drm_encoder *encoder, return -EINVAL; } + if (modes_changed) { + drm_helper_probe_single_connector_modes(connector, 0, 0); + + /* Disable the crtc to ensure a full modeset is + * performed whenever it's turned on again. */ + if (crtc) { + struct drm_mode_set modeset = { + .crtc = crtc, + }; + + crtc->funcs->set_config(&modeset); + } + } + return 0; } -- 1.6.3.3
Francisco Jerez
2009-Aug-17 15:24 UTC
[Nouveau] [PATCHv2 6/6] drm/i2c/ch7006: Reject TV norm changes when there is a mode set.
Signed-off-by: Francisco Jerez <currojerez at riseup.net> --- drivers/gpu/drm/i2c/ch7006_drv.c | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c index 7df4b86..a890652 100644 --- a/drivers/gpu/drm/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/i2c/ch7006_drv.c @@ -287,6 +287,8 @@ static int ch7006_encoder_set_property(struct drm_encoder *encoder, struct ch7006_priv *priv = to_ch7006_priv(encoder); struct ch7006_state *state = &priv->state; struct drm_mode_config *conf = &encoder->dev->mode_config; + struct drm_crtc *crtc = encoder->crtc; + bool modes_changed = false; ch7006_dbg(client, "\n"); @@ -314,9 +316,12 @@ static int ch7006_encoder_set_property(struct drm_encoder *encoder, ch7006_load_reg(client, state, CH7006_VPOS); } else if (property == conf->tv_mode_property) { + if (connector->dpms != DRM_MODE_DPMS_OFF) + return -EINVAL; + priv->norm = val; - drm_helper_probe_single_connector_modes(connector, 0, 0); + modes_changed = true; } else if (property == conf->tv_brightness_property) { priv->brightness = val; @@ -340,14 +345,31 @@ static int ch7006_encoder_set_property(struct drm_encoder *encoder, ch7006_load_reg(client, state, CH7006_FFILTER); } else if (property == priv->scale_property) { + if (connector->dpms != DRM_MODE_DPMS_OFF) + return -EINVAL; + priv->scale = val; - drm_helper_probe_single_connector_modes(connector, 0, 0); + modes_changed = true; } else { return -EINVAL; } + if (modes_changed) { + drm_helper_probe_single_connector_modes(connector, 0, 0); + + /* Disable the crtc to ensure a full modeset is + * performed whenever it's turned on again. */ + if (crtc) { + struct drm_mode_set modeset = { + .crtc = crtc, + }; + + crtc->funcs->set_config(&modeset); + } + } + return 0; } -- 1.6.3.3
Apparently Analagous Threads
- [PATCH 1/6] drm/i2c/ch7006: Fix some sparse warnings.
- [PATCH 1/3] drm/nouveau: Update the CRTC arbitration parameters on FB depth switch.
- [PATCH 00/12] TV-out modesetting kernel patches.
- [PATCHv2 01/10] drm/nouveau: Fix a lock up at NVSetOwner with nv11.
- [PATCH 1/2] drm/i2c/ch7006: Make some parameter descriptions more useful.