summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
Commit message (Collapse)AuthorAgeFilesLines
* vmwgfx: remove useless set memory to zero use memset()Wei Yongjun2012-09-131-1/+0Star
| | | | | | | | The memory return by kzalloc() or kmem_cache_zalloc() has already be set to zero, so remove useless memset(0). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: stop vmgfx driver explosionAlan Cox2012-08-221-1/+5
| | | | | | | | | | | | | | | | | If you do a page flip with no flags set then event is NULL. If event is NULL then the vmw_gfx driver likes to go digging into NULL and extracts NULL->base.file_priv. On a modern kernel with NULL mapping protection it's just another oops, without it there are some "intriguing" possibilities. What it should do is an open question but that for the driver owners to sort out. Signed-off-by: Alan Cox <alan@linux.intel.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Constify drm_mode_config_funcs pointerLaurent Pinchart2012-05-221-1/+1
| | | | | | | | | | | | | | | | The DRM mode config functions structure declared by drivers and pointed to by the drm_mode_config funcs field is never modified. Make it a const pointer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Inki Dae <inki.dae@samsung.com> Cc: Alan Cox <alan@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Thomas Hellstrom <thellstrom@vmware.com> Cc: Rob Clark <rob.clark@linaro.org> Reviwed-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Add page flip supportJakob Bornecrantz2012-02-131-0/+64
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Pipe fence out of screen object dirty functionsJakob Bornecrantz2012-02-131-6/+15
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Make it possible to get fence from execbufJakob Bornecrantz2012-02-131-5/+5
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Fix assignment in vmw_framebuffer_create_handleRyan Mallon2012-01-301-1/+1
| | | | | | | | | The assignment of handle in vmw_framebuffer_create_handle doesn't actually do anything useful and is incorrectly assigning an integer value to a pointer argument. It appears that this is a typo and should be dereferencing handle rather than assigning to it directly. This fixes a bug where an undefined handle value is potentially returned to user-space. Signed-off-by: Ryan Mallon <rmallon@gmail.com> Reviewed-by: Jakob Bornecrantz<jakob@vmware.com> Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
* Merge branch 'drm-core-next' of git://people.freedesktop.org/~airlied/linuxLinus Torvalds2012-01-101-11/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'drm-core-next' of git://people.freedesktop.org/~airlied/linux: (307 commits) drm/nouveau/pm: fix build with HWMON off gma500: silence gcc warnings in mid_get_vbt_data() drm/ttm: fix condition (and vs or) drm/radeon: double lock typo in radeon_vm_bo_rmv() drm/radeon: use after free in radeon_vm_bo_add() drm/sis|via: don't return stack garbage from free_mem ioctl drm/radeon/kms: remove pointless CS flags priority struct drm/radeon/kms: check if vm is supported in VA ioctl drm: introduce drm_can_sleep and use in intel/radeon drivers. (v2) radeon: Fix disabling PCI bus mastering on big endian hosts. ttm: fix agp since ttm tt rework agp: Fix multi-line warning message whitespace drm/ttm/dma: Fix accounting error when calling ttm_mem_global_free_page and don't try to free freed pages. drm/ttm/dma: Only call set_pages_array_wb when the page is not in WB pool. drm/radeon/kms: sync across multiple rings when doing bo moves v3 drm/radeon/kms: Add support for multi-ring sync in CS ioctl (v2) drm/radeon: GPU virtual memory support v22 drm: make DRM_UNLOCKED ioctls with their own mutex drm: no need to hold global mutex for static data drm/radeon/benchmark: common modes sweep ignores 640x480@32 ... Fix up trivial conflicts in radeon/evergreen.c and vmwgfx/vmwgfx_kms.c
| * Merge remote-tracking branch 'pfdo/drm-fixes' into drm-core-nextDave Airlie2011-12-211-141/+249
| |\ | | | | | | | | | | | | | | | | | | | | | -next reported a messy merge, so I've merged my upstream pull into my -next tree. Conflicts: drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
| * \ Merge tag 'v3.2-rc6' of /home/airlied/devel/kernel/linux-2.6 into drm-core-nextDave Airlie2011-12-201-8/+17
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge in the upstream tree to bring in the mainline fixes. Conflicts: drivers/gpu/drm/exynos/exynos_drm_fbdev.c drivers/gpu/drm/nouveau/nouveau_sgdma.c
| * | | drm: Replace pitch with pitches[] in drm_framebufferVille Syrjälä2011-12-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise each driver would need to keep the information inside their own framebuffer object structure. Also add offsets[]. BOs on the other hand are driver specific, so those can be kept in driver specific structures. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
| * | | drm: move the fb bpp/depth helper into the core.Dave Airlie2011-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is used by nearly everyone including vmwgfx which doesn't generally use the fb helper. Signed-off-by: Dave Airlie <airlied@redhat.com>
| * | | drm: add an fb creation ioctl that takes a pixel format v5Jesse Barnes2011-11-151-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To properly support the various plane formats supported by different hardware, the kernel must know the pixel format of a framebuffer object. So add a new ioctl taking a format argument corresponding to a fourcc name from the new drm_fourcc.h header file. Implement the fb creation hooks in terms of the new mode_fb_cmd2 using helpers where the old bpp/depth values are needed. v2: create DRM specific fourcc header file for sharing with libdrm etc v3: fix rebase failure and use DRM fourcc codes in intel_display.c and update commit message v4: make fb_cmd2 handle field into an array for multi-object formats pull in Ville's fix for the memcpy in drm_plane_init apply Ville's cleanup to zero out fb_cmd2 arg in drm_mode_addfb v5: add 'flags' field for interlaced support (from Ville) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Reviewed-by: Rob Clark <rob.clark@linaro.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | | | vmwgfx: fix incorrect VRAM size check in vmw_kms_fb_create()Xi Wang2011-12-221-3/+3
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e133e737 didn't correctly fix the integer overflow issue. - unsigned int required_size; + u64 required_size; ... required_size = mode_cmd->pitch * mode_cmd->height; - if (unlikely(required_size > dev_priv->vram_size)) { + if (unlikely(required_size > (u64) dev_priv->vram_size)) { Note that both pitch and height are u32. Their product is still u32 and would overflow before being assigned to required_size. A correct way is to convert pitch and height to u64 before the multiplication. required_size = (u64)mode_cmd->pitch * (u64)mode_cmd->height; This patch calls the existing vmw_kms_validate_mode_vram() for validation. Signed-off-by: Xi Wang <xi.wang@gmail.com> Reviewed-and-tested-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | | vmwgfx: Clip cliprects against screen boundaries in present and dirtyJakob Bornecrantz2011-12-191-53/+156
| | | | | | | | | | | | | | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | | vmwgfx: Do better culling of presentsJakob Bornecrantz2011-12-191-12/+25
| | | | | | | | | | | | | | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | | vmwgfx: Refactor kms code to use vmw_user_lookup_handle helperJakob Bornecrantz2011-12-191-61/+37Star
| | | | | | | | | | | | | | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | | vmwgfx: Refactor cursor updateJakob Bornecrantz2011-12-191-27/+39
| |/ |/| | | | | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | vmwgfx: integer overflow in vmw_kms_update_layout_ioctl()Xi Wang2011-12-021-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | There are two issues in vmw_kms_update_layout_ioctl(). First, the for loop forgets to index rects and only checks the first element. Second, there is a potential integer overflow if userspace passes in a large arg->num_outputs. The call to kzalloc() would allocate a small buffer, leading to out-of-bounds read. Reported-by: Haogang Chen <haogangchen@gmail.com> Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | vmwgfx: Only allow 64x64 cursorsJakob Bornecrantz2011-11-111-0/+4
| | | | | | | | | | | | | | | | Snooping code expects this to be the case. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | vmwgfx: Initialize clip rect loop correctly in surface dirtyJakob Bornecrantz2011-11-111-2/+3
| | | | | | | | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | vmwgfx: Close screen object systemJakob Bornecrantz2011-11-111-1/+4
|/ | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Snoop DMA transfers with non-covering sizesJakob Bornecrantz2011-11-071-9/+21
| | | | | | | | Enough to get cursors working under Wayland. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Move the prefered mode first in the listJakob Bornecrantz2011-11-071-0/+4
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Unreference surface on cursor error pathJakob Bornecrantz2011-11-071-0/+1
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Free prefered mode on error pathJakob Bornecrantz2011-11-071-6/+11
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Use pointer return error codesJakob Bornecrantz2011-11-071-1/+1
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Fix hw cursor positionThomas Hellstrom2011-11-071-2/+5
| | | | | | Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Make the preferred autofit mode have a 60Hz vrefreshThomas Hellstrom2011-11-071-1/+23
| | | | | | Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Reinstate the update_layout ioctlThomas Hellstrom2011-11-021-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | We need to redefine a connector as "connected" if it matches a window in the host preferred GUI layout. Otherwise "smart" window managers would turn on Xorg outputs that we don't want to be on. This reinstates the update_layout and adds the following information to the modesetting system. a) Connection status <-> Equivalent to real hardware connection status b) Preferred mode <-> Equivalent to real hardware reading EDID c) Host window position <-> Equivalent to a real hardware scanout address dynamic register. It should be noted that there is no assumption here about what should be displayed and where. Only how to access the host windows. This also bumps minor to signal availability of the new IOCTL. Based on code originally written by Jakob Bornecrantz Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Don't pass unused arguments to do_dirty functionsJakob Bornecrantz2011-10-231-9/+3Star
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Emulate depth 32 framebuffersJakob Bornecrantz2011-10-231-1/+9
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Add vblank stubsJakob Bornecrantz2011-10-181-0/+19
| | | | | | | | | | This fixes kernel panics when running the vbltest from the drm repo. We can't just skip initializing the vblank system since it sets up certain state for us, see: "vmwgfx: Enable use of the vblank system." Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Don't use virtual coords when using screen objectsJakob Bornecrantz2011-10-101-57/+215
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Minor cleanupsThomas Hellstrom2011-10-051-8/+9
| | | | | | | As suggested by Konrad Rzeszutek Wilk Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Be more strict with fb depths when using screen objectsJakob Bornecrantz2011-10-051-0/+27
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Make sure we always have a user-space handle to use for objects that ↵Thomas Hellstrom2011-10-051-17/+39
| | | | | | | | are backing kms framebuffers. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Add present and readback ioctlsJakob Bornecrantz2011-10-051-0/+170
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Drop 3D Legacy Display Unit supportJakob Bornecrantz2011-10-051-214/+11Star
| | | | | | | | | Since 3D requires HWv8 and screen objects is always available on those hosts we only need the screen objects path for surfaces. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Add screen object supportJakob Bornecrantz2011-10-051-14/+151
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Add dmabuf helper functions for pinningJakob Bornecrantz2011-10-051-2/+2
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Refactor common display unit functions to shared fileJakob Bornecrantz2011-10-051-0/+238
| | | | | | | | More preparation for Screen Object support. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Break out dirty submission codeJakob Bornecrantz2011-10-051-54/+90
| | | | | | | | | In preperation for screen objects, still leaves the delayed workqueue for surface updates in place. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Make sure the reserved area is at the start of vramJakob Bornecrantz2011-10-051-0/+3
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Add comments for buffer pinning codeJakob Bornecrantz2011-10-051-0/+10
| | | | | | Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Remove the update layout IOCTL.Thomas Hellstrom2011-09-061-46/+0Star
| | | | | | | | | It doesn't seem like its needed. If this turns out to be an incorrect assumption, we can reinstate it. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Print error diagnostics if depth doesn't match the host expectationMichel Dänzer2011-09-011-1/+9
| | | | | | Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Fix 'bbp' typoMichel Dänzer2011-09-011-2/+2
| | | | | | Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Don't write to read-only registersMichel Dänzer2011-09-011-14/+0Star
| | | | | | Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vmwgfx: Add support for depth 8Michel Dänzer2011-09-011-0/+3
| | | | | | Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>