diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-08 22:20:11 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-08 22:20:11 -0400 |
commit | 3c85f20a289d044f303f473ee6ab7502303fc3b0 (patch) | |
tree | 016657e9d62b77a3c7f237e58346bd6a7ab8cc6e /drivers/gpu/drm/omapdrm/omap_crtc.c | |
parent | 76c6dccf34413ca460372fde027bedcdc2f59f86 (diff) | |
parent | 492a426a2fc531774356e05f1ad87ab49e80156c (diff) |
Merge tag 'omapdrm-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next
omapdrm changes for 4.8
* Update MAINTAINERS file for omapdrm and tilcdc
* PLL refactoring to allow versatile use of the PLL clocks
* Public omapdss header refactoring to separate omapfb and omapdrm
* Gamma table support
* Support reset GPIO and vcc regulator in omapdrm's panel-dpi
* Minor cleanups
* tag 'omapdrm-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (69 commits)
drm/omapdrm: Implement gamma_lut atomic crtc properties
drm/omapdrm: Workaround for errata i734 (LCD1 Gamma) in DSS dispc
drm/omapdrm: Add gamma table support to DSS dispc
drm: drm_helper_crtc_enable_color_mgmt() => drm_crtc_enable_color_mgmt()
drm/omap: rename panel/encoder Kconfig names
drm: omapdrm: add DSI mapping
drm: omapdrm: Remove unused omap_framebuffer_bo function
drm: omapdrm: Remove unused omap_gem_tiled_size function
drm: omapdrm: panel-lgphilips-lb035q02: Remove unused backlight GPIO
drm/omap: panel-dpi: implement support for a vcc regulator
drm/omap: panel-dpi: make (limited) use of a reset gpio
devicetree/bindings: add reset-gpios and vcc-supply for panel-dpi
MAINTAINERS: Add maintainer for TI LCDC DRM driver
MAINTAINERS: Add maintainer for OMAP DRM driver
drm/omap: fix pitch round-up
drm/omap: remove align_pitch()
drm/omap: remove unnecessary pitch round-up
drm/omap: remove unneeded gpio includes
drm/omap: Remove the video/omapdss.h and move it's content to local header file
[media] omap_vout: Switch to use the video/omapfb_dss.h header file
...
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 075f2bb44867..180f644e861e 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
@@ -372,6 +372,20 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc) | |||
372 | copy_timings_drm_to_omap(&omap_crtc->timings, mode); | 372 | copy_timings_drm_to_omap(&omap_crtc->timings, mode); |
373 | } | 373 | } |
374 | 374 | ||
375 | static int omap_crtc_atomic_check(struct drm_crtc *crtc, | ||
376 | struct drm_crtc_state *state) | ||
377 | { | ||
378 | if (state->color_mgmt_changed && state->gamma_lut) { | ||
379 | uint length = state->gamma_lut->length / | ||
380 | sizeof(struct drm_color_lut); | ||
381 | |||
382 | if (length < 2) | ||
383 | return -EINVAL; | ||
384 | } | ||
385 | |||
386 | return 0; | ||
387 | } | ||
388 | |||
375 | static void omap_crtc_atomic_begin(struct drm_crtc *crtc, | 389 | static void omap_crtc_atomic_begin(struct drm_crtc *crtc, |
376 | struct drm_crtc_state *old_crtc_state) | 390 | struct drm_crtc_state *old_crtc_state) |
377 | { | 391 | { |
@@ -384,6 +398,32 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, | |||
384 | 398 | ||
385 | WARN_ON(omap_crtc->vblank_irq.registered); | 399 | WARN_ON(omap_crtc->vblank_irq.registered); |
386 | 400 | ||
401 | if (crtc->state->color_mgmt_changed) { | ||
402 | struct drm_color_lut *lut = NULL; | ||
403 | uint length = 0; | ||
404 | |||
405 | if (crtc->state->gamma_lut) { | ||
406 | lut = (struct drm_color_lut *) | ||
407 | crtc->state->gamma_lut->data; | ||
408 | length = crtc->state->gamma_lut->length / | ||
409 | sizeof(*lut); | ||
410 | } | ||
411 | dispc_mgr_set_gamma(omap_crtc->channel, lut, length); | ||
412 | } | ||
413 | |||
414 | if (crtc->state->color_mgmt_changed) { | ||
415 | struct drm_color_lut *lut = NULL; | ||
416 | uint length = 0; | ||
417 | |||
418 | if (crtc->state->gamma_lut) { | ||
419 | lut = (struct drm_color_lut *) | ||
420 | crtc->state->gamma_lut->data; | ||
421 | length = crtc->state->gamma_lut->length / | ||
422 | sizeof(*lut); | ||
423 | } | ||
424 | dispc_mgr_set_gamma(omap_crtc->channel, lut, length); | ||
425 | } | ||
426 | |||
387 | if (dispc_mgr_is_enabled(omap_crtc->channel)) { | 427 | if (dispc_mgr_is_enabled(omap_crtc->channel)) { |
388 | 428 | ||
389 | DBG("%s: GO", omap_crtc->name); | 429 | DBG("%s: GO", omap_crtc->name); |
@@ -460,6 +500,7 @@ static const struct drm_crtc_funcs omap_crtc_funcs = { | |||
460 | .set_config = drm_atomic_helper_set_config, | 500 | .set_config = drm_atomic_helper_set_config, |
461 | .destroy = omap_crtc_destroy, | 501 | .destroy = omap_crtc_destroy, |
462 | .page_flip = drm_atomic_helper_page_flip, | 502 | .page_flip = drm_atomic_helper_page_flip, |
503 | .gamma_set = drm_atomic_helper_legacy_gamma_set, | ||
463 | .set_property = drm_atomic_helper_crtc_set_property, | 504 | .set_property = drm_atomic_helper_crtc_set_property, |
464 | .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, | 505 | .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, |
465 | .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, | 506 | .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, |
@@ -471,6 +512,7 @@ static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = { | |||
471 | .mode_set_nofb = omap_crtc_mode_set_nofb, | 512 | .mode_set_nofb = omap_crtc_mode_set_nofb, |
472 | .disable = omap_crtc_disable, | 513 | .disable = omap_crtc_disable, |
473 | .enable = omap_crtc_enable, | 514 | .enable = omap_crtc_enable, |
515 | .atomic_check = omap_crtc_atomic_check, | ||
474 | .atomic_begin = omap_crtc_atomic_begin, | 516 | .atomic_begin = omap_crtc_atomic_begin, |
475 | .atomic_flush = omap_crtc_atomic_flush, | 517 | .atomic_flush = omap_crtc_atomic_flush, |
476 | }; | 518 | }; |
@@ -534,6 +576,20 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, | |||
534 | 576 | ||
535 | drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs); | 577 | drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs); |
536 | 578 | ||
579 | /* The dispc API adapts to what ever size, but the HW supports | ||
580 | * 256 element gamma table for LCDs and 1024 element table for | ||
581 | * OMAP_DSS_CHANNEL_DIGIT. X server assumes 256 element gamma | ||
582 | * tables so lets use that. Size of HW gamma table can be | ||
583 | * extracted with dispc_mgr_gamma_size(). If it returns 0 | ||
584 | * gamma table is not supprted. | ||
585 | */ | ||
586 | if (dispc_mgr_gamma_size(channel)) { | ||
587 | uint gamma_lut_size = 256; | ||
588 | |||
589 | drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size); | ||
590 | drm_mode_crtc_set_gamma_size(crtc, gamma_lut_size); | ||
591 | } | ||
592 | |||
537 | omap_plane_install_properties(crtc->primary, &crtc->base); | 593 | omap_plane_install_properties(crtc->primary, &crtc->base); |
538 | 594 | ||
539 | omap_crtcs[channel] = omap_crtc; | 595 | omap_crtcs[channel] = omap_crtc; |