summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-05-07vmwgfx: Add gui_x/y to vmw_connector_stateDeepak Rawat4-36/+86
As gui_x/y positioning is display unit is protected by requested_layout_mutex adding vmw_connector_state copy of the same and modeset commit will refer the state copy to sync with modeset_check state. v2: Tested with CONFIG_PROVE_LOCKING enabled. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-05-07vmwgfx: Use a mutex to protect gui positioning in vmw_display_unitDeepak Rawat3-11/+37
To avoid race condition between update_layout ioctl and modeset ioctl for access to gui_x/y positioning added a new mutex requested_layout_mutex. Also used drm_for_each_connector_iter to iterate over connector list. v2: Tested with CONFIG_PROVE_LOCKING enabled. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-04-25vmwgfx: Clean up fbdev modeset lockingThomas Hellstrom2-24/+20
At least since the atomic port, the vmwgfx fbdev code is taking a number of unnecessary modeset locks. In particular the kms_set_config() function will grab its own locks, leading to locking retries. So avoid drm_modeset_lock_all() and instead provide a local acquire context for kms_set_config(). Also have the vmw_kms_fbdev_init data itself grab the lock that it needs. This also fixed a long standing problem that vmw_fb_close() didn't provide an acquire context for kms_set_config(), causing potential warnings and hangs during driver unload. Testing done: Repeated driver load and unload on Ubuntu 16.04.2 Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-04-05vmwgfx: Remove primary memory validation against mode while creating fbDeepak Rawat1-13/+0
This validation is not required because user-space will send create_fb request once the memory is allocated. This check should be performed during mode-setting. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-04-05vmwgfx: Perform memory validations only when need full modeset.Deepak Rawat1-2/+21
For cases when full modeset is not requested like page-flip, skip memory validation as the topology is not changed. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-04-05vmwgfx: Use modeset display memory validation for layout ioctlDeepak Rawat1-69/+51
Call the same display memory validation function which is used by modeset_check. This ensure consistency that kernel change preferred mode/topology only if supported. Also change the internal function to use drm_rect instead of rm_vmw_rect. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-04-05vmwgfx: Perform topology validation during atomic modeset.Deepak Rawat2-38/+177
This patch adds display (primary) memory validation during modeset check. Display memory validation are applicable to both SOU and STDU, so allow both display unit to undergo this check. Also added check for SVGA_CAP_NO_BB_RESTRICTION capability which lifts bounding box restriction for STDU. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-04-05vmwgfx: Use blocking buffer object reserves when evicting resourcesThomas Hellstrom1-10/+19
Previously when evicting resources we were unconditionally calling ttm_eu_reserve_buffers with a NULL ww acquire context. That meant all buffer object reserves were done using trylock semantics. That makes sense when evicting during resource validation, because then there already are a number of buffers reserved and using waiting locks would cause lockdep errors. That's not the case when unconditionally evicting all resources as part of driver takedown or hibernation, so in that code path, make sure we have a ww acquire context to get waiting lock buffer object reserve semantics. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-04-05vmwgfx: Optimize the buffer object swap_notify callback somewhat.Thomas Hellstrom1-4/+6
Only try to unmap cached maps when the buffer is moved into or out from vram. Otherwise the underlying pages stay the same. Also when unbinding resources from MOBs about to move, make sure we're really moving out of MOB memory. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-04-05vmwgfx: Move buffer object related code to vmwgfx_bo.cThomas Hellstrom11-715/+851
It makes more sense to have all the buffer object related code in a single file rather than splitting it up between the resource code and buffer object pinning utilities. Place all buffer object related code in vmwgfx_bo.c. Fix up headers and export resource functionality when needed in the buffer object code. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-03-26vmwgfx: Replace vmw_dma_buffer with vmw_buffer_objectThomas Hellstrom20-610/+592
Initially vmware buffer objects were only used as DMA buffers, so the name DMA buffer was a natural one. However, currently they are used also as dumb buffers and MOBs backing guest backed objects so renaming them to buffer objects is logical. Particularly since there is a dmabuf subsystem in the kernel where a dma buffer means something completely different. This also renames user-space api structures and IOCTL names correspondingly, but the old names remain defined for now and the ABI hasn't changed. There are a couple of minor style changes to make checkpatch happy. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-03-19vmwgfx: Unpin the screen object backup buffer when not usedThomas Hellstrom1-8/+21
We were relying on the pinned screen object backup buffer to be destroyed when not used. But if we hold a copy of the atomic state, like when hibernating, the backup buffer might not be destroyed since it's refcounted by the atomic state. This causes us to hibernate with a buffer pinned in VRAM. Fix this by only having the buffer pinned when it is actually used by a screen object. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-03-19vmwgfx: Fix a destoy-while-held mutex problem.Thomas Hellstrom4-17/+38
When validating legacy surfaces, the backup bo might be destroyed at surface validate time. However, the kms resource validation code may have the bo reserved, so we will destroy a locked mutex. While there shouldn't be any other users of that mutex when it is destroyed, it causes a lock leak and thus throws a lockdep error. Fix this by having the kms resource validation code hold a reference to the bo while we have it reserved. We do this by introducing a validation context which might come in handy when the kms code is extended to validate multiple resources or buffers. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-03-19vmwgfx: Get rid of the device-private suspended memberThomas Hellstrom3-5/+1
It was used to early block fbdev dirty processing. Replace it with an unprotected check of the par->dirty.active field. While this might race with the vmw_fb_off() function, we do a protected check later so the race will at worst lead to grabbing and releasing a couple of locks. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-03-19vmwgfx: Fix fbdev and atomic kms interaction during hibernationThomas Hellstrom3-36/+53
Since fbdev, while not using atomic explicitly, uses callbacks that calls into atomic helpers, we can use atomic helpers also to turn off and save fbdev kms state. Do that and alter the vmw_fb_on and vmw_fb_off functions to only switch on- and off fbdev dirty processing, which may otherwise re-validate bos that have just been swapped out for hibernation. Also split out the fbdev_refresh functionality. Ideally we shouldn't need to use that, since kms_restore should reinstall needed functionality. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-03-19vmwgfx: Stricter count of legacy surface device resourcesThomas Hellstrom1-5/+3
For legacy surfaces, they were previously registered as device resources when the driver resources were created. Since they are evictable we instead register them as device resources once they are created on the device, just like for guest-backed surfaces. This has implications during hibernation where we can't hibernate with device resources active. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-03-19vmwgfx: Fix warnings on 4.16 kernelThomas Hellstrom1-1/+2
We get redefined macro warnings for __ATTR_RW Testing done: Compilation on 4.16.0-rc3 and Centos 2.6.32. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-03-12vmwgfx: Use kasprintfHimanshu Jha1-10/+3
Use kasprintf instead of combination of kmalloc and sprintf. Also, remove the local variables used for storing the string length as they are not required now. Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-03-09vmwgfx: only unmap if a vbo has been mappedSinclair Yeh1-0/+3
On boot up with fbcon, the first time FB surface is pinned it is moved from system mem to MOB or GMR. This triggers vmw_resource_move_notify(), which will unconditionally try to vmw_dma_buffer_unmap() the buffer even though it has not been mapped before. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-03-08vmwgfx: Improve on hibernationThomas Hellstrom3-21/+102
Make it possible to hibernate also with masters that don't switch VT at hibernation time. We save and restore modesetting state unless fbdev is active and enabled at hibernation time. Testing done: Hibernation with the "kmscube" app on Fedora 27. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-03-06vmwgfx: Avoid pinning fbdev framebuffersThomas Hellstrom5-51/+96
fbdev framebuffers were previously pinned to be able to keep them mapped across updates. This commit introduces a mechanism that instead revalidates the map on each update, keeping the map cached across updates. The cached map is torn down if the underlying pages change. Typically on buffer object moves and swapouts. This should be nicer to the system when we have resource contention. Testing done: Basic fbdev functionality under Fedora 27. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-03-06vmwgfx: Fix compilation failure on older kernelsThomas Hellstrom2-2/+2
A compat macro was incorrectly defined. Also make sure the vmwgfx_compat.h file is included in vmwgfx_msg.c Testing done: Compilation on linux versions 4.1.49, 4.14.16 Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-03-06vmwgfx: Fix black screen and device errors when running without fbdevThomas Hellstrom4-1/+25
When we are running without fbdev, transitioning from the login screen to X or gnome-shell/wayland will cause a vt switch and the driver will disable svga mode, losing all modesetting resources. However, the kms atomic state does not reflect that and may think that a crtc is still turned on, which will cause device errors when we try to bind an fb to the crtc, and the screen will remain black. Fix this by turning off all kms resources before disabling svga mode. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-02-28vmwgfx: Fix multiple command buffer context useThomas Hellstrom3-33/+38
The start / stop and preempt commands don't honor the context argument but rather acts on all available contexts. Also add detection for context 1 availability. Note that currently there's no driver interface for submitting buffers using the high-priority command queue (context 1). Testing done: Change the default context for command submission to 1 instead of 0, verify basic desktop functionality including faulty command injection and recovery. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-02-28vmwgfx: Fix gdm-wayland missing cursor imageThomas Hellstrom1-18/+15
gdm-wayland doesn't tell us when the cursor image was updated, so for now revert to our old habit of uploading the image on each cursor move. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-02-28vmwgfx: Fix compilation failure on linux 4.15Thomas Hellstrom1-1/+1
Replace ACCESS_ONCE with READ_ONCE. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-02-13vmwgfx: Fix "duplicate frame pointer save" warningJosh Poimboeuf3-1/+10
objtool reports the following warnings: drivers/gpu/drm/vmwgfx/vmwgfx_msg.o: warning: objtool: vmw_send_msg()+0x107: duplicate frame pointer save drivers/gpu/drm/vmwgfx/vmwgfx_msg.o: warning: objtool: vmw_host_get_guestinfo()+0x252: duplicate frame pointer save To quote Linus: "The reason is that VMW_PORT_HB_OUT() uses a magic instruction sequence (a "rep outsb") to communicate with the hypervisor (it's a virtual GPU driver for vmware), and %rbp is part of the communication. So the inline asm does a save-and-restore of the frame pointer around the instruction sequence. I actually find the objtool warning to be quite reasonable, so it's not exactly a false positive, since in this case it actually does point out that the frame pointer won't be reliable over that instruction sequence. But in this particular case it just ends up being the wrong thing - the code is what it is, and %rbp just can't have the frame information due to annoying magic calling conventions." Silence the warnings by telling objtool to ignore the two functions which use the VMW_PORT_HB_{IN,OUT} macros. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-02-13drm, vmwgfx: Fix compilation on CentOS 6.5Thomas Hellstrom5-37/+504
Recent DRM backporting has broken compilation on CentOS 6.5. Fix this by adding some compat code and change version checks, In particular we import the current upstream version of <linux/hdmi.h> Testing: Compilation and basic functionality on vanilla 2.6.35.9, Compilation and basic functionality on 2.6.32-431.29.2.el6.x86_64 Compilation on 4.14.16-300.fc27.x86_64. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Acked-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-01-19vmwgfx: fix memory corruption with legacy/sou connectorsRob Clark2-4/+4
It looks like in all cases 'struct vmw_connector_state' is used. But only in stdu connectors, was atomic_{duplicate,destroy}_state() properly subclassed. Leading to writes beyond the end of the allocated connector state block and all sorts of fun memory corruption related crashes. Signed-off-by: Rob Clark <rclark@redhat.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-01-19vmwgfx: Fix a boot time warningWoody Suwalski1-1/+1
The 4.15 vmwgfx driver shows a warning during boot. It is caused by a mismatch between the result of vmw_enable_vblank() and what the drm_atomic_helper expects. Signed-off by: Woody Suwalski <terraluna977@gmail.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-01-19vmwgfx: Potential off by one in vmw_view_add()Dan Carpenter1-0/+2
The vmw_view_cmd_to_type() function returns vmw_view_max (3) on error. It's one element beyond the end of the vmw_view_cotables[] table. My read on this is that it's possible to hit this failure. header->id comes from vmw_cmd_check() and it's a user controlled number between 1040 and 1225 so we can hit that error. But I don't have the hardware to test this code. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-12-22vmwgfx: Use the cpu blit utility for framebuffer to screen target blitsThomas Hellstrom6-91/+95
This blit was previously performed using two large vmaps, one of which was teared down and remapped on each blit. Use the more resource- conserving TTM cpu blit instead. The blit is used in boundary-box computing mode which makes it possible to minimize the bounding box used in host operations. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-22vmwgfx: Add a cpu blit utility that can be used for page-backed bos v4Thomas Hellstrom3-1/+551
The utility uses kmap_atomic() instead of vmapping the whole buffer object. As a result there will be more book-keeping but on some architectures this will help avoid exhausting vmalloc space and also avoid expensive TLB flushes. The blit utility also adds a provision to compute a bounding box of changed content, which is very useful to optimize presentation speed of ill-behaved applications that don't supply proper damage regions, and for page-flips. The cost of computing the bounding box is not that expensive when done in a cpu-blit utility like this. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-22vmwgfx/ttm: Export the ttm_k[un]map_atomic API.Thomas Hellstrom2-5/+30
It will be used by vmwgfx cpu blit. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-22vmwgfx: Cursor update fixesThomas Hellstrom1-16/+30
Use drm_plane_helper_check_update also for the cursor plane. Avoid uploading a new cursor image on each cursor move and only upload cursor images on cursor fb changes, assuming that we're in effect page-flipping the cursor, which is exactly what the legacy helper does. Cursor front-buffer like rendering using atomic still needs some kind of atomic damage interface. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-22drm: Fix compilation on Fedora 32-bitThomas Hellstrom1-1/+1
Contrary to fedora 64-bit, the 32-bit kernels enable CONFIG_VIDEOMODE_HELPERS which causes compilation errors since then we don't include the necessary headers. This change shouldn't cause any regression since if the affected header's aren't present we would have failed compilation without this change anyway. Testing done: Successful compilation on Fedora 26 x86. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-12-22vmwgfx: Replace the backend treatment of legacy hotspotsThomas Hellstrom3-8/+28
Assuming now that cursor hotspots are always present in the plane state, we don't need to add in the legacy hotspots in the backend code anymore. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-22vmwgfx/drm: Add core support to supply legacy cursor hotspot pointersThomas Hellstrom2-1/+18
We revisit this change. Previous we added the different hotspots together just before programming the device, but that makes the plane atomic state incompatible with what's actually in the device. So add a way for the only legacy ioctl that doesn't support cursor hotspots to add the device internal legacy hotspots into the atomic plane state. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-22vmwgfx: Fix build on 4.15rcThomas Hellstrom2-6/+14
The timer interface changed slightly, so adapt the drm code to the new version and add some compate defines to make it compile on older kernels. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-22vmwgfx/ttm: Remove the "aliased" argument to ttm_bo_k[un]map_protThomas Hellstrom1-21/+11
We don't use it currently, so it can be re-added later if needed for faster cpu buffer moves. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-19vmwgfx: Send the correct nonblock option for atomic_commitDeepak Rawat1-24/+1
Page flip can be slow for vmwgfx in some cases, like need to do surface copy to different surface or waiting for IN_FENCE_FD. Enabling nonblocking commits for vmwgfx in case userspace request it. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-12-18vmwgfx: Move the stdu vblank event to atomic functionDeepak Rawat1-65/+79
Atomic ioctl can also send the same page flip flags as legacy ioctl. In those cases also need to send the vblank event to userspace. vmwgfx does not support flag DRM_MODE_PAGE_FLIP_ASYNC, so this flag is never expected. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-12-18vmwgfx: Move screen object page flip to atomic functionDeepak Rawat1-50/+64
The dmabuf_dirty/surface_dirty in case of screen object is moved to plane atomic update, so that page flip in atomic ioctl also works. vmwgfx does not support DRM_MODE_PAGE_FLIP_ASYNC, so this flag is never expected. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-12-18vmwgfx: Remove drm_crtc_arm_vblank_event from atomic flushDeepak Rawat1-5/+1
The function drm_crtc_arm_vblank_event should be used for the driver which have vblank interrupt support. In case of vmwgfx we do not have vblank interrupt. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-12-13vmwgfx: use monotonic event timestampsSinclair Yeh1-4/+5
DRM_VMW_EVENT_FENCE_SIGNALED (struct drm_vmw_event_fence) and DRM_EVENT_VBLANK (struct drm_event_vblank) pass timestamps in 32-bit seconds/microseconds format. As of commit c61eef726a78 ("drm: add support for monotonic vblank timestamps"), other DRM drivers use monotonic times for drm_event_vblank, but vmwgfx still uses CLOCK_REALTIME for both events, which suffers from the y2038/y2106 overflow as well as time jumps. For consistency, this changes vmwgfx to use ktime_get_ts64 as well, which solves those problems and avoids the deprecated do_gettimeofday() function. This should be transparent to to user space, as long as it doesn't compare the time against the result of gettimeofday(). Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-11-27vmwgfx: Move surface copy cmd to atomic functionDeepak Rawat1-25/+22
When display surface is different than the framebuffer surface, atomic path do not copy the surface data. This commit moved the code to copy surface from legacy to atomic path. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-11-27vmwgfx: Avoid iterating over display unit if crtc is availableDeepak Rawat4-26/+56
In case of page flip there is no need to iterate over all display unit in the function "vmw_kms_helper_dirty". If crtc is available then dirty commands is performed on that crtc only. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-11-14ttm: Clean up kmap selection codeThomas Hellstrom1-35/+44
Avoid using in-function ifdefs for this, and also add an aliasing hint that could help callers avoid uncached reads. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-11-14vmwgfx: Don't cache framebuffer mapsThomas Hellstrom3-36/+13
Buffer objects need to be either pinned or reserved while a map is active, that's not the case here, so avoid caching the framebuffer map. This will cause increasing mapping activity mainly when we don't do page flipping. This fixes occasional garbage filled screens when the framebuffer has been evicted after the map. Since in-kernel mapping of whole buffer objects is error-prone on 32-bit architectures and also quite inefficient, we will revisit this. Testing done: Disabled proxy surfaces and manually tested normal desktop usage on a 3D-disabled Ubuntu 16.04.2 vm. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-10-25vmwgfx: Fix atomic mode set checkSinclair Yeh1-12/+28
vmw_kms_atomic_check_modeset() is currently checking config using the legacy state, which is updated after a commit has happened. This means vmw_kms_atomic_check_modeset() will reject an invalid config on the next update rather than the current one. Fix this by using the new states for config checking Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>