diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-10-26 10:16:30 -0400 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2014-01-20 04:04:46 -0500 |
commit | 545cdd5510205f01cd9604e23385bac468d45c63 (patch) | |
tree | 1018894b8b3b22b26b3e7d0f08c116a8889fef5d | |
parent | cfd72a4c2089aa3938f37281a34d6eb3306d5fd8 (diff) |
drm: Pass the display mode to drm_calc_timestamping_constants()
We don't really use hwmode anymore in i915, so eliminating its use
from the core code seems prudent. Just pass the appropriate mode
to drm_calc_timestamping_constants().
Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_irq.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 3 | ||||
-rw-r--r-- | include/drm/drmP.h | 3 |
4 files changed, 14 insertions, 11 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 01361aba033b..245fe4fa9c9e 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -536,7 +536,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
536 | * are later needed by vblank and swap-completion | 536 | * are later needed by vblank and swap-completion |
537 | * timestamping. They are derived from true hwmode. | 537 | * timestamping. They are derived from true hwmode. |
538 | */ | 538 | */ |
539 | drm_calc_timestamping_constants(crtc); | 539 | drm_calc_timestamping_constants(crtc, &crtc->hwmode); |
540 | 540 | ||
541 | /* FIXME: add subpixel order */ | 541 | /* FIXME: add subpixel order */ |
542 | done: | 542 | done: |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index e7de2da57234..3837132086f0 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -445,20 +445,22 @@ int drm_control(struct drm_device *dev, void *data, | |||
445 | * adjustments into account. | 445 | * adjustments into account. |
446 | * | 446 | * |
447 | * @crtc drm_crtc whose timestamp constants should be updated. | 447 | * @crtc drm_crtc whose timestamp constants should be updated. |
448 | * @mode display mode containing the scanout timings | ||
448 | * | 449 | * |
449 | */ | 450 | */ |
450 | void drm_calc_timestamping_constants(struct drm_crtc *crtc) | 451 | void drm_calc_timestamping_constants(struct drm_crtc *crtc, |
452 | const struct drm_display_mode *mode) | ||
451 | { | 453 | { |
452 | s64 linedur_ns = 0, pixeldur_ns = 0, framedur_ns = 0; | 454 | s64 linedur_ns = 0, pixeldur_ns = 0, framedur_ns = 0; |
453 | u64 dotclock; | 455 | u64 dotclock; |
454 | 456 | ||
455 | /* Dot clock in Hz: */ | 457 | /* Dot clock in Hz: */ |
456 | dotclock = (u64) crtc->hwmode.clock * 1000; | 458 | dotclock = (u64) mode->clock * 1000; |
457 | 459 | ||
458 | /* Fields of interlaced scanout modes are only half a frame duration. | 460 | /* Fields of interlaced scanout modes are only half a frame duration. |
459 | * Double the dotclock to get half the frame-/line-/pixelduration. | 461 | * Double the dotclock to get half the frame-/line-/pixelduration. |
460 | */ | 462 | */ |
461 | if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE) | 463 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) |
462 | dotclock *= 2; | 464 | dotclock *= 2; |
463 | 465 | ||
464 | /* Valid dotclock? */ | 466 | /* Valid dotclock? */ |
@@ -469,10 +471,9 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc) | |||
469 | * nanoseconds: | 471 | * nanoseconds: |
470 | */ | 472 | */ |
471 | pixeldur_ns = (s64) div64_u64(1000000000, dotclock); | 473 | pixeldur_ns = (s64) div64_u64(1000000000, dotclock); |
472 | linedur_ns = (s64) div64_u64(((u64) crtc->hwmode.crtc_htotal * | 474 | linedur_ns = (s64) div64_u64(((u64) mode->crtc_htotal * |
473 | 1000000000), dotclock); | 475 | 1000000000), dotclock); |
474 | frame_size = crtc->hwmode.crtc_htotal * | 476 | frame_size = mode->crtc_htotal * mode->crtc_vtotal; |
475 | crtc->hwmode.crtc_vtotal; | ||
476 | framedur_ns = (s64) div64_u64((u64) frame_size * 1000000000, | 477 | framedur_ns = (s64) div64_u64((u64) frame_size * 1000000000, |
477 | dotclock); | 478 | dotclock); |
478 | } else | 479 | } else |
@@ -484,8 +485,8 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc) | |||
484 | crtc->framedur_ns = framedur_ns; | 485 | crtc->framedur_ns = framedur_ns; |
485 | 486 | ||
486 | DRM_DEBUG("crtc %d: hwmode: htotal %d, vtotal %d, vdisplay %d\n", | 487 | DRM_DEBUG("crtc %d: hwmode: htotal %d, vtotal %d, vdisplay %d\n", |
487 | crtc->base.id, crtc->hwmode.crtc_htotal, | 488 | crtc->base.id, mode->crtc_htotal, |
488 | crtc->hwmode.crtc_vtotal, crtc->hwmode.crtc_vdisplay); | 489 | mode->crtc_vtotal, mode->crtc_vdisplay); |
489 | DRM_DEBUG("crtc %d: clock %d kHz framedur %d linedur %d, pixeldur %d\n", | 490 | DRM_DEBUG("crtc %d: clock %d kHz framedur %d linedur %d, pixeldur %d\n", |
490 | crtc->base.id, (int) dotclock/1000, (int) framedur_ns, | 491 | crtc->base.id, (int) dotclock/1000, (int) framedur_ns, |
491 | (int) linedur_ns, (int) pixeldur_ns); | 492 | (int) linedur_ns, (int) pixeldur_ns); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e77d4b8856a7..920fcff8818c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -9693,7 +9693,8 @@ static int __intel_set_mode(struct drm_crtc *crtc, | |||
9693 | * are later needed by vblank and swap-completion | 9693 | * are later needed by vblank and swap-completion |
9694 | * timestamping. They are derived from true hwmode. | 9694 | * timestamping. They are derived from true hwmode. |
9695 | */ | 9695 | */ |
9696 | drm_calc_timestamping_constants(crtc); | 9696 | drm_calc_timestamping_constants(crtc, |
9697 | &pipe_config->adjusted_mode); | ||
9697 | } | 9698 | } |
9698 | 9699 | ||
9699 | /* FIXME: add subpixel order */ | 9700 | /* FIXME: add subpixel order */ |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 63eab2b72ee7..46bf8ae7e302 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1402,7 +1402,8 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, | |||
1402 | struct timeval *vblank_time, | 1402 | struct timeval *vblank_time, |
1403 | unsigned flags, | 1403 | unsigned flags, |
1404 | struct drm_crtc *refcrtc); | 1404 | struct drm_crtc *refcrtc); |
1405 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc); | 1405 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, |
1406 | const struct drm_display_mode *mode); | ||
1406 | 1407 | ||
1407 | extern bool | 1408 | extern bool |
1408 | drm_mode_parse_command_line_for_connector(const char *mode_option, | 1409 | drm_mode_parse_command_line_for_connector(const char *mode_option, |