prepare for atomic.. the great propertyification
Subsystems (18)
cover prepare for atomic.. the great propertyification
This is mostly just a rebase+resend. Was going to send it a bit earlier but had a few things to fix up as a result of the rebase.
At this point, I think next steps are roughly:
1) introduce plane->mutex
2) decide what we want to do about events
3) add actual ioctl
I think we could shoot for merging this series next, and then adding plane->mutex in 3.18?
Before we add the ioctl, I think we want to sort out events for updates to non-primary layers, and what the interface to drivers should look like. Ie. just add event to ->update_plane() or should we completely ditch ->page_flip() and ->update_plane()?
Technically, I think we could get away without a new API and just let drivers grab all the events in their ->atomic_commit(), but I suspect core could provide something more useful to drivers. I guess it would be useful to have a few more drivers converted over to see what makes sense.
Rob Clark (5):
drm: add atomic fxns
drm: split propvals out and blob property support
drm: convert plane to properties/state
drm: convert crtc to properties/state drm/msm: add atomic support
Sean Paul (1):
drm: Fix up the atomic legacy paths so they work
Ville Syrjälä (1):
drm: Refactor object property check code
drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 14 +- drivers/gpu/drm/armada/armada_output.c | 3 +- drivers/gpu/drm/armada/armada_overlay.c | 14 +- drivers/gpu/drm/ast/ast_drv.c | 6 + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/ast/ast_mode.c | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 6 + drivers/gpu/drm/cirrus/cirrus_drv.h | 1 + drivers/gpu/drm/cirrus/cirrus_mode.c | 1 + drivers/gpu/drm/drm_atomic.c | 733 +++++++++++++++ drivers/gpu/drm/drm_crtc.c | 1351 ++++++++++++++++++--------- drivers/gpu/drm/drm_fb_helper.c | 55 +- drivers/gpu/drm/drm_irq.c | 8 +- drivers/gpu/drm/drm_modeset_lock.c | 28 + drivers/gpu/drm/drm_plane_helper.c | 2 + drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 7 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 +- drivers/gpu/drm/gma500/cdv_intel_crt.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 1 + drivers/gpu/drm/gma500/cdv_intel_dp.c | 7 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 7 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 10 +- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 12 +- drivers/gpu/drm/gma500/psb_drv.c | 7 + drivers/gpu/drm/gma500/psb_drv.h | 1 + drivers/gpu/drm/gma500/psb_intel_display.c | 1 + drivers/gpu/drm/gma500/psb_intel_drv.h | 4 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 10 +- drivers/gpu/drm/gma500/psb_intel_sdvo.c | 23 +- drivers/gpu/drm/i2c/ch7006_drv.c | 4 +- drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/intel_crt.c | 4 +- drivers/gpu/drm/i915/intel_display.c | 6 +- drivers/gpu/drm/i915/intel_dp.c | 7 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 7 +- drivers/gpu/drm/i915/intel_lvds.c | 4 +- drivers/gpu/drm/i915/intel_sdvo.c | 23 +- drivers/gpu/drm/i915/intel_sprite.c | 1 + drivers/gpu/drm/i915/intel_tv.c | 12 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 7 + drivers/gpu/drm/mgag200/mgag200_drv.h | 1 + drivers/gpu/drm/mgag200/mgag200_mode.c | 1 + drivers/gpu/drm/msm/Makefile | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 66 +- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 6 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 14 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 65 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 6 + drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 2 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 14 +- drivers/gpu/drm/msm/msm_atomic.c | 141 +++ drivers/gpu/drm/msm/msm_drv.c | 26 + drivers/gpu/drm/msm/msm_drv.h | 8 + drivers/gpu/drm/msm/msm_gem.c | 24 +- drivers/gpu/drm/msm/msm_gem.h | 13 + drivers/gpu/drm/msm/msm_kms.h | 1 + drivers/gpu/drm/nouveau/dispnv04/crtc.c | 1 + drivers/gpu/drm/nouveau/dispnv04/overlay.c | 13 +- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 3 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 7 + drivers/gpu/drm/nouveau/nouveau_drm.h | 1 + drivers/gpu/drm/nouveau/nv50_display.c | 1 + drivers/gpu/drm/omapdrm/omap_crtc.c | 16 +- drivers/gpu/drm/omapdrm/omap_drv.c | 12 +- drivers/gpu/drm/omapdrm/omap_drv.h | 4 +- drivers/gpu/drm/omapdrm/omap_plane.c | 10 +- drivers/gpu/drm/qxl/qxl_display.c | 6 +- drivers/gpu/drm/qxl/qxl_drv.c | 9 + drivers/gpu/drm/radeon/radeon_connectors.c | 9 +- drivers/gpu/drm/radeon/radeon_display.c | 2 + drivers/gpu/drm/radeon/radeon_drv.c | 9 + drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 + drivers/gpu/drm/rcar-du/rcar_du_drv.c | 7 + drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 3 +- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 12 +- drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 3 +- drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 6 +- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 7 + drivers/gpu/drm/shmobile/shmob_drm_plane.c | 2 + drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 1 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 + drivers/gpu/drm/tilcdc/tilcdc_drv.h | 1 + drivers/gpu/drm/tilcdc/tilcdc_slave.c | 3 +- drivers/gpu/drm/udl/udl_connector.c | 6 +- drivers/gpu/drm/udl/udl_drv.c | 8 + drivers/gpu/drm/udl/udl_modeset.c | 2 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 1 + include/drm/drmP.h | 80 ++ include/drm/drm_atomic.h | 170 ++++ include/drm/drm_crtc.h | 238 ++++- include/drm/drm_modeset_lock.h | 47 + include/uapi/drm/drm_mode.h | 3 + 102 files changed, 2901 insertions(+), 650 deletions(-) create mode 100644 drivers/gpu/drm/drm_atomic.c create mode 100644 drivers/gpu/drm/msm/msm_atomic.c create mode 100644 include/drm/drm_atomic.h
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/7 drm: add atomic fxns
The 'atomic' mechanism allows for multiple properties to be updated, checked, and commited atomically. This will be the basis of atomic- modeset and nuclear-pageflip.
The basic flow is:
state = dev->atomic_begin();
for (... one or more ...)
obj->set_property(obj, state, prop, value);
if (dev->atomic_check(state))
dev->atomic_commit(state);
dev->atomic_end(state);The split of check and commit steps is to allow for ioctls with a test-only flag (which would skip the commit step).
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 3 +- drivers/gpu/drm/armada/armada_output.c | 3 +- drivers/gpu/drm/armada/armada_overlay.c | 3 +- drivers/gpu/drm/ast/ast_drv.c | 6 + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 6 + drivers/gpu/drm/cirrus/cirrus_drv.h | 1 + drivers/gpu/drm/drm_atomic.c | 274 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc.c | 149 +++++++++------ drivers/gpu/drm/drm_modeset_lock.c | 28 +++ drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 7 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_crt.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_dp.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 4 +- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 4 +- drivers/gpu/drm/gma500/psb_drv.c | 7 + drivers/gpu/drm/gma500/psb_drv.h | 1 + drivers/gpu/drm/gma500/psb_intel_drv.h | 4 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 4 +- drivers/gpu/drm/gma500/psb_intel_sdvo.c | 4 +- drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/intel_crt.c | 4 +- drivers/gpu/drm/i915/intel_dp.c | 4 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 4 +- drivers/gpu/drm/i915/intel_lvds.c | 4 +- drivers/gpu/drm/i915/intel_sdvo.c | 4 +- drivers/gpu/drm/i915/intel_tv.c | 6 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 7 + drivers/gpu/drm/mgag200/mgag200_drv.h | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 3 +- drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 3 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 3 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 3 +- drivers/gpu/drm/msm/msm_drv.c | 6 + drivers/gpu/drm/msm/msm_drv.h | 1 + drivers/gpu/drm/nouveau/dispnv04/overlay.c | 5 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 7 + drivers/gpu/drm/nouveau/nouveau_drm.h | 1 + drivers/gpu/drm/omapdrm/omap_crtc.c | 6 +- drivers/gpu/drm/omapdrm/omap_drv.c | 6 + drivers/gpu/drm/omapdrm/omap_drv.h | 4 +- drivers/gpu/drm/omapdrm/omap_plane.c | 3 +- drivers/gpu/drm/qxl/qxl_display.c | 4 +- drivers/gpu/drm/qxl/qxl_drv.c | 9 + drivers/gpu/drm/radeon/radeon_connectors.c | 9 +- drivers/gpu/drm/radeon/radeon_drv.c | 9 + drivers/gpu/drm/rcar-du/rcar_du_drv.c | 7 + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 7 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 + drivers/gpu/drm/tilcdc/tilcdc_drv.h | 1 + drivers/gpu/drm/tilcdc/tilcdc_slave.c | 3 +- drivers/gpu/drm/udl/udl_connector.c | 6 +- drivers/gpu/drm/udl/udl_drv.c | 8 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 +- include/drm/drmP.h | 80 ++++++++ include/drm/drm_atomic.h | 114 ++++++++++++ include/drm/drm_crtc.h | 15 +- include/drm/drm_modeset_lock.h | 47 +++++ include/uapi/drm/drm_mode.h | 3 + 69 files changed, 873 insertions(+), 103 deletions(-) create mode 100644 drivers/gpu/drm/drm_atomic.c create mode 100644 include/drm/drm_atomic.h
drivers/gpu/drm/Makefile +1 -1
@@ -14,7 +14,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_info.o drm_debugfs.o drm_encoder_slave.o \ drm_trace_points.o drm_global.o drm_prime.o \ drm_rect.o drm_vma_manager.o drm_flip_work.o \ - drm_modeset_lock.o + drm_modeset_lock.o drm_atomic.o drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
drivers/gpu/drm/armada/armada_crtc.c +2 -1
@@ -961,7 +961,8 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,static int armada_drm_crtc_set_property (struct drm_crtc *crtc, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {struct armada_private *priv = crtc->dev->dev_private;struct armada_crtc *dcrtc =drm_to_armada_crtc (crtc);
drivers/gpu/drm/armada/armada_output.c +2 -1
@@ -54,7 +54,8 @@ static void armada_drm_connector_destroy(struct drm_connector *conn) }static int armada_drm_connector_set_property (struct drm_connector *conn, -struct drm_property *property,uint64_t value) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {struct armada_connector *dconn =drm_to_armada_conn (conn);
drivers/gpu/drm/armada/armada_overlay.c +2 -1
@@ -283,7 +283,8 @@ static void armada_plane_destroy(struct drm_plane *plane) }static int armada_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {struct armada_private *priv = plane->dev->dev_private;struct armada_plane *dplane =drm_to_armada_plane (plane);
drivers/gpu/drm/ast/ast_drv.c +6 -0
@@ -213,6 +213,12 @@ static struct drm_driver driver = { .dumb_map_offset = ast_dumb_mmap_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, };static int __init ast_init (void )
drivers/gpu/drm/ast/ast_drv.h +1 -0
@@ -29,6 +29,7 @@#define __AST_DRV_H__#include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include <drm/ttm/ttm_bo_api.h> #include <drm/ttm/ttm_bo_driver.h>
drivers/gpu/drm/cirrus/cirrus_drv.c +6 -0
@@ -137,6 +137,12 @@ static struct drm_driver driver = { .dumb_create = cirrus_dumb_create, .dumb_map_offset = cirrus_dumb_mmap_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, };static const struct dev_pm_ops cirrus_pm_ops = {
drivers/gpu/drm/cirrus/cirrus_drv.h +1 -0
@@ -14,6 +14,7 @@#include <video/vga.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include <drm/ttm/ttm_bo_api.h> #include <drm/ttm/ttm_bo_driver.h>
drivers/gpu/drm/drm_atomic.c new file +274 -0
274 lines not on this page · raw message
drivers/gpu/drm/drm_crtc.c +93 -56
215 lines not on this page · raw message
drivers/gpu/drm/drm_modeset_lock.c +28 -0
@@ -67,9 +67,18 @@ void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,memset (ctx,0 ,sizeof (*ctx));ww_acquire_init (&ctx->ww_ctx, &crtc_ww_class);INIT_LIST_HEAD (&ctx->locked); +mutex_init (&ctx->mutex); + ctx->nolock = !!(flags &DRM_MODESET_ACQUIRE_NOLOCK ); + ctx->nonblock = !!(flags &DRM_MODESET_ACQUIRE_NONBLOCK ); }EXPORT_SYMBOL (drm_modeset_acquire_init); +/* special version for atomic.. which needs to ww_acquire_fini() itself */ +void __drm_modeset_acquire_fini (struct drm_modeset_acquire_ctx *ctx) +{ +mutex_destroy (&ctx->mutex); +} +/** * drm_modeset_acquire_fini - cleanup acquire context * @ctx: the acquire context
@@ -77,6 +86,7 @@ EXPORT_SYMBOL(drm_modeset_acquire_init);void drm_modeset_acquire_fini (struct drm_modeset_acquire_ctx *ctx) {ww_acquire_fini (&ctx->ww_ctx); +__drm_modeset_acquire_fini (ctx); }EXPORT_SYMBOL (drm_modeset_acquire_fini);
@@ -89,6 +99,7 @@ EXPORT_SYMBOL(drm_modeset_acquire_fini);void drm_modeset_drop_locks (struct drm_modeset_acquire_ctx *ctx) {WARN_ON (ctx->contended); +mutex_lock (&ctx->mutex);while (!list_empty (&ctx->locked)) {struct drm_modeset_lock *lock;
@@ -97,6 +108,7 @@ void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx)drm_modeset_unlock (lock); } +mutex_unlock (&ctx->mutex); }EXPORT_SYMBOL (drm_modeset_drop_locks);
@@ -106,8 +118,13 @@ static inline int modeset_lock(struct drm_modeset_lock *lock, {int ret; +if (ctx->nolock) +return 0 ; + +WARN_ON (ctx->frozen);/* all locks should be held by now! */ WARN_ON (ctx->contended); +retry:if (interruptible && slow) { ret =ww_mutex_lock_slow_interruptible (&lock->mutex, &ctx->ww_ctx); }else if (interruptible) {
@@ -119,6 +136,15 @@ static inline int modeset_lock(struct drm_modeset_lock *lock, ret =ww_mutex_lock (&lock->mutex, &ctx->ww_ctx); }if (!ret) { +if (lock->atomic_pending) { +/* some other pending update with dropped locks */ +ww_mutex_unlock (&lock->mutex); +if (ctx->nonblock) +return -EBUSY ; +wait_event (lock->event, !lock->atomic_pending); + goto retry; + } + lock->atomic_pending = true;WARN_ON (!list_empty (&lock->head));list_add (&lock->head, &ctx->locked); }else if (ret == -EALREADY ) {
@@ -222,7 +248,9 @@ EXPORT_SYMBOL(drm_modeset_lock_interruptible);void drm_modeset_unlock (struct drm_modeset_lock *lock) {list_del_init (&lock->head); + lock->atomic_pending = false;ww_mutex_unlock (&lock->mutex); +wake_up_all (&lock->event); }EXPORT_SYMBOL (drm_modeset_unlock);
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -1
@@ -281,8 +281,10 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc) }static int exynos_drm_crtc_set_property (struct drm_crtc *crtc, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct drm_device *dev = crtc->dev;struct exynos_drm_private *dev_priv = dev->dev_private;
drivers/gpu/drm/exynos/exynos_drm_drv.c +7 -0
@@ -14,6 +14,7 @@#include <linux/pm_runtime.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <linux/anon_inodes.h> #include <linux/component.h>
@@ -338,6 +339,12 @@ static struct drm_driver exynos_drm_driver = { .dumb_create = exynos_drm_gem_dumb_create, .dumb_map_offset = exynos_drm_gem_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_export = exynos_dmabuf_prime_export,
drivers/gpu/drm/exynos/exynos_drm_plane.c +3 -1
@@ -212,8 +212,10 @@ static void exynos_plane_destroy(struct drm_plane *plane) }static int exynos_plane_set_property (struct drm_plane *plane, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct drm_device *dev = plane->dev;struct exynos_plane *exynos_plane =to_exynos_plane (plane);
drivers/gpu/drm/gma500/cdv_intel_crt.c +3 -1
@@ -205,8 +205,10 @@ static int cdv_intel_crt_get_modes(struct drm_connector *connector) }static int cdv_intel_crt_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {return 0 ; }
drivers/gpu/drm/gma500/cdv_intel_dp.c +3 -1
@@ -1645,8 +1645,10 @@ cdv_intel_dp_detect_audio(struct drm_connector *connector)static int cdv_intel_dp_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct drm_psb_private *dev_priv = connector->dev->dev_private;struct gma_encoder *encoder =gma_attached_encoder (connector);
drivers/gpu/drm/gma500/cdv_intel_hdmi.c +3 -1
@@ -150,8 +150,10 @@ static enum drm_connector_status cdv_hdmi_detect( }static int cdv_hdmi_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_encoder *encoder = connector->encoder;
drivers/gpu/drm/gma500/cdv_intel_lvds.c +3 -1
@@ -452,8 +452,10 @@ static void cdv_intel_lvds_destroy(struct drm_connector *connector) }static int cdv_intel_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_encoder *encoder = connector->encoder;
drivers/gpu/drm/gma500/mdfld_dsi_output.c +3 -1
@@ -243,8 +243,10 @@ mdfld_dsi_connector_detect(struct drm_connector *connector, bool force) }static int mdfld_dsi_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_encoder *encoder = connector->encoder;
drivers/gpu/drm/gma500/psb_drv.c +7 -0
@@ -487,6 +487,13 @@ static struct drm_driver driver = { .disable_vblank = psb_disable_vblank, .get_vblank_counter = psb_get_vblank_counter, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .gem_free_object = psb_gem_free_object, .gem_vm_ops = &psb_gem_vm_ops,
drivers/gpu/drm/gma500/psb_drv.h +1 -0
@@ -25,6 +25,7 @@#include <drm/drmP.h> #include <drm/drm_global.h> #include <drm/gma_drm.h> +#include <drm/drm_atomic.h> #include "psb_reg.h" #include "psb_intel_drv.h" #include "gma_display.h"
drivers/gpu/drm/gma500/psb_intel_drv.h +3 -1
@@ -254,8 +254,10 @@ extern bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,extern int psb_intel_lvds_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode);extern int psb_intel_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value); +uint64_t value, +void *blob_data);extern void psb_intel_lvds_destroy (struct drm_connector *connector);extern const struct drm_encoder_funcs psb_intel_lvds_enc_funcs;
drivers/gpu/drm/gma500/psb_intel_lvds.c +3 -1
@@ -569,8 +569,10 @@ void psb_intel_lvds_destroy(struct drm_connector *connector) }int psb_intel_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_encoder *encoder = connector->encoder;
drivers/gpu/drm/gma500/psb_intel_sdvo.c +3 -1
@@ -1705,8 +1705,10 @@ static bool psb_intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)static int psb_intel_sdvo_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct psb_intel_sdvo *psb_intel_sdvo =intel_attached_sdvo (connector);struct psb_intel_sdvo_connector *psb_intel_sdvo_connector =to_psb_intel_sdvo_connector (connector);
drivers/gpu/drm/i915/i915_drv.c +8 -0
@@ -1544,6 +1544,14 @@ static struct drm_driver driver = { .dumb_create = i915_gem_dumb_create, .dumb_map_offset = i915_gem_mmap_gtt, .dumb_destroy = drm_gem_dumb_destroy, + + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .ioctls = i915_ioctls, .fops = &i915_driver_fops, .name = DRIVER_NAME,
drivers/gpu/drm/i915/intel_crt.c +3 -1
@@ -753,8 +753,10 @@ out: }static int intel_crt_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {return 0 ; }
drivers/gpu/drm/i915/intel_dp.c +3 -1
@@ -3719,8 +3719,10 @@ intel_dp_detect_audio(struct drm_connector *connector)static int intel_dp_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct drm_i915_private *dev_priv = connector->dev->dev_private;struct intel_connector *intel_connector =to_intel_connector (connector);
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -31,6 +31,7 @@#include "i915_drv.h" #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_helper.h> #include <drm/drm_dp_helper.h>
drivers/gpu/drm/i915/intel_hdmi.c +3 -1
@@ -1063,8 +1063,10 @@ intel_hdmi_detect_audio(struct drm_connector *connector)static int intel_hdmi_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector); struct intel_digital_port *intel_dig_port =
drivers/gpu/drm/i915/intel_lvds.c +3 -1
@@ -480,8 +480,10 @@ static void intel_lvds_destroy(struct drm_connector *connector) }static int intel_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct intel_connector *intel_connector =to_intel_connector (connector);struct drm_device *dev = connector->dev;
drivers/gpu/drm/i915/intel_sdvo.c +3 -1
@@ -2065,8 +2065,10 @@ static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)static int intel_sdvo_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct intel_sdvo *intel_sdvo =intel_attached_sdvo (connector);struct intel_sdvo_connector *intel_sdvo_connector =to_intel_sdvo_connector (connector);
drivers/gpu/drm/i915/intel_tv.c +4 -2
@@ -1445,8 +1445,10 @@ intel_tv_destroy(struct drm_connector *connector)static int -intel_tv_set_property (struct drm_connector *connector,struct drm_property *property, -uint64_t val) +intel_tv_set_property (struct drm_connector *connector, +struct drm_atomic_state *state, +struct drm_property *property, +uint64_t val,void *blob_data) {struct drm_device *dev = connector->dev;struct intel_tv *intel_tv =intel_attached_tv (connector);
drivers/gpu/drm/mgag200/mgag200_drv.c +7 -0
@@ -103,6 +103,13 @@ static struct drm_driver driver = { .dumb_create = mgag200_dumb_create, .dumb_map_offset = mgag200_dumb_mmap_offset, .dumb_destroy = drm_gem_dumb_destroy, + + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, };static struct pci_driver mgag200_pci_driver = {
drivers/gpu/drm/mgag200/mgag200_drv.h +1 -0
@@ -16,6 +16,7 @@#include <video/vga.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include <drm/ttm/ttm_bo_api.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_placement.h>
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +2 -1
@@ -466,7 +466,8 @@ static int mdp4_crtc_page_flip(struct drm_crtc *crtc, }static int mdp4_crtc_set_property (struct drm_crtc *crtc, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {// XXX return -EINVAL ;
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +2 -1
@@ -85,7 +85,8 @@ void mdp4_plane_install_properties(struct drm_plane *plane, }int mdp4_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {// XXX return -EINVAL ;
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +2 -1
@@ -384,7 +384,8 @@ static int mdp5_crtc_page_flip(struct drm_crtc *crtc, }static int mdp5_crtc_set_property (struct drm_crtc *crtc, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {// XXX return -EINVAL ;
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2 -1
@@ -103,7 +103,8 @@ void mdp5_plane_install_properties(struct drm_plane *plane, }int mdp5_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {// XXX return -EINVAL ;
drivers/gpu/drm/msm/msm_drv.c +6 -0
@@ -858,6 +858,12 @@ static struct drm_driver msm_driver = { .gem_prime_import_sg_table = msm_gem_prime_import_sg_table, .gem_prime_vmap = msm_gem_prime_vmap, .gem_prime_vunmap = msm_gem_prime_vunmap, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, #ifdef CONFIG_DEBUG_FS .debugfs_init = msm_debugfs_init, .debugfs_cleanup = msm_debugfs_cleanup,
drivers/gpu/drm/msm/msm_drv.h +1 -0
@@ -50,6 +50,7 @@ static inline struct device *msm_iommu_get_ctx(const char *ctx_name)#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include <drm/msm_drm.h> struct msm_kms ;
drivers/gpu/drm/nouveau/dispnv04/overlay.c +3 -2
@@ -221,8 +221,9 @@ nv10_set_params(struct nouveau_plane *plane)static int nv_set_property (struct drm_plane *plane, -struct drm_property *property, -uint64_t value) +struct drm_atomic_state *state, +struct drm_property *property, +uint64_t value,void *blob_data) {struct nouveau_plane *nv_plane = (struct nouveau_plane *)plane;
drivers/gpu/drm/nouveau/nouveau_connector.c +2 -1
@@ -441,7 +441,8 @@ nouveau_connector_force(struct drm_connector *connector)static int nouveau_connector_set_property (struct drm_connector *connector, -struct drm_property *property,uint64_t value) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {struct nouveau_display *disp =nouveau_display (connector->dev);struct nouveau_connector *nv_connector =nouveau_connector (connector);
drivers/gpu/drm/nouveau/nouveau_drm.c +7 -0
@@ -859,6 +859,13 @@ driver = { .dumb_map_offset = nouveau_display_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .name = DRIVER_NAME, .desc =DRIVER_DESC , #ifdef GIT_REVISION
drivers/gpu/drm/nouveau/nouveau_drm.h +1 -0
@@ -29,6 +29,7 @@#include <subdev/vm.h> #include <drmP.h> +#include <drm/drm_atomic.h> #include <drm/nouveau_drm.h> #include <drm/ttm/ttm_bo_api.h>
drivers/gpu/drm/omapdrm/omap_crtc.c +4 -2
@@ -382,7 +382,8 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, }static int omap_crtc_set_property (struct drm_crtc *crtc, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {struct omap_crtc *omap_crtc =to_omap_crtc (crtc);struct omap_drm_private *priv = crtc->dev->dev_private;
@@ -392,7 +393,8 @@ static int omap_crtc_set_property(struct drm_crtc *crtc, !!(val & ((1LL <<DRM_ROTATE_90 ) | (1LL <<DRM_ROTATE_270 ))); } -return omap_plane_set_property (omap_crtc->plane, property, val); +return omap_plane_set_property (omap_crtc->plane, state, + property, val, blob_data); }static const struct drm_crtc_funcs omap_crtc_funcs = {
drivers/gpu/drm/omapdrm/omap_drv.c +6 -0
@@ -649,6 +649,12 @@ static struct drm_driver omap_drm_driver = { .dumb_create = omap_gem_dumb_create, .dumb_map_offset = omap_gem_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, .ioctls = ioctls, .num_ioctls = DRM_OMAP_NUM_IOCTLS, .fops = &omapdriver_fops,
drivers/gpu/drm/omapdrm/omap_drv.h +3 -1
@@ -25,6 +25,7 @@#include <linux/types.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/omap_drm.h> #include <linux/platform_data/omap_drm.h>
@@ -178,7 +179,8 @@ int omap_plane_mode_set(struct drm_plane *plane,void omap_plane_install_properties (struct drm_plane *plane,struct drm_mode_object *obj);int omap_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val); +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data);struct drm_encoder *omap_encoder_init (struct drm_device *dev,struct omap_dss_device *dssdev);
drivers/gpu/drm/omapdrm/omap_plane.c +2 -1
@@ -336,7 +336,8 @@ void omap_plane_install_properties(struct drm_plane *plane, }int omap_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {struct omap_plane *omap_plane =to_omap_plane (plane);struct omap_drm_private *priv = plane->dev->dev_private;
drivers/gpu/drm/qxl/qxl_display.c +3 -1
@@ -823,8 +823,10 @@ static enum drm_connector_status qxl_conn_detect( }static int qxl_conn_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {DRM_DEBUG ("\n" );return 0 ;
drivers/gpu/drm/qxl/qxl_drv.c +9 -0
@@ -34,6 +34,7 @@#include "drmP.h" #include "drm/drm.h" #include "drm_crtc_helper.h" +#include "drm_atomic.h" #include "qxl_drv.h" #include "qxl_object.h"
@@ -220,6 +221,14 @@ static struct drm_driver qxl_driver = { .dumb_create = qxl_mode_dumb_create, .dumb_map_offset = qxl_mode_dumb_mmap, .dumb_destroy = drm_gem_dumb_destroy, + + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, +#if defined(CONFIG_DEBUG_FS ) .debugfs_init = qxl_debugfs_init, .debugfs_cleanup = qxl_debugfs_takedown,
drivers/gpu/drm/radeon/radeon_connectors.c +6 -3
@@ -409,8 +409,9 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_conn } } -static int radeon_connector_set_property (struct drm_connector *connector,struct drm_property *property, -uint64_t val) +static int radeon_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {struct drm_device *dev = connector->dev;struct radeon_device *rdev = dev->dev_private;
@@ -732,8 +733,10 @@ static void radeon_connector_destroy(struct drm_connector *connector) }static int radeon_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_device *dev = connector->dev;struct radeon_encoder *radeon_encoder;
drivers/gpu/drm/radeon/radeon_drv.c +9 -0
@@ -34,6 +34,7 @@#include "radeon_drv.h" #include <drm/drm_pciids.h> +#include <drm/drm_atomic.h> #include <linux/console.h> #include <linux/module.h> #include <linux/pm_runtime.h>
@@ -558,6 +559,14 @@ static struct drm_driver kms_driver = { .dumb_create = radeon_mode_dumb_create, .dumb_map_offset = radeon_mode_dumb_mmap, .dumb_destroy = drm_gem_dumb_destroy, + + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .fops = &radeon_driver_kms_fops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
drivers/gpu/drm/rcar-du/rcar_du_drv.c +7 -0
@@ -21,6 +21,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
@@ -175,6 +176,12 @@ static struct drm_driver rcar_du_driver = { .dumb_create = rcar_du_dumb_create, .dumb_map_offset = drm_gem_cma_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, .fops = &rcar_du_fops, .name = "rcar-du", .desc = "Renesas R-Car Display Unit",
drivers/gpu/drm/rcar-du/rcar_du_plane.c +3 -1
@@ -397,8 +397,10 @@ done: }static int rcar_du_plane_set_property (struct drm_plane *plane, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct rcar_du_plane *rplane =to_rcar_plane (plane);struct rcar_du_group *rgrp = rplane->group;
drivers/gpu/drm/shmobile/shmob_drm_drv.c +7 -0
@@ -21,6 +21,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_gem_cma_helper.h> #include "shmob_drm_crtc.h"
@@ -285,6 +286,12 @@ static struct drm_driver shmob_drm_driver = { .dumb_create = drm_gem_cma_dumb_create, .dumb_map_offset = drm_gem_cma_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, .fops = &shmob_drm_fops, .name = "shmob-drm", .desc = "Renesas SH Mobile DRM",
drivers/gpu/drm/tilcdc/tilcdc_drv.c +6 -0
@@ -514,6 +514,12 @@ static struct drm_driver tilcdc_driver = { .dumb_create = drm_gem_cma_dumb_create, .dumb_map_offset = drm_gem_cma_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, #ifdef CONFIG_DEBUG_FS .debugfs_init = tilcdc_debugfs_init, .debugfs_cleanup = tilcdc_debugfs_cleanup,
drivers/gpu/drm/tilcdc/tilcdc_drv.h +1 -0
@@ -31,6 +31,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
drivers/gpu/drm/tilcdc/tilcdc_slave.c +2 -1
@@ -207,7 +207,8 @@ static struct drm_encoder *slave_connector_best_encoder( }static int slave_connector_set_property (struct drm_connector *connector, -struct drm_property *property,uint64_t value) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {struct drm_encoder *encoder =to_slave_connector (connector)->encoder; return get_slave_funcs(encoder)->set_property(encoder,
drivers/gpu/drm/udl/udl_connector.c +3 -3
@@ -108,9 +108,9 @@ udl_best_single_encoder(struct drm_connector *connector)return drm_encoder_find (connector->dev, enc_id); } -static int udl_connector_set_property (struct drm_connector *connector, -struct drm_property *property, -uint64_t val) +static int udl_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {return 0 ; }
drivers/gpu/drm/udl/udl_drv.c +8 -0
@@ -9,6 +9,7 @@#include <linux/module.h> #include <drm/drm_usb.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include "udl_drv.h" static struct drm_driver driver;
@@ -88,6 +89,13 @@ static struct drm_driver driver = { .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = udl_gem_prime_import, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE,
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +7 -0
@@ -1426,6 +1426,13 @@ static struct drm_driver driver = { .prime_fd_to_handle = vmw_prime_fd_to_handle, .prime_handle_to_fd = vmw_prime_handle_to_fd, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .fops = &vmwgfx_driver_fops, .name = VMWGFX_DRIVER_NAME, .desc = VMWGFX_DRIVER_DESC,
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +1 -0
@@ -30,6 +30,7 @@#include "vmwgfx_reg.h" #include <drm/drmP.h> +#include <drm/drm_atomic.h> #include <drm/vmwgfx_drm.h> #include <drm/drm_hashtab.h> #include <linux/suspend.h>
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3 -1
@@ -2005,8 +2005,10 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, }int vmw_du_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {return 0 ; }
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +3 -1
@@ -141,8 +141,10 @@ vmw_du_connector_detect(struct drm_connector *connector, bool force);int vmw_du_connector_fill_modes (struct drm_connector *connector,uint32_t max_width,uint32_t max_height);int vmw_du_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val); +uint64_t val, +void *blob_data);/*
include/drm/drmP.h +80 -0
86 lines not on this page · raw message
include/drm/drm_atomic.h new file +114 -0
114 lines not on this page · raw message
include/drm/drm_crtc.h +11 -4
@@ -219,6 +219,8 @@ struct drm_encoder;struct drm_pending_vblank_event ;struct drm_plane ;struct drm_bridge ; +struct drm_atomic_state ; +struct drm_atomic_funcs ;/** * drm_crtc_funcs - control CRTCs for a given device
@@ -281,7 +283,9 @@ struct drm_crtc_funcs { uint32_t flags);int (*set_property)(struct drm_crtc *crtc, -struct drm_property *property,uint64_t val); +struct drm_atomic_state *state, +struct drm_property *property,uint64_t val, +void *blob_data); };/**
@@ -399,8 +403,9 @@ struct drm_connector_funcs {enum drm_connector_status (*detect)(struct drm_connector *connector,bool force);int (*fill_modes)(struct drm_connector *connector,uint32_t max_width,uint32_t max_height); -int (*set_property)(struct drm_connector *connector,struct drm_property *property, -uint64_t val); +int (*set_property)(struct drm_connector *connector, +struct drm_atomic_state *state, +struct drm_property *property,uint64_t val,void *blob_data);void (*destroy)(struct drm_connector *connector);void (*force)(struct drm_connector *connector); };
@@ -574,7 +579,9 @@ struct drm_plane_funcs {void (*destroy)(struct drm_plane *plane);int (*set_property)(struct drm_plane *plane, -struct drm_property *property,uint64_t val); +struct drm_atomic_state *state, +struct drm_property *property,uint64_t val, +void *blob_data); };enum drm_plane_type {
include/drm/drm_modeset_lock.h +47 -0
92 lines not on this page · raw message
include/uapi/drm/drm_mode.h +3 -0
@@ -512,4 +512,7 @@ struct drm_mode_destroy_dumb { uint32_t handle; }; +#define DRM_MODE_ATOMIC_NONBLOCK 0x0200 +#define DRM_MODE_ATOMIC_NOLOCK 0x8000/* only used internally */ +#endif
Signature · 1 line
1.9.3
Re: [PATCH 1/7] drm: add atomic fxns
Quoted 17 lines · Rob Clark
The 'atomic' mechanism allows for multiple properties to be updated, checked, and commited atomically. This will be the basis of atomic- modeset and nuclear-pageflip.
The basic flow is:
state = dev->atomic_begin(); for (... one or more ...) obj->set_property(obj, state, prop, value); if (dev->atomic_check(state)) dev->atomic_commit(state); dev->atomic_end(state);The split of check and commit steps is to allow for ioctls with a test-only flag (which would skip the commit step).
Signed-off-by Rob Clark <[email protected]>
[snip]
drivers/gpu/drm/drm_atomic.c line 65
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c new file +4
-0+if (flags &DRM_MODE_ATOMIC_NOLOCK ) + acquire_flags |=DRM_MODESET_ACQUIRE_NOLOCK ; +if (flags &DRM_MODE_ATOMIC_NONBLOCK ) + acquire_flags |=DRM_MODESET_ACQUIRE_NONBLOCK ;
Just a very quick reply. Can you please remove the code which does the NOLOCK/NONBLOCK stuff here? It's not really part of the property conversion and I'm still not sold on those concepts.
At least I want to review them once we add them, maybe at the very end where everything else is clear. Afaics nothing in this series actually uses this.
-Daniel
Quoted 1,800 lines
drivers/gpu/drm/drm_atomic.c new file +209
-0+ +drm_modeset_acquire_init (&state->acquire_ctx, acquire_flags); + + state->dev = dev; + state->flags = flags; + +return state; +} +EXPORT_SYMBOL (drm_atomic_begin); + +/** +* drm_atomic_set_event - set a pending event on mode object +* @dev: DRM device +* @state: the driver state object +* @obj: the object to set the event on +* @event: the event to send back +* +* Set pending event for an update on the specified object. The +* event is to be sent back to userspace after the update completes. +*/ +int drm_atomic_set_event (struct drm_device *dev, +struct drm_atomic_state *state,struct drm_mode_object *obj, +struct drm_pending_vblank_event *event) +{ +return -EINVAL ;/* for now */ +} +EXPORT_SYMBOL (drm_atomic_set_event); + +/** +* drm_atomic_check - validate state object +* @dev: DRM device +* @state: the driver state object +* +* Check the state object to see if the requested state is +* physically possible. +* +* RETURNS +* Zero for success or -errno +*/ +int drm_atomic_check (struct drm_device *dev,struct drm_atomic_state *state) +{ +struct drm_atomic_state *a = state; + a->acquire_ctx.frozen = true; +return 0 ;/* for now */ +} +EXPORT_SYMBOL (drm_atomic_check); + +/* Note that we drop and re-acquire the locks w/ ww_mutex directly, +* since we keep the crtc in our list with in_atomic == true. +*/ + +static void drop_locks (struct drm_atomic_state *a, +struct ww_acquire_ctx *ww_ctx) +{ +struct drm_modeset_acquire_ctx *ctx = &a->acquire_ctx; +struct drm_modeset_lock *lock; + +mutex_lock (&ctx->mutex); +list_for_each_entry (lock, &ctx->locked, head) +ww_mutex_unlock (&lock->mutex); +mutex_unlock (&ctx->mutex); + +ww_acquire_fini (ww_ctx); +} + +static void grab_locks (struct drm_atomic_state *a, +struct ww_acquire_ctx *ww_ctx) +{ +struct drm_modeset_acquire_ctx *ctx = &a->acquire_ctx; +struct drm_modeset_lock *lock, *slow_locked, *contended; +int ret; + + lock = slow_locked = contended =NULL ; + + +ww_acquire_init (ww_ctx, &crtc_ww_class); + +/* +* We need to do proper rain^Hww dance.. another context +* could sneak in a grab the lock in order to check +* crtc->in_atomic, and we get -EDEADLK. But the winner +* will realize the mistake when it sees crtc->in_atomic +* already set, and then drop lock and return -EBUSY. +* So we just need to keep dancing until we win. +*/ +retry: + ret =0 ; +list_for_each_entry (lock, &ctx->locked, head) { +if (lock == slow_locked) { + slow_locked =NULL ; +continue ; + } + contended = lock; + ret =ww_mutex_lock (&lock->mutex, ww_ctx); +if (ret) + goto fail; + } + +fail: +if (ret == -EDEADLK ) { +/* we lost out in a seqno race, backoff, lock and retry.. */ + +list_for_each_entry (lock, &ctx->locked, head) { +if (lock == contended) +break ; +ww_mutex_unlock (&lock->mutex); + } + +if (slow_locked) +ww_mutex_unlock (&slow_locked->mutex); + +ww_mutex_lock_slow (&contended->mutex, ww_ctx); + slow_locked = contended; + goto retry; + } +WARN_ON (ret);/* if we get EALREADY then something is fubar */ +} + +static void commit_locks (struct drm_atomic_state *a, +struct ww_acquire_ctx *ww_ctx) +{ +/* and properly release them (clear in_atomic, remove from list): */ +drm_modeset_drop_locks (&a->acquire_ctx); +ww_acquire_fini (ww_ctx); + a->committed = true; +} + +static int atomic_commit (struct drm_atomic_state *a, +struct ww_acquire_ctx *ww_ctx) +{ +int ret =0 ; + +commit_locks (a, ww_ctx); + +return ret; +} + +/** +* drm_atomic_commit - commit state +* @dev: DRM device +* @state: the driver state object +* +* Commit the state. This will only be called if atomic_check() +* succeeds. +* +* RETURNS +* Zero for success or -errno +*/ +int drm_atomic_commit (struct drm_device *dev,struct drm_atomic_state *a) +{ +return atomic_commit (a, &a->acquire_ctx.ww_ctx); +} +EXPORT_SYMBOL (drm_atomic_commit); + +/** +* drm_atomic_commit_unlocked - like drm_atomic_commit +* but can be called back by driver in other thread. Manages the lock +* transfer from initiating thread. +*/ +int drm_atomic_commit_unlocked (struct drm_device *dev, +struct drm_atomic_state *a) +{ +struct ww_acquire_ctx ww_ctx; +grab_locks (a, &ww_ctx); +return atomic_commit (a, &ww_ctx); +} +EXPORT_SYMBOL (drm_atomic_commit_unlocked); + +/** +* drm_atomic_end - conclude the atomic update +* @dev: DRM device +* @state: the driver state object +* +* Release resources associated with the state object. +*/ +void drm_atomic_end (struct drm_device *dev,struct drm_atomic_state *a) +{ +/* if commit is happening from another thread, it will +* block grabbing locks until we drop (and not set +* a->committed until after), so this is not a race: +*/ +if (!a->committed) +drop_locks (a, &a->acquire_ctx.ww_ctx); + +drm_atomic_state_unreference (a); +} +EXPORT_SYMBOL (drm_atomic_end); + +void _drm_atomic_state_free (struct kref *kref) +{ +struct drm_atomic_state *a = + container_of(kref, struct drm_atomic_state, refcount); + +/* in case we haven't already: */ +if (!a->committed) { +grab_locks (a, &a->acquire_ctx.ww_ctx); +commit_locks (a, &a->acquire_ctx.ww_ctx); + } + +__drm_modeset_acquire_fini (&a->acquire_ctx); + +kfree (a); +} +EXPORT_SYMBOL (_drm_atomic_state_free); + + +const struct drm_atomic_funcs drm_atomic_funcs = { +}; +EXPORT_SYMBOL (drm_atomic_funcs);drivers/gpu/drm/drm_crtc.c +93
-56@@ -38,6 +38,7 @@#include <drm/drm_edid.h> #include <drm/drm_fourcc.h> #include <drm/drm_modeset_lock.h> +#include <drm/drm_atomic.h> #include "drm_crtc_internal.h" @@ -4056,20 +4057,21 @@ int drm_mode_connector_property_set_ioctl(struct drm_device *dev,return drm_mode_obj_set_property_ioctl (dev, &obj_set_prop, file_priv); } -static int drm_mode_connector_set_obj_prop (struct drm_mode_object *obj, -struct drm_property *property, -uint64_t value) +static int drm_mode_connector_set_obj_prop (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {int ret = -EINVAL ; -struct drm_connector *connector =obj_to_connector (obj);/* Do DPMS ourselves */ if (property == connector->dev->mode_config.dpms_property) {if (connector->funcs->dpms) (*connector->funcs->dpms)(connector, (int )value); ret =0 ; - }else if (connector->funcs->set_property) - ret = connector->funcs->set_property (connector, property, value); + }else if (connector->funcs->set_property) { + ret = connector->funcs->set_property (connector, state, + property, value, blob_data); + }/* store the property value if successful */ if (!ret)@@ -4077,38 +4079,90 @@ static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,return ret; } -static int drm_mode_crtc_set_obj_prop (struct drm_mode_object *obj, -struct drm_property *property, -uint64_t value) +static int drm_mode_crtc_set_obj_prop (struct drm_crtc *crtc, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {int ret = -EINVAL ; -struct drm_crtc *crtc =obj_to_crtc (obj);if (crtc->funcs->set_property) - ret = crtc->funcs->set_property (crtc, property, value); + ret = crtc->funcs->set_property (crtc, state, property, + value, blob_data);if (!ret) -drm_object_property_set_value (obj, property, value); +drm_object_property_set_value (&crtc->base, property, value);return ret; } -static int drm_mode_plane_set_obj_prop (struct drm_mode_object *obj, -struct drm_property *property, -uint64_t value) +static int drm_mode_plane_set_obj_prop (struct drm_plane *plane, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {int ret = -EINVAL ; -struct drm_plane *plane =obj_to_plane (obj);if (plane->funcs->set_property) - ret = plane->funcs->set_property (plane, property, value); + ret = plane->funcs->set_property (plane, state, property, + value, blob_data);if (!ret) -drm_object_property_set_value (obj, property, value); +drm_object_property_set_value (&plane->base, property, value);return ret; } +static int drm_mode_set_obj_prop (struct drm_device *dev, +struct drm_mode_object *obj,struct drm_atomic_state *state, +struct drm_property *property,uint64_t value,void *blob_data) +{ +if (drm_property_change_is_valid (property, value)) { +switch (obj->type) { +case DRM_MODE_OBJECT_CONNECTOR : +return drm_mode_connector_set_obj_prop (obj_to_connector (obj), + state, property, value, blob_data); +case DRM_MODE_OBJECT_CRTC : +return drm_mode_crtc_set_obj_prop (obj_to_crtc (obj), + state, property, value, blob_data); +case DRM_MODE_OBJECT_PLANE : +return drm_mode_plane_set_obj_prop (obj_to_plane (obj), + state, property, value, blob_data); + } + } + +return -EINVAL ; +} + +/* call with mode_config mutex held */ +static int drm_mode_set_obj_prop_id (struct drm_device *dev, +struct drm_atomic_state *state, +uint32_t obj_id,uint32_t obj_type, +uint32_t prop_id,uint64_t value,void *blob_data) +{ +struct drm_mode_object *arg_obj; +struct drm_property *property; +int i; + + arg_obj =drm_mode_object_find (dev, obj_id, obj_type); +if (!arg_obj) +return -ENOENT ; +if (!arg_obj->properties) +return -EINVAL ; + +for (i =0 ; i < arg_obj->properties->count; i++) +if (arg_obj->properties->ids[i] == prop_id) +break ; + +if (i == arg_obj->properties->count) +return -EINVAL ; + + property =drm_property_find (dev, prop_id); +if (!property) +return -ENOENT ; + +return drm_mode_set_obj_prop (dev, arg_obj, state, property, + value, blob_data); +} +/** -* drm_mode_getproperty_ioctl - get the current value of a object's property +* drm_mode_obj_get_properties_ioctl - get the current value of a object's property * @dev: DRM device * @data: ioctl data * @file_priv: DRM file info @@ -4198,58 +4252,41 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) {struct drm_mode_obj_set_property *arg = data; -struct drm_mode_object *arg_obj; -struct drm_mode_object *prop_obj; -struct drm_property *property; +struct drm_mode_config *config = &dev->mode_config; +struct drm_atomic_state *state;int ret = -EINVAL ; -int i;if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -drm_modeset_lock_all (dev); +retry: + state = dev->driver->atomic_begin (dev,0 ); +if (IS_ERR (state)) +return PTR_ERR (state); - arg_obj =drm_mode_object_find (dev, arg->obj_id, arg->obj_type); -if (!arg_obj) { - ret = -ENOENT ; - goto out; - } -if (!arg_obj->properties) + ret =drm_modeset_lock (&config->connection_mutex, &state->acquire_ctx); +if (ret) goto out; - -for (i =0 ; i < arg_obj->properties->count; i++) -if (arg_obj->properties->ids[i] == arg->prop_id) -break ; - -if (i == arg_obj->properties->count) + ret =drm_modeset_lock_all_crtcs (dev, &state->acquire_ctx); +if (ret) goto out; - prop_obj =drm_mode_object_find (dev, arg->prop_id, -DRM_MODE_OBJECT_PROPERTY ); -if (!prop_obj) { - ret = -ENOENT ; + ret =drm_mode_set_obj_prop_id (dev, state, + arg->obj_id, arg->obj_type, + arg->prop_id, arg->value,NULL ); +if (ret) goto out; - } - property =obj_to_property (prop_obj); -if (!drm_property_change_is_valid (property, arg->value)) + ret = dev->driver->atomic_check (dev, state); +if (ret) goto out; -switch (arg_obj->type) { -case DRM_MODE_OBJECT_CONNECTOR : - ret =drm_mode_connector_set_obj_prop (arg_obj, property, - arg->value); -break ; -case DRM_MODE_OBJECT_CRTC : - ret =drm_mode_crtc_set_obj_prop (arg_obj, property, arg->value); -break ; -case DRM_MODE_OBJECT_PLANE : - ret =drm_mode_plane_set_obj_prop (arg_obj, property, arg->value); -break ; - } + ret = dev->driver->atomic_commit (dev, state); out: -drm_modeset_unlock_all (dev); + dev->driver->atomic_end (dev, state); +if (ret == -EDEADLK ) + goto retry;return ret; }drivers/gpu/drm/drm_modeset_lock.c +28
-0@@ -67,9 +67,18 @@ void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,memset (ctx,0 ,sizeof (*ctx));ww_acquire_init (&ctx->ww_ctx, &crtc_ww_class);INIT_LIST_HEAD (&ctx->locked); +mutex_init (&ctx->mutex); + ctx->nolock = !!(flags &DRM_MODESET_ACQUIRE_NOLOCK ); + ctx->nonblock = !!(flags &DRM_MODESET_ACQUIRE_NONBLOCK ); }EXPORT_SYMBOL (drm_modeset_acquire_init); +/* special version for atomic.. which needs to ww_acquire_fini() itself */ +void __drm_modeset_acquire_fini (struct drm_modeset_acquire_ctx *ctx) +{ +mutex_destroy (&ctx->mutex); +} +/** * drm_modeset_acquire_fini - cleanup acquire context * @ctx: the acquire context @@ -77,6 +86,7 @@ EXPORT_SYMBOL(drm_modeset_acquire_init);void drm_modeset_acquire_fini (struct drm_modeset_acquire_ctx *ctx) {ww_acquire_fini (&ctx->ww_ctx); +__drm_modeset_acquire_fini (ctx); }EXPORT_SYMBOL (drm_modeset_acquire_fini);@@ -89,6 +99,7 @@ EXPORT_SYMBOL(drm_modeset_acquire_fini);void drm_modeset_drop_locks (struct drm_modeset_acquire_ctx *ctx) {WARN_ON (ctx->contended); +mutex_lock (&ctx->mutex);while (!list_empty (&ctx->locked)) {struct drm_modeset_lock *lock;@@ -97,6 +108,7 @@ void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx)drm_modeset_unlock (lock); } +mutex_unlock (&ctx->mutex); }EXPORT_SYMBOL (drm_modeset_drop_locks);@@ -106,8 +118,13 @@ static inline int modeset_lock(struct drm_modeset_lock *lock, {int ret; +if (ctx->nolock) +return 0 ; + +WARN_ON (ctx->frozen);/* all locks should be held by now! */ WARN_ON (ctx->contended); +retry:if (interruptible && slow) { ret =ww_mutex_lock_slow_interruptible (&lock->mutex, &ctx->ww_ctx); }else if (interruptible) {@@ -119,6 +136,15 @@ static inline int modeset_lock(struct drm_modeset_lock *lock, ret =ww_mutex_lock (&lock->mutex, &ctx->ww_ctx); }if (!ret) { +if (lock->atomic_pending) { +/* some other pending update with dropped locks */ +ww_mutex_unlock (&lock->mutex); +if (ctx->nonblock) +return -EBUSY ; +wait_event (lock->event, !lock->atomic_pending); + goto retry; + } + lock->atomic_pending = true;WARN_ON (!list_empty (&lock->head));list_add (&lock->head, &ctx->locked); }else if (ret == -EALREADY ) {@@ -222,7 +248,9 @@ EXPORT_SYMBOL(drm_modeset_lock_interruptible);void drm_modeset_unlock (struct drm_modeset_lock *lock) {list_del_init (&lock->head); + lock->atomic_pending = false;ww_mutex_unlock (&lock->mutex); +wake_up_all (&lock->event); }EXPORT_SYMBOL (drm_modeset_unlock);drivers/gpu/drm/exynos/exynos_drm_crtc.c +3
-1@@ -281,8 +281,10 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc) }static int exynos_drm_crtc_set_property (struct drm_crtc *crtc, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct drm_device *dev = crtc->dev;struct exynos_drm_private *dev_priv = dev->dev_private;drivers/gpu/drm/exynos/exynos_drm_drv.c +7
-0@@ -14,6 +14,7 @@#include <linux/pm_runtime.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <linux/anon_inodes.h> #include <linux/component.h> @@ -338,6 +339,12 @@ static struct drm_driver exynos_drm_driver = { .dumb_create = exynos_drm_gem_dumb_create, .dumb_map_offset = exynos_drm_gem_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_export = exynos_dmabuf_prime_export,drivers/gpu/drm/exynos/exynos_drm_plane.c +3
-1@@ -212,8 +212,10 @@ static void exynos_plane_destroy(struct drm_plane *plane) }static int exynos_plane_set_property (struct drm_plane *plane, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct drm_device *dev = plane->dev;struct exynos_plane *exynos_plane =to_exynos_plane (plane);drivers/gpu/drm/gma500/cdv_intel_crt.c +3
-1@@ -205,8 +205,10 @@ static int cdv_intel_crt_get_modes(struct drm_connector *connector) }static int cdv_intel_crt_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {return 0 ; }drivers/gpu/drm/gma500/cdv_intel_dp.c +3
-1@@ -1645,8 +1645,10 @@ cdv_intel_dp_detect_audio(struct drm_connector *connector)static int cdv_intel_dp_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct drm_psb_private *dev_priv = connector->dev->dev_private;struct gma_encoder *encoder =gma_attached_encoder (connector);drivers/gpu/drm/gma500/cdv_intel_hdmi.c +3
-1@@ -150,8 +150,10 @@ static enum drm_connector_status cdv_hdmi_detect( }static int cdv_hdmi_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_encoder *encoder = connector->encoder;drivers/gpu/drm/gma500/cdv_intel_lvds.c +3
-1@@ -452,8 +452,10 @@ static void cdv_intel_lvds_destroy(struct drm_connector *connector) }static int cdv_intel_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_encoder *encoder = connector->encoder;drivers/gpu/drm/gma500/mdfld_dsi_output.c +3
-1@@ -243,8 +243,10 @@ mdfld_dsi_connector_detect(struct drm_connector *connector, bool force) }static int mdfld_dsi_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_encoder *encoder = connector->encoder;drivers/gpu/drm/gma500/psb_drv.c +7
-0@@ -487,6 +487,13 @@ static struct drm_driver driver = { .disable_vblank = psb_disable_vblank, .get_vblank_counter = psb_get_vblank_counter, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .gem_free_object = psb_gem_free_object, .gem_vm_ops = &psb_gem_vm_ops,drivers/gpu/drm/gma500/psb_drv.h +1
-0@@ -25,6 +25,7 @@#include <drm/drmP.h> #include <drm/drm_global.h> #include <drm/gma_drm.h> +#include <drm/drm_atomic.h> #include "psb_reg.h" #include "psb_intel_drv.h" #include "gma_display.h" drivers/gpu/drm/gma500/psb_intel_drv.h +3
-1@@ -254,8 +254,10 @@ extern bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,extern int psb_intel_lvds_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode);extern int psb_intel_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value); +uint64_t value, +void *blob_data);extern void psb_intel_lvds_destroy (struct drm_connector *connector);extern const struct drm_encoder_funcs psb_intel_lvds_enc_funcs;drivers/gpu/drm/gma500/psb_intel_lvds.c +3
-1@@ -569,8 +569,10 @@ void psb_intel_lvds_destroy(struct drm_connector *connector) }int psb_intel_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_encoder *encoder = connector->encoder;drivers/gpu/drm/gma500/psb_intel_sdvo.c +3
-1@@ -1705,8 +1705,10 @@ static bool psb_intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)static int psb_intel_sdvo_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct psb_intel_sdvo *psb_intel_sdvo =intel_attached_sdvo (connector);struct psb_intel_sdvo_connector *psb_intel_sdvo_connector =to_psb_intel_sdvo_connector (connector);drivers/gpu/drm/i915/i915_drv.c +8
-0@@ -1544,6 +1544,14 @@ static struct drm_driver driver = { .dumb_create = i915_gem_dumb_create, .dumb_map_offset = i915_gem_mmap_gtt, .dumb_destroy = drm_gem_dumb_destroy, + + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .ioctls = i915_ioctls, .fops = &i915_driver_fops, .name = DRIVER_NAME,drivers/gpu/drm/i915/intel_crt.c +3
-1@@ -753,8 +753,10 @@ out: }static int intel_crt_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {return 0 ; }drivers/gpu/drm/i915/intel_dp.c +3
-1@@ -3719,8 +3719,10 @@ intel_dp_detect_audio(struct drm_connector *connector)static int intel_dp_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct drm_i915_private *dev_priv = connector->dev->dev_private;struct intel_connector *intel_connector =to_intel_connector (connector);drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -31,6 +31,7 @@#include "i915_drv.h" #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_helper.h> #include <drm/drm_dp_helper.h> drivers/gpu/drm/i915/intel_hdmi.c +3
-1@@ -1063,8 +1063,10 @@ intel_hdmi_detect_audio(struct drm_connector *connector)static int intel_hdmi_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector); struct intel_digital_port *intel_dig_port =drivers/gpu/drm/i915/intel_lvds.c +3
-1@@ -480,8 +480,10 @@ static void intel_lvds_destroy(struct drm_connector *connector) }static int intel_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct intel_connector *intel_connector =to_intel_connector (connector);struct drm_device *dev = connector->dev;drivers/gpu/drm/i915/intel_sdvo.c +3
-1@@ -2065,8 +2065,10 @@ static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)static int intel_sdvo_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {struct intel_sdvo *intel_sdvo =intel_attached_sdvo (connector);struct intel_sdvo_connector *intel_sdvo_connector =to_intel_sdvo_connector (connector);drivers/gpu/drm/i915/intel_tv.c +4
-2@@ -1445,8 +1445,10 @@ intel_tv_destroy(struct drm_connector *connector)static int -intel_tv_set_property (struct drm_connector *connector,struct drm_property *property, -uint64_t val) +intel_tv_set_property (struct drm_connector *connector, +struct drm_atomic_state *state, +struct drm_property *property, +uint64_t val,void *blob_data) {struct drm_device *dev = connector->dev;struct intel_tv *intel_tv =intel_attached_tv (connector);drivers/gpu/drm/mgag200/mgag200_drv.c +7
-0@@ -103,6 +103,13 @@ static struct drm_driver driver = { .dumb_create = mgag200_dumb_create, .dumb_map_offset = mgag200_dumb_mmap_offset, .dumb_destroy = drm_gem_dumb_destroy, + + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, };static struct pci_driver mgag200_pci_driver = {drivers/gpu/drm/mgag200/mgag200_drv.h +1
-0@@ -16,6 +16,7 @@#include <video/vga.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include <drm/ttm/ttm_bo_api.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_placement.h> drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +2
-1@@ -466,7 +466,8 @@ static int mdp4_crtc_page_flip(struct drm_crtc *crtc, }static int mdp4_crtc_set_property (struct drm_crtc *crtc, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {// XXX return -EINVAL ;drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +2
-1@@ -85,7 +85,8 @@ void mdp4_plane_install_properties(struct drm_plane *plane, }int mdp4_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {// XXX return -EINVAL ;drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +2
-1@@ -384,7 +384,8 @@ static int mdp5_crtc_page_flip(struct drm_crtc *crtc, }static int mdp5_crtc_set_property (struct drm_crtc *crtc, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {// XXX return -EINVAL ;drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +2
-1@@ -103,7 +103,8 @@ void mdp5_plane_install_properties(struct drm_plane *plane, }int mdp5_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {// XXX return -EINVAL ;drivers/gpu/drm/msm/msm_drv.c +6
-0@@ -858,6 +858,12 @@ static struct drm_driver msm_driver = { .gem_prime_import_sg_table = msm_gem_prime_import_sg_table, .gem_prime_vmap = msm_gem_prime_vmap, .gem_prime_vunmap = msm_gem_prime_vunmap, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, #ifdef CONFIG_DEBUG_FS .debugfs_init = msm_debugfs_init, .debugfs_cleanup = msm_debugfs_cleanup,drivers/gpu/drm/msm/msm_drv.h +1
-0@@ -50,6 +50,7 @@ static inline struct device *msm_iommu_get_ctx(const char *ctx_name)#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include <drm/msm_drm.h> struct msm_kms ;drivers/gpu/drm/nouveau/dispnv04/overlay.c +3
-2@@ -221,8 +221,9 @@ nv10_set_params(struct nouveau_plane *plane)static int nv_set_property (struct drm_plane *plane, -struct drm_property *property, -uint64_t value) +struct drm_atomic_state *state, +struct drm_property *property, +uint64_t value,void *blob_data) {struct nouveau_plane *nv_plane = (struct nouveau_plane *)plane;drivers/gpu/drm/nouveau/nouveau_connector.c +2
-1@@ -441,7 +441,8 @@ nouveau_connector_force(struct drm_connector *connector)static int nouveau_connector_set_property (struct drm_connector *connector, -struct drm_property *property,uint64_t value) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {struct nouveau_display *disp =nouveau_display (connector->dev);struct nouveau_connector *nv_connector =nouveau_connector (connector);drivers/gpu/drm/nouveau/nouveau_drm.c +7
-0@@ -859,6 +859,13 @@ driver = { .dumb_map_offset = nouveau_display_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .name = DRIVER_NAME, .desc =DRIVER_DESC , #ifdef GIT_REVISIONdrivers/gpu/drm/nouveau/nouveau_drm.h +1
-0@@ -29,6 +29,7 @@#include <subdev/vm.h> #include <drmP.h> +#include <drm/drm_atomic.h> #include <drm/nouveau_drm.h> #include <drm/ttm/ttm_bo_api.h> drivers/gpu/drm/omapdrm/omap_crtc.c +4
-2@@ -382,7 +382,8 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, }static int omap_crtc_set_property (struct drm_crtc *crtc, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {struct omap_crtc *omap_crtc =to_omap_crtc (crtc);struct omap_drm_private *priv = crtc->dev->dev_private;@@ -392,7 +393,8 @@ static int omap_crtc_set_property(struct drm_crtc *crtc, !!(val & ((1LL <<DRM_ROTATE_90 ) | (1LL <<DRM_ROTATE_270 ))); } -return omap_plane_set_property (omap_crtc->plane, property, val); +return omap_plane_set_property (omap_crtc->plane, state, + property, val, blob_data); }static const struct drm_crtc_funcs omap_crtc_funcs = {drivers/gpu/drm/omapdrm/omap_drv.c +6
-0@@ -649,6 +649,12 @@ static struct drm_driver omap_drm_driver = { .dumb_create = omap_gem_dumb_create, .dumb_map_offset = omap_gem_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, .ioctls = ioctls, .num_ioctls = DRM_OMAP_NUM_IOCTLS, .fops = &omapdriver_fops,drivers/gpu/drm/omapdrm/omap_drv.h +3
-1@@ -25,6 +25,7 @@#include <linux/types.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/omap_drm.h> #include <linux/platform_data/omap_drm.h> @@ -178,7 +179,8 @@ int omap_plane_mode_set(struct drm_plane *plane,void omap_plane_install_properties (struct drm_plane *plane,struct drm_mode_object *obj);int omap_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val); +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data);struct drm_encoder *omap_encoder_init (struct drm_device *dev,struct omap_dss_device *dssdev);drivers/gpu/drm/omapdrm/omap_plane.c +2
-1@@ -336,7 +336,8 @@ void omap_plane_install_properties(struct drm_plane *plane, }int omap_plane_set_property (struct drm_plane *plane, -struct drm_property *property,uint64_t val) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {struct omap_plane *omap_plane =to_omap_plane (plane);struct omap_drm_private *priv = plane->dev->dev_private;drivers/gpu/drm/qxl/qxl_display.c +3
-1@@ -823,8 +823,10 @@ static enum drm_connector_status qxl_conn_detect( }static int qxl_conn_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {DRM_DEBUG ("\n" );return 0 ;drivers/gpu/drm/qxl/qxl_drv.c +9
-0@@ -34,6 +34,7 @@#include "drmP.h" #include "drm/drm.h" #include "drm_crtc_helper.h" +#include "drm_atomic.h" #include "qxl_drv.h" #include "qxl_object.h" @@ -220,6 +221,14 @@ static struct drm_driver qxl_driver = { .dumb_create = qxl_mode_dumb_create, .dumb_map_offset = qxl_mode_dumb_mmap, .dumb_destroy = drm_gem_dumb_destroy, + + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, +#if defined(CONFIG_DEBUG_FS ) .debugfs_init = qxl_debugfs_init, .debugfs_cleanup = qxl_debugfs_takedown,drivers/gpu/drm/radeon/radeon_connectors.c +6
-3@@ -409,8 +409,9 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_conn } } -static int radeon_connector_set_property (struct drm_connector *connector,struct drm_property *property, -uint64_t val) +static int radeon_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {struct drm_device *dev = connector->dev;struct radeon_device *rdev = dev->dev_private;@@ -732,8 +733,10 @@ static void radeon_connector_destroy(struct drm_connector *connector) }static int radeon_lvds_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct drm_device *dev = connector->dev;struct radeon_encoder *radeon_encoder;drivers/gpu/drm/radeon/radeon_drv.c +9
-0@@ -34,6 +34,7 @@#include "radeon_drv.h" #include <drm/drm_pciids.h> +#include <drm/drm_atomic.h> #include <linux/console.h> #include <linux/module.h> #include <linux/pm_runtime.h> @@ -558,6 +559,14 @@ static struct drm_driver kms_driver = { .dumb_create = radeon_mode_dumb_create, .dumb_map_offset = radeon_mode_dumb_mmap, .dumb_destroy = drm_gem_dumb_destroy, + + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .fops = &radeon_driver_kms_fops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,drivers/gpu/drm/rcar-du/rcar_du_drv.c +7
-0@@ -21,6 +21,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> @@ -175,6 +176,12 @@ static struct drm_driver rcar_du_driver = { .dumb_create = rcar_du_dumb_create, .dumb_map_offset = drm_gem_cma_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, .fops = &rcar_du_fops, .name = "rcar-du", .desc = "Renesas R-Car Display Unit",drivers/gpu/drm/rcar-du/rcar_du_plane.c +3
-1@@ -397,8 +397,10 @@ done: }static int rcar_du_plane_set_property (struct drm_plane *plane, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t value) +uint64_t value, +void *blob_data) {struct rcar_du_plane *rplane =to_rcar_plane (plane);struct rcar_du_group *rgrp = rplane->group;drivers/gpu/drm/shmobile/shmob_drm_drv.c +7
-0@@ -21,6 +21,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_gem_cma_helper.h> #include "shmob_drm_crtc.h" @@ -285,6 +286,12 @@ static struct drm_driver shmob_drm_driver = { .dumb_create = drm_gem_cma_dumb_create, .dumb_map_offset = drm_gem_cma_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, .fops = &shmob_drm_fops, .name = "shmob-drm", .desc = "Renesas SH Mobile DRM",drivers/gpu/drm/tilcdc/tilcdc_drv.c +6
-0@@ -514,6 +514,12 @@ static struct drm_driver tilcdc_driver = { .dumb_create = drm_gem_cma_dumb_create, .dumb_map_offset = drm_gem_cma_dumb_map_offset, .dumb_destroy = drm_gem_dumb_destroy, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, #ifdef CONFIG_DEBUG_FS .debugfs_init = tilcdc_debugfs_init, .debugfs_cleanup = tilcdc_debugfs_cleanup,drivers/gpu/drm/tilcdc/tilcdc_drv.h +1
-0@@ -31,6 +31,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_fb_cma_helper.h> drivers/gpu/drm/tilcdc/tilcdc_slave.c +2
-1@@ -207,7 +207,8 @@ static struct drm_encoder *slave_connector_best_encoder( }static int slave_connector_set_property (struct drm_connector *connector, -struct drm_property *property,uint64_t value) +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {struct drm_encoder *encoder =to_slave_connector (connector)->encoder; return get_slave_funcs(encoder)->set_property(encoder,drivers/gpu/drm/udl/udl_connector.c +3
-3@@ -108,9 +108,9 @@ udl_best_single_encoder(struct drm_connector *connector)return drm_encoder_find (connector->dev, enc_id); } -static int udl_connector_set_property (struct drm_connector *connector, -struct drm_property *property, -uint64_t val) +static int udl_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data) {return 0 ; }drivers/gpu/drm/udl/udl_drv.c +8
-0@@ -9,6 +9,7 @@#include <linux/module.h> #include <drm/drm_usb.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include "udl_drv.h" static struct drm_driver driver;@@ -88,6 +89,13 @@ static struct drm_driver driver = { .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = udl_gem_prime_import, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE,drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +7
-0@@ -1426,6 +1426,13 @@ static struct drm_driver driver = { .prime_fd_to_handle = vmw_prime_fd_to_handle, .prime_handle_to_fd = vmw_prime_handle_to_fd, + .atomic_begin = drm_atomic_begin, + .atomic_set_event = drm_atomic_set_event, + .atomic_check = drm_atomic_check, + .atomic_commit = drm_atomic_commit, + .atomic_end = drm_atomic_end, + .atomic_funcs = &drm_atomic_funcs, + .fops = &vmwgfx_driver_fops, .name = VMWGFX_DRIVER_NAME, .desc = VMWGFX_DRIVER_DESC,drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +1
-0@@ -30,6 +30,7 @@#include "vmwgfx_reg.h" #include <drm/drmP.h> +#include <drm/drm_atomic.h> #include <drm/vmwgfx_drm.h> #include <drm/drm_hashtab.h> #include <linux/suspend.h> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3
-1@@ -2005,8 +2005,10 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, }int vmw_du_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val) +uint64_t val, +void *blob_data) {return 0 ; }drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +3
-1@@ -141,8 +141,10 @@ vmw_du_connector_detect(struct drm_connector *connector, bool force);int vmw_du_connector_fill_modes (struct drm_connector *connector,uint32_t max_width,uint32_t max_height);int vmw_du_connector_set_property (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, -uint64_t val); +uint64_t val, +void *blob_data);/* include/drm/drmP.h +80
-0@@ -946,6 +946,86 @@ struct drm_driver {struct drm_device *dev, uint32_t handle); +/* +* Atomic functions: +*/ + +/** +* atomic_begin - start a sequence of atomic updates +* @dev: DRM device +* @flags: the modifier flags that userspace has requested +* +* Begin a sequence of atomic property sets. Returns a driver +* private state object that is passed back into the various +* object's set_property() fxns, and into the remainder of the +* atomic funcs. The state object should accumulate the changes +* from one o more set_property()'s. At the end, the state can +* be checked, and optionally committed. +* +* RETURNS +* a driver state object, which is passed back in to the +* various other atomic fxns, or error (such as -EBUSY if +* there is still a pending async update) +*/ +struct drm_atomic_state *(*atomic_begin)(struct drm_device *dev,uint32_t flags); + +/** +* atomic_set_event - set a pending event on mode object +* @dev: DRM device +* @state: the driver state object +* @obj: the object to set the event on +* @event: the event to send back +* +* Set pending event for an update on the specified object. The +* event is to be sent back to userspace after the update completes. +*/ +int (*atomic_set_event)(struct drm_device *dev, +struct drm_atomic_state *state,struct drm_mode_object *obj, +struct drm_pending_vblank_event *event); + +/** +* atomic_check - validate state object +* @dev: DRM device +* @state: the driver state object +* +* Check the state object to see if the requested state is +* physically possible. +* +* RETURNS +* Zero for success or -errno +*/ +int (*atomic_check)(struct drm_device *dev, +struct drm_atomic_state *state); + +/** +* atomic_commit - commit state +* @dev: DRM device +* @state: the driver state object +* +* Commit the state. This will only be called if atomic_check() +* succeeds. +* +* RETURNS +* Zero for success or -errno +*/ +int (*atomic_commit)(struct drm_device *dev, +struct drm_atomic_state *state); + +/** +* atomic_end - conclude the atomic update +* @dev: DRM device +* @state: the driver state object + +* Release resources associated with the state object. +*/ +void (*atomic_end)(struct drm_device *dev, +struct drm_atomic_state *state); + +/** +* Funcs used by drm-atomic-helpers +*/ +const struct drm_atomic_funcs *atomic_funcs; +/* Driver private ops for this object */ const struct vm_operations_struct *gem_vm_ops;include/drm/drm_atomic.h new file +114
-0@@ -0,0 +1,114 @@ +/* +* Copyright (C) 2014 Red Hat +* Author: Rob Clark <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef DRM_ATOMIC_HELPER_H_ +#define DRM_ATOMIC_HELPER_H_ + +/** +* DOC: atomic state helpers +* +* Base helper atomic state and functions. Drivers are free to either +* use these as-is, extend them, or completely replace them, in order +* to implement the atomic KMS API. +* +* A naive driver, with no special constraints or hw support for atomic +* updates may simply add the following to their driver struct: +* +* .atomic_begin = drm_atomic_begin, +* .atomic_set_event = drm_atomic_set_event, +* .atomic_check = drm_atomic_check, +* .atomic_commit = drm_atomic_commit, +* .atomic_end = drm_atomic_end, +* .atomics = &drm_atomic_funcs, +* +* In addition, if you're plane/crtc doesn't already have it's own custom +* properties, then add to your plane/crtc_funcs: +* +* .set_property = drm_atomic_{plane,crtc}_set_property, +* +* Unlike the crtc helpers, it is intended that the atomic helpers can be +* used piecemeal by the drivers, either using all or overriding parts as +* needed. +* +* A driver which can have (for example) conflicting modes across multiple +* crtcs (for example, bandwidth limitations or clock/pll configuration +* restrictions), can simply wrap drm_atomic_check() with their own +* driver specific .atomic_check() function. +* +* A driver which can support true atomic updates can wrap +* drm_atomic_commit(). +* +* A driver with custom properties should override the appropriate get_state(), +* check_state(), and commit_state() functions in .atomics if it uses +* the drm-atomic-helpers. Otherwise it is free to use &drm_atomic_funcs +* as-is. +*/ + +/** +* struct drm_atomic_funcs - helper funcs used by the atomic helpers +*/ +struct drm_atomic_funcs { +int dummy;/* for now */ +}; + +const extern struct drm_atomic_funcs drm_atomic_funcs; + +struct drm_atomic_state *drm_atomic_begin (struct drm_device *dev, +uint32_t flags); +int drm_atomic_set_event (struct drm_device *dev, +struct drm_atomic_state *state,struct drm_mode_object *obj, +struct drm_pending_vblank_event *event); +int drm_atomic_check (struct drm_device *dev,struct drm_atomic_state *state); +int drm_atomic_commit (struct drm_device *dev,struct drm_atomic_state *state); +int drm_atomic_commit_unlocked (struct drm_device *dev, +struct drm_atomic_state *state); +void drm_atomic_end (struct drm_device *dev,struct drm_atomic_state *state); + +/** +* struct drm_atomic_state - the state object used by atomic helpers +*/ +struct drm_atomic_state { +struct kref refcount; +struct drm_device *dev; +uint32_t flags; + +bool committed; +bool checked;/* just for debugging */ + +struct drm_modeset_acquire_ctx acquire_ctx; +}; + +static inline void +drm_atomic_state_reference (struct drm_atomic_state *state) +{ +kref_get (&state->refcount); +} + +static inline void +drm_atomic_state_unreference (struct drm_atomic_state *state) +{ +void _drm_atomic_state_free (struct kref *kref); +kref_put (&state->refcount, _drm_atomic_state_free); +} + +#endif /* DRM_ATOMIC_HELPER_H_ */ include/drm/drm_crtc.h +11
-4@@ -219,6 +219,8 @@ struct drm_encoder;struct drm_pending_vblank_event ;struct drm_plane ;struct drm_bridge ; +struct drm_atomic_state ; +struct drm_atomic_funcs ;/** * drm_crtc_funcs - control CRTCs for a given device @@ -281,7 +283,9 @@ struct drm_crtc_funcs { uint32_t flags);int (*set_property)(struct drm_crtc *crtc, -struct drm_property *property,uint64_t val); +struct drm_atomic_state *state, +struct drm_property *property,uint64_t val, +void *blob_data); };/** @@ -399,8 +403,9 @@ struct drm_connector_funcs {enum drm_connector_status (*detect)(struct drm_connector *connector,bool force);int (*fill_modes)(struct drm_connector *connector,uint32_t max_width,uint32_t max_height); -int (*set_property)(struct drm_connector *connector,struct drm_property *property, -uint64_t val); +int (*set_property)(struct drm_connector *connector, +struct drm_atomic_state *state, +struct drm_property *property,uint64_t val,void *blob_data);void (*destroy)(struct drm_connector *connector);void (*force)(struct drm_connector *connector); };@@ -574,7 +579,9 @@ struct drm_plane_funcs {void (*destroy)(struct drm_plane *plane);int (*set_property)(struct drm_plane *plane, -struct drm_property *property,uint64_t val); +struct drm_atomic_state *state, +struct drm_property *property,uint64_t val, +void *blob_data); };enum drm_plane_type {include/drm/drm_modeset_lock.h +47
-0@@ -32,6 +32,9 @@ struct drm_modeset_lock;* drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx) * @ww_ctx: base acquire ctx * @contended: used internally for -EDEADLK handling +* @nolock: bypass locking (for emergencies) +* @nonblock: don't block +* @frozen: for debugging * @locked: list of held locks * * Each thread competing for a set of locks must use one acquire @@ -42,6 +45,16 @@ struct drm_modeset_acquire_ctx {struct ww_acquire_ctx ww_ctx; + bool nolock : 1; + bool nonblock : 1; + +/** +* Just for debugging, the context is 'frozen' in drm_atomic_check() +* to catch anyone who might be trying to acquire a lock after it is +* too late. +*/ + bool frozen : 1; +/** * Contended lock: if a lock is contended you should only call * drm_modeset_backoff() which drops locks and slow-locks the @@ -53,11 +66,23 @@ struct drm_modeset_acquire_ctx {* list of held locks (drm_modeset_lock) */ struct list_head locked; + +/* currently simply for protecting against 'locked' list manipulation +* between original thread calling atomic->end() and driver thread +* calling back drm_atomic_commit_unlocked(). +* +* Other spots are sufficiently synchronized by virtue of holding +* the lock's ww_mutex. But during the lock/resource hand-over to the +* driver thread (drop_locks()/grab_locks()), we cannot rely on this. +*/ +struct mutex mutex; };/** * drm_modeset_lock - used for locking modeset resources. * @mutex: resource locking +* @atomic_pending: is this resource part of a still-pending +* atomic update * @head: used to hold it's place on state->locked list when * part of an atomic update * @@ -70,16 +95,37 @@ struct drm_modeset_lock {struct ww_mutex mutex;/** +* Are we busy (pending asynchronous/NONBLOCK update)? Any further +* asynchronous update will return -EBUSY if it also needs to acquire +* this lock. While a synchronous update will block until the pending +* async update completes. +* +* Drivers must ensure the update is completed before sending vblank +* event to userspace. Typically this just means don't send event +* before drm_atomic_commit_unlocked() returns. +*/ +bool atomic_pending; + +/** * Resources that are locked as part of an atomic update are added * to a list (so we know what to unlock at the end). */ struct list_head head; + +/** +* For waiting on atomic_pending locks, if not a NONBLOCK operation. +*/ +wait_queue_head_t event; };extern struct ww_class crtc_ww_class; +#define DRM_MODESET_ACQUIRE_NOLOCK 0x0001 +#define DRM_MODESET_ACQUIRE_NONBLOCK 0x0002 +void drm_modeset_acquire_init (struct drm_modeset_acquire_ctx *ctx,uint32_t flags); +void __drm_modeset_acquire_fini (struct drm_modeset_acquire_ctx *ctx);void drm_modeset_acquire_fini (struct drm_modeset_acquire_ctx *ctx);void drm_modeset_drop_locks (struct drm_modeset_acquire_ctx *ctx);void drm_modeset_backoff (struct drm_modeset_acquire_ctx *ctx);@@ -93,6 +139,7 @@ static inline void drm_modeset_lock_init(struct drm_modeset_lock *lock) {ww_mutex_init (&lock->mutex, &crtc_ww_class);INIT_LIST_HEAD (&lock->head); +init_waitqueue_head (&lock->event); }/** include/uapi/drm/drm_mode.h +3
-0@@ -512,4 +512,7 @@ struct drm_mode_destroy_dumb { uint32_t handle; }; +#define DRM_MODE_ATOMIC_NONBLOCK 0x0200 +#define DRM_MODE_ATOMIC_NOLOCK 0x8000/* only used internally */ +#endif Signature · 1 line
1.9.3
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 1/7] drm: add atomic fxns
Quoted 29 lines · Daniel Vetter
Quoted 17 lines · Rob Clark
The 'atomic' mechanism allows for multiple properties to be updated, checked, and commited atomically. This will be the basis of atomic- modeset and nuclear-pageflip.
The basic flow is:
state = dev->atomic_begin(); for (... one or more ...) obj->set_property(obj, state, prop, value); if (dev->atomic_check(state)) dev->atomic_commit(state); dev->atomic_end(state);The split of check and commit steps is to allow for ioctls with a test-only flag (which would skip the commit step).
Signed-off-by Rob Clark <[email protected]>[snip]
drivers/gpu/drm/drm_atomic.c line 65
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c new file +4
-0+if (flags &DRM_MODE_ATOMIC_NOLOCK ) + acquire_flags |=DRM_MODESET_ACQUIRE_NOLOCK ; +if (flags &DRM_MODE_ATOMIC_NONBLOCK ) + acquire_flags |=DRM_MODESET_ACQUIRE_NONBLOCK ;Just a very quick reply. Can you please remove the code which does the NOLOCK/NONBLOCK stuff here? It's not really part of the property conversion and I'm still not sold on those concepts.
Quoted 3 lines
At least I want to review them once we add them, maybe at the very end where everything else is clear. Afaics nothing in this series actually uses this.
Self-correct: NOLOCK is used for the fbdev restore code. Imo we should drop the modeset_lock_all this one uses and switch to using the atomic locking scheme like everywhere. That way fbdev modeset changes work exactly like any other modeset change.
fbdev state itself can be protected with dev->mode_config.mutex, which wraps around all the ww_mutex dancing.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 1/7] drm: add atomic fxns
In reply to Rob ClarkQuoted 82 lines · Rob Clark
The 'atomic' mechanism allows for multiple properties to be updated, checked, and commited atomically. This will be the basis of atomic- modeset and nuclear-pageflip.
The basic flow is:
state = dev->atomic_begin(); for (... one or more ...) obj->set_property(obj, state, prop, value); if (dev->atomic_check(state)) dev->atomic_commit(state); dev->atomic_end(state);The split of check and commit steps is to allow for ioctls with a test-only flag (which would skip the commit step).
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 3 +- drivers/gpu/drm/armada/armada_output.c | 3 +- drivers/gpu/drm/armada/armada_overlay.c | 3 +- drivers/gpu/drm/ast/ast_drv.c | 6 + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 6 + drivers/gpu/drm/cirrus/cirrus_drv.h | 1 + drivers/gpu/drm/drm_atomic.c | 274 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc.c | 149 +++++++++------ drivers/gpu/drm/drm_modeset_lock.c | 28 +++ drivers/gpu/drm/exynos/exynos_drm_crtc.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 7 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_crt.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_dp.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 4 +- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 4 +- drivers/gpu/drm/gma500/psb_drv.c | 7 + drivers/gpu/drm/gma500/psb_drv.h | 1 + drivers/gpu/drm/gma500/psb_intel_drv.h | 4 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 4 +- drivers/gpu/drm/gma500/psb_intel_sdvo.c | 4 +- drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/intel_crt.c | 4 +- drivers/gpu/drm/i915/intel_dp.c | 4 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 4 +- drivers/gpu/drm/i915/intel_lvds.c | 4 +- drivers/gpu/drm/i915/intel_sdvo.c | 4 +- drivers/gpu/drm/i915/intel_tv.c | 6 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 7 + drivers/gpu/drm/mgag200/mgag200_drv.h | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 3 +- drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 3 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 3 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 3 +- drivers/gpu/drm/msm/msm_drv.c | 6 + drivers/gpu/drm/msm/msm_drv.h | 1 + drivers/gpu/drm/nouveau/dispnv04/overlay.c | 5 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 7 + drivers/gpu/drm/nouveau/nouveau_drm.h | 1 + drivers/gpu/drm/omapdrm/omap_crtc.c | 6 +- drivers/gpu/drm/omapdrm/omap_drv.c | 6 + drivers/gpu/drm/omapdrm/omap_drv.h | 4 +- drivers/gpu/drm/omapdrm/omap_plane.c | 3 +- drivers/gpu/drm/qxl/qxl_display.c | 4 +- drivers/gpu/drm/qxl/qxl_drv.c | 9 + drivers/gpu/drm/radeon/radeon_connectors.c | 9 +- drivers/gpu/drm/radeon/radeon_drv.c | 9 + drivers/gpu/drm/rcar-du/rcar_du_drv.c | 7 + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 +- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 7 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 + drivers/gpu/drm/tilcdc/tilcdc_drv.h | 1 + drivers/gpu/drm/tilcdc/tilcdc_slave.c | 3 +- drivers/gpu/drm/udl/udl_connector.c | 6 +- drivers/gpu/drm/udl/udl_drv.c | 8 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 +-
Quoted 8 lines
include/drm/drmP.h | 80 ++++++++ include/drm/drm_atomic.h | 114 ++++++++++++ include/drm/drm_crtc.h | 15 +- include/drm/drm_modeset_lock.h | 47 +++++ include/uapi/drm/drm_mode.h | 3 + 69 files changed, 873 insertions(+), 103 deletions(-) create mode 100644 drivers/gpu/drm/drm_atomic.c create mode 100644 include/drm/drm_atomic.h
The above list seems to include only drivers that actually implement properties. But that also means that none of the .atomic_* functions will get set for drivers that lack properties. I'm wondering if that isn't going to cause problems later on. What's the effect of not providing .atomic_*() implementations?
Also for the drivers that are modified in this patch the only change seems to be the addition of a new parameter to .set_property(), but that alone surely isn't enough to implement atomic modesetting, right?
So I guess my question is: wouldn't it be more useful to consistently set .atomic_* for all drivers? Even if they don't provide any custom properties they'll get some of the standard ones.
Quoted 1 line
drivers/gpu/drm/drm_atomic.c +0
-0
[...]
Quoted 13 lines
+/**
+ *drm_atomic_begin- start a sequence of atomic updates
+ * @dev: DRM device
+ * @flags: the modifier flags that userspace has requested
+ *
+ * Begin a sequence of atomic property sets. Returns a driver
+ * private state object that is passed back into the various
+ * object'sset_property()fxns, and into the remainder of the
+ * atomic funcs. The state object should accumulate the changes
+ * from one o more set_property()'s. At the end, the state can
+ * be checked, and optionally committed.
+ *
+ * RETURNS
Quoted 4 lines
+ * a driver state object, which is passed back in to the + * various other atomic fxns, or error (such as -EBUSY if + * there is still a pending async update)+ */
This section should be "Return: a driver state object ..." according to Documentation/kernel-doc-nano-HOWTO.txt.
drivers/gpu/drm/drm_atomic.c line 46
Quoted 2 lines
drivers/gpu/drm/drm_atomic.c +2
-0+struct drm_atomic_state *drm_atomic_begin (struct drm_device *dev, +uint32_t flags)
Nit: I think we usually try to align arguments on subsequent lines with the first argument on the first line.
drivers/gpu/drm/drm_atomic.c line 55
Quoted 9 lines
drivers/gpu/drm/drm_atomic.c +9
-0+{ +struct drm_atomic_state *state; +uint32_t acquire_flags =0 ; +int sz; +void *ptr; + + sz =sizeof (*state); + + ptr =kzalloc (sz,GFP_KERNEL );
Shouldn't this error out on ptr == NULL?
drivers/gpu/drm/drm_atomic.c line 58
Quoted 3 lines
drivers/gpu/drm/drm_atomic.c +3
-0+ + state = ptr; + ptr = &state[1 ];
I'm not exactly sure what this is doing. ptr doesn't seem to be used anymore, so the last assignment becomes unnecessary. It also seems wrong since ptr now points to unallocated memory.
And if that assignment is removed, then state = ptr isn't necessary either anymore, since you could simply do:
state = kzalloc(sz, GFP_KERNEL);
But maybe I'm missing something?
drivers/gpu/drm/drm_atomic.c line 140
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +10
-0+static void grab_locks (struct drm_atomic_state *a, +struct ww_acquire_ctx *ww_ctx) +{ +struct drm_modeset_acquire_ctx *ctx = &a->acquire_ctx; +struct drm_modeset_lock *lock, *slow_locked, *contended; +int ret; + + lock = slow_locked = contended =NULL ; + +
There's a gratuituous newline here.
Quoted 8 lines
drivers/gpu/drm/drm_atomic.c +8
-0+static void commit_locks (struct drm_atomic_state *a, +struct ww_acquire_ctx *ww_ctx) +{ +/* and properly release them (clear in_atomic, remove from list): */ +drm_modeset_drop_locks (&a->acquire_ctx); +ww_acquire_fini (ww_ctx); + a->committed = true; +}
drivers/gpu/drm/drm_atomic.c line 201
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +10
-0+ +static int atomic_commit (struct drm_atomic_state *a, +struct ww_acquire_ctx *ww_ctx) +{ +int ret =0 ; + +commit_locks (a, ww_ctx); + +return ret; +}
These look somewhat unnecessary, but I suspect that subsequent patches will flesh them out.
Quoted 8 lines
drivers/gpu/drm/drm_atomic.c +8
-0+void _drm_atomic_state_free (struct kref *kref) +{ +struct drm_atomic_state *a = + container_of(kref, struct drm_atomic_state, refcount); + +/* in case we haven't already: */ +if (!a->committed) { +grab_locks (a, &a->acquire_ctx.ww_ctx);
drivers/gpu/drm/drm_atomic.c line 271
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +10
-0+commit_locks (a, &a->acquire_ctx.ww_ctx); + } + +__drm_modeset_acquire_fini (&a->acquire_ctx); + +kfree (a); +} +EXPORT_SYMBOL (_drm_atomic_state_free); + +
There's another gratuituous blank line above.
Quoted 1 line
drivers/gpu/drm/drm_crtc.c +0
-0
[...]
Quoted 11 lines
drivers/gpu/drm/drm_crtc.c +3
-4-static int drm_mode_connector_set_obj_prop (struct drm_mode_object *obj, -struct drm_property *property, -uint64_t value) +static int drm_mode_connector_set_obj_prop (struct drm_connector *connector, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t value,void *blob_data) {int ret = -EINVAL ; -struct drm_connector *connector =obj_to_connector (obj);/* Do DPMS ourselves */
drivers/gpu/drm/drm_crtc.c int drm_mode_connector_property_set_ioctl(struct drm_device *dev, · line 4074
Quoted 10 lines
drivers/gpu/drm/drm_crtc.c +4
-2if (property == connector->dev->mode_config.dpms_property) {if (connector->funcs->dpms) (*connector->funcs->dpms)(connector, (int )value); ret =0 ; - }else if (connector->funcs->set_property) - ret = connector->funcs->set_property (connector, property, value); + }else if (connector->funcs->set_property) { + ret = connector->funcs->set_property (connector, state, + property, value, blob_data); + }
Why the extra braces here? There's still only one statement in the block.
Quoted 6 lines
/**
- *drm_mode_getproperty_ioctl- get the current value of a object's property
+ *drm_mode_obj_get_properties_ioctl- get the current value of a object's property
* @dev: DRM device
* @data: ioctl data
* @file_priv: DRM file info
This isn't really introduced by this patch, but isn't this kerneldoc comment wrong? drm_mode_obj_get_properties_ioctl() seems to return the values of all properties of an object rather than just one.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm: add atomic fxns
Hi,
Quoted 12 lines
drivers/gpu/drm/drm_crtc.c int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
Quoted 11 lines
{
drivers/gpu/drm/drm_crtc.c +0
-3int ret = -EINVAL ; -struct drm_connector *connector =obj_to_connector (obj);/* Do DPMS ourselves */ if (property == connector->dev->mode_config.dpms_property) {if (connector->funcs->dpms) (*connector->funcs->dpms)(connector, (int )value); ret =0 ; - }else if (connector->funcs->set_property) - ret = connector->funcs->set_property(connector, property,value);
Quoted 8 lines
drivers/gpu/drm/drm_crtc.c int drm_mode_connector_property_set_ioctl(struct drm_device *dev, · line 4074
Quoted 4 lines
drivers/gpu/drm/drm_crtc.c +4
-0+ }else if (connector->funcs->set_property) { + ret = connector->funcs->set_property (connector, state, + property, value, blob_data); + }Why the extra braces here? There's still only one statement in the block.
According to Documentation/kernel-doc-nano-HOWTO.txt, these extra braces are supposed to be present:
"
Chapter 3: Placing Braces and Spaces
[...]
Do not unnecessarily use braces where a single statement will do. [...]
This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:
if (condition) {
do_this();
do_that();
} else {
otherwise();
}"
Stéphane.
Quoted 15 lines
Quoted 2 lines
/**
- *drm_mode_getproperty_ioctl- get the current value of a object'sproperty
Quoted 1 line
+ *
drm_mode_obj_get_properties_ioctl- get the current value of aobject's property
Quoted 3 lines
* @dev: DRM device
* @data: ioctl data
* @file_priv: DRM file infoThis isn't really introduced by this patch, but isn't this kerneldoc comment wrong?
drm_mode_obj_get_properties_ioctl()seems to return the values of all properties of an object rather than just one.Thierry
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
PATCH 2/7 drm: split propvals out and blob property support
In reply to Rob ClarkSplit property values out into a different struct, so we can later move property values into state structs. This will allow the property values to stay in sync w/ the state updates which are either discarded or atomically committed.
And since we are touching all the same code, add support for mutable blob properties, which will also be needed for atomic modeset.
--- drivers/gpu/drm/drm_crtc.c | 78 +++++++++++++++++++++-------- drivers/gpu/drm/drm_fb_helper.c | 3 +- drivers/gpu/drm/gma500/cdv_intel_dp.c | 3 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 3 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 6 ++- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 8 +-- drivers/gpu/drm/gma500/psb_intel_lvds.c | 6 ++- drivers/gpu/drm/gma500/psb_intel_sdvo.c | 19 +++++-- drivers/gpu/drm/i2c/ch7006_drv.c | 4 +- drivers/gpu/drm/i915/intel_display.c | 3 +- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_hdmi.c | 3 +- drivers/gpu/drm/i915/intel_sdvo.c | 19 +++++-- drivers/gpu/drm/i915/intel_tv.c | 6 ++- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 3 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 4 +- drivers/gpu/drm/omapdrm/omap_drv.c | 6 ++- drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 3 +- drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 3 +- drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 4 +- include/drm/drm_crtc.h | 11 +++- 21 files changed, 142 insertions(+), 56 deletions(-)
drivers/gpu/drm/drm_crtc.c +58 -20
@@ -141,6 +141,14 @@ void drm_warn_on_modeset_not_all_locked(struct drm_device *dev) }EXPORT_SYMBOL (drm_warn_on_modeset_not_all_locked); +static int drm_mode_set_obj_prop (struct drm_device *dev, +struct drm_mode_object *obj,struct drm_atomic_state *state, +struct drm_property *property,uint64_t value,void *blob_data); +static struct drm_property_blob *drm_property_create_blob (struct drm_device *dev, +int length,void *data); +static void drm_property_destroy_blob (struct drm_device *dev, +struct drm_property_blob *blob); +/* Avoid boilerplate. I'm tired of typing. */ #define DRM_ENUM_NAME_FN (fnname, list) \ const char *fnname(int val) \
@@ -748,6 +756,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, goto out; crtc->base.properties = &crtc->properties; + crtc->base.propvals = &crtc->propvals;list_add_tail (&crtc->head, &config->crtc_list); config->num_crtc++;
@@ -855,6 +864,7 @@ int drm_connector_init(struct drm_device *dev, goto out_unlock; connector->base.properties = &connector->properties; + connector->base.propvals = &connector->propvals; connector->dev = dev; connector->funcs = funcs; connector->connector_type = connector_type;
@@ -1143,6 +1153,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, goto out; plane->base.properties = &plane->properties; + plane->base.propvals = &plane->propvals; plane->dev = dev; plane->funcs = funcs; plane->format_types = kmalloc(sizeof(uint32_t) * format_count,
@@ -1978,7 +1989,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, goto out; } -if (put_user (connector->properties.values[i], +if (put_user (connector->propvals.values[i], prop_values + copied)) { ret = -EFAULT ; goto out;
@@ -3655,7 +3666,7 @@ void drm_object_attach_property(struct drm_mode_object *obj, } obj->properties->ids[count] = property->base.id; - obj->properties->values[count] = init_val; + obj->propvals->values[count] = init_val; obj->properties->count++; }EXPORT_SYMBOL (drm_object_attach_property);
@@ -3674,13 +3685,27 @@ EXPORT_SYMBOL(drm_object_attach_property);* Zero on success, error code on failure. */ int drm_object_property_set_value (struct drm_mode_object *obj, -struct drm_property *property,uint64_t val) +struct drm_object_property_values *propvals, +struct drm_property *property,uint64_t val, +void *blob_data) {int i;for (i =0 ; i < obj->properties->count; i++) {if (obj->properties->ids[i] == property->base.id) { - obj->properties->values[i] = val; +struct drm_device *dev = property->dev; +if (property->flags &DRM_MODE_PROP_BLOB ) { +struct drm_property_blob *blob, *old_blob =NULL ; + old_blob =drm_property_blob_find (dev, propvals->values[i]); + blob =drm_property_create_blob (dev, val, blob_data); +if (!blob) +return -ENOMEM ; + propvals->values[i] = blob->base.id; +if (old_blob) +drm_property_destroy_blob (dev, old_blob); + }else { + propvals->values[i] = val; + }return 0 ; } }
@@ -3710,7 +3735,7 @@ int drm_object_property_get_value(struct drm_mode_object *obj,for (i =0 ; i < obj->properties->count; i++) {if (obj->properties->ids[i] == property->base.id) { - *val = obj->properties->values[i]; + *val = obj->propvals->values[i];return 0 ; } }
@@ -3929,8 +3954,9 @@ int drm_mode_connector_set_path_property(struct drm_connector *connector,return -EINVAL ; ret =drm_object_property_set_value (&connector->base, + &connector->propvals, dev->mode_config.path_property, - connector->path_blob_ptr->base.id); + connector->path_blob_ptr->base.id,NULL );return ret; }EXPORT_SYMBOL (drm_mode_connector_set_path_property);
@@ -3950,7 +3976,9 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, struct edid *edid) {struct drm_device *dev = connector->dev; -int ret, size; +struct drm_mode_object *obj = &connector->base; +struct drm_property *edid_prop = dev->mode_config.edid_property; +int i, ret, size;/* ignore requests to set edid when overridden */ if (connector->override_edid)
@@ -3961,20 +3989,26 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,/* Delete edid, when there is none. */ if (!edid) { - connector->edid_blob_ptr =NULL ; - ret =drm_object_property_set_value (&connector->base, dev->mode_config.edid_property,0 ); + ret =drm_object_property_set_value (obj, + &connector->propvals, edid_prop,0 ,NULL );return ret; } size =EDID_LENGTH * (1 + edid->extensions); - connector->edid_blob_ptr =drm_property_create_blob (connector->dev, - size, edid); -if (!connector->edid_blob_ptr) -return -EINVAL ; - ret =drm_object_property_set_value (&connector->base, - dev->mode_config.edid_property, - connector->edid_blob_ptr->base.id); + ret =drm_object_property_set_value (obj, + &connector->propvals, edid_prop, size, edid); +if (ret) +return ret; + +/* find the blob object created for us by drm_object_property_set_value(): */ +for (i =0 ; i < obj->properties->count; i++) { +if (obj->properties->ids[i] == edid_prop->base.id) { + connector->edid_blob_ptr =drm_property_blob_find (dev, + connector->propvals.values[i]); +break ; + } + }return ret; }
@@ -4075,7 +4109,9 @@ static int drm_mode_connector_set_obj_prop(struct drm_connector *connector,/* store the property value if successful */ if (!ret) -drm_object_property_set_value (&connector->base, property, value); +drm_object_property_set_value (&connector->base, + &connector->propvals, property, value, blob_data); +return ret; }
@@ -4089,7 +4125,8 @@ static int drm_mode_crtc_set_obj_prop(struct drm_crtc *crtc, ret = crtc->funcs->set_property (crtc, state, property, value, blob_data);if (!ret) -drm_object_property_set_value (&crtc->base, property, value); +drm_object_property_set_value (&crtc->base, &crtc->propvals, + property, value,NULL );return ret; }
@@ -4104,7 +4141,8 @@ static int drm_mode_plane_set_obj_prop(struct drm_plane *plane, ret = plane->funcs->set_property (plane, state, property, value, blob_data);if (!ret) -drm_object_property_set_value (&plane->base, property, value); +drm_object_property_set_value (&plane->base, &plane->propvals, + property, value,NULL );return ret; }
@@ -4218,7 +4256,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, ret = -EFAULT ; goto out; } -if (put_user (obj->properties->values[i], +if (put_user (obj->propvals->values[i], prop_values_ptr + copied)) { ret = -EFAULT ; goto out;
drivers/gpu/drm/drm_fb_helper.c +2 -1
@@ -539,7 +539,8 @@ static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode) connector = fb_helper->connector_info[j]->connector; connector->funcs->dpms (connector, dpms_mode);drm_object_property_set_value (&connector->base, - dev->mode_config.dpms_property, dpms_mode); + &connector->propvals, + dev->mode_config.dpms_property, dpms_mode,NULL ); } }drm_modeset_unlock_all (dev);
drivers/gpu/drm/gma500/cdv_intel_dp.c +2 -1
@@ -1655,7 +1655,8 @@ cdv_intel_dp_set_property(struct drm_connector *connector,struct cdv_intel_dp *intel_dp = encoder->dev_priv;int ret; - ret =drm_object_property_set_value (&connector->base, property, val); + ret =drm_object_property_set_value (&connector->base, + &connector->propvals, property, val, blob_data);if (ret)return ret;
drivers/gpu/drm/gma500/cdv_intel_hdmi.c +2 -1
@@ -184,7 +184,8 @@ static int cdv_hdmi_set_property(struct drm_connector *connector,return 0 ;if (drm_object_property_set_value (&connector->base, - property, value)) + &connector->propvals, + property, value, blob_data))return -1 ; centre = (curValue == DRM_MODE_SCALE_NO_SCALE) ||
drivers/gpu/drm/gma500/cdv_intel_lvds.c +4 -2
@@ -486,8 +486,9 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector,return 0 ;if (drm_object_property_set_value (&connector->base, + &connector->propvals, property, - value)) + value, blob_data))return -1 ; if (crtc->saved_mode.hdisplay != 0 &&
@@ -501,8 +502,9 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector, } }else if (!strcmp (property->name,"backlight" ) && encoder) {if (drm_object_property_set_value (&connector->base, + &connector->propvals, property, - value)) + value, blob_data))return -1 ;else gma_backlight_set (encoder->dev, value);
drivers/gpu/drm/gma500/mdfld_dsi_output.c +5 -3
@@ -276,7 +276,8 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector, goto set_prop_done;if (drm_object_property_set_value (&connector->base, - property, value)) + &connector->propvals, + property, value, blob_data)) goto set_prop_error; centerechange = (val == DRM_MODE_SCALE_NO_SCALE) ||
@@ -300,8 +301,9 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector, } } }else if (!strcmp (property->name,"backlight" ) && encoder) { -if (drm_object_property_set_value (&connector->base, property, - value)) +if (drm_object_property_set_value (&connector->base, + &connector->propvals, + property, value, blob_data)) goto set_prop_error;else gma_backlight_set (encoder->dev, value);
drivers/gpu/drm/gma500/psb_intel_lvds.c +4 -2
@@ -606,8 +606,9 @@ int psb_intel_lvds_set_property(struct drm_connector *connector, goto set_prop_done;if (drm_object_property_set_value (&connector->base, + &connector->propvals, property, - value)) + value, blob_data)) goto set_prop_error; if (crtc->saved_mode.hdisplay != 0 &&
@@ -621,8 +622,9 @@ int psb_intel_lvds_set_property(struct drm_connector *connector, } }else if (!strcmp (property->name,"backlight" )) {if (drm_object_property_set_value (&connector->base, + &connector->propvals, property, - value)) + value, blob_data)) goto set_prop_error;else gma_backlight_set (encoder->dev, value);
drivers/gpu/drm/gma500/psb_intel_sdvo.c +14 -5
@@ -1717,7 +1717,8 @@ psb_intel_sdvo_set_property(struct drm_connector *connector,uint8_t cmd;int ret; - ret =drm_object_property_set_value (&connector->base, property, val); + ret =drm_object_property_set_value (&connector->base, + &connector->propvals, property, val, blob_data);if (ret)return ret;
@@ -1773,7 +1774,9 @@ psb_intel_sdvo_set_property(struct drm_connector *connector, temp_value = val;if (psb_intel_sdvo_connector->left == property) {drm_object_property_set_value (&connector->base, - psb_intel_sdvo_connector->right, val); + &connector->propvals, + psb_intel_sdvo_connector->right, + val, blob_data);if (psb_intel_sdvo_connector->left_margin == temp_value)return 0 ;
@@ -1785,7 +1788,9 @@ psb_intel_sdvo_set_property(struct drm_connector *connector, goto set_value; }else if (psb_intel_sdvo_connector->right == property) {drm_object_property_set_value (&connector->base, - psb_intel_sdvo_connector->left, val); + &connector->propvals, + psb_intel_sdvo_connector->left, + val, blob_data);if (psb_intel_sdvo_connector->right_margin == temp_value)return 0 ;
@@ -1797,7 +1802,9 @@ psb_intel_sdvo_set_property(struct drm_connector *connector, goto set_value; }else if (psb_intel_sdvo_connector->top == property) {drm_object_property_set_value (&connector->base, - psb_intel_sdvo_connector->bottom, val); + &connector->propvals, + psb_intel_sdvo_connector->bottom, + val, blob_data);if (psb_intel_sdvo_connector->top_margin == temp_value)return 0 ;
@@ -1809,7 +1816,9 @@ psb_intel_sdvo_set_property(struct drm_connector *connector, goto set_value; }else if (psb_intel_sdvo_connector->bottom == property) {drm_object_property_set_value (&connector->base, - psb_intel_sdvo_connector->top, val); + &connector->propvals, + psb_intel_sdvo_connector->top, + val, blob_data);if (psb_intel_sdvo_connector->bottom_margin == temp_value)return 0 ;
drivers/gpu/drm/i2c/ch7006_drv.c +2 -2
@@ -214,9 +214,9 @@ static enum drm_connector_status ch7006_encoder_detect(struct drm_encoder *encodelse priv->subconnector = DRM_MODE_SUBCONNECTOR_Unknown; -drm_object_property_set_value (&connector->base, +drm_object_property_set_value (&connector->base, &connector->propvals, encoder->dev->mode_config.tv_subconnector_property, - priv->subconnector); + priv->subconnector,NULL );return priv->subconnector ? connector_status_connected : connector_status_disconnected;
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -10285,8 +10285,9 @@ intel_modeset_update_state(struct drm_device *dev, unsigned prepare_pipes) connector->dpms =DRM_MODE_DPMS_ON ;drm_object_property_set_value (&connector->base, + &connector->propvals, dpms_property, -DRM_MODE_DPMS_ON ); +DRM_MODE_DPMS_ON ,NULL ); intel_encoder =to_intel_encoder (connector->encoder); intel_encoder->connectors_active = true;
drivers/gpu/drm/i915/intel_dp.c +2 -1
@@ -3730,7 +3730,8 @@ intel_dp_set_property(struct drm_connector *connector,struct intel_dp *intel_dp =enc_to_intel_dp (&intel_encoder->base);int ret; - ret =drm_object_property_set_value (&connector->base, property, val); + ret =drm_object_property_set_value (&connector->base, + &connector->propvals, property, val, blob_data);if (ret)return ret;
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
@@ -1074,7 +1074,8 @@ intel_hdmi_set_property(struct drm_connector *connector,struct drm_i915_private *dev_priv = connector->dev->dev_private;int ret; - ret =drm_object_property_set_value (&connector->base, property, val); + ret =drm_object_property_set_value (&connector->base, + &connector->propvals, property, val, blob_data);if (ret)return ret;
drivers/gpu/drm/i915/intel_sdvo.c +14 -5
@@ -2077,7 +2077,8 @@ intel_sdvo_set_property(struct drm_connector *connector,uint8_t cmd;int ret; - ret =drm_object_property_set_value (&connector->base, property, val); + ret =drm_object_property_set_value (&connector->base, + &connector->propvals, property, val, blob_data);if (ret)return ret;
@@ -2154,7 +2155,9 @@ intel_sdvo_set_property(struct drm_connector *connector, temp_value = val;if (intel_sdvo_connector->left == property) {drm_object_property_set_value (&connector->base, - intel_sdvo_connector->right, val); + &connector->propvals, + intel_sdvo_connector->right, + val, blob_data);if (intel_sdvo_connector->left_margin == temp_value)return 0 ;
@@ -2166,7 +2169,9 @@ intel_sdvo_set_property(struct drm_connector *connector, goto set_value; }else if (intel_sdvo_connector->right == property) {drm_object_property_set_value (&connector->base, - intel_sdvo_connector->left, val); + &connector->propvals, + intel_sdvo_connector->left, + val, blob_data);if (intel_sdvo_connector->right_margin == temp_value)return 0 ;
@@ -2178,7 +2183,9 @@ intel_sdvo_set_property(struct drm_connector *connector, goto set_value; }else if (intel_sdvo_connector->top == property) {drm_object_property_set_value (&connector->base, - intel_sdvo_connector->bottom, val); + &connector->propvals, + intel_sdvo_connector->bottom, + val, blob_data);if (intel_sdvo_connector->top_margin == temp_value)return 0 ;
@@ -2190,7 +2197,9 @@ intel_sdvo_set_property(struct drm_connector *connector, goto set_value; }else if (intel_sdvo_connector->bottom == property) {drm_object_property_set_value (&connector->base, - intel_sdvo_connector->top, val); + &connector->propvals, + intel_sdvo_connector->top, + val, blob_data);if (intel_sdvo_connector->bottom_margin == temp_value)return 0 ;
drivers/gpu/drm/i915/intel_tv.c +4 -2
@@ -1297,7 +1297,8 @@ static void intel_tv_find_better_format(struct drm_connector *connector) intel_tv->tv_format = tv_mode->name;drm_object_property_set_value (&connector->base, - connector->dev->mode_config.tv_mode_property, i); + &connector->propvals, + connector->dev->mode_config.tv_mode_property, i,NULL ); }/**
@@ -1456,7 +1457,8 @@ intel_tv_set_property(struct drm_connector *connector,int ret =0 ;bool changed = false; - ret =drm_object_property_set_value (&connector->base, property, val); + ret =drm_object_property_set_value (&connector->base, + &connector->propvals, property, val, blob_data);if (ret <0 ) goto out;
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +2 -1
@@ -196,8 +196,9 @@ nv17_tv_detect(struct drm_encoder *encoder, struct drm_connector *connector) }drm_object_property_set_value (&connector->base, + &connector->propvals, conf->tv_subconnector_property, - tv_enc->subconnector); + tv_enc->subconnector,NULL );if (!reliable) {return connector_status_unknown;
drivers/gpu/drm/nouveau/nouveau_connector.c +3 -1
@@ -229,10 +229,12 @@ nouveau_connector_set_encoder(struct drm_connector *connector,if (nv_connector->type ==DCB_CONNECTOR_DVI_I ) {drm_object_property_set_value (&connector->base, + &connector->propvals, dev->mode_config.dvi_i_subconnector_property, nv_encoder->dcb->type ==DCB_OUTPUT_TMDS ?DRM_MODE_SUBCONNECTOR_DVID : -DRM_MODE_SUBCONNECTOR_DVIA ); +DRM_MODE_SUBCONNECTOR_DVIA , +NULL ); } }
drivers/gpu/drm/omapdrm/omap_drv.c +4 -2
@@ -579,12 +579,14 @@ static void dev_lastclose(struct drm_device *dev)*/ for (i =0 ; i < priv->num_crtcs; i++) {drm_object_property_set_value (&priv->crtcs[i]->base, - priv->rotation_prop,0 ); + &priv->crtcs[i]->propvals, + priv->rotation_prop,0 ,NULL ); }for (i =0 ; i < priv->num_planes; i++) {drm_object_property_set_value (&priv->planes[i]->base, - priv->rotation_prop,0 ); + &priv->planes[i]->propvals, + priv->rotation_prop,0 ,NULL ); } }
drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c +2 -1
@@ -111,7 +111,8 @@ int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF );drm_object_property_set_value (&connector->base, - rcdu->ddev->mode_config.dpms_property,DRM_MODE_DPMS_OFF ); + &connector->propvals, + rcdu->ddev->mode_config.dpms_property,DRM_MODE_DPMS_OFF ,NULL ); ret =drm_mode_connector_attach_encoder (connector, &renc->encoder);if (ret <0 )
drivers/gpu/drm/rcar-du/rcar_du_vgacon.c +2 -1
@@ -76,7 +76,8 @@ int rcar_du_vga_connector_init(struct rcar_du_device *rcdu,drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF );drm_object_property_set_value (&connector->base, - rcdu->ddev->mode_config.dpms_property,DRM_MODE_DPMS_OFF ); + &connector->propvals, + rcdu->ddev->mode_config.dpms_property,DRM_MODE_DPMS_OFF ,NULL ); ret =drm_mode_connector_attach_encoder (connector, &renc->encoder);if (ret <0 )
drivers/gpu/drm/shmobile/shmob_drm_crtc.c +2 -2
@@ -741,8 +741,8 @@ int shmob_drm_connector_create(struct shmob_drm_device *sdev, connector->encoder = encoder;drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); -drm_object_property_set_value (&connector->base, - sdev->ddev->mode_config.dpms_property,DRM_MODE_DPMS_OFF ); +drm_object_property_set_value (&connector->base, &connector->propvals, + sdev->ddev->mode_config.dpms_property,DRM_MODE_DPMS_OFF ,NULL );return 0 ;
include/drm/drm_crtc.h +10 -1
@@ -41,6 +41,7 @@ struct drm_framebuffer;struct drm_object_properties ;struct drm_file ;struct drm_clip_rect ; +struct drm_object_property_values ;#define DRM_MODE_OBJECT_CRTC 0xcccccccc#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
@@ -57,12 +58,16 @@ struct drm_mode_object {uint32_t id;uint32_t type;struct drm_object_properties *properties; +struct drm_object_property_values *propvals; };#define DRM_OBJECT_MAX_PROPERTY 24struct drm_object_properties {int count;uint32_t ids[DRM_OBJECT_MAX_PROPERTY ]; +}; + +struct drm_object_property_values {uint64_t values[DRM_OBJECT_MAX_PROPERTY ]; };
@@ -369,6 +374,7 @@ struct drm_crtc {void *helper_private;struct drm_object_properties properties; +struct drm_object_property_values propvals; };
@@ -532,6 +538,7 @@ struct drm_connector {struct drm_property_blob *edid_blob_ptr;struct drm_object_properties properties; +struct drm_object_property_values propvals;struct drm_property_blob *path_blob_ptr;
@@ -620,6 +627,7 @@ struct drm_plane {const struct drm_plane_funcs *funcs;struct drm_object_properties properties; +struct drm_object_property_values propvals;enum drm_plane_type type; };
@@ -988,8 +996,9 @@ static inline bool drm_property_type_valid(struct drm_property *property) }extern int drm_object_property_set_value (struct drm_mode_object *obj, +struct drm_object_property_values *propvals,struct drm_property *property, -uint64_t val); +uint64_t val,void *blob_data);extern int drm_object_property_get_value (struct drm_mode_object *obj,struct drm_property *property,uint64_t *value);
Signature · 1 line
1.9.3
PATCH 3/7 drm: Refactor object property check code
In reply to Rob ClarkFrom: Ville Syrjälä <[email protected]>
Refactor the code to check whether an object has a specific property to a new function.
v1: original
v2: rebase on atomic -- Rob Clark
v3: EINVAL->ENOENT
--- drivers/gpu/drm/drm_crtc.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_crtc.c +14 -11
@@ -4168,6 +4168,19 @@ static int drm_mode_set_obj_prop(struct drm_device *dev,return -EINVAL ; } +static bool object_has_prop (const struct drm_mode_object *obj,u32 prop_id) +{ +int i; + +if (!obj->properties) +return false; + +for (i =0 ; i < obj->properties->count; i++) +if (obj->properties->ids[i] == prop_id) +return true; +return false; +} +/* call with mode_config mutex held */ static int drm_mode_set_obj_prop_id(struct drm_device *dev, struct drm_atomic_state *state,
@@ -4176,20 +4189,10 @@ static int drm_mode_set_obj_prop_id(struct drm_device *dev, {struct drm_mode_object *arg_obj;struct drm_property *property; -int i; arg_obj =drm_mode_object_find (dev, obj_id, obj_type); -if (!arg_obj) +if (!(arg_obj &&object_has_prop (arg_obj, prop_id)))return -ENOENT ; -if (!arg_obj->properties) -return -EINVAL ; - -for (i =0 ; i < arg_obj->properties->count; i++) -if (arg_obj->properties->ids[i] == prop_id) -break ; - -if (i == arg_obj->properties->count) -return -EINVAL ; property =drm_property_find (dev, prop_id);if (!property)
Signature · 6 lines
1.9.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/7 drm: convert plane to properties/state
In reply to Rob ClarkBreak the mutable state of a plane out into a separate structure and use atomic properties mechanism to set plane attributes. This makes it easier to have some helpers for plane->set_property() and for checking for invalid params. The idea is that individual drivers can wrap the state struct in their own struct which adds driver specific parameters, for easy build-up of state across multiple set_property() calls and for easy atomic commit or roll- back.
The same should be done for CRTC, encoder, and connector, but this patch only includes the first part (plane).
--- drivers/gpu/drm/armada/armada_overlay.c | 11 +- drivers/gpu/drm/drm_atomic.c | 235 +++++++++++++- drivers/gpu/drm/drm_crtc.c | 502 ++++++++++++++++++++--------- drivers/gpu/drm/drm_fb_helper.c | 30 +- drivers/gpu/drm/drm_plane_helper.c | 2 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 7 +- drivers/gpu/drm/i915/intel_sprite.c | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 6 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 6 +- drivers/gpu/drm/nouveau/dispnv04/overlay.c | 8 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_plane.c | 7 + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 8 +- drivers/gpu/drm/shmobile/shmob_drm_plane.c | 2 + include/drm/drm_atomic.h | 29 +- include/drm/drm_crtc.h | 112 ++++++- 16 files changed, 789 insertions(+), 179 deletions(-)
drivers/gpu/drm/armada/armada_overlay.c +10 -1
@@ -7,6 +7,7 @@* published by the Free Software Foundation. */ #include <drm/drmP.h> +#include <drm/drm_atomic.h> #include "armada_crtc.h" #include "armada_drm.h" #include "armada_fb.h"
@@ -288,7 +289,12 @@ static int armada_plane_set_property(struct drm_plane *plane, {struct armada_private *priv = plane->dev->dev_private;struct armada_plane *dplane =drm_to_armada_plane (plane); +struct drm_plane_state *pstate =drm_atomic_get_plane_state (plane, state);bool update_attr = false; +int ret =0 ; + +if (IS_ERR (pstate)) +return PTR_ERR (pstate);if (property == priv->colorkey_prop) {#define CCC (v) ((v) << 24 | (v) << 16 | (v) << 8)
@@ -342,13 +348,16 @@ static int armada_plane_set_property(struct drm_plane *plane, }else if (property == priv->saturation_prop) { dplane->prop.saturation = val; update_attr = true; + }else { + ret =drm_plane_set_property (plane, pstate, property, + val, blob_data); }if (update_attr && dplane->base.crtc)armada_ovl_update_attr (&dplane->prop,drm_to_armada_crtc (dplane->base.crtc)); -return 0 ; +return ret; }static const struct drm_plane_funcs armada_plane_funcs = {
drivers/gpu/drm/drm_atomic.c +233 -2
283 lines not on this page · raw message
drivers/gpu/drm/drm_crtc.c +348 -154
663 lines not on this page · raw message
drivers/gpu/drm/drm_fb_helper.c +20 -10
@@ -336,18 +336,33 @@ int drm_fb_helper_debug_leave(struct fb_info *info) }EXPORT_SYMBOL (drm_fb_helper_debug_leave); -static bool restore_fbdev_mode (struct drm_fb_helper *fb_helper) +static bool restore_fbdev_mode (struct drm_fb_helper *fb_helper, +bool lockless) {struct drm_device *dev = fb_helper->dev;struct drm_plane *plane;bool error = false; +void *state;int i; -drm_warn_on_modeset_not_all_locked (dev); + state = dev->driver->atomic_begin (dev, lockless ? +DRM_MODE_ATOMIC_NOLOCK :0 ); +if (IS_ERR (state)) { +DRM_ERROR ("failed to restore fbdev mode\n" ); +return true; + }list_for_each_entry (plane, &dev->mode_config.plane_list, head)if (plane->type !=DRM_PLANE_TYPE_PRIMARY ) -drm_plane_force_disable (plane); +drm_plane_force_disable (plane, state); + +/* just disabling stuff shouldn't fail, hopefully: */ +if (dev->driver->atomic_check (dev, state)) +DRM_ERROR ("failed to restore fbdev mode\n" ); +else + dev->driver->atomic_commit (dev, state); + + dev->driver->atomic_end (dev, state);for (i =0 ; i < fb_helper->crtc_count; i++) {struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;
@@ -379,7 +394,7 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)*/ static bool drm_fb_helper_restore_fbdev_mode (struct drm_fb_helper *fb_helper) { -return restore_fbdev_mode (fb_helper); +return restore_fbdev_mode (fb_helper, true); }/**
@@ -392,12 +407,7 @@ static bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)*/ bool drm_fb_helper_restore_fbdev_mode_unlocked (struct drm_fb_helper *fb_helper) { -struct drm_device *dev = fb_helper->dev; -bool ret; -drm_modeset_lock_all (dev); - ret =restore_fbdev_mode (fb_helper); -drm_modeset_unlock_all (dev); -return ret; +return restore_fbdev_mode (fb_helper, false); }EXPORT_SYMBOL (drm_fb_helper_restore_fbdev_mode_unlocked);
drivers/gpu/drm/drm_plane_helper.c +2 -0
@@ -28,6 +28,7 @@#include <drm/drm_plane_helper.h> #include <drm/drm_rect.h> #include <drm/drm_plane_helper.h> +#include <drm/drm_atomic.h> #define SUBPIXEL_MASK 0xffff
@@ -301,6 +302,7 @@ EXPORT_SYMBOL(drm_primary_helper_destroy);const struct drm_plane_funcs drm_primary_helper_funcs = { .update_plane = drm_primary_helper_update, .disable_plane = drm_primary_helper_disable, + .set_property = drm_atomic_plane_set_property, .destroy = drm_primary_helper_destroy, };EXPORT_SYMBOL (drm_primary_helper_funcs);
drivers/gpu/drm/exynos/exynos_drm_plane.c +6 -1
@@ -10,6 +10,7 @@*/ #include <drm/drmP.h> +#include <drm/drm_atomic.h> #include <drm/exynos_drm.h> #include "exynos_drm_drv.h"
@@ -220,13 +221,17 @@ static int exynos_plane_set_property(struct drm_plane *plane,struct drm_device *dev = plane->dev;struct exynos_plane *exynos_plane =to_exynos_plane (plane);struct exynos_drm_private *dev_priv = dev->dev_private; +struct drm_plane_state *pstate =drm_atomic_get_plane_state (plane, state); + +if (IS_ERR (pstate)) +return PTR_ERR (pstate);if (property == dev_priv->plane_zpos_property) { exynos_plane->overlay.zpos = val;return 0 ; } -return -EINVAL ; +return drm_plane_set_property (plane, pstate, property, val, blob_data); }static struct drm_plane_funcs exynos_plane_funcs = {
drivers/gpu/drm/i915/intel_sprite.c +1 -0
@@ -1203,6 +1203,7 @@ static const struct drm_plane_funcs intel_plane_funcs = { .update_plane = intel_update_plane, .disable_plane = intel_disable_plane, .destroy = intel_destroy_plane, + .set_property = drm_atomic_plane_set_property, };static uint32_t ilk_plane_formats[] = {
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +4 -2
@@ -88,8 +88,10 @@ int mdp4_plane_set_property(struct drm_plane *plane, struct drm_atomic_state *state, struct drm_property *property, uint64_t val, void *blob_data) { - // XXX - return -EINVAL; + struct drm_plane_state *pstate = drm_atomic_get_plane_state(plane, state); +if (IS_ERR (pstate)) +return PTR_ERR (pstate); +return drm_plane_set_property (plane, pstate, property, val, blob_data); } static const struct drm_plane_funcs mdp4_plane_funcs = {
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +4 -2
@@ -106,8 +106,10 @@ int mdp5_plane_set_property(struct drm_plane *plane, struct drm_atomic_state *state, struct drm_property *property, uint64_t val, void *blob_data) { - // XXX - return -EINVAL; + struct drm_plane_state *pstate = drm_atomic_get_plane_state(plane, state); +if (IS_ERR (pstate)) +return PTR_ERR (pstate); +return drm_plane_set_property (plane, pstate, property, val, blob_data); } static const struct drm_plane_funcs mdp5_plane_funcs = {
drivers/gpu/drm/nouveau/dispnv04/overlay.c +7 -1
@@ -24,6 +24,7 @@*/ #include <drm/drmP.h> +#include <drm/drm_atomic.h> #include <drm/drm_crtc.h> #include <drm/drm_fourcc.h>
@@ -226,6 +227,10 @@ nv_set_property(struct drm_plane *plane, uint64_t value, void *blob_data) { struct nouveau_plane *nv_plane = (struct nouveau_plane *)plane; +struct drm_plane_state *pstate =drm_atomic_get_plane_state (plane, state); + +if (IS_ERR (pstate)) +return PTR_ERR (pstate);if (property == nv_plane->props.colorkey) nv_plane->colorkey = value;
@@ -240,7 +245,8 @@ nv_set_property(struct drm_plane *plane,else if (property == nv_plane->props.iturbt_709) nv_plane->iturbt_709 = value;else -return -EINVAL ; +return drm_plane_set_property (plane, pstate, + property, value, blob_data);if (nv_plane->set_params) nv_plane->set_params (nv_plane);
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -585,7 +585,7 @@ static void dev_lastclose(struct drm_device *dev)for (i =0 ; i < priv->num_planes; i++) {drm_object_property_set_value (&priv->planes[i]->base, - &priv->planes[i]->propvals, + &priv->planes[i]->state->propvals, priv->rotation_prop,0 ,NULL ); } }
drivers/gpu/drm/omapdrm/omap_plane.c +7 -0
@@ -341,8 +341,12 @@ int omap_plane_set_property(struct drm_plane *plane, {struct omap_plane *omap_plane =to_omap_plane (plane);struct omap_drm_private *priv = plane->dev->dev_private; +struct drm_plane_state *pstate =drm_atomic_get_plane_state (plane, state);int ret = -EINVAL ; +if (IS_ERR (pstate)) +return PTR_ERR (pstate); +if (property == priv->rotation_prop) {DBG ("%s: rotation: %02x" , omap_plane->name, (uint32_t )val); omap_plane->win.rotation = val;
@@ -351,6 +355,9 @@ int omap_plane_set_property(struct drm_plane *plane,DBG ("%s: zorder: %02x" , omap_plane->name, (uint32_t )val); omap_plane->info.zorder = val; ret =apply (plane); + }else { + ret =drm_plane_set_property (plane, pstate, property, + val, blob_data); }return ret;
drivers/gpu/drm/rcar-du/rcar_du_plane.c +7 -1
@@ -14,6 +14,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
@@ -404,6 +405,10 @@ static int rcar_du_plane_set_property(struct drm_plane *plane, {struct rcar_du_plane *rplane =to_rcar_plane (plane);struct rcar_du_group *rgrp = rplane->group; +struct drm_plane_state *pstate =drm_atomic_get_plane_state (plane, state); + +if (IS_ERR (pstate)) +return PTR_ERR (pstate);if (property == rgrp->planes.alpha)rcar_du_plane_set_alpha (rplane, value);
@@ -412,7 +417,8 @@ static int rcar_du_plane_set_property(struct drm_plane *plane,else if (property == rgrp->planes.zpos)rcar_du_plane_set_zpos (rplane, value);else -return -EINVAL ; +return drm_plane_set_property (plane, pstate, + property, value, blob_data);return 0 ; }
drivers/gpu/drm/shmobile/shmob_drm_plane.c +2 -0
@@ -14,6 +14,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
@@ -228,6 +229,7 @@ static void shmob_drm_plane_destroy(struct drm_plane *plane)static const struct drm_plane_funcs shmob_drm_plane_funcs = { .update_plane = shmob_drm_plane_update, .disable_plane = shmob_drm_plane_disable, + .set_property = drm_atomic_plane_set_property, .destroy = shmob_drm_plane_destroy, };
include/drm/drm_atomic.h +28 -1
@@ -68,7 +68,8 @@* struct drm_atomic_funcs - helper funcs used by the atomic helpers */ struct drm_atomic_funcs { -int dummy;/* for now */ +int (*check_plane_state)(struct drm_plane *plane,struct drm_plane_state *pstate); +int (*commit_plane_state)(struct drm_plane *plane,struct drm_plane_state *pstate); };const extern struct drm_atomic_funcs drm_atomic_funcs;
@@ -84,6 +85,30 @@ int drm_atomic_commit_unlocked(struct drm_device *dev, struct drm_atomic_state *state);void drm_atomic_end (struct drm_device *dev,struct drm_atomic_state *state); +int drm_atomic_plane_set_property (struct drm_plane *plane, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data); +struct drm_plane_state *drm_atomic_get_plane_state (struct drm_plane *plane, +struct drm_atomic_state *state); + +static inline int +drm_atomic_check_plane_state (struct drm_plane *plane, +struct drm_plane_state *pstate) +{ +const struct drm_atomic_funcs *funcs = + plane->dev->driver->atomic_funcs; +return funcs->check_plane_state (plane, pstate); +} + +static inline int +drm_atomic_commit_plane_state (struct drm_plane *plane, +struct drm_plane_state *pstate) +{ +const struct drm_atomic_funcs *funcs = + plane->dev->driver->atomic_funcs; +return funcs->commit_plane_state (plane, pstate); +} +/** * struct drm_atomic_state - the state object used by atomic helpers */
@@ -91,6 +116,8 @@ struct drm_atomic_state {struct kref refcount;struct drm_device *dev;uint32_t flags; +struct drm_plane **planes; +struct drm_plane_state **pstates;bool committed;bool checked;/* just for debugging */
include/drm/drm_crtc.h +109 -3
168 lines not on this page · raw message
Signature · 1 line
1.9.3
Re: [PATCH 4/7] drm: convert plane to properties/state
On Wed, Jul 23, 2014 at 03:38:17PM -0400, Rob Clark wrote:
...
drivers/gpu/drm/drm_crtc.c static int drm_mode_cursor_universal(struct drm_crtc *crtc, · line 2902
Quoted 11 lines
drivers/gpu/drm/drm_crtc.c +3
-2@@ -2702,10 +2895,11 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,* setplane_internal will take care of deref'ing either the old or new * framebuffer depending on success. */ - ret =setplane_internal (crtc->cursor, crtc, fb, + ret =setplane_internal (crtc->cursor, + crtc->base.id, fb ? fb->base.id :0 , crtc_x, crtc_y, crtc_w, crtc_h,0 ,0 , src_w, src_h); - +drm_framebuffer_unreference (fb);
I haven't had time to look through this in depth yet, but can't we wind up unreferencing NULL here?
Also, the comment above this call should probably be updated/removed since the locking works a bit differently now?
Matt
Signature · 5 lines
Matt Roper Graphics Software Engineer IoTG Platform Enabling & Development Intel Corporation (916) 356-2795
PATCH 5/7 drm: convert crtc to properties/state
In reply to Rob ClarkBreak the mutable state of a crtc out into a separate structure and use atomic properties mechanism to set crtc attributes. This makes it easier to have some helpers for crtc->set_property() and for checking for invalid params. The idea is that individual drivers can wrap the state struct in their own struct which adds driver specific parameters, for easy build-up of state across multiple set_property() calls and for easy atomic commit or roll- back.
--- drivers/gpu/drm/armada/armada_crtc.c | 11 +- drivers/gpu/drm/ast/ast_mode.c | 1 + drivers/gpu/drm/cirrus/cirrus_mode.c | 1 + drivers/gpu/drm/drm_atomic.c | 230 +++++++++- drivers/gpu/drm/drm_crtc.c | 654 +++++++++++++++++++---------- drivers/gpu/drm/drm_fb_helper.c | 24 +- drivers/gpu/drm/drm_irq.c | 8 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 7 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 1 + drivers/gpu/drm/gma500/psb_intel_display.c | 1 + drivers/gpu/drm/i915/intel_display.c | 3 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 6 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 1 + drivers/gpu/drm/nouveau/nv50_display.c | 1 + drivers/gpu/drm/omapdrm/omap_crtc.c | 12 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/qxl/qxl_display.c | 2 + drivers/gpu/drm/radeon/radeon_display.c | 2 + drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 + drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 2 + drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 1 + drivers/gpu/drm/udl/udl_modeset.c | 2 + drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 1 + include/drm/drm_atomic.h | 29 ++ include/drm/drm_crtc.h | 103 ++++- 28 files changed, 864 insertions(+), 251 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +10 -1
@@ -9,6 +9,7 @@#include <linux/clk.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include "armada_crtc.h" #include "armada_drm.h" #include "armada_fb.h"
@@ -966,7 +967,12 @@ armada_drm_crtc_set_property(struct drm_crtc *crtc, {struct armada_private *priv = crtc->dev->dev_private;struct armada_crtc *dcrtc =drm_to_armada_crtc (crtc); +struct drm_crtc_state *cstate =drm_atomic_get_crtc_state (crtc, state);bool update_csc = false; +int ret =0 ; + +if (IS_ERR (cstate)) +return PTR_ERR (cstate);if (property == priv->csc_yuv_prop) { dcrtc->csc_yuv_mode = val;
@@ -974,6 +980,9 @@ armada_drm_crtc_set_property(struct drm_crtc *crtc, }else if (property == priv->csc_rgb_prop) { dcrtc->csc_rgb_mode = val; update_csc = true; + }else { + ret =drm_crtc_set_property (crtc, cstate, property, + val, blob_data); }if (update_csc) {
@@ -984,7 +993,7 @@ armada_drm_crtc_set_property(struct drm_crtc *crtc,writel_relaxed (val, dcrtc->base +LCD_SPU_IOPAD_CONTROL ); } -return 0 ; +return ret; }static struct drm_crtc_funcs armada_crtc_funcs = {
drivers/gpu/drm/ast/ast_mode.c +1 -0
@@ -632,6 +632,7 @@ static const struct drm_crtc_funcs ast_crtc_funcs = { .cursor_move = ast_cursor_move, .reset = ast_crtc_reset, .set_config = drm_crtc_helper_set_config, + .set_property = drm_atomic_crtc_set_property, .gamma_set = ast_crtc_gamma_set, .destroy = ast_crtc_destroy, };
drivers/gpu/drm/cirrus/cirrus_mode.c +1 -0
@@ -366,6 +366,7 @@ static void cirrus_crtc_destroy(struct drm_crtc *crtc)static const struct drm_crtc_funcs cirrus_crtc_funcs = { .gamma_set = cirrus_crtc_gamma_set, .set_config = drm_crtc_helper_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = cirrus_crtc_destroy, };
drivers/gpu/drm/drm_atomic.c +227 -3
321 lines not on this page · raw message
drivers/gpu/drm/drm_crtc.c +438 -216
851 lines not on this page · raw message
drivers/gpu/drm/drm_fb_helper.c +22 -2
@@ -36,6 +36,7 @@#include <linux/module.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_helper.h> #include <drm/drm_crtc_helper.h>
@@ -340,10 +341,11 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper, bool lockless) {struct drm_device *dev = fb_helper->dev; +struct drm_mode_config *config = &dev->mode_config;struct drm_plane *plane;bool error = false; -void *state; -int i; +struct drm_atomic_state *state; +int ret, i; state = dev->driver->atomic_begin (dev, lockless ?DRM_MODE_ATOMIC_NOLOCK :0 );
@@ -352,6 +354,14 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper,return true; } +retry: + ret =drm_modeset_lock (&config->connection_mutex, &state->acquire_ctx); +if (ret) + goto out; + ret =drm_modeset_lock_all_crtcs (dev, &state->acquire_ctx); +if (ret) + goto out; +list_for_each_entry (plane, &dev->mode_config.plane_list, head)if (plane->type !=DRM_PLANE_TYPE_PRIMARY )drm_plane_force_disable (plane, state);
@@ -362,8 +372,15 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper,else dev->driver->atomic_commit (dev, state); +out: +if (ret == -EDEADLK ) { +drm_modeset_backoff (&state->acquire_ctx); + goto retry; + } dev->driver->atomic_end (dev, state); +drm_modeset_lock_all (dev); +for (i =0 ; i < fb_helper->crtc_count; i++) {struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;struct drm_crtc *crtc = mode_set->crtc;
@@ -379,6 +396,9 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper,if (ret) error = true; } + +drm_modeset_unlock_all (dev); +return error; }/**
drivers/gpu/drm/drm_irq.c +4 -4
@@ -957,7 +957,7 @@ EXPORT_SYMBOL(drm_vblank_get);*/ int drm_crtc_vblank_get (struct drm_crtc *crtc) { -return drm_vblank_get (crtc->dev,drm_crtc_index (crtc)); +return drm_vblank_get (crtc->dev, crtc->index); }EXPORT_SYMBOL (drm_crtc_vblank_get);
@@ -994,7 +994,7 @@ EXPORT_SYMBOL(drm_vblank_put);*/ void drm_crtc_vblank_put (struct drm_crtc *crtc) { -drm_vblank_put (crtc->dev,drm_crtc_index (crtc)); +drm_vblank_put (crtc->dev, crtc->index); }EXPORT_SYMBOL (drm_crtc_vblank_put);
@@ -1058,7 +1058,7 @@ EXPORT_SYMBOL(drm_vblank_off);*/ void drm_crtc_vblank_off (struct drm_crtc *crtc) { -drm_vblank_off (crtc->dev,drm_crtc_index (crtc)); +drm_vblank_off (crtc->dev, crtc->index); }EXPORT_SYMBOL (drm_crtc_vblank_off);
@@ -1099,7 +1099,7 @@ EXPORT_SYMBOL(drm_vblank_on);*/ void drm_crtc_vblank_on (struct drm_crtc *crtc) { -drm_vblank_on (crtc->dev,drm_crtc_index (crtc)); +drm_vblank_on (crtc->dev, crtc->index); }EXPORT_SYMBOL (drm_crtc_vblank_on);
drivers/gpu/drm/exynos/exynos_drm_crtc.c +6 -1
@@ -14,6 +14,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include "exynos_drm_crtc.h" #include "exynos_drm_drv.h"
@@ -289,6 +290,10 @@ static int exynos_drm_crtc_set_property(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct exynos_drm_private *dev_priv = dev->dev_private;struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); +struct drm_crtc_state *cstate =drm_atomic_get_crtc_state (crtc, state); + +if (IS_ERR (cstate)) +return PTR_ERR (cstate);if (property == dev_priv->crtc_mode_property) {enum exynos_crtc_mode mode = val;
@@ -313,7 +318,7 @@ static int exynos_drm_crtc_set_property(struct drm_crtc *crtc,return 0 ; } -return -EINVAL ; +return drm_crtc_set_property (crtc, cstate, property, val, blob_data); }static struct drm_crtc_funcs exynos_crtc_funcs = {
drivers/gpu/drm/gma500/cdv_intel_display.c +1 -0
@@ -989,6 +989,7 @@ const struct drm_crtc_funcs cdv_intel_crtc_funcs = { .cursor_move = gma_crtc_cursor_move, .gamma_set = gma_crtc_gamma_set, .set_config = gma_crtc_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = gma_crtc_destroy, };
drivers/gpu/drm/gma500/psb_intel_display.c +1 -0
@@ -444,6 +444,7 @@ const struct drm_crtc_funcs psb_intel_crtc_funcs = { .cursor_move = gma_crtc_cursor_move, .gamma_set = gma_crtc_gamma_set, .set_config = gma_crtc_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = gma_crtc_destroy, };
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -11308,6 +11308,7 @@ out_config:static const struct drm_crtc_funcs intel_crtc_funcs = { .gamma_set = intel_crtc_gamma_set, .set_config = intel_crtc_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = intel_crtc_destroy, .page_flip = intel_crtc_page_flip, };
@@ -11765,7 +11766,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)drm_crtc_helper_add (&intel_crtc->base, &intel_helper_funcs); -WARN_ON (drm_crtc_index (&intel_crtc->base) != intel_crtc->pipe); +WARN_ON (intel_crtc->base.index != intel_crtc->pipe);return ; fail:
drivers/gpu/drm/mgag200/mgag200_mode.c +1 -0
@@ -1296,6 +1296,7 @@ static const struct drm_crtc_funcs mga_crtc_funcs = { .cursor_move = mga_crtc_cursor_move, .gamma_set = mga_crtc_gamma_set, .set_config = drm_crtc_helper_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = mga_crtc_destroy, };
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +4 -2
@@ -469,8 +469,10 @@ static int mdp4_crtc_set_property(struct drm_crtc *crtc, struct drm_atomic_state *state, struct drm_property *property, uint64_t val, void *blob_data) { - // XXX - return -EINVAL; + struct drm_crtc_state *cstate = drm_atomic_get_crtc_state(crtc, state); +if (IS_ERR (cstate)) +return PTR_ERR (cstate); +return drm_crtc_set_property (crtc, cstate, property, val, blob_data); }#define CURSOR_WIDTH 64
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +4 -2
@@ -387,8 +387,10 @@ static int mdp5_crtc_set_property(struct drm_crtc *crtc, struct drm_atomic_state *state, struct drm_property *property, uint64_t val, void *blob_data) { - // XXX - return -EINVAL; + struct drm_crtc_state *cstate = drm_atomic_get_crtc_state(crtc, state); +if (IS_ERR (cstate)) +return PTR_ERR (cstate); +return drm_crtc_set_property (crtc, cstate, property, val, blob_data); } static const struct drm_crtc_funcs mdp5_crtc_funcs = {
drivers/gpu/drm/nouveau/dispnv04/crtc.c +1 -0
@@ -1086,6 +1086,7 @@ static const struct drm_crtc_funcs nv04_crtc_funcs = { .cursor_move = nv04_crtc_cursor_move, .gamma_set = nv_crtc_gamma_set, .set_config = nouveau_crtc_set_config, + .set_property = drm_atomic_crtc_set_property, .page_flip = nouveau_crtc_page_flip, .destroy = nv_crtc_destroy, };
drivers/gpu/drm/nouveau/nv50_display.c +1 -0
@@ -1331,6 +1331,7 @@ static const struct drm_crtc_funcs nv50_crtc_func = { .cursor_move = nv50_crtc_cursor_move, .gamma_set = nv50_crtc_gamma_set, .set_config = nouveau_crtc_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = nv50_crtc_destroy, .page_flip = nouveau_crtc_page_flip, };
drivers/gpu/drm/omapdrm/omap_crtc.c +10 -2
@@ -387,14 +387,22 @@ static int omap_crtc_set_property(struct drm_crtc *crtc, {struct omap_crtc *omap_crtc =to_omap_crtc (crtc);struct omap_drm_private *priv = crtc->dev->dev_private; +struct drm_crtc_state *cstate =drm_atomic_get_crtc_state (crtc, state); +int ret; + +if (IS_ERR (cstate)) +return PTR_ERR (cstate);if (property == priv->rotation_prop) { - crtc->invert_dimensions = + cstate->invert_dimensions = !!(val & ((1LL <<DRM_ROTATE_90 ) | (1LL <<DRM_ROTATE_270 ))); } -return omap_plane_set_property (omap_crtc->plane, state, + ret =omap_plane_set_property (omap_crtc->plane, state, property, val, blob_data); +if (ret) + ret =drm_crtc_set_property (crtc, cstate, property, val, blob_data); +return ret; }static const struct drm_crtc_funcs omap_crtc_funcs = {
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -579,7 +579,7 @@ static void dev_lastclose(struct drm_device *dev)*/ for (i =0 ; i < priv->num_crtcs; i++) {drm_object_property_set_value (&priv->crtcs[i]->base, - &priv->crtcs[i]->propvals, + &priv->crtcs[i]->state->propvals, priv->rotation_prop,0 ,NULL ); }
drivers/gpu/drm/qxl/qxl_display.c +2 -0
@@ -29,6 +29,7 @@#include "qxl_drv.h" #include "qxl_object.h" #include "drm_crtc_helper.h" +#include "drm_atomic.h" static bool qxl_head_enabled (struct qxl_head *head) {
@@ -373,6 +374,7 @@ static const struct drm_crtc_funcs qxl_crtc_funcs = { .cursor_set2 = qxl_crtc_cursor_set2, .cursor_move = qxl_crtc_cursor_move, .set_config = drm_crtc_helper_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = qxl_crtc_destroy, };
drivers/gpu/drm/radeon/radeon_display.c +2 -0
@@ -32,6 +32,7 @@#include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_edid.h> #include <linux/gcd.h>
@@ -622,6 +623,7 @@ static const struct drm_crtc_funcs radeon_crtc_funcs = { .cursor_move = radeon_crtc_cursor_move, .gamma_set = radeon_crtc_gamma_set, .set_config = radeon_crtc_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = radeon_crtc_destroy, .page_flip = radeon_crtc_page_flip, };
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +2 -0
@@ -17,6 +17,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
@@ -527,6 +528,7 @@ static int rcar_du_crtc_page_flip(struct drm_crtc *crtc,static const struct drm_crtc_funcs crtc_funcs = { .destroy = drm_crtc_cleanup, .set_config = drm_crtc_helper_set_config, + .set_property = drm_atomic_crtc_set_property, .page_flip = rcar_du_crtc_page_flip, };
drivers/gpu/drm/shmobile/shmob_drm_crtc.c +2 -0
@@ -17,6 +17,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
@@ -506,6 +507,7 @@ static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc,static const struct drm_crtc_funcs crtc_funcs = { .destroy = drm_crtc_cleanup, .set_config = drm_crtc_helper_set_config, + .set_property = drm_atomic_crtc_set_property, .page_flip = shmob_drm_crtc_page_flip, };
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +1 -0
@@ -411,6 +411,7 @@ static int tilcdc_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,static const struct drm_crtc_funcs tilcdc_crtc_funcs = { .destroy = tilcdc_crtc_destroy, .set_config = drm_crtc_helper_set_config, + .set_property = drm_atomic_crtc_set_property, .page_flip = tilcdc_crtc_page_flip, };
drivers/gpu/drm/udl/udl_modeset.c +2 -0
@@ -14,6 +14,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include "udl_drv.h" /*
@@ -403,6 +404,7 @@ static struct drm_crtc_helper_funcs udl_helper_funcs = {static const struct drm_crtc_funcs udl_crtc_funcs = { .set_config = drm_crtc_helper_set_config, + .set_property = drm_atomic_crtc_set_property, .destroy = udl_crtc_destroy, .page_flip = udl_crtc_page_flip, };
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +1 -0
@@ -300,6 +300,7 @@ static struct drm_crtc_funcs vmw_legacy_crtc_funcs = { .cursor_move = vmw_du_crtc_cursor_move, .gamma_set = vmw_du_crtc_gamma_set, .destroy = vmw_ldu_crtc_destroy, + .set_property = drm_atomic_crtc_set_property, .set_config = vmw_ldu_crtc_set_config, };
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +1 -0
@@ -397,6 +397,7 @@ static struct drm_crtc_funcs vmw_screen_object_crtc_funcs = { .gamma_set = vmw_du_crtc_gamma_set, .destroy = vmw_sou_crtc_destroy, .set_config = vmw_sou_crtc_set_config, + .set_property = drm_atomic_crtc_set_property, .page_flip = vmw_du_page_flip, };
include/drm/drm_atomic.h +29 -0
@@ -70,6 +70,9 @@struct drm_atomic_funcs {int (*check_plane_state)(struct drm_plane *plane,struct drm_plane_state *pstate);int (*commit_plane_state)(struct drm_plane *plane,struct drm_plane_state *pstate); + +int (*check_crtc_state)(struct drm_crtc *crtc,struct drm_crtc_state *cstate); +int (*commit_crtc_state)(struct drm_crtc *crtc,struct drm_crtc_state *cstate); };const extern struct drm_atomic_funcs drm_atomic_funcs;
@@ -109,6 +112,30 @@ drm_atomic_commit_plane_state(struct drm_plane *plane,return funcs->commit_plane_state (plane, pstate); } +int drm_atomic_crtc_set_property (struct drm_crtc *crtc, +struct drm_atomic_state *state,struct drm_property *property, +uint64_t val,void *blob_data); +struct drm_crtc_state *drm_atomic_get_crtc_state (struct drm_crtc *crtc, +struct drm_atomic_state *state); + +static inline int +drm_atomic_check_crtc_state (struct drm_crtc *crtc, +struct drm_crtc_state *cstate) +{ +const struct drm_atomic_funcs *funcs = + crtc->dev->driver->atomic_funcs; +return funcs->check_crtc_state (crtc, cstate); +} + +static inline int +drm_atomic_commit_crtc_state (struct drm_crtc *crtc, +struct drm_crtc_state *cstate) +{ +const struct drm_atomic_funcs *funcs = + crtc->dev->driver->atomic_funcs; +return funcs->commit_crtc_state (crtc, cstate); +} +/** * struct drm_atomic_state - the state object used by atomic helpers */
@@ -118,6 +145,8 @@ struct drm_atomic_state {uint32_t flags;struct drm_plane **planes;struct drm_plane_state **pstates; +struct drm_crtc **crtcs; +struct drm_crtc_state **cstates;bool committed;bool checked;/* just for debugging */
include/drm/drm_crtc.h +87 -16
186 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH 6/7 drm/msm: add atomic support
In reply to Rob Clark--- drivers/gpu/drm/msm/Makefile | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 57 ++++++------ drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 6 ++ drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 5 -- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 56 ++++++------ drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 6 ++ drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 2 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 5 -- drivers/gpu/drm/msm/msm_atomic.c | 141 ++++++++++++++++++++++++++++++ drivers/gpu/drm/msm/msm_drv.c | 22 ++++- drivers/gpu/drm/msm/msm_drv.h | 7 ++ drivers/gpu/drm/msm/msm_gem.c | 24 +---- drivers/gpu/drm/msm/msm_gem.h | 13 +++ drivers/gpu/drm/msm/msm_kms.h | 1 + 15 files changed, 253 insertions(+), 94 deletions(-) create mode 100644 drivers/gpu/drm/msm/msm_atomic.c
drivers/gpu/drm/msm/Makefile +1 -0
@@ -27,6 +27,7 @@ msm-y := \ mdp/mdp5/mdp5_kms.o \ mdp/mdp5/mdp5_plane.o \ mdp/mdp5/mdp5_smp.o \ + msm_atomic.o \ msm_drv.o \ msm_fb.o \ msm_gem.o \
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +26 -31
140 lines not on this page · raw message
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +6 -0
@@ -131,6 +131,11 @@ static long mdp4_round_pixclk(struct msm_kms *kms, unsigned long rate,return mdp4_dtv_round_pixclk (encoder, rate); } +static void mdp4_flush (struct msm_kms *kms,struct drm_crtc *crtc) +{ +mdp4_crtc_flush (crtc); +} +static void mdp4_preclose (struct msm_kms *kms,struct drm_file *file) {struct mdp4_kms *mdp4_kms =to_mdp4_kms (to_mdp_kms (kms));
@@ -162,6 +167,7 @@ static const struct mdp_kms_funcs kms_funcs = { .disable_vblank = mdp4_disable_vblank, .get_format = mdp_get_format, .round_pixclk = mdp4_round_pixclk, + .flush = mdp4_flush, .preclose = mdp4_preclose, .destroy = mdp4_destroy, },
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h +1 -0
@@ -185,6 +185,7 @@ enum mdp4_pipe mdp4_plane_pipe(struct drm_plane *plane);struct drm_plane *mdp4_plane_init (struct drm_device *dev,enum mdp4_pipe pipe_id,bool private_plane); +void mdp4_crtc_flush (struct drm_crtc *crtc);uint32_t mdp4_crtc_vblank (struct drm_crtc *crtc);void mdp4_crtc_cancel_pending_flip (struct drm_crtc *crtc,struct drm_file *file);void mdp4_crtc_set_config (struct drm_crtc *crtc,uint32_t config);
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +0 -5
@@ -48,11 +48,6 @@ static int mdp4_plane_update(struct drm_plane *plane, mdp4_plane->enabled = true; -if (plane->fb) -drm_framebuffer_unreference (plane->fb); - -drm_framebuffer_reference (fb); -return mdp4_plane_mode_set (plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h);
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +25 -31
140 lines not on this page · raw message
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +6 -0
@@ -206,6 +206,11 @@ static long mdp5_round_pixclk(struct msm_kms *kms, unsigned long rate,return rate; } +static void mdp5_flush (struct msm_kms *kms,struct drm_crtc *crtc) +{ +mdp5_crtc_flush (crtc); +} +static void mdp5_preclose (struct msm_kms *kms,struct drm_file *file) {struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (kms));
@@ -239,6 +244,7 @@ static const struct mdp_kms_funcs kms_funcs = { .disable_vblank = mdp5_disable_vblank, .get_format = mdp_get_format, .round_pixclk = mdp5_round_pixclk, + .flush = mdp5_flush, .preclose = mdp5_preclose, .destroy = mdp5_destroy, },
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +1 -1
@@ -223,8 +223,8 @@ enum mdp5_pipe mdp5_plane_pipe(struct drm_plane *plane);struct drm_plane *mdp5_plane_init (struct drm_device *dev,enum mdp5_pipe pipe,bool private_plane); +void mdp5_crtc_flush (struct drm_crtc *crtc);uint32_t mdp5_crtc_vblank (struct drm_crtc *crtc); -void mdp5_crtc_cancel_pending_flip (struct drm_crtc *crtc,struct drm_file *file);void mdp5_crtc_set_intf (struct drm_crtc *crtc,int intf,enum mdp5_intf intf_id);
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +0 -5
@@ -48,11 +48,6 @@ static int mdp5_plane_update(struct drm_plane *plane, mdp5_plane->enabled = true; -if (plane->fb) -drm_framebuffer_unreference (plane->fb); - -drm_framebuffer_reference (fb); -return mdp5_plane_mode_set (plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h);
drivers/gpu/drm/msm/msm_atomic.c new file +141 -0
141 lines not on this page · raw message
drivers/gpu/drm/msm/msm_drv.c +21 -1
@@ -646,6 +646,26 @@ int msm_wait_fence_interruptable(struct drm_device *dev, uint32_t fence,return ret; } +int msm_queue_fence_cb (struct drm_device *dev, +struct msm_fence_cb *cb,uint32_t fence) +{ +struct msm_drm_private *priv = dev->dev_private; +int ret =0 ; + +mutex_lock (&dev->struct_mutex); +if (!list_empty (&cb->work.entry)) { + ret = -EINVAL ; + }else if (fence > priv->completed_fence) { + cb->fence = fence; +list_add_tail (&cb->work.entry, &priv->fence_cbs); + }else { +queue_work (priv->wq, &cb->work); + } +mutex_unlock (&dev->struct_mutex); + +return ret; +} +/* called from workqueue */ void msm_update_fence (struct drm_device *dev,uint32_t fence) {
@@ -861,7 +881,7 @@ static struct drm_driver msm_driver = { .atomic_begin = drm_atomic_begin, .atomic_set_event = drm_atomic_set_event, .atomic_check = drm_atomic_check, - .atomic_commit = drm_atomic_commit, + .atomic_commit = msm_atomic_commit, .atomic_end = drm_atomic_end, .atomic_funcs = &drm_atomic_funcs,#ifdef CONFIG_DEBUG_FS
drivers/gpu/drm/msm/msm_drv.h +7 -0
@@ -116,6 +116,9 @@ struct msm_drm_private {unsigned int num_connectors;struct drm_connector *connectors[8 ]; +/* crtc's pending atomic update: */ +uint32_t pending_crtcs; +/* VRAM carveout, used when no IOMMU: */ struct {unsigned long size;
@@ -149,11 +152,15 @@ int msm_register_mmu(struct drm_device *dev, struct msm_mmu *mmu);int msm_wait_fence_interruptable (struct drm_device *dev,uint32_t fence,struct timespec *timeout); +int msm_queue_fence_cb (struct drm_device *dev, +struct msm_fence_cb *cb,uint32_t fence);void msm_update_fence (struct drm_device *dev,uint32_t fence);int msm_ioctl_gem_submit (struct drm_device *dev,void *data,struct drm_file *file); +int msm_atomic_commit (struct drm_device *dev,struct drm_atomic_state *state); +int msm_gem_mmap (struct file *filp,struct vm_area_struct *vma);int msm_gem_fault (struct vm_area_struct *vma,struct vm_fault *vmf);uint64_t msm_gem_mmap_offset (struct drm_gem_object *obj);
drivers/gpu/drm/msm/msm_gem.c +4 -20
@@ -397,23 +397,11 @@ void *msm_gem_vaddr(struct drm_gem_object *obj)int msm_gem_queue_inactive_cb (struct drm_gem_object *obj,struct msm_fence_cb *cb) { -struct drm_device *dev = obj->dev; -struct msm_drm_private *priv = dev->dev_private;struct msm_gem_object *msm_obj =to_msm_bo (obj); -int ret =0 ; +uint32_t fence =msm_gem_fence (msm_obj, +MSM_PREP_READ |MSM_PREP_WRITE ); -mutex_lock (&dev->struct_mutex); -if (!list_empty (&cb->work.entry)) { - ret = -EINVAL ; - }else if (is_active (msm_obj)) { - cb->fence =max (msm_obj->read_fence, msm_obj->write_fence); -list_add_tail (&cb->work.entry, &priv->fence_cbs); - }else { -queue_work (priv->wq, &cb->work); - } -mutex_unlock (&dev->struct_mutex); - -return ret; +return msm_queue_fence_cb (obj->dev, cb, fence); } void msm_gem_move_to_active(struct drm_gem_object *obj,
@@ -452,12 +440,8 @@ int msm_gem_cpu_prep(struct drm_gem_object *obj, uint32_t op,int ret =0 ;if (is_active (msm_obj)) { -uint32_t fence =0 ; +uint32_t fence =msm_gem_fence (msm_obj, op); -if (op &MSM_PREP_READ ) - fence = msm_obj->write_fence; -if (op &MSM_PREP_WRITE ) - fence =max (fence, msm_obj->read_fence);if (op &MSM_PREP_NOSYNC ) timeout =NULL ;
drivers/gpu/drm/msm/msm_gem.h +13 -0
@@ -70,6 +70,19 @@ static inline bool is_active(struct msm_gem_object *msm_obj)return msm_obj->gpu !=NULL ; } +static inline uint32_t msm_gem_fence (struct msm_gem_object *msm_obj, +uint32_t op) +{ +uint32_t fence =0 ; + +if (op &MSM_PREP_READ ) + fence = msm_obj->write_fence; +if (op &MSM_PREP_WRITE ) + fence =max (fence, msm_obj->read_fence); + +return fence; +} +#define MAX_CMDS 4/* Created per submit-ioctl, to track bo's and cmdstream bufs, etc,
drivers/gpu/drm/msm/msm_kms.h +1 -0
@@ -42,6 +42,7 @@ struct msm_kms_funcs {const struct msm_format *(*get_format)(struct msm_kms *kms,uint32_t format);long (*round_pixclk)(struct msm_kms *kms,unsigned long rate,struct drm_encoder *encoder); +void (*flush)(struct msm_kms *kms,struct drm_crtc *crtc);/* cleanup: */ void (*preclose)(struct msm_kms *kms,struct drm_file *file);void (*destroy)(struct msm_kms *kms);
Signature · 1 line
1.9.3
PATCH 7/7 drm: Fix up the atomic legacy paths so they work
In reply to Rob ClarkFrom: Sean Paul <[email protected]>
BUG=chromium:336809
TEST=Tested on snow & peppy
--- drivers/gpu/drm/drm_atomic.c | 4 ++++ drivers/gpu/drm/drm_crtc.c | 11 ++++++++--- include/drm/drm_crtc.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic.c +4 -0
@@ -626,6 +626,7 @@ swap_crtc_state(struct drm_crtc *crtc, struct drm_atomic_state *a)/* clear transient state (only valid during atomic update): */ cstate->set_config = false; cstate->connectors_change = false; + cstate->commit_state = false;swap (crtc->state, a->cstates[crtc->index]); crtc->base.propvals = &crtc->state->propvals;
@@ -700,6 +701,9 @@ commit_crtc_state(struct drm_crtc *crtc,drm_atomic_get_plane_state (crtc->primary, cstate->state);int ret = -EINVAL ; +if (!cstate->commit_state) +return 0 ; +if (cstate->set_config)return set_config (crtc, cstate);
drivers/gpu/drm/drm_crtc.c +8 -3
@@ -777,7 +777,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, crtc->base.propvals = &crtc->state->propvals;list_add_tail (&crtc->head, &config->crtc_list); - config->num_crtc++; + crtc->index = config->num_crtc++; crtc->primary = primary; crtc->cursor = cursor;
@@ -898,7 +898,7 @@ static int check_connectors(struct drm_crtc *crtc,if (ocrtc == crtc)continue ; - ostate =drm_atomic_get_crtc_state (crtc, state); + ostate =drm_atomic_get_crtc_state (ocrtc, state);if (IS_ERR (ostate))return PTR_ERR (ostate);
@@ -926,7 +926,6 @@ retry:return -EINVAL ; } } -return 0 ; }
@@ -948,6 +947,10 @@ int drm_crtc_check_state(struct drm_crtc *crtc,if (!(fb && state->mode_valid))return 0 ; +/* We're not committing this state, ignore */ +if (!state->commit_state) +return 0 ; + hdisplay = state->mode.hdisplay; vdisplay = state->mode.vdisplay;
@@ -1021,6 +1024,7 @@ int drm_crtc_set_property(struct drm_crtc *crtc,/* grab primary plane state now, to ensure locks are held, etc. */ drm_atomic_get_plane_state (crtc->primary, state->state); + state->commit_state = true;drm_object_property_set_value (&crtc->base, &state->propvals, property, value, blob_data);
@@ -1032,6 +1036,7 @@ int drm_crtc_set_property(struct drm_crtc *crtc,/* check size: */ if (value <sizeof (struct drm_mode_modeinfo ))return -EINVAL ; + state->mode = *(struct drm_mode_modeinfo *)blob_data; state->mode_valid = true; }
include/drm/drm_crtc.h +1 -0
@@ -320,6 +320,7 @@ struct drm_crtc_state {/* transient state, only valid during atomic operation: */ bool set_config : 1; bool connectors_change : 1; + bool commit_state : 1;uint8_t num_connector_ids;uint32_t *connector_ids;
Signature · 1 line
1.9.3
Quoted 16 lines · Rob Clark
This is mostly just a rebase+resend. Was going to send it a bit earlier but had a few things to fix up as a result of the rebase.
At this point, I think next steps are roughly:
1) introduceplane->mutex
2) decide what we want to do about events
3) add actual ioctlI think we could shoot for merging this series next, and then adding
plane->mutexin 3.18?Before we add the ioctl, I think we want to sort out events for updates to non-primary layers, and what the interface to drivers should look like. Ie. just add event to ->update_plane() or should we completely ditch ->page_flip() and ->update_plane()?
Quoted 5 lines
Technically, I think we could get away without a new API and just let drivers grab all the events in their ->atomic_commit(), but I suspect core could provide something more useful to drivers. I guess it would be useful to have a few more drivers converted over to see what makes sense.
Ok so we've had a lot of discussions about this on irc and overall I'm not terribly happy with what this looks like. I have a few concerns:
- The entire atomic conversion for drivers is monolithic, at least at the interface level. So if you want to do this step-by-step you're forced to add hacks and e.g. bypass pageflips until that's implemented. E.g. on i915 I see no chance that we'll get atomic ready for all cases (so nonblocking flips and multi-crtc and everything on all platforms) in one go.
- Related to that is that we force legacy ioctls through atomic. E.g. on older i915 platforms I very much expect that we won't ever convert the pageflip code to atomic for them and just not support atomic flips of cursor + primary plane. At least not at the beginning. I know that's different from my stance a year ago, but I've become a bit more realistic.
- The entire conversion is monolithic and we can't do it on a driver-by-driver basis. Everyone has to go through the new atomic interfaces on a flag day. drm is much bigger now and forcing everyone to convert at the same time is really risky. Again I know I've changed my mind again, but drm is a lot bigger and there's a lot more drivers that implement pageflip and cursors, i.e. stuff that's special.
- The separation between interface marshalling code in the drm core and helper functions for drivers to implement stuff is fuzzy at best. Thus far we've had an excellent seperation in this are for kms, I don't think it's vise to throw that out.
So here's my proposal for how to get this in without breaking the world
1. We add a complete new set of ->atomic_foo driver entry points to all relevant objects. So instead of changing all the set_prop functions in a flag-day like operation we just add a new interface. I haven't double checked, but I guess that means per-obj ->atomic_set_prop functions plus a global ->atomic_check and ->atomic_commit.
2. We add a new drm_atomic_helper.c library which provides functions to implement all the legacy interfaces (page_flip, update_plane, set_prop) using atomic interfaces. We should be able to 1:1 reuse Rob's code for this, but instead of changing the actual current interface code we put that into helpers.
We don't need anything for cursor ioctls since cursor plane helpers already map the legacy cursor ioctls.
3. Rob's current code reuses the existing ->update_plane, ->pageflip and other entry points to implement the atomic commit helper functions. Imo that's a bad layering violation, and if we plug helpers in there we can't use them.
Instead I think we should add a new per-plane ->atomic_commit functions clearly marked as optional. Maybe even as part of an opaque plane_helper_funcs pointer like we have with crtc/encoder/connector and crtc helpers. msm would then implement it's atomic commit function in there (since it's the only driver currently supporting atomic for real).
3b. We could adjust crtc helpers to use the plane commit hook instead of the set_base function when avialable.
4. We do a pimped atomic helper based upon crtc helpers and the above plane commit function added in 3. It would essentially implement what Rob's current helper does, i.e.
Step 1: Shut down all crtcs which change using the crtc helpers. This step is obviously optional and ommitted when there's nothing to do.
Step 2: Loop over all planes and call ->plane_commit or whatever we will call the interface added in 3. above.
Step 3: Enable all crtcs that need enabling.
5. We start converting drivers. Every driver can convert at it's own pace, opting in for atomic behaviour step-by-step.
6. We optionally use the atomic interface in the fb helper. It's imo important to keep the code here parallel so that drivers can convert at their own leisure.
7. We add the atomic ioctl.
8. Various cleanups once 5. is completed for all drivers - which will likely take at least a year:
- Remove ->set_base from crtc helpers.
- Remove legacy functions from fbdev helpers.
- ...
I know this is a stack of work, but most of it just shuffles code around that already exists 1:1 in Rob's series. And I really think that this is where we should ultimately end up at, and going indirectly to that point will be much more painful.
Also note that nothing in here really touches shared code, so we can squeeze this into 3.17 even really late without risk to existing drivers. Imo it's too late already in the 3.17 cycle for the current series, which touches everything. If we get everything up to step 4. in now we can convert 1-2 drivers in 3.18 and enable the atomic ioctl after that.
And I realize that everyon will totally hate this because apparently google is making a hard move with adf and plans to enforce usage of that, so this entire thing is a bit ugly.
Cheers, Daniel
Quoted 124 lines
Rob Clark (5):
drm: add atomic fxns
drm: split propvals out and blob property support
drm: convert plane to properties/state
drm: convert crtc to properties/state drm/msm: add atomic supportSean Paul (1):
drm: Fix up the atomic legacy paths so they workVille Syrjälä (1):
drm: Refactor object property check codedrivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 14 +- drivers/gpu/drm/armada/armada_output.c | 3 +- drivers/gpu/drm/armada/armada_overlay.c | 14 +- drivers/gpu/drm/ast/ast_drv.c | 6 + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/ast/ast_mode.c | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 6 + drivers/gpu/drm/cirrus/cirrus_drv.h | 1 + drivers/gpu/drm/cirrus/cirrus_mode.c | 1 + drivers/gpu/drm/drm_atomic.c | 733 +++++++++++++++ drivers/gpu/drm/drm_crtc.c | 1351 ++++++++++++++++++--------- drivers/gpu/drm/drm_fb_helper.c | 55 +- drivers/gpu/drm/drm_irq.c | 8 +- drivers/gpu/drm/drm_modeset_lock.c | 28 + drivers/gpu/drm/drm_plane_helper.c | 2 + drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 7 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 +- drivers/gpu/drm/gma500/cdv_intel_crt.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 1 + drivers/gpu/drm/gma500/cdv_intel_dp.c | 7 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 7 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 10 +- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 12 +- drivers/gpu/drm/gma500/psb_drv.c | 7 + drivers/gpu/drm/gma500/psb_drv.h | 1 + drivers/gpu/drm/gma500/psb_intel_display.c | 1 + drivers/gpu/drm/gma500/psb_intel_drv.h | 4 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 10 +- drivers/gpu/drm/gma500/psb_intel_sdvo.c | 23 +- drivers/gpu/drm/i2c/ch7006_drv.c | 4 +- drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/intel_crt.c | 4 +- drivers/gpu/drm/i915/intel_display.c | 6 +- drivers/gpu/drm/i915/intel_dp.c | 7 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 7 +- drivers/gpu/drm/i915/intel_lvds.c | 4 +- drivers/gpu/drm/i915/intel_sdvo.c | 23 +- drivers/gpu/drm/i915/intel_sprite.c | 1 + drivers/gpu/drm/i915/intel_tv.c | 12 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 7 + drivers/gpu/drm/mgag200/mgag200_drv.h | 1 + drivers/gpu/drm/mgag200/mgag200_mode.c | 1 + drivers/gpu/drm/msm/Makefile | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 66 +- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 6 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 14 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 65 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 6 + drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 2 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 14 +- drivers/gpu/drm/msm/msm_atomic.c | 141 +++ drivers/gpu/drm/msm/msm_drv.c | 26 + drivers/gpu/drm/msm/msm_drv.h | 8 + drivers/gpu/drm/msm/msm_gem.c | 24 +- drivers/gpu/drm/msm/msm_gem.h | 13 + drivers/gpu/drm/msm/msm_kms.h | 1 + drivers/gpu/drm/nouveau/dispnv04/crtc.c | 1 + drivers/gpu/drm/nouveau/dispnv04/overlay.c | 13 +- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 3 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 7 + drivers/gpu/drm/nouveau/nouveau_drm.h | 1 + drivers/gpu/drm/nouveau/nv50_display.c | 1 + drivers/gpu/drm/omapdrm/omap_crtc.c | 16 +- drivers/gpu/drm/omapdrm/omap_drv.c | 12 +- drivers/gpu/drm/omapdrm/omap_drv.h | 4 +- drivers/gpu/drm/omapdrm/omap_plane.c | 10 +- drivers/gpu/drm/qxl/qxl_display.c | 6 +- drivers/gpu/drm/qxl/qxl_drv.c | 9 + drivers/gpu/drm/radeon/radeon_connectors.c | 9 +- drivers/gpu/drm/radeon/radeon_display.c | 2 + drivers/gpu/drm/radeon/radeon_drv.c | 9 + drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 + drivers/gpu/drm/rcar-du/rcar_du_drv.c | 7 + drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 3 +- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 12 +- drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 3 +- drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 6 +- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 7 + drivers/gpu/drm/shmobile/shmob_drm_plane.c | 2 + drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 1 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 + drivers/gpu/drm/tilcdc/tilcdc_drv.h | 1 + drivers/gpu/drm/tilcdc/tilcdc_slave.c | 3 +- drivers/gpu/drm/udl/udl_connector.c | 6 +- drivers/gpu/drm/udl/udl_drv.c | 8 + drivers/gpu/drm/udl/udl_modeset.c | 2 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 1 + include/drm/drmP.h | 80 ++ include/drm/drm_atomic.h | 170 ++++ include/drm/drm_crtc.h | 238 ++++- include/drm/drm_modeset_lock.h | 47 + include/uapi/drm/drm_mode.h | 3 + 102 files changed, 2901 insertions(+), 650 deletions(-) create mode 100644 drivers/gpu/drm/drm_atomic.c create mode 100644 drivers/gpu/drm/msm/msm_atomic.c create mode 100644 include/drm/drm_atomic.hSignature · 1 line
1.9.3
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 26 lines · Daniel Vetter
Quoted 16 lines · Rob Clark
This is mostly just a rebase+resend. Was going to send it a bit earlier but had a few things to fix up as a result of the rebase.
At this point, I think next steps are roughly:
1) introduceplane->mutex
2) decide what we want to do about events
3) add actual ioctlI think we could shoot for merging this series next, and then adding
plane->mutexin 3.18?Before we add the ioctl, I think we want to sort out events for updates to non-primary layers, and what the interface to drivers should look like. Ie. just add event to ->update_plane() or should we completely ditch ->page_flip() and ->update_plane()?
Quoted 5 lines
Technically, I think we could get away without a new API and just let drivers grab all the events in their ->atomic_commit(), but I suspect core could provide something more useful to drivers. I guess it would be useful to have a few more drivers converted over to see what makes sense.
Ok so we've had a lot of discussions about this on irc and overall I'm not terribly happy with what this looks like. I have a few concerns:
Quoted 6 lines
- The entire atomic conversion for drivers is monolithic, at least at the interface level. So if you want to do this step-by-step you're forced to add hacks and e.g. bypass pageflips until that's implemented. E.g. on i915 I see no chance that we'll get atomic ready for all cases (so nonblocking flips and multi-crtc and everything on all platforms) in one go.
So, there interface is *intended* to be monolithic, in a way.. many years ago, I started by adding side by side atomic vs legacy paths, and it was pretty ugly in core. I'm much happier with the current iteration.
A slightly later iteration preserved atomic helpers (so drivers could do completely their own thing). I ended up dropping that because most of what atomic does is manage the interface to whatever is doing modeset/pageflip/whatever. I completely expect some changes around the commit stuff.. that part is intended to either be wrapped/extended by the driver or replaced. Possibly it could be made more clear what drivers are expected to use vs extend or replace. I expect this to evolve a bit as more drivers are converted.
Note that the current atomic "layer" results in 1:1 conversion from old userspace API to legacy vfuncs. This way what is on top of atomic API and what is beneath (ie. the driver) has same code paths either way (old or new userspace, converted or not driver). The edge cases don't come in until atomic ioctl is exposed, and for that I expect a driver flag to enable the new ioctl. You could even set the flag based on hw generation if you want.
Quoted 7 lines
- Related to that is that we force legacy ioctls through atomic. E.g. on older i915 platforms I very much expect that we won't ever convert the pageflip code to atomic for them and just not support atomic flips of cursor + primary plane. At least not at the beginning. I know that's different from my stance a year ago, but I've become a bit more realistic.
Quoted 6 lines
- The entire conversion is monolithic and we can't do it on a driver-by-driver basis. Everyone has to go through the new atomic interfaces on a flag day. drm is much bigger now and forcing everyone to convert at the same time is really risky. Again I know I've changed my mind again, but drm is a lot bigger and there's a lot more drivers that implement pageflip and cursors, i.e. stuff that's special.
the only flag day part is plugging in atomic functions and couple vfunc API changes around set_prop().. the current design allows for conversion on driver by driver basis.
Quoted 4 lines
- The separation between interface marshalling code in the drm core and helper functions for drivers to implement stuff is fuzzy at best. Thus far we've had an excellent seperation in this are for kms, I don't think it's vise to throw that out.
Interface marshalling should not be helper. Everyone needs the same thing, since what is on top is the same.
Quoted 7 lines
So here's my proposal for how to get this in without breaking the world
1. We add a complete new set of ->atomic_foo driver entry points to all relevant objects. So instead of changing all the
set_propfunctions in a flag-day like operation we just add a new interface. I haven't double checked, but I guess that means per-obj ->atomic_set_prop functions plus a global ->atomic_check and ->atomic_commit.
that sounds much worse
Quoted 5 lines
2. We add a new
drm_atomic_helper.clibrary which provides functions to implement all the legacy interfaces (page_flip,update_plane,set_prop) using atomic interfaces. We should be able to 1:1 reuse Rob's code for this, but instead of changing the actual current interface code we put that into helpers.
So, I've started ripping out page_flip.. now w/ primary plane helpers we can do everything in terms of update_plane(). I have an idea to handle events. It isn't so bad, but forces me to do some re-arranging in drm/msm that I was planning to postpone otherwise.
(And I just got a fedex package w/ new toys, er, hardware.. but I'll try to finish this today)
Quoted 7 lines
We don't need anything for cursor ioctls since cursor plane helpers already map the legacy cursor ioctls.
3. Rob's current code reuses the existing ->update_plane, ->pageflip and other entry points to implement the atomic commit helper functions. Imo that's a bad layering violation, and if we plug helpers in there we can't use them.
Well, it is only a layering violation because you have a slightly different idea of where the layers should be. ;-)
Atomic (or really the state stuff.. maybe I should have called it "transaction" or something like that to avoid the atomic connotation..) should be on top of, not below, helpers.
Probably the commit part should be more clearly separated out and marked as "helper", because that is the part that is about taking the state that userspace (or fbdev) has asked for and applying it to the hw. This is really the part where drivers for some hw might want to do something different. Although I admit lumping it in w/ drm_atomic.c makes this not very clear.
And then beneath atomic we introduce new interfaces (if needed.. although update_plane isn't so bad once we toss out page_flip). We could introduce new ->commit_state() vfuncs, and alternate set of commit helper which uses those.. at least for planes I suspect ->commit_state() ends up looking a lot like ->update_plane.
Quoted 8 lines
Instead I think we should add a new per-plane ->atomic_commit functions clearly marked as optional. Maybe even as part of an opaque
plane_helper_funcspointer like we have with crtc/encoder/connector and crtc helpers. msm would then implement it's atomic commit function in there (since it's the only driver currently supporting atomic for real).3b. We could adjust crtc helpers to use the plane commit hook instead of the
set_basefunction when avialable.
would be a nice cleanup either way.. but I think it is independent..
Quoted 10 lines
4. We do a pimped atomic helper based upon crtc helpers and the above plane commit function added in 3. It would essentially implement what Rob's current helper does, i.e.
Step 1: Shut down all crtcs which change using the crtc helpers. This step is obviously optional and ommitted when there's nothing to do.
Step 2: Loop over all planes and call ->plane_commit or whatever we will call the interface added in 3. above.
Quoted 8 lines
Step 3: Enable all crtcs that need enabling.
5. We start converting drivers. Every driver can convert at it's own pace, opting in for atomic behaviour step-by-step.
6. We optionally use the atomic interface in the fb helper. It's imo important to keep the code here parallel so that drivers can convert at their own leisure.
this is one thing I really wanted to avoid. It was already getting ugly the first time I tried it, and I hadn't even converted everything.
BR,
-R
Quoted 146 lines
7. We add the atomic ioctl.
8. Various cleanups once 5. is completed for all drivers - which will likely take at least a year:
- Remove ->set_base from crtc helpers.
- Remove legacy functions from fbdev helpers.
- ...I know this is a stack of work, but most of it just shuffles code around that already exists 1:1 in Rob's series. And I really think that this is where we should ultimately end up at, and going indirectly to that point will be much more painful.
Also note that nothing in here really touches shared code, so we can squeeze this into 3.17 even really late without risk to existing drivers. Imo it's too late already in the 3.17 cycle for the current series, which touches everything. If we get everything up to step 4. in now we can convert 1-2 drivers in 3.18 and enable the atomic ioctl after that.
And I realize that everyon will totally hate this because apparently google is making a hard move with adf and plans to enforce usage of that, so this entire thing is a bit ugly.
Cheers, Daniel
Quoted 121 lines
Rob Clark (5):
drm: add atomic fxns
drm: split propvals out and blob property support
drm: convert plane to properties/state
drm: convert crtc to properties/state drm/msm: add atomic supportSean Paul (1):
drm: Fix up the atomic legacy paths so they workVille Syrjälä (1):
drm: Refactor object property check codedrivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/armada/armada_crtc.c | 14 +- drivers/gpu/drm/armada/armada_output.c | 3 +- drivers/gpu/drm/armada/armada_overlay.c | 14 +- drivers/gpu/drm/ast/ast_drv.c | 6 + drivers/gpu/drm/ast/ast_drv.h | 1 + drivers/gpu/drm/ast/ast_mode.c | 1 + drivers/gpu/drm/cirrus/cirrus_drv.c | 6 + drivers/gpu/drm/cirrus/cirrus_drv.h | 1 + drivers/gpu/drm/cirrus/cirrus_mode.c | 1 + drivers/gpu/drm/drm_atomic.c | 733 +++++++++++++++ drivers/gpu/drm/drm_crtc.c | 1351 ++++++++++++++++++--------- drivers/gpu/drm/drm_fb_helper.c | 55 +- drivers/gpu/drm/drm_irq.c | 8 +- drivers/gpu/drm/drm_modeset_lock.c | 28 + drivers/gpu/drm/drm_plane_helper.c | 2 + drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 7 + drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 +- drivers/gpu/drm/gma500/cdv_intel_crt.c | 4 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 1 + drivers/gpu/drm/gma500/cdv_intel_dp.c | 7 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 7 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 10 +- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 12 +- drivers/gpu/drm/gma500/psb_drv.c | 7 + drivers/gpu/drm/gma500/psb_drv.h | 1 + drivers/gpu/drm/gma500/psb_intel_display.c | 1 + drivers/gpu/drm/gma500/psb_intel_drv.h | 4 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 10 +- drivers/gpu/drm/gma500/psb_intel_sdvo.c | 23 +- drivers/gpu/drm/i2c/ch7006_drv.c | 4 +- drivers/gpu/drm/i915/i915_drv.c | 8 + drivers/gpu/drm/i915/intel_crt.c | 4 +- drivers/gpu/drm/i915/intel_display.c | 6 +- drivers/gpu/drm/i915/intel_dp.c | 7 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 7 +- drivers/gpu/drm/i915/intel_lvds.c | 4 +- drivers/gpu/drm/i915/intel_sdvo.c | 23 +- drivers/gpu/drm/i915/intel_sprite.c | 1 + drivers/gpu/drm/i915/intel_tv.c | 12 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 7 + drivers/gpu/drm/mgag200/mgag200_drv.h | 1 + drivers/gpu/drm/mgag200/mgag200_mode.c | 1 + drivers/gpu/drm/msm/Makefile | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 66 +- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 6 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h | 1 + drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 14 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 65 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 6 + drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 2 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 14 +- drivers/gpu/drm/msm/msm_atomic.c | 141 +++ drivers/gpu/drm/msm/msm_drv.c | 26 + drivers/gpu/drm/msm/msm_drv.h | 8 + drivers/gpu/drm/msm/msm_gem.c | 24 +- drivers/gpu/drm/msm/msm_gem.h | 13 + drivers/gpu/drm/msm/msm_kms.h | 1 + drivers/gpu/drm/nouveau/dispnv04/crtc.c | 1 + drivers/gpu/drm/nouveau/dispnv04/overlay.c | 13 +- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 3 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 7 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 7 + drivers/gpu/drm/nouveau/nouveau_drm.h | 1 + drivers/gpu/drm/nouveau/nv50_display.c | 1 + drivers/gpu/drm/omapdrm/omap_crtc.c | 16 +- drivers/gpu/drm/omapdrm/omap_drv.c | 12 +- drivers/gpu/drm/omapdrm/omap_drv.h | 4 +- drivers/gpu/drm/omapdrm/omap_plane.c | 10 +- drivers/gpu/drm/qxl/qxl_display.c | 6 +- drivers/gpu/drm/qxl/qxl_drv.c | 9 + drivers/gpu/drm/radeon/radeon_connectors.c | 9 +- drivers/gpu/drm/radeon/radeon_display.c | 2 + drivers/gpu/drm/radeon/radeon_drv.c | 9 + drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 + drivers/gpu/drm/rcar-du/rcar_du_drv.c | 7 + drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 3 +- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 12 +- drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 3 +- drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 6 +- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 7 + drivers/gpu/drm/shmobile/shmob_drm_plane.c | 2 + drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 1 + drivers/gpu/drm/tilcdc/tilcdc_drv.c | 6 + drivers/gpu/drm/tilcdc/tilcdc_drv.h | 1 + drivers/gpu/drm/tilcdc/tilcdc_slave.c | 3 +- drivers/gpu/drm/udl/udl_connector.c | 6 +- drivers/gpu/drm/udl/udl_drv.c | 8 + drivers/gpu/drm/udl/udl_modeset.c | 2 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 +- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 1 + include/drm/drmP.h | 80 ++ include/drm/drm_atomic.h | 170 ++++ include/drm/drm_crtc.h | 238 ++++- include/drm/drm_modeset_lock.h | 47 + include/uapi/drm/drm_mode.h | 3 + 102 files changed, 2901 insertions(+), 650 deletions(-) create mode 100644 drivers/gpu/drm/drm_atomic.c create mode 100644 drivers/gpu/drm/msm/msm_atomic.c create mode 100644 include/drm/drm_atomic.h
Quoted 8 lines
Quoted 3 lines
--
1.9.3--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 74 lines · Rob Clark
Quoted 26 lines · Daniel Vetter
Quoted 16 lines · Rob Clark
This is mostly just a rebase+resend. Was going to send it a bit earlier but had a few things to fix up as a result of the rebase.
At this point, I think next steps are roughly:
1) introduceplane->mutex
2) decide what we want to do about events
3) add actual ioctlI think we could shoot for merging this series next, and then adding
plane->mutexin 3.18?Before we add the ioctl, I think we want to sort out events for updates to non-primary layers, and what the interface to drivers should look like. Ie. just add event to ->update_plane() or should we completely ditch ->page_flip() and ->update_plane()?
Quoted 5 lines
Technically, I think we could get away without a new API and just let drivers grab all the events in their ->atomic_commit(), but I suspect core could provide something more useful to drivers. I guess it would be useful to have a few more drivers converted over to see what makes sense.
Ok so we've had a lot of discussions about this on irc and overall I'm not terribly happy with what this looks like. I have a few concerns:
Quoted 6 lines
- The entire atomic conversion for drivers is monolithic, at least at the interface level. So if you want to do this step-by-step you're forced to add hacks and e.g. bypass pageflips until that's implemented. E.g. on i915 I see no chance that we'll get atomic ready for all cases (so nonblocking flips and multi-crtc and everything on all platforms) in one go.
So, there interface is *intended* to be monolithic, in a way.. many years ago, I started by adding side by side atomic vs legacy paths, and it was pretty ugly in core. I'm much happier with the current iteration.
A slightly later iteration preserved atomic helpers (so drivers could do completely their own thing). I ended up dropping that because most of what atomic does is manage the interface to whatever is doing modeset/pageflip/whatever. I completely expect some changes around the commit stuff.. that part is intended to either be wrapped/extended by the driver or replaced. Possibly it could be made more clear what drivers are expected to use vs extend or replace. I expect this to evolve a bit as more drivers are converted.
Note that the current atomic "layer" results in 1:1 conversion from old userspace API to legacy vfuncs. This way what is on top of atomic API and what is beneath (ie. the driver) has same code paths either way (old or new userspace, converted or not driver). The edge cases don't come in until atomic ioctl is exposed, and for that I expect a driver flag to enable the new ioctl. You could even set the flag based on hw generation if you want.
Quoted 7 lines
- Related to that is that we force legacy ioctls through atomic. E.g. on older i915 platforms I very much expect that we won't ever convert the pageflip code to atomic for them and just not support atomic flips of cursor + primary plane. At least not at the beginning. I know that's different from my stance a year ago, but I've become a bit more realistic.
Quoted 6 lines
- The entire conversion is monolithic and we can't do it on a driver-by-driver basis. Everyone has to go through the new atomic interfaces on a flag day. drm is much bigger now and forcing everyone to convert at the same time is really risky. Again I know I've changed my mind again, but drm is a lot bigger and there's a lot more drivers that implement pageflip and cursors, i.e. stuff that's special.
the only flag day part is plugging in atomic functions and couple vfunc API changes around
set_prop().. the current design allows for conversion on driver by driver basis.
Quoted 7 lines
Quoted 4 lines
- The separation between interface marshalling code in the drm core and helper functions for drivers to implement stuff is fuzzy at best. Thus far we've had an excellent seperation in this are for kms, I don't think it's vise to throw that out.
Interface marshalling should not be helper. Everyone needs the same thing, since what is on top is the same.
Erhm I've certainly not meant the interface marshalling to be a helper. This started with "The separation ..." after all, so I want inteface marshilling as fixed code in the drm core, and everything else outside in a separate drm_atomic_helper.c module.
Quoted 9 lines
Quoted 7 lines
So here's my proposal for how to get this in without breaking the world
1. We add a complete new set of ->atomic_foo driver entry points to all relevant objects. So instead of changing all the
set_propfunctions in a flag-day like operation we just add a new interface. I haven't double checked, but I guess that means per-obj ->atomic_set_prop functions plus a global ->atomic_check and ->atomic_commit.that sounds much worse
Why that? Afaics your patch only changes the interfaces but leaves the semantics the same (i915 does set_config_internal all over the place in set_prop). So essentially you have both interface, but merged into one. And especially for the set_prop the semantics our different.
Quoted 6 lines
Quoted 5 lines
2. We add a new
drm_atomic_helper.clibrary which provides functions to implement all the legacy interfaces (page_flip,update_plane,set_prop) using atomic interfaces. We should be able to 1:1 reuse Rob's code for this, but instead of changing the actual current interface code we put that into helpers.
Quoted 7 lines
So, I've started ripping out
page_flip.. now w/ primary plane helpers we can do everything in terms ofupdate_plane(). I have an idea to handle events. It isn't so bad, but forces me to do some re-arranging in drm/msm that I was planning to postpone otherwise.(And I just got a fedex package w/ new toys, er, hardware.. but I'll try to finish this today)
Well in that case I think we should demote ->update_plane and friends to helper status, since for a proper atomic implemenation for i915 we can't use them.
Quoted 8 lines
Quoted 7 lines
We don't need anything for cursor ioctls since cursor plane helpers already map the legacy cursor ioctls.
3. Rob's current code reuses the existing ->update_plane, ->pageflip and other entry points to implement the atomic commit helper functions. Imo that's a bad layering violation, and if we plug helpers in there we can't use them.
Quoted 6 lines
Well, it is only a layering violation because you have a slightly different idea of where the layers should be. ;-)
Atomic (or really the state stuff.. maybe I should have called it "transaction" or something like that to avoid the atomic connotation..) should be on top of, not below, helpers.
I'm talking only about the legacy interfaces here, and my thinking is that we should not add a midlayer here (the atomic helper stuff) but directly pass it to drivers. They can the choose how to implement this.
With the current scheme I essentially have to add a bunch of hacks for i915 to fish out the old pageflip semantics to keep gen2 going. That's fairly ugly, and the only reason is that you force a midlay between the existing legacy ioctls and i915.
Of course for the actual atomic ioctl I don't want this inversion. But that's not what I'm talking about here.
Quoted 7 lines
Probably the commit part should be more clearly separated out and marked as "helper", because that is the part that is about taking the state that userspace (or fbdev) has asked for and applying it to the hw. This is really the part where drivers for some hw might want to do something different. Although I admit lumping it in w/
drm_atomic.cmakes this not very clear.
Quoted 5 lines
And then beneath atomic we introduce new interfaces (if needed.. although
update_planeisn't so bad once we toss outpage_flip). We could introduce new ->commit_state() vfuncs, and alternate set of commit helper which uses those.. at least for planes I suspect ->commit_state() ends up looking a lot like ->update_plane.
All ok with me, but really not my concern. This is all for drivers which support atomic, I'll have a driver which will (at least partially and likely forever) not support atomic everywhere.
Quoted 10 lines
Quoted 8 lines
Instead I think we should add a new per-plane ->atomic_commit functions clearly marked as optional. Maybe even as part of an opaque
plane_helper_funcspointer like we have with crtc/encoder/connector and crtc helpers. msm would then implement it's atomic commit function in there (since it's the only driver currently supporting atomic for real).3b. We could adjust crtc helpers to use the plane commit hook instead of the
set_basefunction when avialable.would be a nice cleanup either way.. but I think it is independent..
I think I've raised this a few times in the past, but imo having somewhat clear helper semantics would help. Atm they try to do a bit too much (legacy support, generic helpers, interface with crtc helpers without changing too much) and don't look good in any of them.
Quoted 15 lines
Quoted 15 lines
4. We do a pimped atomic helper based upon crtc helpers and the above plane commit function added in 3. It would essentially implement what Rob's current helper does, i.e.
Step 1: Shut down all crtcs which change using the crtc helpers. This step is obviously optional and ommitted when there's nothing to do.
Step 2: Loop over all planes and call ->plane_commit or whatever we will call the interface added in 3. above.
Step 3: Enable all crtcs that need enabling.
5. We start converting drivers. Every driver can convert at it's own pace, opting in for atomic behaviour step-by-step.
Quoted 7 lines
Quoted 3 lines
6. We optionally use the atomic interface in the fb helper. It's imo important to keep the code here parallel so that drivers can convert at their own leisure.
this is one thing I really wanted to avoid. It was already getting ugly the first time I tried it, and I hadn't even converted everything.
Well I think we can't avoid ugliness in that area. There simply will be parallel support for atomic in different drivers.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 80 lines · Daniel Vetter
Quoted 79 lines · Rob Clark
Quoted 26 lines · Daniel Vetter
Quoted 16 lines · Rob Clark
This is mostly just a rebase+resend. Was going to send it a bit earlier but had a few things to fix up as a result of the rebase.
At this point, I think next steps are roughly:
1) introduceplane->mutex
2) decide what we want to do about events
3) add actual ioctlI think we could shoot for merging this series next, and then adding
plane->mutexin 3.18?Before we add the ioctl, I think we want to sort out events for updates to non-primary layers, and what the interface to drivers should look like. Ie. just add event to ->update_plane() or should we completely ditch ->page_flip() and ->update_plane()?
Quoted 5 lines
Technically, I think we could get away without a new API and just let drivers grab all the events in their ->atomic_commit(), but I suspect core could provide something more useful to drivers. I guess it would be useful to have a few more drivers converted over to see what makes sense.
Ok so we've had a lot of discussions about this on irc and overall I'm not terribly happy with what this looks like. I have a few concerns:
Quoted 6 lines
- The entire atomic conversion for drivers is monolithic, at least at the interface level. So if you want to do this step-by-step you're forced to add hacks and e.g. bypass pageflips until that's implemented. E.g. on i915 I see no chance that we'll get atomic ready for all cases (so nonblocking flips and multi-crtc and everything on all platforms) in one go.
So, there interface is *intended* to be monolithic, in a way.. many years ago, I started by adding side by side atomic vs legacy paths, and it was pretty ugly in core. I'm much happier with the current iteration.
A slightly later iteration preserved atomic helpers (so drivers could do completely their own thing). I ended up dropping that because most of what atomic does is manage the interface to whatever is doing modeset/pageflip/whatever. I completely expect some changes around the commit stuff.. that part is intended to either be wrapped/extended by the driver or replaced. Possibly it could be made more clear what drivers are expected to use vs extend or replace. I expect this to evolve a bit as more drivers are converted.
Note that the current atomic "layer" results in 1:1 conversion from old userspace API to legacy vfuncs. This way what is on top of atomic API and what is beneath (ie. the driver) has same code paths either way (old or new userspace, converted or not driver). The edge cases don't come in until atomic ioctl is exposed, and for that I expect a driver flag to enable the new ioctl. You could even set the flag based on hw generation if you want.
Quoted 7 lines
- Related to that is that we force legacy ioctls through atomic. E.g. on older i915 platforms I very much expect that we won't ever convert the pageflip code to atomic for them and just not support atomic flips of cursor + primary plane. At least not at the beginning. I know that's different from my stance a year ago, but I've become a bit more realistic.
Quoted 6 lines
- The entire conversion is monolithic and we can't do it on a driver-by-driver basis. Everyone has to go through the new atomic interfaces on a flag day. drm is much bigger now and forcing everyone to convert at the same time is really risky. Again I know I've changed my mind again, but drm is a lot bigger and there's a lot more drivers that implement pageflip and cursors, i.e. stuff that's special.
the only flag day part is plugging in atomic functions and couple vfunc API changes around
set_prop().. the current design allows for conversion on driver by driver basis.Quoted 4 lines
- The separation between interface marshalling code in the drm core and helper functions for drivers to implement stuff is fuzzy at best. Thus far we've had an excellent seperation in this are for kms, I don't think it's vise to throw that out.
Quoted 7 lines
Quoted 2 lines
Interface marshalling should not be helper. Everyone needs the same thing, since what is on top is the same.
Erhm I've certainly not meant the interface marshalling to be a helper. This started with "The separation ..." after all, so I want inteface marshilling as fixed code in the drm core, and everything else outside in a separate
drm_atomic_helper.cmodule.
ok, it's entirely possibly that I'm missunderstanding a bit your proposal..
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
So here's my proposal for how to get this in without breaking the world
1. We add a complete new set of ->atomic_foo driver entry points to all relevant objects. So instead of changing all the
set_propfunctions in a flag-day like operation we just add a new interface. I haven't double checked, but I guess that means per-obj ->atomic_set_prop functions plus a global ->atomic_check and ->atomic_commit.
Quoted 6 lines
Quoted 1 line
that sounds much worse
Why that? Afaics your patch only changes the interfaces but leaves the semantics the same (i915 does
set_config_internalall over the place inset_prop). So essentially you have both interface, but merged into one. And especially for theset_propthe semantics our different.
well, it was the doubling up of code paths in core for handling legacy and atomic side-by-side that I was trying to avoid
I do remember seeing i915 set_config_internal (looks like it has been refactored into intel_set_mode()).. iirc, it was all on connector->set_prop(), so it would essentially be it's own atomic/transaction.
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines
2. We add a new
drm_atomic_helper.clibrary which provides functions to implement all the legacy interfaces (page_flip,update_plane,set_prop) using atomic interfaces. We should be able to 1:1 reuse Rob's code for this, but instead of changing the actual current interface code we put that into helpers.So, I've started ripping out
page_flip.. now w/ primary plane helpers we can do everything in terms ofupdate_plane(). I have an idea to handle events. It isn't so bad, but forces me to do some re-arranging in drm/msm that I was planning to postpone otherwise.
Quoted 6 lines
Quoted 2 lines
(And I just got a fedex package w/ new toys, er, hardware.. but I'll try to finish this today)
Well in that case I think we should demote ->update_plane and friends to helper status, since for a proper atomic implemenation for i915 we can't use them.
->update_plane() probably should have been helper all along (but I'd kinda like to get something merged before we do too much other cleanup.. I spend enough of my time rebasing patches..)
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
We don't need anything for cursor ioctls since cursor plane helpers already map the legacy cursor ioctls.
3. Rob's current code reuses the existing ->update_plane, ->pageflip and other entry points to implement the atomic commit helper functions. Imo that's a bad layering violation, and if we plug helpers in there we can't use them.
Well, it is only a layering violation because you have a slightly different idea of where the layers should be. ;-)
Quoted 7 lines
Quoted 3 lines
Atomic (or really the state stuff.. maybe I should have called it "transaction" or something like that to avoid the atomic connotation..) should be on top of, not below, helpers.
I'm talking only about the legacy interfaces here, and my thinking is that we should not add a midlayer here (the atomic helper stuff) but directly pass it to drivers. They can the choose how to implement this.
so you actually have exactly what you want already.. just rename 'struct drm_atomic_funcs' to 'struct drm_atomic_helper_funcs' and your own i915_atomic_commit() fxn.
Quoted 4 lines
With the current scheme I essentially have to add a bunch of hacks for i915 to fish out the old pageflip semantics to keep gen2 going. That's fairly ugly, and the only reason is that you force a midlay between the existing legacy ioctls and i915.
not quite sure I follow.. isn't that what primary-plane helpers are supposed to do for you?
update: oh, I guess they don't.. that sort of screws my plan to move over to just ->update_plane().
Quoted 16 lines
Of course for the actual atomic ioctl I don't want this inversion. But that's not what I'm talking about here.
Quoted 7 lines
Probably the commit part should be more clearly separated out and marked as "helper", because that is the part that is about taking the state that userspace (or fbdev) has asked for and applying it to the hw. This is really the part where drivers for some hw might want to do something different. Although I admit lumping it in w/
drm_atomic.cmakes this not very clear.Quoted 5 lines
And then beneath atomic we introduce new interfaces (if needed.. although
update_planeisn't so bad once we toss outpage_flip). We could introduce new ->commit_state() vfuncs, and alternate set of commit helper which uses those.. at least for planes I suspect ->commit_state() ends up looking a lot like ->update_plane.
Quoted 3 lines
All ok with me, but really not my concern. This is all for drivers which support atomic, I'll have a driver which will (at least partially and likely forever) not support atomic everywhere.
admittedly it wasn't a case I thought of much (one driver, supporting atomic for only certain generations).. although I don't particularly see the problem here. You might just need to plug in different helper fxn ptrs depending on generation.
Quoted 35 lines
Quoted 10 lines
Quoted 8 lines
Instead I think we should add a new per-plane ->atomic_commit functions clearly marked as optional. Maybe even as part of an opaque
plane_helper_funcspointer like we have with crtc/encoder/connector and crtc helpers. msm would then implement it's atomic commit function in there (since it's the only driver currently supporting atomic for real).3b. We could adjust crtc helpers to use the plane commit hook instead of the
set_basefunction when avialable.would be a nice cleanup either way.. but I think it is independent..
I think I've raised this a few times in the past, but imo having somewhat clear helper semantics would help. Atm they try to do a bit too much (legacy support, generic helpers, interface with crtc helpers without changing too much) and don't look good in any of them.
Quoted 19 lines
Quoted 18 lines
4. We do a pimped atomic helper based upon crtc helpers and the above plane commit function added in 3. It would essentially implement what Rob's current helper does, i.e.
Step 1: Shut down all crtcs which change using the crtc helpers. This step is obviously optional and ommitted when there's nothing to do.
Step 2: Loop over all planes and call ->plane_commit or whatever we will call the interface added in 3. above.
Step 3: Enable all crtcs that need enabling.
5. We start converting drivers. Every driver can convert at it's own pace, opting in for atomic behaviour step-by-step.
6. We optionally use the atomic interface in the fb helper. It's imo important to keep the code here parallel so that drivers can convert at their own leisure.
Quoted 6 lines
Quoted 3 lines
this is one thing I really wanted to avoid. It was already getting ugly the first time I tried it, and I hadn't even converted everything.
Well I think we can't avoid ugliness in that area. There simply will be parallel support for atomic in different drivers.
I think it is avoidable. I mean, I've used my patchset on an unconverted i915 (as well as both converted and unconverted msm).. the commit helper part of things successfully turns legacy APIs back into legacy vfunc calls.
BR,
-R
Quoted 5 lines
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
On Thu, Jul 24, 2014 at 10:56:07AM -0400, Rob Clark wrote:
[snip]
Quoted 1 line
ok, it's entirely possibly that I'm missunderstanding a bit your proposal..
Yeah I get that feeling a bit too. I'll cut out the technical details for now and will try to concentrate on one example. Maybe that clarifies.
[snip]
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
So here's my proposal for how to get this in without breaking the world
1. We add a complete new set of ->atomic_foo driver entry points to all relevant objects. So instead of changing all the
set_propfunctions in a flag-day like operation we just add a new interface. I haven't double checked, but I guess that means per-obj ->atomic_set_prop functions plus a global ->atomic_check and ->atomic_commit.Quoted 6 lines
Quoted 1 line
that sounds much worse
Why that? Afaics your patch only changes the interfaces but leaves the semantics the same (i915 does
set_config_internalall over the place inset_prop). So essentially you have both interface, but merged into one. And especially for theset_propthe semantics our different.
Quoted 7 lines
well, it was the doubling up of code paths in core for handling legacy and atomic side-by-side that I was trying to avoid
I do remember seeing i915
set_config_internal(looks like it has been refactored intointel_set_mode()).. iirc, it was all onconnector->set_prop(), so it would essentially be it's own atomic/transaction.
So currently our set_prop functions work like that:
1. We parse the property, sanity check it and store it in the relevant object structure.
2. We check whether (after all the checking and parsing) there has been an actual change in configuration. E.g. for the audio stuff if the use sets back to "auto" we check whether the old config matches the new autoconfig state or not. So it's not just "has the prop value changed", we actually diff the resulting hw config.
3. If there is a change, we update the hw state with a call to mode_set iff the pipe is on.
There's a few reasons why this works and why it looks like that.
- Our internal mode set code currently doesn't notice changes in property values. We plan to fix this eventually by shuffling the compute_config code around, but that's a lot of work.
- Our internal mode set function _always_ forces a full modeset on the crtc you pass it (besides doing modeset on other crtcs where tracked state has changed). We need to have this hack to make the above set_prop sequence work.
Now with atomic we want completely different semantics:
- Set_prop only updates state. We need to drop the state computation and diffing and the forced mode_set.
- The eventual commit will force a mode_set. Note that calling ->set_config will not be enough since that doesn't have the "force full mode-set" hack which the internal version has. And we can't do this since userspace uses set_crtc/->set_config to update frontbuffers which absolutely must not result in a full modeset.
So looking just at the ->set_prop function we have 2 completely different semantics. Now I agree that with your patch i915 keeps on working. But the problem I have is converting i915 over to the new world. Since you've removed the old entry point I am left with no other choice than to convert everything at once. And there's a lot more than just the hdmi audio property - page_flip has slightly different semantics with atomic, update_plane dito, set-crtc the same.
Which means I either have to convert i915 in one go (impossible given the usual churn I face) or I just end up implementing the infrastructure I've asked for (which means I get to reinstante all the old legacy ioctl paths). Since with the doubled-up entry points I can e.g. just convert hdmi set_prop to atomic, which means I have a minimal use-case to validate the core infrastructure in i915 (i.e. the state diffing we need to improve in the mode_set code) and can ignore all the nonsense in the tv connectors and sdvo encoders and plane props and crtcs props and hacked-up other crap we have all around. It's still going to be a major pain, but I expect the transition to be much more smoothly.
My experience with the universal plane stuff really is that even slight semantic differences in the interfaces bite you hard and there's no way to work around that. The only sane way really is to have parallel entry points with helpers so that transitioned drivers can remap legacy interfaces to the more powerful new ones.
I hope this explains a bit better where I see the big risk with your approach and what exactly I'm proposing.
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 54 lines · Daniel Vetter
On Thu, Jul 24, 2014 at 10:56:07AM -0400, Rob Clark wrote:
[snip]Quoted 1 line
ok, it's entirely possibly that I'm missunderstanding a bit your proposal..
Yeah I get that feeling a bit too. I'll cut out the technical details for now and will try to concentrate on one example. Maybe that clarifies.
[snip]
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
So here's my proposal for how to get this in without breaking the world
1. We add a complete new set of ->atomic_foo driver entry points to all relevant objects. So instead of changing all the
set_propfunctions in a flag-day like operation we just add a new interface. I haven't double checked, but I guess that means per-obj ->atomic_set_prop functions plus a global ->atomic_check and ->atomic_commit.Quoted 6 lines
Quoted 1 line
that sounds much worse
Why that? Afaics your patch only changes the interfaces but leaves the semantics the same (i915 does
set_config_internalall over the place inset_prop). So essentially you have both interface, but merged into one. And especially for theset_propthe semantics our different.Quoted 7 lines
well, it was the doubling up of code paths in core for handling legacy and atomic side-by-side that I was trying to avoid
I do remember seeing i915
set_config_internal(looks like it has been refactored intointel_set_mode()).. iirc, it was all onconnector->set_prop(), so it would essentially be it's own atomic/transaction.So currently our
set_propfunctions work like that:
1. We parse the property, sanity check it and store it in the relevant object structure.
2. We check whether (after all the checking and parsing) there has been an actual change in configuration. E.g. for the audio stuff if the use sets back to "auto" we check whether the old config matches the new autoconfig state or not. So it's not just "has the prop value changed", we actually diff the resulting hw config.
3. If there is a change, we update the hw state with a call tomode_setiff the pipe is on.There's a few reasons why this works and why it looks like that.
- Our internal mode set code currently doesn't notice changes in property values. We plan to fix this eventually by shuffling thecompute_configcode around, but that's a lot of work.
- Our internal mode set function _always_ forces a full modeset on the crtc you pass it (besides doing modeset on other crtcs where tracked state has changed). We need to have this hack to make the aboveset_propsequence work.
Quoted 3 lines
Now with atomic we want completely different semantics:
-Set_proponly updates state. We need to drop the state computation and diffing and the forcedmode_set.
So probably the first thing, is that we need to bring connectors into the atomic game.. probably that is something that i915 should take the lead on, since you actually have a bunch of connector properties which, from the sounds of it, should play by atomic rules. I don't have anything as complicated in msm, and wasn't entirely sure what would be needed for connectors, so I punted on that part.
That said, crtc_state->set_config, etc, flags should be what you need to know if you need a full modeset or not. You just need your connector's set_prop to grab the appropriate crtc_state and set the appropriate flag(s). So I'm not sure that I see any fundamental problem here[*].
[*] well, combining connector changes w/ connector property changes perhaps.. you may actually need your ->atomic_check() step to propagate the "I need a modeset" flag from connector to crtc.. but otoh a connector change is a full modeset, so maybe not.
Quoted 25 lines
- The eventual commit will force a
mode_set. Note that calling ->set_config will not be enough since that doesn't have the "force full mode-set" hack which the internal version has. And we can't do this since userspace uses set_crtc/->set_config to update frontbuffers which absolutely must not result in a full modeset.So looking just at the ->set_prop function we have 2 completely different semantics. Now I agree that with your patch i915 keeps on working. But the problem I have is converting i915 over to the new world. Since you've removed the old entry point I am left with no other choice than to convert everything at once. And there's a lot more than just the hdmi audio property -
page_fliphas slightly different semantics with atomic,update_planedito, set-crtc the same.Which means I either have to convert i915 in one go (impossible given the usual churn I face) or I just end up implementing the infrastructure I've asked for (which means I get to reinstante all the old legacy ioctl paths). Since with the doubled-up entry points I can e.g. just convert hdmi
set_propto atomic, which means I have a minimal use-case to validate the core infrastructure in i915 (i.e. the state diffing we need to improve in themode_setcode) and can ignore all the nonsense in the tv connectors and sdvo encoders and plane props and crtcs props and hacked-up other crap we have all around. It's still going to be a major pain, but I expect the transition to be much more smoothly.
Quoted 8 lines
My experience with the universal plane stuff really is that even slight semantic differences in the interfaces bite you hard and there's no way to work around that. The only sane way really is to have parallel entry points with helpers so that transitioned drivers can remap legacy interfaces to the more powerful new ones.
I hope this explains a bit better where I see the big risk with your approach and what exactly I'm proposing.
Well, I'm still not convinced that my approach won't work.. at the end of the day it is turning old interface -> new -> old. And as long as the new->old step is only having to deal with the subset of the new more powerful API that was the old interface, the round-trip should be doable/straightforward.
But I agree that your approach is more conservative, in that it is more obviously not touching legacy stuff. Although I'm not completely sure yet how atomic helpers and crtc helpers fit together with your approach. I am really not ready to ditch crtc helpers for modeset yet in msm. I suppose that is mostly a matter of where the new vfuncs live (esp. if we have both atomic and non-atomic versions of ->set_prop())..
I've got some other things to finish first, but I'll probably cook up a patch to convert drm_display_mode to a refcnt'd object, which will let me use display mode ptrs in drm_crtc_state, and gets rid of the biggest awkwardness that I was seeing with your approach.
After that, I suppose I can give your proposal a try. The change shuffles things around quite a bit, so I doubt I'll have time to finish it before the merge window, although as you point out it wouldn't really effect any existing driver so probably safe for later -rc merge. Not sure that I'd have the driver bits for msm ready in time, but I guess even if we were not ready to merge any driver bits, it might be more convenient for everyone to have the core bits in place the kernel before for merging driver bits in 3.18...
BR,
-R
Quoted 5 lines
Cheers, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch