Chris Wilson
433e404f07
drm/armada: s/drm_mm_dump_table/drm_mm_print/
...
Missed rename during v2 of b5c3714fe8
("drm/mm: Convert to
drm_printer")
Reported-by: kbuild test robot <fengguang.wu@intel.com >
Fixes: b5c3714fe8
("drm/mm: Convert to drm_printer")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Daniel Vetter <daniel.vetter@intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161230145510.12951-1-chris@chris-wilson.co.uk
2016-12-30 17:35:13 +01:00
Alex Williamson
99e3123e3d
vfio-mdev: Make mdev_device private and abstract interfaces
...
Abstract access to mdev_device so that we can define which interfaces
are public rather than relying on comments in the structure.
Cc: Zhenyu Wang <zhenyuw@linux.intel.com >
Cc: Zhi Wang <zhi.a.wang@intel.com >
Signed-off-by: Alex Williamson <alex.williamson@redhat.com >
Reviewed-by: Jike Song <jike.song@intel.com >
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com >
2016-12-30 08:13:44 -07:00
Alex Williamson
9372e6feaa
vfio-mdev: Make mdev_parent private
...
Rather than hoping for good behavior by marking some elements
internal, enforce it by making the entire structure private and
creating an accessor function for the one useful external field.
Cc: Zhenyu Wang <zhenyuw@linux.intel.com >
Cc: Zhi Wang <zhi.a.wang@intel.com >
Cc: Jike Song <jike.song@intel.com >
Signed-off-by: Alex Williamson <alex.williamson@redhat.com >
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com >
2016-12-30 08:13:41 -07:00
Alex Williamson
42930553a7
vfio-mdev: de-polute the namespace, rename parent_device & parent_ops
...
Add an mdev_ prefix so we're not poluting the namespace so much.
Cc: Zhenyu Wang <zhenyuw@linux.intel.com >
Cc: Zhi Wang <zhi.a.wang@intel.com >
Cc: Jike Song <jike.song@intel.com >
Signed-off-by: Alex Williamson <alex.williamson@redhat.com >
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com >
2016-12-30 08:13:38 -07:00
Chris Wilson
6098909cf2
drm: Avoid NULL dereference of drm_device.dev
...
For a virtual device, drm_device.dev is NULL, so becareful not to
dereference it unconditionally in core code such as drm_dev_register().
Fixes: 75f6dfe3e6
("drm: Deduplicate driver initialization message")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Gabriel Krisman Bertazi <krisman@collabora.co.uk >
Cc: Daniel Vetter <daniel.vetter@ffwll.ch >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161230141639.10487-1-chris@chris-wilson.co.uk
2016-12-30 15:29:44 +01:00
Daniel Vetter
824387b2f6
drm/atomic-helpers: Remove outdated comment
...
We forgot to clean this up when adding connector refcounting.
Reviewed-by: David Herrmann <dh.herrmann@gmail.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/1483044517-5770-10-git-send-email-daniel.vetter@ffwll.ch
2016-12-30 13:36:08 +01:00
Daniel Vetter
5edbfc474c
drm/rect: Fix formatting of example code
...
Drive-by polish.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/1483044517-5770-9-git-send-email-daniel.vetter@ffwll.ch
2016-12-30 13:35:54 +01:00
Daniel Vetter
ea0dd85a75
drm/doc: use preferred struct reference in kernel-doc
...
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 <jani.nikula@linux.intel.com >
Cc: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: David Herrmann <dh.herrmann@gmail.com >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/1483044517-5770-6-git-send-email-daniel.vetter@ffwll.ch
2016-12-30 13:34:59 +01:00
Daniel Vetter
05fc03217e
drm/mm: Some doc polish
...
Added some boilerplate for the structs, documented members where they
are relevant and plenty of markup for hyperlinks all over. And a few
small wording polish.
Note that the intro needs some more love after the DRM_MM_INSERT_*
patch from Chris has landed.
v2: Spelling fixes (Chris).
v3: Use &struct foo instead of &foo structure (Chris).
Cc: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Reviewed-by: David Herrmann <dh.herrmann@gmail.com >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/1483044517-5770-3-git-send-email-daniel.vetter@ffwll.ch
2016-12-30 12:53:51 +01:00
Gabriel Krisman Bertazi
b834ff86a6
drm: Update TTM initialization documentation
...
ttm_global_reference was renamed to drm_global_reference. This updates
the documentation to reflect that. While we are there, document the
drm_global_reference API and update the initialization interface
documentation.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk >
[danvet: Keep the warning, ttm docs are still massively inadequate.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161228143216.26821-7-krisman@collabora.co.uk
2016-12-30 12:52:10 +01:00
Gabriel Krisman Bertazi
5bbf92d3eb
drm: Export drm_ioctl_permit to kernel-doc
...
drm_ioctl_permit is exported but missed a kernel-doc style
documentation.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161228143216.26821-5-krisman@collabora.co.uk
2016-12-30 12:40:48 +01:00
Gabriel Krisman Bertazi
8caead148a
drm: Drop unused forward declaration of drm_version
...
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161228143216.26821-4-krisman@collabora.co.uk
2016-12-30 12:40:18 +01:00
Gabriel Krisman Bertazi
75f6dfe3e6
drm: Deduplicate driver initialization message
...
Several DRM drivers print the same initialization message right after
drm_dev_register, so move that to common code. The exception is i915,
which uses its own register handle, so let it keep its own message.
Notice that this was tested only with Exynos, but looks simple enough
for the other drivers.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161228143216.26821-2-krisman@collabora.co.uk
2016-12-30 12:37:39 +01:00
Chris Wilson
e82dfa00da
drm: Reduce verbosity level for drm_core_init() debug message
...
Currently at the end of drm_core_init() we print
[ 0.735185] [drm] Initialized
which does not provide any user information and is only a breadcrumb for
developers, so reduce it from info to debug.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161229133729.32673-1-chris@chris-wilson.co.uk
2016-12-30 12:17:03 +01:00
Shawn Guo
48df6336d7
drm: rockchip: use crtc helper drm_crtc_from_index()
...
Function rockchip_crtc_from_pipe() does the exactly same thing as what
crtc helper drm_crtc_from_index() provides. Use the helper to save
some code.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/1483015290-16660-4-git-send-email-shawnguo@kernel.org
2016-12-30 12:15:11 +01:00
Shawn Guo
ac620ba3d0
drm: zte: use crtc helper drm_crtc_from_index()
...
Function zx_find_crtc() does the exactly same thing as what crtc helper
drm_crtc_from_index() provides. Use the helper to save some code.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/1483015290-16660-3-git-send-email-shawnguo@kernel.org
2016-12-30 12:15:01 +01:00
Shawn Guo
6d1b81d8e2
drm: add crtc helper drm_crtc_from_index()
...
It adds a crtc helper drm_crtc_from_index() to find the registered CRTC
with a given index, just like drm_plane_from_index().
Signed-off-by: Shawn Guo <shawn.guo@linaro.org >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/1483015290-16660-2-git-send-email-shawnguo@kernel.org
2016-12-30 12:11:59 +01:00
Daniel Vetter
b5c3714fe8
drm/mm: Convert to drm_printer
...
Including all drivers. I thought about keeping small compat functions
to avoid having to change all drivers. But I really like the
drm_printer idea, so figured spreading it more widely is a good thing.
v2: Review from Chris:
- Natural argument order and better name for drm_mm_print.
- show_mm() macro in the selftest.
Cc: Rob Clark <robdclark@gmail.com >
Cc: Russell King <rmk+kernel@armlinux.org.uk >
Cc: Alex Deucher <alexander.deucher@amd.com >
Cc: Christian König <christian.koenig@amd.com >
Cc: Lucas Stach <l.stach@pengutronix.de >
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jyri Sarha <jsarha@ti.com >
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/1483009764-8281-1-git-send-email-daniel.vetter@ffwll.ch
2016-12-30 12:08:28 +01:00
Daniel Vetter
3d387d923c
drm/printer: add debug printer
...
Useful for dumping lots of data into dmesg, e.g. drm_mm.
v2: Fixup export_symbol line, I misplaced a hunk (Chris).
Cc: Rob Clark <robdclark@gmail.com >
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/1482943330-11592-1-git-send-email-daniel.vetter@ffwll.ch
2016-12-30 11:43:40 +01:00
Ander Conselvan de Oliveira
f50b79f096
drm/i915: Add dpll entrypoint for dumping hw state
...
Remove the IS_PLATFORM() macros from intel_dump_pipe_config() and split
that logic in platform specific implementations inside the dpll code,
accessed through a platform independent interface.
v2: Rebase.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch > (v1)
Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-7-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30 09:32:34 +02:00
Ander Conselvan de Oliveira
294591cfbd
drm/i915: Update kerneldoc for intel_dpll_mgr.c
...
The documentation for most of the non-static members and structs were
missing. Fix that.
v2: Fix typos (Durga)
v3: Rebase.
Fix make docs warnings.
Document more.
v4: capitilize CRTC; say that the prepare hook is a nop if the DPLL is
already enabled; link to struct intel_dpll_hw_state from @hw_state
field in struct intel_shared_dpll_state; reorganize DPLL flags; link
intel_shared_dpll_state to other structs and functions. (Daniel)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-6-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30 09:32:31 +02:00
Ander Conselvan de Oliveira
eac6176cbd
drm/i915: Rename intel_shared_dpll->mode_set() to prepare()
...
The hook is called from intel_prepare_shared_dpll(). The name doesn't
make sense after all the changes to modeset code. So just call it
prepare.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com >
Reviewed-by: Durgadoss R <durgadoss.r@intel.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-5-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30 09:31:29 +02:00
Ander Conselvan de Oliveira
2c42e53514
drm/i915: Rename intel_shared_dpll_config to intel_shared_dpll_state
...
Struct intel_shared_dpll_config is used to hold the state of the DPLL in
the "atomic" sense, so call it state like everything else atomic.
v2: Rebase
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch > (v1)
Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-4-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30 09:26:10 +02:00
Ander Conselvan de Oliveira
3c0fb58820
drm/i915: Rename intel_shared_dpll_commit() to _swap_state()
...
The function intel_shared_dpll_commit() performs the equivalent of
drm_atomic_helper_swap_state() for the shared dpll state, which is not
handled by the helpers. So make it do a full swap of the state and
rename it for consistency.
v2: Fix typo in the commit message. (Durga)
v3: Rebase.
v4: Swap the states instead of just renaming the function. (Daniel)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com >
Reviewed-by: Durgadoss R <durgadoss.r@intel.com > (v2)
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch > (v3)
Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-3-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30 09:25:59 +02:00
Ander Conselvan de Oliveira
a1c414ee82
drm/i915: Introduce intel_release_shared_dpll()
...
While the details of getting a shared dpll are wrapped by
intel_get_shared_dpll(), the release was still hand rolled into the
modeset code. Fix that by creating an entry point for releasing the
pll and move that code there.
v2: Take old_dpll from crtc->state instead of crtc_state. (CI)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-2-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30 09:25:50 +02:00
Jordan Crouse
a6cb3b864b
drm/msm: Verify that MSM_SUBMIT_BO_FLAGS are set
...
For every submission buffer object one of MSM_SUBMIT_BO_WRITE
and MSM_SUBMIT_BO_READ must be set (and nothing else). If we
allowed zero then the buffer object would never get queued to
be unreferenced.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org >
Signed-off-by: Rob Clark <robdclark@gmail.com >
2016-12-29 15:03:00 -05:00
Jordan Crouse
6490abc4bc
drm/msm: Put back the vaddr in submit_reloc()
...
The error cases in submit_reloc() need to put back the virtual
address of the bo before failling. Add a single failure path
for the function.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org >
Signed-off-by: Rob Clark <robdclark@gmail.com >
2016-12-29 15:02:59 -05:00
Jordan Crouse
88b333b0ed
drm/msm: Ensure that the hardware write pointer is valid
...
Currently the value written to CP_RB_WPTR is calculated on the fly as
(rb->next - rb->start). But as the code is designed rb->next is wrapped
before writing the commands so if a series of commands happened to
fit perfectly in the ringbuffer, rb->next would end up being equal to
rb->size / 4 and thus result in an out of bounds address to CP_RB_WPTR.
The easiest way to fix this is to mask WPTR when writing it to the
hardware; it makes the hardware happy and the rest of the ringbuffer
math appears to work and there isn't any point in upsetting anything.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org >
[squash in is_power_of_2() check]
Signed-off-by: Rob Clark <robdclark@gmail.com >
2016-12-29 15:02:58 -05:00
Chris Wilson
9b8b75de4c
drm: Add kerneldoc markup for new @scan parameters in drm_mm
...
A couple of parameters slipped through the kerneldoc net.
Reported-by: kbuild test robot <fengguang.wu@intel.com >
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Daniel Vetter <daniel.vetter@ffwll.ch >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161228105120.14500-1-chris@chris-wilson.co.uk
2016-12-28 14:05:38 +01:00
Daniel Vetter
1c9bd1ede8
drm/mm: Document locking rules
...
Drivers need to take care. Motivated by a discussion between Mark and
Rob on dri-devel.
Cc: Mark yao <mark.yao@rock-chips.com >
Cc: Rob Clark <robdclark@gmail.com >
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk >
[danvet: s/alloc|freeing/modifications/ per Chris' suggestion.]
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/1482833457-29592-1-git-send-email-daniel.vetter@ffwll.ch
2016-12-28 14:05:20 +01:00
Chris Wilson
adb040b86b
drm: Use drm_mm_insert_node_in_range_generic() for everyone
...
Remove a superfluous helper as drm_mm_insert_node is equivalent to
insert_node_in_range with a range of [0, U64_MAX].
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-37-chris@chris-wilson.co.uk
2016-12-28 13:51:20 +01:00
Chris Wilson
3db93756b5
drm: Apply range restriction after color adjustment when allocation
...
mm->color_adjust() compares the hole with its neighbouring nodes. They
only abutt before we restrict the hole, so we have to apply color_adjust
before we apply the range restriction.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-36-chris@chris-wilson.co.uk
2016-12-28 13:50:34 +01:00
Chris Wilson
3f85fb3462
drm: Wrap drm_mm_node.hole_follows
...
Insulate users from changes to the internal hole tracking within
struct drm_mm_node by using an accessor for hole_follows.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
[danvet: resolve conflicts in i915_vma.c]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
2016-12-28 13:30:24 +01:00
Chris Wilson
3fa489dabe
drm: Apply tight eviction scanning to color_adjust
...
Using mm->color_adjust makes the eviction scanner much tricker since we
don't know the actual neighbours of the target hole until after it is
created (after scanning is complete). To work out whether we need to
evict the neighbours because they impact upon the hole, we have to then
check the hole afterwards - requiring an extra step in the user of the
eviction scanner when they apply color_adjust.
v2: Massage kerneldoc.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-34-chris@chris-wilson.co.uk
2016-12-28 13:23:06 +01:00
Chris Wilson
f29051f12f
drm: Simplify drm_mm scan-list manipulation
...
Since we mandate a strict reverse-order of drm_mm_scan_remove_block()
after drm_mm_scan_add_block() we can further simplify the list
manipulations when generating the temporary scan-hole.
v2: Highlight the games being played with the lists to track the scan
holes without allocation.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-33-chris@chris-wilson.co.uk
2016-12-28 13:22:56 +01:00
Chris Wilson
4741da925f
drm/i915/guc: Assert that all GGTT offsets used by the GuC are mappable
...
Add an assertion to the plain i915_ggtt_offset() to double check that
any offset we hand to the GuC is outside of its unmappable ranges.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20161224193146.4402-1-chris@chris-wilson.co.uk
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com >
2016-12-28 11:15:48 +00:00
Chris Wilson
9a956b1548
drm: Optimise power-of-two alignments in drm_mm_scan_add_block()
...
For power-of-two alignments, we can avoid the 64bit divide and do a
simple bitwise add instead.
v2: s/alignment_mask/remainder_mask/
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-32-chris@chris-wilson.co.uk
2016-12-28 11:51:52 +01:00
Chris Wilson
0b04d474a6
drm: Compute tight evictions for drm_mm_scan
...
Compute the minimal required hole during scan and only evict those nodes
that overlap. This enables us to reduce the number of nodes we need to
evict to the bare minimum.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-31-chris@chris-wilson.co.uk
2016-12-28 11:50:55 +01:00
Chris Wilson
268c6498fb
drm: Fix application of color vs range restriction when scanning drm_mm
...
The range restriction should be applied after the color adjustment, or
else we may inadvertently apply the color adjustment to the restricted
hole (and not against its neighbours).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-30-chris@chris-wilson.co.uk
2016-12-28 11:50:42 +01:00
Chris Wilson
2c4b389518
drm: Unconditionally do the range check in drm_mm_scan_add_block()
...
Doing the check is trivial (low cost in comparison to overall eviction)
and helps simplify the code.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-29-chris@chris-wilson.co.uk
2016-12-28 11:50:28 +01:00
Chris Wilson
4a6c156f56
drm: Rename prev_node to hole in drm_mm_scan_add_block()
...
Acknowledging that we were building up the hole was more useful to me
when reading the code, than knowing the relationship between this node
and the previous node.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-28-chris@chris-wilson.co.uk
2016-12-28 11:49:22 +01:00
Daniel Vetter
25a7bb1834
drm: Fix O= out-of-tree builds for selftests
...
Kbuild really doesn't like non-recursive Makefiles, but they do work
as long as you build without O=
Reported-by: kbuild test robot <fengguang.wu@intel.com >
Fixes: 50f0033d1a
("drm: Add some kselftests for the DRM range manager (struct drm_mm)")
Cc: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Christian König <christian.koenig@amd.com >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/1482918077-30027-1-git-send-email-daniel.vetter@ffwll.ch
2016-12-28 11:34:57 +01:00
Chris Wilson
9a71e27788
drm: Extract struct drm_mm_scan from struct drm_mm
...
The scan state occupies a large proportion of the struct drm_mm and is
rarely used and only contains temporary state. That makes it suitable to
moving to its struct and onto the stack of the callers.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
[danvet: Fix up etnaviv to compile, was missing a BUG_ON.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
2016-12-27 16:44:13 +01:00
Chris Wilson
6259a56ba0
drm: Add asserts to catch overflow in drm_mm_init() and drm_mm_init_scan()
...
A simple assert to ensure that we don't overflow start + size when
initialising the drm_mm, or its scanner.
In future, we may want to switch to tracking the value of ranges (rather
than size) so that we can cover the full u64, for example like resource
tracking.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-26-chris@chris-wilson.co.uk
2016-12-27 14:17:00 +01:00
Chris Wilson
ac9bb7b7d3
drm: Simplify drm_mm_clean()
...
Since commit ea7b1dd448
("drm: mm: track free areas implicitly"),
to test whether there are any nodes allocated within the range manager,
we merely have to ask whether the node_list is empty.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-25-chris@chris-wilson.co.uk
2016-12-27 14:16:59 +01:00
Chris Wilson
c820186d5b
drm: Detect overflow in drm_mm_reserve_node()
...
Protect ourselves from a caller passing in node.start + node.size that
will overflow and trick us into reserving that node.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-24-chris@chris-wilson.co.uk
2016-12-27 14:16:59 +01:00
Chris Wilson
ba004e39b1
drm: Fix kerneldoc for drm_mm_scan_remove_block()
...
The nodes must be removed in the *reverse* order. This is correct in the
overview, but backwards in the function description. Whilst here add
Intel's copyright statement and tweak some formatting.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-23-chris@chris-wilson.co.uk
2016-12-27 14:16:58 +01:00
Chris Wilson
7173320758
drm: Promote drm_mm alignment to u64
...
In places (e.g. i915.ko), the alignment is exported to userspace as u64
and there now exists hardware for which we can indeed utilize a u64
alignment. As such, we need to keep 64bit integers throughout when
handling alignment.
Testcase: igt/drm_mm/align64
Testcase: igt/gem_exec_alignment
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Christian König <christian.koenig@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-22-chris@chris-wilson.co.uk
2016-12-27 14:16:58 +01:00
Chris Wilson
d1bac3a781
drm: kselftest for drm_mm and restricted color eviction
...
Check that after applying the driver's color adjustment, restricted
eviction scanning finds a suitable hole.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-20-chris@chris-wilson.co.uk
2016-12-27 14:16:57 +01:00
Chris Wilson
c1b702c9a5
drm: kselftest for drm_mm and color eviction
...
Check that after applying the driver's color adjustment, eviction
scanning finds a suitable hole.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-19-chris@chris-wilson.co.uk
2016-12-27 14:01:27 +01:00