aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_plane.c
AgeCommit message (Collapse)AuthorFilesLines
2017-03-29drm/atomic-helper: remove backoff hack from page_flipDaniel Vetter1-1/+0
Yay, we can now properly retry in case of deadlocks or whatever! Also don't forget to remove the transitional crtc->acquire_ctx assignment again. Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-03-29drm: Add acquire ctx parameter to ->page_flip(_target)Daniel Vetter1-2/+4
Again just going through the motions, no functional changes in here. Cc: Gerd Hoffmann <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Russell King <[email protected]> Cc: Laurent Pinchart <[email protected]> Cc: Eric Anholt <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Christian König <[email protected]> Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>t Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-03-29drm: Roll out acquire context for the page_flip ioctlDaniel Vetter1-2/+19
Again just prep work. Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-03-29drm/atomic-helper: remove backoff hack from disable/update_planeDaniel Vetter1-2/+0
We can now properly retry at the top level, yay! v2: Also remove the temporary acquire_ctx hack again, no longer needed! Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-03-29drm: Add acquire ctx parameter to ->plane_disableDaniel Vetter1-2/+2
Nouveau had a few direct calls to ->disable_plane, I replaced those with drm_plane_force_disable. Same story for shmob. Otherwise no code changes. Cc: Ben Skeggs <[email protected]> Cc: Russell King <[email protected]> Cc: Laurent Pinchart <[email protected]> Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-03-29drm: drm_plane_force_disable is not for atomic driversDaniel Vetter1-0/+8
This way I can explain why it'll be fine to pass a NULL acquire ctx here in the next patch. Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-03-29drm: Add acquire ctx parameter to ->update_planeDaniel Vetter1-1/+1
Just rolling it out, no code change here. Cc: Ben Skeggs <[email protected]> Cc: Russell King <[email protected]> Cc: Rob Clark <[email protected]> Cc: Laurent Pinchart <[email protected]> Cc: Eric Anholt <[email protected]> Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-03-29drm: Wire up proper acquire ctx for plane functionsDaniel Vetter1-10/+42
This is just prep work to get an acquire ctx into every place where we call ->update_plane or ->disable_plane. v2: Keep the hidden acquire_ctx pointers valid while transitioning. Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-02-28drm: Introduce drm_framebuffer_{get,put}()Thierry Reding1-6/+6
For consistency with other reference counting APIs in the kernel, add drm_framebuffer_get() and drm_framebuffer_put() to reference count DRM framebuffers. Compatibility aliases are added to keep existing code working. To help speed up the transition, all the instances of the old functions in the DRM core are already replaced in this commit. The existing semantic patch for the DRM subsystem-wide conversion is extended to account for these new helpers. Reviewed-by: Sean Paul <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-02-28drm: Rename drm_mode_object_get()Thierry Reding1-1/+1
Subsequent patches will introduce reference counting APIs that are more consistent with similar APIs throughout the Linux kernel. These APIs use the _get() and _put() suffixes and will collide with this existing function. Rename the function to drm_mode_object_add() which is a slightly more accurate description of what it does. Also the kerneldoc for this function gives an indication that it's badly named because it doesn't actually acquire a reference to anything. Reviewed-by: Sean Paul <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-01-25drm/kms-core: Use recommened kerneldoc for struct member refsDaniel Vetter1-1/+1
I just learned that &struct_name.member_name works and looks pretty even. It doesn't (yet) link to the member directly though, which would be really good for big structures or vfunc tables (where the per-member kerneldoc tends to be long). Also some minor drive-by polish where it makes sense, I read a lot of docs ... v2: Review from Eric. Cc: Jani Nikula <[email protected]> Cc: Chris Wilson <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-01-09drm: add more document for drm_crtc_from_index()Shawn Guo1-1/+1
Add a bit more document for function drm_crtc_from_index() to cross link it with drm_crtc_from_index(), and explain that the function is useful in vblank code. While at it, add cross link comment for drm_plane_from_index() as well. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm/doc: use preferred struct reference in kernel-docDaniel Vetter1-1/+1
sed -e 's/\( \* .*\)struct &\([_a-z]*\)/\1\&struct \2/' -i Originally I wasnt a friend of this style because I thought a line-break between the "&struct" and "foo" part would break it. But a quick test shows that " * &struct \n * foo\n" works pefectly well with current kernel-doc. So time to mass-apply these changes! Cc: Jani Nikula <[email protected]> Cc: Chris Wilson <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-15drm: Replace 'format->format' comparisons to just 'format' comparisonsVille Syrjälä1-1/+1
Rather than compare the format u32s of two format infos, we can direclty compare the format info pointers themselves. Noramlly all the ->format pointers all point to somwehere in the big array, so this is a valid way to test for equality. Also drivers may want to point ->format at a private format info struct instead (eg. for special compressed formats with extra planes), so just comparing the pixel format values wouldn't necessaritly even work. But comparing the pointers will also take care of that case. @@ struct drm_framebuffer *a; struct drm_framebuffer *b; @@ ( - a->format->format != b->format->format + a->format != b->format | - a->format->format == b->format->format + a->format == b->format ) @@ struct drm_plane_state *a; struct drm_plane_state *b; @@ ( - a->fb->format->format != b->fb->format->format + a->fb->format != b->fb->format | - a->fb->format->format == b->fb->format->format + a->fb->format == b->fb->format ) @@ struct drm_crtc *crtc; struct drm_framebuffer *x; @@ ( - crtc->primary->fb->format->format != x->format->format + crtc->primary->fb->format != x->format | - x->format->format != crtc->primary->fb->format->format + x->format != crtc->primary->fb->format ) @@ struct drm_mode_set *set; @@ - set->fb->format->format != set->crtc->primary->fb->format->format + set->fb->format != set->crtc->primary->fb->format Cc: Laurent Pinchart <[email protected]> Suggested-by: Laurent Pinchart <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Laurent Pinchart <[email protected]>
2016-12-15drm: Nuke fb->pixel_formatVille Syrjälä1-3/+3
Replace uses of fb->pixel_format with fb->format->format. Less duplicated information is a good thing. Note that coccinelle failed to eliminate the "/* fourcc format */" comment from drm_framebuffer.h, so I had to do that part manually. @@ struct drm_framebuffer *FB; expression E; @@ drm_helper_mode_fill_fb_struct(...) { ... - FB->pixel_format = E; ... } @@ struct drm_framebuffer *FB; expression E; @@ i9xx_get_initial_plane_config(...) { ... - FB->pixel_format = E; ... } @@ struct drm_framebuffer *FB; expression E; @@ ironlake_get_initial_plane_config(...) { ... - FB->pixel_format = E; ... } @@ struct drm_framebuffer *FB; expression E; @@ skylake_get_initial_plane_config(...) { ... - FB->pixel_format = E; ... } @@ struct drm_framebuffer *a; struct drm_framebuffer b; @@ ( - a->pixel_format + a->format->format | - b.pixel_format + b.format->format ) @@ struct drm_plane_state *a; struct drm_plane_state b; @@ ( - a->fb->pixel_format + a->fb->format->format | - b.fb->pixel_format + b.fb->format->format ) @@ struct drm_crtc *CRTC; @@ ( - CRTC->primary->fb->pixel_format + CRTC->primary->fb->format->format | - CRTC->primary->state->fb->pixel_format + CRTC->primary->state->fb->format->format ) @@ struct drm_mode_set *set; @@ ( - set->fb->pixel_format + set->fb->format->format | - set->crtc->primary->fb->pixel_format + set->crtc->primary->fb->format->format ) @@ @@ struct drm_framebuffer { ... - uint32_t pixel_format; ... }; v2: Fix commit message (Laurent) Rebase due to earlier removal of many fb->pixel_format uses, including the 'fb->format = drm_format_info(fb->format->format);' snafu v3: Adjusted the semantic patch a bit and regenerated due to code changes Cc: Laurent Pinchart <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Reviewed-by: Alex Deucher <[email protected]> (v1) Reviewed-by: Laurent Pinchart <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-13Merge tag 'drm-for-v4.10' of git://people.freedesktop.org/~airlied/linux ↵Daniel Vetter1-2/+2
into drm-misc-next Main pull request for drm for 4.10 kernel - resync drm-misc with full 4.10 state (2 new drivers) so that we can start pulling in all the refactorings for 4.11! Signed-off-by: Daniel Vetter <[email protected]>
2016-12-13drm: Use atomic state for FB in legacy ioctlsDaniel Stone1-2/+6
If atomic state is available, use this to read the current plane in GetCrtc/GetPlane, rather than the legacy points. Signed-off-by: Daniel Stone <[email protected]> Cc: Daniel Vetter <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-09Merge tag 'drm-misc-next-2016-12-08' of ↵Dave Airlie1-2/+2
git://anongit.freedesktop.org/git/drm-misc into drm-next Another pile of misc stuff, final one for 4.10. If there's some serious bugfix still I'll send you a pull for drm-misc-next-fixes (like we do with intel), otherwise this is it and next pull next year for 4.11. Most interesting bits are probably Chris' fb helper fixes against mst hotplug oopses. * tag 'drm-misc-next-2016-12-08' of git://anongit.freedesktop.org/git/drm-misc: (22 commits) drm: Take ownership of the dmabuf->obj when exporting drm: Allow CAP_PRIME on !MODESET drm/fence: add drm_crtc_create_fence() drm/bridge: analogix: Don't return -EINVAL when panel doesn't support PSR drm/atomic: doc: remove old comment about nonblocking commits drm: Don't block the kworker waiting for mode_config.mutex in output_poll() drm: Return -ENOTSUPP when called for KMS cap with a non-KMS driver drm/amdgpu: don't add files at control minor debugfs directory drm: allow changing DPMS mode drm/qxl: fix use of uninitialized variable drm/qxl: Don't register debugfs for control minors drm/radeon: don't add files at control minor debugfs directory drm/vmwgfx: Switch to mode_cmd2 drm/vgem: Use ww_mutex_(un)lock even with a NULL context drm: Make the connector .detect() callback optional drm/bridge: tc358767: don't warn if display side ASSR enable fails drm: Initialise drm_mm.head_node.allocated drm: Fix locking cargo-cult in encoder/plane init/cleanup drm/doc: Fix indenting in drm_modeset_lock.c comment drm: Protect fb_helper list manipulation with a mutex ...
2016-12-08drm: fix possible_crtc's typeTomi Valkeinen1-2/+2
drm_universal_plane_init() and drm_plane_init() take "unsigned long possible_crtcs" parameter, but then stuff it into uint32_t. Change the parameter to uint32_t. Signed-off-by: Tomi Valkeinen <[email protected]> Cc: Ville Syrjälä <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]>
2016-11-29drm: Fix locking cargo-cult in encoder/plane init/cleanupDaniel Vetter1-2/+2
Encoders&planes can't be hotplugged, we dont need locking for this since it's all single-threaded driver setup/teardown code. CRTCs already don't grab locks. While at it I noticed that plane's are missing the drm_modeset_lock_fini() call, so add it. Reviewed-by: Frank Binns <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-11-16drm/fence: add in-fences supportGustavo Padovan1-0/+1
There is now a new property called IN_FENCE_FD attached to every plane state that receives sync_file fds from userspace via the atomic commit IOCTL. The fd is then translated to a fence (that may be a fence_array subclass or just a normal fence) and then used by DRM to fence_wait() for all fences in the sync_file to signal. So it only commits when all framebuffers are ready to scanout. v2: Comments by Daniel Vetter: - remove set state->fence = NULL in destroy phase - accept fence -1 as valid and just return 0 - do not call fence_get() - sync_file_fences_get() already calls it - fence_put() if state->fence is already set, in case userspace set the property more than once. v3: WARN_ON if fence is set but state has no FB v4: Comment from Maarten Lankhorst - allow set fence with no related fb v5: rename FENCE_FD to IN_FENCE_FD v6: Comments by Daniel Vetter: - rename plane_state->in_fence back to "fence" - re-introduce WARN_ON if fence set but no fb - rebase after fence -> dma_fence rename v7: Comments by Brian Starkey - set state->fence to NULL when duplicating the state - fail if IN_FENCE_FD was already set v8: rebase against latest drm-misc Signed-off-by: Gustavo Padovan <[email protected]> Reviewed-by: Brian Starkey <[email protected]> Reviewed-by: Sean Paul <[email protected]> Tested-by: Robert Foss <[email protected]> [danvet: Rebase onto extracted drm_mode_config.[hc].] Signed-off-by: Daniel Vetter <[email protected]>
2016-11-12drm: move allocation out of drm_get_format_name()Eric Engestrom1-3/+4
The function's behaviour was changed in 90844f00049e, without changing its signature, causing people to keep using it the old way without realising they were now leaking memory. Rob Clark also noticed it was also allocating GFP_KERNEL memory in atomic contexts, breaking them. Instead of having to allocate GFP_ATOMIC memory and fixing the callers to make them cleanup the memory afterwards, let's change the function's signature by having the caller take care of the memory and passing it to the function. The new parameter is a single-field struct in order to enforce the size of its buffer and help callers to correctly manage their memory. Fixes: 90844f00049e ("drm: make drm_get_format_name thread-safe") Cc: Rob Clark <[email protected]> Cc: Christian König <[email protected]> Acked-by: Christian König <[email protected]> Acked-by: Rob Clark <[email protected]> Acked-by: Sinclair Yeh <[email protected]> (vmwgfx) Reviewed-by: Jani Nikula <[email protected]> Suggested-by: Ville Syrjälä <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-10-04drm: Undo damage to page_flip_ioctlDaniel Vetter1-42/+39
I screwed up rebasing of my patch in commit 43968d7b806d7a7e021261294c583a216fddf0e5 Author: Daniel Vetter <[email protected]> Date: Wed Sep 21 10:59:24 2016 +0200 drm: Extract drm_plane.[hc] which meant on error paths drm_crtc_vblank_put could be called without a get, leading to an underrun of the refcount. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98020 Reported-and-tested-by: Andy Furniss <[email protected]> Cc: Sean Paul <[email protected]> Cc: Michel Dänzer <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Dave Airlie <[email protected]>
2016-10-04drm: Restore lost drm_framebuffer_unreference in drm_mode_page_flip_ioctlChris Wilson1-0/+2
Commit 43968d7b806d ("drm: Extract drm_plane.[hc]") was not the simple cut'n'paste we presumed, somehow it introduced a leak of the page flip target's framebuffer. Fixes: 43968d7b806d ("drm: Extract drm_plane.[hc]") Signed-off-by: Chris Wilson <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Sean Paul <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Dave Airlie <[email protected]>
2016-09-22drm/doc: Polish plane composition property docsDaniel Vetter1-0/+3
Try to spec a bit more precisely how they all fit together, now that at least the code is for all the additional properties is in one place. Also remove the entries for the standardized properties from the table, because that thing is supremely unmaintaineable. v2: Fix typos Sean spotted. Cc: Ville Syrjälä <[email protected]> Cc: Sean Paul <[email protected]> Cc: Benjamin Gaignard <[email protected]> Reviewed-by: Sean Paul <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Signed-off-by: Sean Paul <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-09-22drm/doc: Polish for drm_plane.[hc]Daniel Vetter1-109/+23
Big thing is untangling and carefully documenting the different uapi types of planes. I also sprinkled a few more cross references around to make this easier to discover. As usual, remove the kerneldoc for internal functions which are not exported. Aside: We should probably go OCD on all the ioctl handlers and consistenly give them an _ioctl postfix. Acked-by: Archit Taneja <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Signed-off-by: Sean Paul <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-09-22drm: Extract drm_plane.[hc]Daniel Vetter1-0/+990
Just pure code movement, cleanup and polish will happen in later patches. v2: Don't forget all the ioctl! To extract those cleanly I decided to put check_src_coords into drm_framebuffer.c (and give it a drm_framebuffer_ prefix), since that just checks framebuffer constraints. v3: rebase over PAGE_FLIP_TARGET. Reviewed-by: Sean Paul <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> [seanpaul] This patch as posted on the list was rebased on: commit 6f00975c619064a18c23fd3aced325ae165a73b9 Author: Daniel Vetter <[email protected]> Date: Sat Aug 20 12:22:11 2016 +0200 drm: Reject page_flip for !DRIVER_MODESET so as a result of moving the page_flip ioctl, this fix has been rolled into this patch. Signed-off-by: Sean Paul <[email protected]>