summaryrefslogtreecommitdiff
path: root/vmwgfx_ldu.c
AgeCommit message (Collapse)AuthorFilesLines
2018-03-26vmwgfx: Replace vmw_dma_buffer with vmw_buffer_objectThomas Hellstrom1-5/+5
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-01-19vmwgfx: fix memory corruption with legacy/sou connectorsRob Clark1-2/+2
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>
2017-10-25vmwgfx: Update stand alone to v4.12Sinclair Yeh1-15/+0
Mostly straight copy-and-paste from upstream, with the following notable changes * Added #undef CONFIG_DEBUG_FS in drmP.h to exclude all debugfs code * Minor updates to a few vmwgfx files due to API change * Carried over from the v4.11 update: Skipped update to drm_mm and drm_vma_manager because the switch to using interval tree makes porting difficult * Added #include <linux/highuid.h> to drm_ioctl.c to make CentOS build * Rolled in [Commit 3bacf4361cd0: drm/vmwgfx: Fix fbdev emulation using legacy functions] * Updated vmwgfx code to match upstream v4.12 code Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-06-14vmwgfx: Update stand alone to v4.11Sinclair Yeh1-13/+5
* Skipped update to drm_mm and drm_vma_manager because the switch to using interval tree makes porting difficult. * Added memdup_user_nul(), but replaced kmalloc_track_caller() with kmalloc() due to a compilation error. * Removed building and usage of debugfs_crc * VMWGFX_COMPAT_NO_VAF no longer seems to be required * Tested on CentOS 6.5, RHEL 6.8: 2.6.32-696 RHEL 7.3: 3.10.0-514 Ubuntu 14.04: 4.2.0-35 Ubuntu 16.04: 4.4.0-78 Ubuntu 16.04: 4.12-rc1 Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-03-31vmwgfx: Turn on DRIVER_ATOMIC flagSinclair Yeh1-1/+0
Now that the legacy front end path has been tested, turn on the DRIVER_ATOMIC flag so user mode driver can start going through the Atomic front end, if it chooses to do so. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-03-31vmwgfx: Use drm_atomic_helper_best_encoderSinclair Yeh1-1/+1
vmw_du_connector_best_encoder() can be replaced by drm_atomic_helper_best_encoder Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-03-27vmwgfx: Strip legacy cursor codeThomas Hellstrom1-23/+1
Use the atomic code only. Also clean up the locking by taking a spinlock around the position update. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair yeh <syeh@vmware.com>
2017-03-08vmwgfx: Enable svga before using VRAMThomas Hellstrom1-3/+1
Before pinning buffers in VRAM, we need to turn on SVGA mode which is a prerequisite for VRAM usage. SVGA mode is disabled in master_drop if fbdev is not running. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-03-08vmwgfx: Clear an uninitialized mode field during set_configThomas Hellstrom1-1/+1
This is a Workaround for buggy vmwgfx X drivers. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-02-23vmwgfx: Fix LDU X blank screen until mode change issueSinclair Yeh1-20/+21
vmw_ldu_crtc_helper_commit() is not called if drm_atomic_crtc_needs_modeset() decides nothing related to CRTC timing has changed. So a better place for this code is in vmw_ldu_primary_plane_atomic_update() since we will need to update ld->fb every time the FB is updated. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: Switch over to internal atomic API for SOU and LDUSinclair Yeh1-96/+7
Switch over to internal atomic API. This completes the atomic internal atomic switch for all the Display Units. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: Add and connect connector helper functionSinclair Yeh1-0/+7
Since the link between connector and encoder is always fixed in our case, just return the one encoder. These helpers won't be called until we flip on the atomic support flag or set drm_crtc_funcs->set_config to using the atomic helper. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: Add and connect plane helper functionsSinclair Yeh1-1/+65
Refactor previous FB and cursor plane update code into their atomic counterparts: check, update, prepare, cleanup, and disable. These helpers won't be called until we flip on the atomic support flag or set drm_crtc_funcs->set_config to using the atomic helper. v2: * Removed unnecessary pinning of cursor surface * Added a few function headers Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: Add and connect CRTC helper functionsSinclair Yeh1-0/+96
Atomic mode set requires us to refactor existing vmw_stdu_crtc_set_config code into sections that check the validity of the new mode, and sections that actually program the hardware state. vmw_du_crtc_atomic_check() takes CRTC-related checking code. In a later patch, vmw_du_primary_plane_atomic_check() will take framebuffer-related checking code. These helpers won't be called until we flip on the atomic support flag or set drm_crtc_funcs->set_config to using the atomic helper. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: Connector atomic stateSinclair Yeh1-2/+11
Add connector handling functions. Start tracking is_implicity in the connector state. Eventually, this field should be tracked exclusively in a connector state. Now that plane and connector states have been created, we can also activate the code that use CRTC state. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: Plane atomic stateSinclair Yeh1-0/+13
Add plane state handling functions. We have to keep track of a few plane states so we cannot use the DRM helper for this. Created vmw_plane_state along with functions to reset, duplicate, and destroty it. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: CRTC atomic stateSinclair Yeh1-0/+10
Create and Add CRTC state. We currently do not track any properties or custom states so we can technically use the DRM helpers. Creating this code just to make potential future additions easier. Most of the new code will be compiled but not enabled until plane/connector state handling code is also in place. This is the first of a series to enable atomic mode set for vmwgfx. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: Add universal plane supportSinclair Yeh1-7/+77
Universal support is prerequisite for atomic mode set. Explicitly create planes for the cursor and the primary FB. With a functional cursor plane, the DRM will no longer use the legacy cursor_set2 and cursor_move entry points. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-02-23vmwgfx: Porting over new drm and ttm filesSinclair Yeh1-29/+24
This is the one large DRM and vmwgfx port from kernel 4.6+ to vmwgfx stand alone. The code is not quite v4.7, but some of the structures have been ported over. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2016-01-20vmwgfx: Calculate the cursor position based on the crtc gui originThomas Hellstrom1-0/+2
Base the cursor position on the coordinate of the crtc origin in the gui coordinate system rather than in the framebuffer coordinate system. With explicit placement, these may differ (for example when two crtcs scan out of the same framebuffer location). Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2016-01-20vmwgfx: Add connector properties to switch between explicit and implicit ↵Thomas Hellstrom1-0/+7
placement Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2015-11-26vmwgfx: Implement the cursor_set2 callbackThomas Hellstrom1-0/+1
Now native drm clients like Fedora 23 Wayland appears to be able to use cursor hotspots without strange cursor offsets. Also fixes a couple of ignored error paths. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2015-11-18vmwgfx: Fix address-space- visibility- and endian warnings and errorsThomas Hellstrom1-5/+5
Found by sparse. Also annotate and fix code to avoid confusing sparse with unusual locking patterns. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2015-09-08vmwgfx: Fix copyright headersSinclair Yeh1-1/+1
Updating and fixing copyright headers. Bump version minor to signal vgpu10 support. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2015-09-07vmwgfx: Implement fbdev on kms v2Thomas Hellstrom1-1/+0
With screen targets the old legacy display system fbdev doesn't work satisfactory anymore. At best the resolution is severely restricted. Therefore implement fbdev on top of the kms system. With this change, fbdev will be using whatever KMS backend is chosen. There are helpers available for this, so in the future we'd probably want to implement the helper callbacks instead of calling into our KMS implementation directly. v2: Make sure we take the mode_config mutex around modesetting, Also clear the initial framebuffer using vzalloc instead of vmalloc. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2015-09-07vmwgfx: Major KMS refactoring / cleanup in preparation of screen targetsSinclair Yeh1-3/+42
Also some modifications to match upstream code closer. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2015-05-05vmwgfx: Rework device initializationThomas Hellstrom1-0/+1
This commit reworks device initialization so that we always enable the FIFO at driver load, deferring SVGA enable until either first modeset or fbdev enable. This should always leave the fifo properly enabled for render- and control nodes. In addition, *) We disable the use of VRAM when SVGA is not enabled. *) We simplify PM support so that we only throw out resources on hibernate, not on suspend, since the device keeps its state on suspend. *) We remove PM support for kernel versions < 2.6.29 since we only support kernel versions > 2.6.35 anyway. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2014-12-19drm,vmwgfx: Add connectors to sysfsThomas Hellstrom1-0/+2
This is already done upstream, and now that we use the upstream drm sysfs class, it makes sense to do it here as well. Also fix a connector naming bug in our local drm. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yey <syeh@vmware.com>
2014-12-19vmwgfx: Add suggested screen x and y connector propertiesThomas Hellstrom1-0/+6
Introduced by qxl, add these properties as a generic way to tell a display manager about the GUI layout. Also add the hotplug_mode_update_property which advises display managers to reread the mode list on a hotplug event. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2013-11-27drm/vmwgfx: Correctly set the enabled state on crtcsThomas Hellstrom1-0/+2
Failure to do this would make the drm_mode_get_crtc ioctl return without crtc mode info, indicating that no mode was set. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2012-01-05vmwgfx: Pick up the initial size from the width and height regsJakob Bornecrantz1-2/+2
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2011-11-10vmwgfx: Resend the cursror after legacy modesetJakob Bornecrantz1-1/+21
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2011-10-27vmwgfx: Infrastructure for explicit placementThomas Hellstrom1-0/+1
Make it possible to use explicit placement (although not hooked up with a user-space interface yet) and relax the single framebuffer limit to only apply to implicit placement. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2011-10-26vmwgfx: Use "Virtual" connectors and encoders rather than "LVDS".Thomas Hellstrom1-2/+2
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2011-10-19drm: Bring in vblank, events and update modesetting codeJakob Bornecrantz1-1/+1
Changes imported from upstream. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2011-10-17vmwgfx: Whitespace & code style in display unitJakob Bornecrantz1-3/+1
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2011-10-17vmwgfx: Fix display system init & close functionsJakob Bornecrantz1-8/+22
Make sure we null the display private, make sure we catch and handle vblank failing to init and don't call vblank_cleanup if we haven't initialized the display system. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2011-09-27vmwgfx: Add screen object supportJakob Bornecrantz1-3/+2
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2011-09-27vmwgfx: Refactor common display unit functions to shared fileJakob Bornecrantz1-251/+16
More preparation for Screen Object support. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2011-01-11vmwgfx: Print error diagnostics if depth doesn't match the host expectation.Michel Dänzer1-10/+4
Signed-off-by: Michel Dänzer <daenzer@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2011-01-05vmwgfx: Add support for depth 8.Michel Dänzer1-0/+11
Signed-off-by: Michel Dänzer <daenzer@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-12-21vmwgfx: Let SVGA_REG_NUM_DISPLAYS determine output connectivity.Thomas Hellstrom1-3/+10
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-11-23drivers/gpu/drm/vmwgfx: Fix k.alloc switched argumentsJoe Perches1-1/+1
Signed-off-by: Joe Perches <joe@perches.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-24vmwgfx: Enable use of the vblank system.Thomas Hellstrom1-10/+17
This is to avoid accessing uninitialized data during drm_irq_uninstall. At the same time, enable error check from drm_kms_init which previously appeared to ignore all errors. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-09-23vmwgfx: Prune modes based on available VRAM sizeThomas Hellstrom1-10/+20
This needs to be reviewed once we support screen objects and don't rely on VRAM for the frame-buffer. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-09-22vmwgfx: Pull down upstream vmwgfx codeThomas Hellstrom1-7/+10
Code from drm-next v2.6.34-rc5-11562-g96576a9. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-07-23vmwgfx: Prune modes based on available VRAM size.Thomas Hellstrom1-9/+19
This needs to be reviewed once we support screen objects and don't rely on VRAM for the frame-buffer. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2010-04-30vmwgfx: Allow userspace to change default layoutJakob Bornecrantz1-6/+76
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
2010-04-20vmwgfx: Clean up and fix mode settingJakob Bornecrantz1-13/+3
2010-03-04vmwgfx: Don't use SVGA_REG_ENABLE in modesetting codeJakob Bornecrantz1-5/+0