From 712a0dd91c4a5936fa00a24fa4e0100f982ad516 Mon Sep 17 00:00:00 2001 From: Sonika Jindal Date: Thu, 28 May 2015 16:35:07 +0530 Subject: [PATCH 1/6] Documentation/drm: Update rotation property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moving rotation property to "Drm" and removing from i915 and omap. Also, adding description to the property Cc: DRI Development Suggested-by: Ville Syrjälä Signed-off-by: Sonika Jindal Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 41 +++++++++++++++------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 109fde8b4a28..c0312cbd023d 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -2585,7 +2585,22 @@ void intel_crt_init(struct drm_device *dev) Description/Restrictions - DRM + DRM + Generic + “rotation” + BITMASK + { 0, "rotate-0" }, + { 1, "rotate-90" }, + { 2, "rotate-180" }, + { 3, "rotate-270" }, + { 4, "reflect-x" }, + { 5, "reflect-y" } + CRTC, Plane + rotate-(degrees) rotates the image by the specified amount in degrees + in counter clockwise direction. reflect-x and reflect-y reflects the + image along the specified axis prior to rotation + + Connector “EDID” BLOB | IMMUTABLE @@ -2846,7 +2861,7 @@ void intel_crt_init(struct drm_device *dev) TBD - i915 + i915 Generic "Broadcast RGB" ENUM @@ -2862,14 +2877,6 @@ void intel_crt_init(struct drm_device *dev) TBD - Plane - “rotation” - BITMASK - { 0, "rotate-0" }, { 2, "rotate-180" } - Plane - TBD - - SDVO-TV “mode” ENUM @@ -3377,19 +3384,7 @@ void intel_crt_init(struct drm_device *dev) omap - Generic - “rotation” - BITMASK - { 0, "rotate-0" }, - { 1, "rotate-90" }, - { 2, "rotate-180" }, - { 3, "rotate-270" }, - { 4, "reflect-x" }, - { 5, "reflect-y" } - CRTC, Plane - TBD - - + Generic “zorder” RANGE Min=0, Max=3 From 30c4cf3b53b4a09ca24603dd3c3119433e8ac9d5 Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Mon, 4 May 2015 16:16:19 +0200 Subject: [PATCH 2/6] drm/cma: Fix 64-bit size_t build warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix warnings related to size_t when building for 64-bit architectures: drivers/gpu/drm/drm_gem_cma_helper.c: In function ‘drm_gem_cma_create’: drivers/gpu/drm/drm_gem_cma_helper.c:114:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat=] size); ^ drivers/gpu/drm/drm_gem_cma_helper.c: In function ‘drm_gem_cma_describe’: drivers/gpu/drm/drm_gem_cma_helper.c:393:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat=] off, &cma_obj->paddr, cma_obj->vaddr, obj->size); Signed-off-by: Magnus Damm Signed-off-by: Geert Uytterhoeven Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_gem_cma_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index e419eedf751d..bd75f303da63 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -110,7 +110,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, cma_obj->vaddr = dma_alloc_writecombine(drm->dev, size, &cma_obj->paddr, GFP_KERNEL | __GFP_NOWARN); if (!cma_obj->vaddr) { - dev_err(drm->dev, "failed to allocate buffer with size %d\n", + dev_err(drm->dev, "failed to allocate buffer with size %zu\n", size); ret = -ENOMEM; goto error; @@ -388,7 +388,7 @@ void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj, off = drm_vma_node_start(&obj->vma_node); - seq_printf(m, "%2d (%2d) %08llx %pad %p %d", + seq_printf(m, "%2d (%2d) %08llx %pad %p %zu", obj->name, obj->refcount.refcount.counter, off, &cma_obj->paddr, cma_obj->vaddr, obj->size); From 2465ff6217f1b63e194cfd57018fa42abe7fcdf0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Thu, 18 Jun 2015 09:58:55 +0200 Subject: [PATCH 3/6] drm/atomic: Extract needs_modeset function We use the same check already in the atomic core, so might as well make this official. And it's also reused in e.g. i915. Motivated by Maarten's idea to extract a connector_changed state out of mode_changed. Cc: Maarten Lankhorst Reviewed-By: Maarten Lankhorst Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic.c | 3 +-- drivers/gpu/drm/drm_atomic_helper.c | 16 +++++----------- include/drm/drm_atomic.h | 6 ++++++ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index c7e59b074e62..f6f2fb58eb37 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1216,8 +1216,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state) if (!state->allow_modeset) { for_each_crtc_in_state(state, crtc, crtc_state, i) { - if (crtc_state->mode_changed || - crtc_state->active_changed) { + if (drm_atomic_crtc_needs_modeset(crtc_state)) { DRM_DEBUG_ATOMIC("[CRTC:%d] requires full modeset\n", crtc->base.id); return -EINVAL; diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 536ae4da4665..b06a607db6c2 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -331,12 +331,6 @@ mode_fixup(struct drm_atomic_state *state) return 0; } -static bool -needs_modeset(struct drm_crtc_state *state) -{ - return state->mode_changed || state->active_changed; -} - /** * drm_atomic_helper_check_modeset - validate state object for modeset changes * @dev: DRM device @@ -414,7 +408,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, crtc_state->active_changed = true; } - if (!needs_modeset(crtc_state)) + if (!drm_atomic_crtc_needs_modeset(crtc_state)) continue; DRM_DEBUG_ATOMIC("[CRTC:%d] needs all connectors, enable: %c, active: %c\n", @@ -564,7 +558,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) old_crtc_state = old_state->crtc_states[drm_crtc_index(old_conn_state->crtc)]; if (!old_crtc_state->active || - !needs_modeset(old_conn_state->crtc->state)) + !drm_atomic_crtc_needs_modeset(old_conn_state->crtc->state)) continue; encoder = old_conn_state->best_encoder; @@ -601,7 +595,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) const struct drm_crtc_helper_funcs *funcs; /* Shut down everything that needs a full modeset. */ - if (!needs_modeset(crtc->state)) + if (!drm_atomic_crtc_needs_modeset(crtc->state)) continue; if (!old_crtc_state->active) @@ -792,7 +786,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, const struct drm_crtc_helper_funcs *funcs; /* Need to filter out CRTCs where only planes change. */ - if (!needs_modeset(crtc->state)) + if (!drm_atomic_crtc_needs_modeset(crtc->state)) continue; if (!crtc->state->active) @@ -819,7 +813,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, continue; if (!connector->state->crtc->state->active || - !needs_modeset(connector->state->crtc->state)) + !drm_atomic_crtc_needs_modeset(connector->state->crtc->state)) continue; encoder = connector->state->best_encoder; diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 1bbfedf466b9..8a3a913320eb 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -163,5 +163,11 @@ int __must_check drm_atomic_async_commit(struct drm_atomic_state *state); (plane_state) = (state)->plane_states[__i], 1); \ (__i)++) \ if (plane_state) +static inline bool +drm_atomic_crtc_needs_modeset(struct drm_crtc_state *state) +{ + return state->mode_changed || state->active_changed; +} + #endif /* DRM_ATOMIC_H_ */ From afcd950cafea6e27b739fe7772cbbeed37d05b8b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 10 Jun 2015 15:58:01 +0100 Subject: [PATCH 4/6] drm: Avoid the double clflush on the last cache line in drm_clflush_virt_range() As the clflush operates on cache lines, and we can flush any byte address, in order to flush all bytes given in the range we issue an extra clflush on the last byte to ensure the last cacheline is flushed. We can can the iteration to be over the actual cache lines to avoid this double clflush on the last byte. Signed-off-by: Chris Wilson Cc: Imre Deak Reviewed-by: Imre Deak Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_cache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 9a62d7a53553..6743ff7dccfa 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -130,11 +130,12 @@ drm_clflush_virt_range(void *addr, unsigned long length) { #if defined(CONFIG_X86) if (cpu_has_clflush) { + const int size = boot_cpu_data.x86_clflush_size; void *end = addr + length; + addr = (void *)(((unsigned long)addr) & -size); mb(); - for (; addr < end; addr += boot_cpu_data.x86_clflush_size) + for (; addr < end; addr += size) clflushopt(addr); - clflushopt(end - 1); mb(); return; } From ffc5fbdb77e125a5923e3c0ba3fe465b1ebb2c54 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Fri, 19 Jun 2015 14:52:29 +0100 Subject: [PATCH 5/6] drm: prime: Document gem_prime_mmap gem_prime_map is not currently described in the DRM manual, lets document it. Signed-off-by: Daniel Thompson Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_prime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 162dd29b2451..9f935f55d74c 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -309,7 +309,7 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { * Drivers can implement @gem_prime_export and @gem_prime_import in terms of * simpler APIs by using the helper functions @drm_gem_prime_export and * @drm_gem_prime_import. These functions implement dma-buf support in terms of - * five lower-level driver callbacks: + * six lower-level driver callbacks: * * Export callbacks: * @@ -321,6 +321,8 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { * * - @gem_prime_vunmap: vunmap a buffer exported by your driver * + * - @gem_prime_mmap (optional): mmap a buffer exported by your driver + * * Import callback: * * - @gem_prime_import_sg_table (import): produce a GEM object from another From c30f55a7b1336cdfeac74c7931ebff40a32e72b7 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 22 Jun 2015 13:37:46 +0300 Subject: [PATCH 6/6] drm/atomic: Don't set crtc_state->enable manually The enable field needs to be kept in sync with the mode_blob field. Call drm_atomic_set_mode_prop_for_crtc() instead of setting enable to false in order to dereference the mode blob correctly. v2: - Check the return value of drm_atomic_set_mode_prop_for_crtc() - Drop the num_connectors local variable Signed-off-by: Laurent Pinchart Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index b06a607db6c2..5b59d5ad7d1c 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1555,10 +1555,14 @@ static int update_output_state(struct drm_atomic_state *state, if (crtc == set->crtc) continue; - crtc_state->enable = - drm_atomic_connectors_for_crtc(state, crtc); - if (!crtc_state->enable) + if (!drm_atomic_connectors_for_crtc(state, crtc)) { + ret = drm_atomic_set_mode_prop_for_crtc(crtc_state, + NULL); + if (ret < 0) + return ret; + crtc_state->active = false; + } } return 0;