335288 |
17-Jun-2018 |
dim |
MFC r334946:
Fix build of i915kms with base gcc
Base gcc fails to compile sys/dev/drm2/i915/intel_display.c for i386, with the following -Werror warnings:
cc1: warnings being treated as errors /usr/src/sys/dev/drm2/i915/intel_display.c:8884: warning: initialization from incompatible pointer type
This is due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36432, which incorrectly interprets the [] as a flexible array member.
Because base gcc does not have a -W flag to suppress this particular warning, it requires a rather ugly cast. To not influence any other compiler, put it in a #if/#endif block.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D15744 |
303689 |
03-Aug-2016 |
ngie |
MFC r302571,r302572,r302577,r302841:
Approved by: re (gjb)
r302571:
Remove redundant declaration for radeon_pm_acpi_event_handler(..) to fix -Wredundant-decls warning
PR: 209924 Tested with: devel/amd64-gcc (5.3.0)
r302572:
Remove redundant declarations for intel_fbc_enabled(..) and i915_gem_dump_object(..) to fix -Wredundant-decls warning
PR: 209924 Tested with: devel/amd64-gcc (5.3.0)
r302577:
Add missing default case to capable(..) function definition
By definition (enum __drm_capabilities), cases other than CAP_SYS_ADMIN aren't possible. Add in a KASSERT safety belt and return false in !INVARIANTS case if an invalid value is passed in, as it would be a programmer error.
This fixes a -Wreturn-type error with gcc 5.3.0.
r302841:
Always panic if an invalid capability is passed to `capable(..)` instead of just with INVARIANTS
rwatson's point was valid in the sense that if the data passed at runtime is invalid, it should always trip the invariant, not just in the debug case. This is a deterrent against malicious input, or input caused by hardware errors.
Requested by: rwatson |
298933 |
02-May-2016 |
jhb |
Add a new bus method to fetch device-specific CPU sets.
bus_get_cpus() returns a specified set of CPUs for a device. It accepts an enum for the second parameter that indicates the type of cpuset to request. Currently two valus are supported:
- LOCAL_CPUS (on x86 this returns all the CPUs in the package closest to the device when DEVICE_NUMA is enabled) - INTR_CPUS (like LOCAL_CPUS but only returns 1 SMT thread for each core)
For systems that do not support NUMA (or if it is not enabled in the kernel config), LOCAL_CPUS fails with EINVAL. INTR_CPUS is mapped to 'all_cpus' by default. The idea is that INTR_CPUS should always return a valid set.
Device drivers which want to use per-CPU interrupts should start using INTR_CPUS instead of simply assigning interrupts to all available CPUs. In the future we may wish to add tunables to control the policy of INTR_CPUS (e.g. should it be local-only or global, should it ignore SMT threads or not).
The x86 nexus driver exposes the internal set of interrupt CPUs from the the x86 interrupt code via INTR_CPUS.
The ACPI bus driver and PCI bridge drivers use _PXM to return a suitable LOCAL_CPUS set when _PXM exists and DEVICE_NUMA is enabled. They also and the global INTR_CPUS set from the nexus driver with the per-domain set from _PXM to generate a local INTR_CPUS set for child devices.
Reviewed by: wblock (manpage) Differential Revision: https://reviews.freebsd.org/D5519
|
297231 |
24-Mar-2016 |
kib |
Handle the driver KPI change from r292373. Ensure that managed device pagers fault routines always return with a result page, be it the proper and valid result page, or initially passed freshly allocated placeholder. Do not free the passed in page until we are able to provide the replacement, and do not assign NULL to *mres.
Reported and tested by: dumbbell Reviewed by: royger (who also verified that Xen code is safe) Sponsored by: The FreeBSD Foundation
|
296768 |
12-Mar-2016 |
dumbbell |
drm/i915: Import Linux commit 168f83660211b9e059e3bc0638daaa01e9ea0b71
This makes sure the default context of each ring is cleaned up with the ring itself and fixes a memory leak.
Author: Mika Kuoppala <mika.kuoppala@linux.intel.com> Date: Fri May 3 16:29:08 2013 +0300
drm/i915: unreference default context on module unload
Before module unload is called, gpu_idle() will switch to default context. This will increment ref count of base object as the default context is 'running' on module unload time. Unreference the drm object so that when context is freed, base object is freed as well.
v2: added comment to explain the refcounts (Ben Widawsky)
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Obtained from: Linux
|
296720 |
12-Mar-2016 |
dumbbell |
drm/i915: Fix page fault handler failure
... when __wait_seqno() is interrupted by a signal. In this case, __wait_seqno() returns -ERESTARTSYS. Like we already do in drm_ioctl(), we need to convert this error to a common code such as -EINTR, so the page fault handler is restarted.
Reported by: Frederic Chardon <chardon.frederic@gmail.com> Tested by: Frederic Chardon <chardon.frederic@gmail.com>
|
292409 |
17-Dec-2015 |
jhb |
t seems certain Intel GPUs use GPIO bitbanging over a child device instead of GMBUS access for I2C transfers. The GMBUS driver falls back to this mode when a transfer times out. However, the first transfer to timeout was sending the request back to itself resulting in an panic due to recursing on a lock. Fix it to forward the request on to the proper device. This appears to have been accidentally changed in r277487.
Reported by: Joe Maloney <jmaloney@pcbsd.org> Reviewed by: adrian, dumbbell, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D4599
|
292373 |
16-Dec-2015 |
glebius |
A change to KPI of vm_pager_get_pages() and underlying VOP_GETPAGES().
o With new KPI consumers can request contiguous ranges of pages, and unlike before, all pages will be kept busied on return, like it was done before with the 'reqpage' only. Now the reqpage goes away. With new interface it is easier to implement code protected from race conditions.
Such arrayed requests for now should be preceeded by a call to vm_pager_haspage() to make sure that request is possible. This could be improved later, making vm_pager_haspage() obsolete.
Strenghtening the promises on the business of the array of pages allows us to remove such hacks as swp_pager_free_nrpage() and vm_pager_free_nonreq().
o New KPI accepts two integer pointers that may optionally point at values for read ahead and read behind, that a pager may do, if it can. These pages are completely owned by pager, and not controlled by the caller.
This shifts the UFS-specific readahead logic from vm_fault.c, which should be file system agnostic, into vnode_pager.c. It also removes one VOP_BMAP() request per hard fault.
Discussed with: kib, alc, jeff, scottl Sponsored by: Nginx, Inc. Sponsored by: Netflix
|
289719 |
21-Oct-2015 |
jhb |
i915_gem_do_execbuffer() holds the pages backing each relocation region for various reasons while executing user commands. After these commands are completed, the pages backing the relocation regions are unheld.
Since relocation regions do not have to be page aligned, the code in validate_exec_list() allocates 2 extra page pointers in the array of held pages populated by vm_fault_quick_hold_pages(). However, the cleanup code that unheld the pages always assumed that only the buffer size / PAGE_SIZE pages were used. This meant that non-page aligned buffers would not unheld the last 1 or 2 pages in the list. Fix this by saving the number of held pages returned by vm_fault_quick_hold_pages() for each relocation region and using this count during cleanup.
Reviewed by: dumbbell, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3965
|
283291 |
22-May-2015 |
jkim |
CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten years for head. However, it is continuously misused as the mpsafe argument for callout_init(9). Deprecate the flag and clean up callout_init() calls to make them more consistent.
Differential Revision: https://reviews.freebsd.org/D2613 Reviewed by: jhb MFC after: 2 weeks
|
280183 |
17-Mar-2015 |
dumbbell |
drm: Update the device-independent code to match Linux 3.8.13
This update brings few features: o Support for the setmaster/dropmaster ioctls. For instance, they are used to run multiple X servers simultaneously. o Support for minor devices. The only user-visible change is a new entry in /dev/dri but it is useless at the moment. This is a first step to support render nodes [1].
The main benefit is to greatly reduce the diff with Linux (at the expense of an unreadable commit diff). Hopefully, next upgrades will be easier.
No updates were made to the drivers, beside adapting them to API changes.
[1] https://en.wikipedia.org/wiki/Direct_Rendering_Manager#Render_nodes
Tested by: Many people MFC after: 1 month Relnotes: yes
|
277487 |
21-Jan-2015 |
kib |
An update for the i915 GPU driver, which brings the code up to Linux commit 4d93914ae3db4a897ead4b. Some related drm infrastructure changes are imported as needed.
Biggest update is the rewrite of the i915 gem io to more closely follow Linux model, althought the mechanism used by FreeBSD port is different.
Sponsored by: The FreeBSD Foundation MFC after: 2 month
|
271705 |
17-Sep-2014 |
dumbbell |
drm/i915: Add HW context support
This feature is required by Mesa 9.2+. Without this, a GL application crashes with the following message: # glxinfo name of display: :0.0 Gen6+ requires Kernel 3.6 or later. Assertion failed: (ctx->Version > 0), function handle_first_current, file ../../src/mesa/main/context.c, line 1498. Abort (core dumped)
Now, Mesa 10.2.4 and 10.3-rc3 works fine: # glxinfo name of display: :0 display: :0 screen: 0 direct rendering: Yes ... OpenGL renderer string: Mesa DRI Intel(R) 965GM OpenGL version string: 2.1 Mesa 10.2.4 ...
The code was imported from Linux 3.8.13.
Reviewed by: kib@ Tested by: kwm@, danfe@, Henry Hu, Lundberg, Johannes <johannes@brilliantservice.co.jp>, Johannes Dieterich <dieterich.joh@gmail.com>, Lutz Bichler <lutz.bichler@gmail.com>, MFC after: 3 days Relnotes: yes
|
269634 |
06-Aug-2014 |
royger |
drm: fix usage of vm_phys_fictitious_to_vm_page
vm_phys_fictitious_to_vm_page should not be called directly, even when operating on a range that has been registered using vm_phys_fictitious_reg_range. PHYS_TO_VM_PAGE should be used instead because on arches that use VM_PHYSSEG_DENSE the page might come directly from vm_page_array.
Reported by: nwhitehorn Tested by: nwhitehorn, David Mackay <davidm.jx8p@gmail.com> Sponsored by: Citrix Systems R&D
|
267548 |
16-Jun-2014 |
attilio |
- Modify vm_page_unwire() and vm_page_enqueue() to directly accept the queue where to enqueue pages that are going to be unwired. - Add stronger checks to the enqueue/dequeue for the pagequeues when adding and removing pages to them.
Of course, for unmanaged pages the queue parameter of vm_page_unwire() will be ignored, just as the active parameter today. This makes adding new pagequeues quicker.
This change effectively modifies the KPI. __FreeBSD_version will be, however, bumped just when the full cache of free pages will be evicted.
Sponsored by: EMC / Isilon storage division Reviewed by: alc Tested by: pho
|
258780 |
30-Nov-2013 |
eadler |
Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this shifts into the sign bit. Instead use (1U << 31) which gets the expected result.
This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases.
A similar change was made in OpenBSD.
Discussed with: -arch, rdivacky Reviewed by: cperciva
|
256848 |
21-Oct-2013 |
kib |
Reset function on SandyBridge holds the gt_lock for the whole duration already. Also, according to the specs, GDRST register is not in the power well, so the forcewake for reset status read is excessive for this reason.
Use plain register read for waiting of the reset completion notification, to avoid gt_lock recursion. Linux upstream did the similar change, but their code was already restructured.
Reported by: ray Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
255426 |
09-Sep-2013 |
jhb |
Add a mmap flag (MAP_32BIT) on 64-bit platforms to request that a mapping use an address in the first 2GB of the process's address space. This flag should have the same semantics as the same flag on Linux.
To facilitate this, add a new parameter to vm_map_find() that specifies an optional maximum virtual address. While here, fix several callers of vm_map_find() to use a VMFS_* constant for the findspace argument instead of TRUE and FALSE.
Reviewed by: alc Approved by: re (kib)
|
254796 |
24-Aug-2013 |
dumbbell |
drm/i915: Import Linux commit 71244653a8fb0f46bc12ae421f1d5f72af6a75da
Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Mon Jun 4 18:39:20 2012 +0200
drm/i915: adjusted_mode->clock in the dp mode_fixup
... instead of changing mode->clock, which we should leave as-is.
After the previous patch we only touch that if it's a panel, and then adjusted mode->clock equals adjusted_mode->clock. Outside of intel_dp.c we only use ajusted_mode->clock in the mode_set functions.
Within intel_dp.c we only use it to calculate the dp dithering and link bw parameters, so that's the only thing we need to fix up.
As a temporary ugliness (until the cleanup in the next patch) we pass the adjusted_mode into dp_dither for both parameters (because that one still looks at mode->clock).
Note that we do overwrite adjusted_mode->clock with the selected dp link clock, but that only happens after we've calculated everything we need based on the dotclock of the adjusted output configuration.
Outside of intel_dp.c only intel_display.c uses adjusted_mode->clock, and that stays the same after this patch (still equals the selected dp link clock). intel_display.c also needs the actual dotclock (as target_clock), but that has been fixed up in the previous patch.
v2: Adjust the debug message to also use adjusted_mode->clock.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
|
254141 |
09-Aug-2013 |
attilio |
On all the architectures, avoid to preallocate the physical memory for nodes used in vm_radix. On architectures supporting direct mapping, also avoid to pre-allocate the KVA for such nodes.
In order to do so make the operations derived from vm_radix_insert() to fail and handle all the deriving failure of those.
vm_radix-wise introduce a new function called vm_radix_replace(), which can replace a leaf node, already present, with a new one, and take into account the possibility, during vm_radix_insert() allocation, that the operations on the radix trie can recurse. This means that if operations in vm_radix_insert() recursed vm_radix_insert() will start from scratch again.
Sponsored by: EMC / Isilon storage division Reviewed by: alc (older version) Reviewed by: jeff Tested by: pho, scottl
|
254138 |
09-Aug-2013 |
attilio |
The soft and hard busy mechanism rely on the vm object lock to work. Unify the 2 concept into a real, minimal, sxlock where the shared acquisition represent the soft busy and the exclusive acquisition represent the hard busy. The old VPO_WANTED mechanism becames the hard-path for this new lock and it becomes per-page rather than per-object. The vm_object lock becames an interlock for this functionality: it can be held in both read or write mode. However, if the vm_object lock is held in read mode while acquiring or releasing the busy state, the thread owner cannot make any assumption on the busy state unless it is also busying it.
Also: - Add a new flag to directly shared busy pages while vm_page_alloc and vm_page_grab are being executed. This will be very helpful once these functions happen under a read object lock. - Move the swapping sleep into its own per-object flag
The KPI is heavilly changed this is why the version is bumped. It is very likely that some VM ports users will need to change their own code.
Sponsored by: EMC / Isilon storage division Discussed with: alc Reviewed by: jeff, kib Tested by: gavin, bapt (older version) Tested by: pho, scottl
|
253471 |
19-Jul-2013 |
jhb |
Be more aggressive in using superpages in all mappings of objects: - Add a new address space allocation method (VMFS_OPTIMAL_SPACE) for vm_map_find() that will try to alter the alignment of a mapping to match any existing superpage mappings of the object being mapped. If no suitable address range is found with the necessary alignment, vm_map_find() will fall back to using the simple first-fit strategy (VMFS_ANY_SPACE). - Change mmap() without MAP_FIXED, shmat(), and the GEM mapping ioctl to use VMFS_OPTIMAL_SPACE instead of VMFS_ANY_SPACE.
Reviewed by: alc (earlier version) MFC after: 2 weeks
|
251961 |
18-Jun-2013 |
kib |
On some generations of the Intel GPU, disabling of the VGA Display stops updating the vertical retrace indicator. The text mouse renderer in syscons is executing from the callout and spins waiting for the start of next frame. As result, after the X server finishes, since the VGA cannot be turned on, but syscons does not know about this, the clock swi spins forever.
Hack around the problem by disabling wait for the retrace if KMS is activated.
Diagnosed and tested by: Michiel Boland <boland37@xs4all.nl> Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
251960 |
18-Jun-2013 |
kib |
Since the gem pagefault handler relocks the vm object lock, other thread might fault on the same GTT offset meantime and instantiate the mapping. Recheck that the mgt device object still does not have a page at the current offset after relocking, and return a possibly installed page.
Reported by: Oleg Sidorkin <osidorkin@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
249041 |
03-Apr-2013 |
dumbbell |
drm and i915: Left-shift iic_msg.slave at creation time
This is required because, in the radeon driver, we can't left-shift in a central place, like it was done in the i915 driver.
Reviewed by: kib@, kan@, avg@ Tested by: kib@, avg@
|
248084 |
09-Mar-2013 |
attilio |
Switch the vm_object mutex to be a rwlock. This will enable in the future further optimizations where the vm_object lock will be held in read mode most of the time the page cache resident pool of pages are accessed for reading purposes.
The change is mostly mechanical but few notes are reported: * The KPI changes as follow: - VM_OBJECT_LOCK() -> VM_OBJECT_WLOCK() - VM_OBJECT_TRYLOCK() -> VM_OBJECT_TRYWLOCK() - VM_OBJECT_UNLOCK() -> VM_OBJECT_WUNLOCK() - VM_OBJECT_LOCK_ASSERT(MA_OWNED) -> VM_OBJECT_ASSERT_WLOCKED() (in order to avoid visibility of implementation details) - The read-mode operations are added: VM_OBJECT_RLOCK(), VM_OBJECT_TRYRLOCK(), VM_OBJECT_RUNLOCK(), VM_OBJECT_ASSERT_RLOCKED(), VM_OBJECT_ASSERT_LOCKED() * The vm/vm_pager.h namespace pollution avoidance (forcing requiring sys/mutex.h in consumers directly to cater its inlining functions using VM_OBJECT_LOCK()) imposes that all the vm/vm_pager.h consumers now must include also sys/rwlock.h. * zfs requires a quite convoluted fix to include FreeBSD rwlocks into the compat layer because the name clash between FreeBSD and solaris versions must be avoided. At this purpose zfs redefines the vm_object locking functions directly, isolating the FreeBSD components in specific compat stubs.
The KPI results heavilly broken by this commit. Thirdy part ports must be updated accordingly (I can think off-hand of VirtualBox, for example).
Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: pjd (ZFS specific review) Discussed with: alc Tested by: pho
|
236183 |
28-May-2012 |
kib |
Disable end of buffer fixup by default. New DDX does not need this, and since batch_len is unused by Linux driver, it seems that it is sometimes gets passed wrong. This causes command buffer corruption and GPU hung.
Old GEMified DDX drivers that needs this workaround are not supported.
MFC after: 1 month
|
235925 |
24-May-2012 |
dim |
Fix the following clang warning in drm2:
sys/dev/drm2/i915/intel_display.c:8861:3: error: expression result unused [-Werror,-Wunused-value] _intel_wait_for(dev, ^~~~~~~~~~~~~~~~~~~~ @/dev/drm2/i915/intel_drv.h:55:2: note: expanded from macro '_intel_wait_for' ret; \ ^~~
Reviewed by: kib MFC after: 1 week
|
235783 |
22-May-2012 |
kib |
Add the code for new Intel GPU driver, which supports GEM, KMS and works with new generations of GPUs (IronLake, SandyBridge and supposedly IvyBridge).
The driver is not connected to the build yet.
Sponsored by: The FreeBSD Foundation MFC after: 1 week
|