Commit 99ee8729 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'topic/drm-misc-2016-05-13' of git://anongit.freedesktop.org/drm-intel into drm-next

I kinda hoped that I could still sneak in Noralf's
drm_simple_display_pipe, since there's intereset by others now (for tilcdc
at least). But it wasn't ready by a hair. Oh well.

Otherwise random stuff plus prep patches from Noralf.

* tag 'topic/drm-misc-2016-05-13' of git://anongit.freedesktop.org/drm-intel:
  drm/atomic: Add drm_atomic_helper_best_encoder()
  drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcs
  drm/fb-cma-helper: Hook up to DocBook and fix some docs
  drm/fb-helper: Remove mention of CONFIG_FB_DEFERRED_IO in docs
  drm/sti: include linux/seq_file.h where needed
  drm/tegra: Use lockless gem BO free callback
  drm/exynos: Use lockless gem BO free callback
  drm: Make drm_encoder_helper_funcs optional
parents 76e9cab5 9ecb5498
...@@ -1615,6 +1615,11 @@ void intel_crt_init(struct drm_device *dev) ...@@ -1615,6 +1615,11 @@ void intel_crt_init(struct drm_device *dev)
!Pdrivers/gpu/drm/drm_fb_helper.c fbdev helpers !Pdrivers/gpu/drm/drm_fb_helper.c fbdev helpers
!Edrivers/gpu/drm/drm_fb_helper.c !Edrivers/gpu/drm/drm_fb_helper.c
!Iinclude/drm/drm_fb_helper.h !Iinclude/drm/drm_fb_helper.h
</sect2>
<sect2>
<title>Framebuffer CMA Helper Functions Reference</title>
!Pdrivers/gpu/drm/drm_fb_cma_helper.c framebuffer cma helper functions
!Edrivers/gpu/drm/drm_fb_cma_helper.c
</sect2> </sect2>
<sect2> <sect2>
<title>Display Port Helper Functions Reference</title> <title>Display Port Helper Functions Reference</title>
......
...@@ -384,8 +384,6 @@ mode_fixup(struct drm_atomic_state *state) ...@@ -384,8 +384,6 @@ mode_fixup(struct drm_atomic_state *state)
*/ */
encoder = conn_state->best_encoder; encoder = conn_state->best_encoder;
funcs = encoder->helper_private; funcs = encoder->helper_private;
if (!funcs)
continue;
ret = drm_bridge_mode_fixup(encoder->bridge, &crtc_state->mode, ret = drm_bridge_mode_fixup(encoder->bridge, &crtc_state->mode,
&crtc_state->adjusted_mode); &crtc_state->adjusted_mode);
...@@ -394,7 +392,7 @@ mode_fixup(struct drm_atomic_state *state) ...@@ -394,7 +392,7 @@ mode_fixup(struct drm_atomic_state *state)
return -EINVAL; return -EINVAL;
} }
if (funcs->atomic_check) { if (funcs && funcs->atomic_check) {
ret = funcs->atomic_check(encoder, crtc_state, ret = funcs->atomic_check(encoder, crtc_state,
conn_state); conn_state);
if (ret) { if (ret) {
...@@ -402,7 +400,7 @@ mode_fixup(struct drm_atomic_state *state) ...@@ -402,7 +400,7 @@ mode_fixup(struct drm_atomic_state *state)
encoder->base.id, encoder->name); encoder->base.id, encoder->name);
return ret; return ret;
} }
} else if (funcs->mode_fixup) { } else if (funcs && funcs->mode_fixup) {
ret = funcs->mode_fixup(encoder, &crtc_state->mode, ret = funcs->mode_fixup(encoder, &crtc_state->mode,
&crtc_state->adjusted_mode); &crtc_state->adjusted_mode);
if (!ret) { if (!ret) {
...@@ -707,12 +705,14 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) ...@@ -707,12 +705,14 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
drm_bridge_disable(encoder->bridge); drm_bridge_disable(encoder->bridge);
/* Right function depends upon target state. */ /* Right function depends upon target state. */
if (connector->state->crtc && funcs->prepare) if (funcs) {
funcs->prepare(encoder); if (connector->state->crtc && funcs->prepare)
else if (funcs->disable) funcs->prepare(encoder);
funcs->disable(encoder); else if (funcs->disable)
else funcs->disable(encoder);
funcs->dpms(encoder, DRM_MODE_DPMS_OFF); else if (funcs->dpms)
funcs->dpms(encoder, DRM_MODE_DPMS_OFF);
}
drm_bridge_post_disable(encoder->bridge); drm_bridge_post_disable(encoder->bridge);
} }
...@@ -873,7 +873,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) ...@@ -873,7 +873,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
* Each encoder has at most one connector (since we always steal * Each encoder has at most one connector (since we always steal
* it away), so we won't call mode_set hooks twice. * it away), so we won't call mode_set hooks twice.
*/ */
if (funcs->mode_set) if (funcs && funcs->mode_set)
funcs->mode_set(encoder, mode, adjusted_mode); funcs->mode_set(encoder, mode, adjusted_mode);
drm_bridge_mode_set(encoder->bridge, mode, adjusted_mode); drm_bridge_mode_set(encoder->bridge, mode, adjusted_mode);
...@@ -974,10 +974,12 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, ...@@ -974,10 +974,12 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
*/ */
drm_bridge_pre_enable(encoder->bridge); drm_bridge_pre_enable(encoder->bridge);
if (funcs->enable) if (funcs) {
funcs->enable(encoder); if (funcs->enable)
else funcs->enable(encoder);
funcs->commit(encoder); else if (funcs->commit)
funcs->commit(encoder);
}
drm_bridge_enable(encoder->bridge); drm_bridge_enable(encoder->bridge);
} }
...@@ -2480,6 +2482,23 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector, ...@@ -2480,6 +2482,23 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
} }
EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
/**
* drm_atomic_helper_best_encoder - Helper for &drm_connector_helper_funcs
* ->best_encoder callback
* @connector: Connector control structure
*
* This is a &drm_connector_helper_funcs ->best_encoder callback helper for
* connectors that support exactly 1 encoder, statically determined at driver
* init time.
*/
struct drm_encoder *
drm_atomic_helper_best_encoder(struct drm_connector *connector)
{
WARN_ON(connector->encoder_ids[1]);
return drm_encoder_find(connector->dev, connector->encoder_ids[0]);
}
EXPORT_SYMBOL(drm_atomic_helper_best_encoder);
/** /**
* DOC: atomic state reset and initialization * DOC: atomic state reset and initialization
* *
......
...@@ -170,11 +170,14 @@ drm_encoder_disable(struct drm_encoder *encoder) ...@@ -170,11 +170,14 @@ drm_encoder_disable(struct drm_encoder *encoder)
{ {
const struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; const struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
if (!encoder_funcs)
return;
drm_bridge_disable(encoder->bridge); drm_bridge_disable(encoder->bridge);
if (encoder_funcs->disable) if (encoder_funcs->disable)
(*encoder_funcs->disable)(encoder); (*encoder_funcs->disable)(encoder);
else else if (encoder_funcs->dpms)
(*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
drm_bridge_post_disable(encoder->bridge); drm_bridge_post_disable(encoder->bridge);
...@@ -248,6 +251,9 @@ drm_crtc_prepare_encoders(struct drm_device *dev) ...@@ -248,6 +251,9 @@ drm_crtc_prepare_encoders(struct drm_device *dev)
drm_for_each_encoder(encoder, dev) { drm_for_each_encoder(encoder, dev) {
encoder_funcs = encoder->helper_private; encoder_funcs = encoder->helper_private;
if (!encoder_funcs)
continue;
/* Disable unused encoders */ /* Disable unused encoders */
if (encoder->crtc == NULL) if (encoder->crtc == NULL)
drm_encoder_disable(encoder); drm_encoder_disable(encoder);
...@@ -326,6 +332,10 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ...@@ -326,6 +332,10 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (encoder->crtc != crtc) if (encoder->crtc != crtc)
continue; continue;
encoder_funcs = encoder->helper_private;
if (!encoder_funcs)
continue;
ret = drm_bridge_mode_fixup(encoder->bridge, ret = drm_bridge_mode_fixup(encoder->bridge,
mode, adjusted_mode); mode, adjusted_mode);
if (!ret) { if (!ret) {
...@@ -360,11 +370,15 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ...@@ -360,11 +370,15 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (encoder->crtc != crtc) if (encoder->crtc != crtc)
continue; continue;
encoder_funcs = encoder->helper_private;
if (!encoder_funcs)
continue;
drm_bridge_disable(encoder->bridge); drm_bridge_disable(encoder->bridge);
encoder_funcs = encoder->helper_private;
/* Disable the encoders as the first thing we do. */ /* Disable the encoders as the first thing we do. */
encoder_funcs->prepare(encoder); if (encoder_funcs->prepare)
encoder_funcs->prepare(encoder);
drm_bridge_post_disable(encoder->bridge); drm_bridge_post_disable(encoder->bridge);
} }
...@@ -385,11 +399,15 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ...@@ -385,11 +399,15 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (encoder->crtc != crtc) if (encoder->crtc != crtc)
continue; continue;
encoder_funcs = encoder->helper_private;
if (!encoder_funcs)
continue;
DRM_DEBUG_KMS("[ENCODER:%d:%s] set [MODE:%d:%s]\n", DRM_DEBUG_KMS("[ENCODER:%d:%s] set [MODE:%d:%s]\n",
encoder->base.id, encoder->name, encoder->base.id, encoder->name,
mode->base.id, mode->name); mode->base.id, mode->name);
encoder_funcs = encoder->helper_private; if (encoder_funcs->mode_set)
encoder_funcs->mode_set(encoder, mode, adjusted_mode); encoder_funcs->mode_set(encoder, mode, adjusted_mode);
drm_bridge_mode_set(encoder->bridge, mode, adjusted_mode); drm_bridge_mode_set(encoder->bridge, mode, adjusted_mode);
} }
...@@ -402,10 +420,14 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ...@@ -402,10 +420,14 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (encoder->crtc != crtc) if (encoder->crtc != crtc)
continue; continue;
encoder_funcs = encoder->helper_private;
if (!encoder_funcs)
continue;
drm_bridge_pre_enable(encoder->bridge); drm_bridge_pre_enable(encoder->bridge);
encoder_funcs = encoder->helper_private; if (encoder_funcs->commit)
encoder_funcs->commit(encoder); encoder_funcs->commit(encoder);
drm_bridge_enable(encoder->bridge); drm_bridge_enable(encoder->bridge);
} }
...@@ -790,12 +812,15 @@ static void drm_helper_encoder_dpms(struct drm_encoder *encoder, int mode) ...@@ -790,12 +812,15 @@ static void drm_helper_encoder_dpms(struct drm_encoder *encoder, int mode)
struct drm_bridge *bridge = encoder->bridge; struct drm_bridge *bridge = encoder->bridge;
const struct drm_encoder_helper_funcs *encoder_funcs; const struct drm_encoder_helper_funcs *encoder_funcs;
encoder_funcs = encoder->helper_private;
if (!encoder_funcs)
return;
if (mode == DRM_MODE_DPMS_ON) if (mode == DRM_MODE_DPMS_ON)
drm_bridge_pre_enable(bridge); drm_bridge_pre_enable(bridge);
else else
drm_bridge_disable(bridge); drm_bridge_disable(bridge);
encoder_funcs = encoder->helper_private;
if (encoder_funcs->dpms) if (encoder_funcs->dpms)
encoder_funcs->dpms(encoder, mode); encoder_funcs->dpms(encoder, mode);
......
...@@ -43,14 +43,12 @@ struct drm_fbdev_cma { ...@@ -43,14 +43,12 @@ struct drm_fbdev_cma {
* Provides helper functions for creating a cma (contiguous memory allocator) * Provides helper functions for creating a cma (contiguous memory allocator)
* backed framebuffer. * backed framebuffer.
* *
* drm_fb_cma_create() is used in the * drm_fb_cma_create() is used in the &drm_mode_config_funcs ->fb_create
* (struct drm_mode_config_funcs *)->fb_create callback function to create the * callback function to create a cma backed framebuffer.
* cma backed framebuffer.
* *
* An fbdev framebuffer backed by cma is also available by calling * An fbdev framebuffer backed by cma is also available by calling
* drm_fbdev_cma_init(). drm_fbdev_cma_fini() tears it down. * drm_fbdev_cma_init(). drm_fbdev_cma_fini() tears it down.
* If CONFIG_FB_DEFERRED_IO is enabled and the callback * If the &drm_framebuffer_funcs ->dirty callback is set, fb_deferred_io
* (struct drm_framebuffer_funcs)->dirty is set, fb_deferred_io
* will be set up automatically. dirty() is called by * will be set up automatically. dirty() is called by
* drm_fb_helper_deferred_io() in process context (struct delayed_work). * drm_fb_helper_deferred_io() in process context (struct delayed_work).
* *
......
...@@ -85,14 +85,14 @@ static LIST_HEAD(kernel_fb_helper_list); ...@@ -85,14 +85,14 @@ static LIST_HEAD(kernel_fb_helper_list);
* should call drm_fb_helper_single_add_all_connectors() followed by * should call drm_fb_helper_single_add_all_connectors() followed by
* drm_fb_helper_initial_config(). * drm_fb_helper_initial_config().
* *
* If CONFIG_FB_DEFERRED_IO is enabled and &drm_framebuffer_funcs ->dirty is * If &drm_framebuffer_funcs ->dirty is set, the
* set, the drm_fb_helper_{cfb,sys}_{write,fillrect,copyarea,imageblit} * drm_fb_helper_{cfb,sys}_{write,fillrect,copyarea,imageblit} functions will
* functions will accumulate changes and schedule &fb_helper .dirty_work to run * accumulate changes and schedule &drm_fb_helper ->dirty_work to run right
* right away. This worker then calls the dirty() function ensuring that it * away. This worker then calls the dirty() function ensuring that it will
* will always run in process context since the fb_*() function could be * always run in process context since the fb_*() function could be running in
* running in atomic context. If drm_fb_helper_deferred_io() is used as the * atomic context. If drm_fb_helper_deferred_io() is used as the deferred_io
* deferred_io callback it will also schedule dirty_work with the damage * callback it will also schedule dirty_work with the damage collected from the
* collected from the mmap page writes. * mmap page writes.
*/ */
/** /**
......
...@@ -418,7 +418,7 @@ static struct drm_driver exynos_drm_driver = { ...@@ -418,7 +418,7 @@ static struct drm_driver exynos_drm_driver = {
.get_vblank_counter = drm_vblank_no_hw_counter, .get_vblank_counter = drm_vblank_no_hw_counter,
.enable_vblank = exynos_drm_crtc_enable_vblank, .enable_vblank = exynos_drm_crtc_enable_vblank,
.disable_vblank = exynos_drm_crtc_disable_vblank, .disable_vblank = exynos_drm_crtc_disable_vblank,
.gem_free_object = exynos_drm_gem_free_object, .gem_free_object_unlocked = exynos_drm_gem_free_object,
.gem_vm_ops = &exynos_drm_gem_vm_ops, .gem_vm_ops = &exynos_drm_gem_vm_ops,
.dumb_create = exynos_drm_gem_dumb_create, .dumb_create = exynos_drm_gem_dumb_create,
.dumb_map_offset = exynos_drm_gem_dumb_map_offset, .dumb_map_offset = exynos_drm_gem_dumb_map_offset,
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
* License terms: GNU General Public License (GPL), version 2 * License terms: GNU General Public License (GPL), version 2
*/ */
#include <linux/seq_file.h>
#include <drm/drm_atomic.h> #include <drm/drm_atomic.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* for STMicroelectronics. * for STMicroelectronics.
* License terms: GNU General Public License (GPL), version 2 * License terms: GNU General Public License (GPL), version 2
*/ */
#include <linux/seq_file.h>
#include <drm/drm_atomic.h> #include <drm/drm_atomic.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/component.h> #include <linux/component.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/seq_file.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/component.h> #include <linux/component.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/seq_file.h>
#include <drm/drm_atomic.h> #include <drm/drm_atomic.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* for STMicroelectronics. * for STMicroelectronics.
* License terms: GNU General Public License (GPL), version 2 * License terms: GNU General Public License (GPL), version 2
*/ */
#include <linux/seq_file.h>
#include "sti_compositor.h" #include "sti_compositor.h"
#include "sti_mixer.h" #include "sti_mixer.h"
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/seq_file.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Author: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics. * Author: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
* License terms: GNU General Public License (GPL), version 2 * License terms: GNU General Public License (GPL), version 2
*/ */
#include <linux/seq_file.h>
#include <drm/drmP.h> #include <drm/drmP.h>
......
...@@ -932,7 +932,7 @@ static struct drm_driver tegra_drm_driver = { ...@@ -932,7 +932,7 @@ static struct drm_driver tegra_drm_driver = {
.debugfs_cleanup = tegra_debugfs_cleanup, .debugfs_cleanup = tegra_debugfs_cleanup,
#endif #endif
.gem_free_object = tegra_bo_free_object, .gem_free_object_unlocked = tegra_bo_free_object,
.gem_vm_ops = &tegra_bo_vm_ops, .gem_vm_ops = &tegra_bo_vm_ops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
......
...@@ -110,6 +110,8 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, ...@@ -110,6 +110,8 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
uint32_t flags); uint32_t flags);
int drm_atomic_helper_connector_dpms(struct drm_connector *connector, int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
int mode); int mode);
struct drm_encoder *
drm_atomic_helper_best_encoder(struct drm_connector *connector);
/* default implementations for state handling */ /* default implementations for state handling */
void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment