vmw_private *dev_priv,
> .busy_domain = VMW_BO_DOMAIN_SYS,
> .bo_type = ttm_bo_type_device,
> .size = size,
> - .pin = true,
> + .pin = false,
> .keep_resv = true,
> };
>
Looks good.
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala
0);
> }
>
> -void vmw_update_seqno(struct vmw_private *dev_priv)
> -{
> - uint32_t seqno = vmw_fence_read(dev_priv);
> -
> - if (dev_priv->last_read_seqno != seqno) {
> - dev_priv->last_read_seqno = seqno;
> - vmw_fences_update(dev_priv->fman);
> - }
> -}
> -
> bool vmw_seqno_passed(struct vmw_private *dev_priv,
>uint32_t seqno)
> {
> @@ -141,7 +131,7 @@ bool vmw_seqno_passed(struct vmw_private *dev_priv,
> if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP))
> return true;
>
> - vmw_update_seqno(dev_priv);
> + vmw_fences_update(dev_priv->fman);
> if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP))
> return true;
>
--
Maaz Mombasawala
= 0);
> }
>
> -void vmw_update_seqno(struct vmw_private *dev_priv)
> -{
> - uint32_t seqno = vmw_fence_read(dev_priv);
> -
> - if (dev_priv->last_read_seqno != seqno) {
> - dev_priv->last_read_seqno = seqno;
> - vmw_fences_update(dev_priv->fman);
> - }
> -}
> -
> bool vmw_seqno_passed(struct vmw_private *dev_priv,
>uint32_t seqno)
> {
> @@ -141,7 +131,7 @@ bool vmw_seqno_passed(struct vmw_private *dev_priv,
> if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP))
> return true;
>
> - vmw_update_seqno(dev_priv);
> + vmw_fences_update(dev_priv->fman);
> if (likely(dev_priv->last_read_seqno - seqno < VMW_FENCE_WRAP))
> return true;
>
--
Maaz Mombasawala
917 deletions(-)
> create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
> create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h
>
Should update the year in the copyright to 2025, looks good otherwise.
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala
ource properly if there is error in creating surface object.
- Check that guest backed objects are supported when reporting
DRM_VMW_PARAM_USER_SRF.
- Bind hw_destroy function when command buffer gets commited.
Maaz Mombasawala (3):
drm/vmwgfx: Introduce userspace managed surfaces
drm/vmwgfx: Su
-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 92 -
1 file changed, 90 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 0468c9f4f293..71c1e0092d55 100644
--- a
A userspace may create a userspace managed surface but not destroy it,
add hw_destroy function for userspace surfaces so that vmwgfx records the
destroy command and submits it when the userspace context is destroyed.
Signed-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
transfer.
Allow userspace submission of surface create and destroy commands.
Userspace submits its own surface id which is mapped to a ttm base object
and a resource with their corresponding ids.
Signed-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 23 ++-
drivers/gpu/drm
g the hw_destroy function when command
buffer
gets committed, so it only gets invoked when userspace has not submitted the
destroy
command. This also fixes an issue where if there is an error in command buffer
checks
and the surface create command gets reverted, the kernel still registered
hw_destroy
function and submitted a destroy surface command for the surface which was never
created on device.
--
Maaz Mombasawala
ill start failing.
>
> z
We can shield this with SVGA_CAP_GBOBJECTS, but sm5_context is not needed.
The third patch of this series "drm/vmwgfx: Add support for older define
commands
for userspace surfaces" adds support for V3 and V2 of the surface creation
command,
V3 is invoked for sm4.1 and V2 for sm4.
--
Maaz Mombasawala
A userspace may create a userspace managed surface but not destroy it,
add hw_destroy function for userspace surfaces so that vmwgfx records the
destroy command and submits it when the userspace context is destroyed.
Signed-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 92 -
1 file changed, 90 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 70f816062fd2..e7f224afe338 100644
--- a
transfer.
Allow userspace submission of surface create and destroy commands.
Userspace submits its own surface id which is mapped to a ttm base object
and a resource with their corresponding ids.
Signed-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 23 ++-
drivers/gpu/drm
This series introduces basic support for userspace managed surfaces. The
lifetime and id's of these surfaces is managed by userspace submitted
commands instead of relying on the kernel to manage them.
v2: Add flag for userspace to check userspace surface support.
Maaz Mombasawala (3):
fx: Fix handling of dumb buffers")
> Cc: Broadcom internal kernel review list
>
> Cc: dri-devel@lists.freedesktop.org
> Cc: # v6.9+
> Cc: Maaz Mombasawala
> Cc: Martin Krastev
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 29 -
> drive
rivers/gpu/drm/vmwgfx/vmwgfx_bo.h | 3 +
> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 4 +-
> drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c| 12 +--
> drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 6 +-
> 6 files changed, 136 insertions(+), 16 deletions(-)
>
LGTM for the series.
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala
On 8/13/24 19:33, Zack Rusin wrote:
> On Mon, Aug 12, 2024 at 3:16 PM Maaz Mombasawala
> wrote:
>>
>> This series introduces basic support for userspace managed surfaces. The
>> lifetime and id's of these surfaces is managed by userspace submitted
>> commands
LGTM.
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala
of these files.
Signed-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 120
drivers/gpu/drm/vmwgfx/vmwgfx_bo.h | 8 ++
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 +-
drivers/gpu/drm/vmwgfx/vmwgfx_gem.c | 51
4 files changed, 131
LGTM.
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala
> .detect = vmw_du_connector_detect,
> @@ -891,7 +917,8 @@ static const struct drm_connector_funcs
> vmw_stdu_connector_funcs = {
> static const struct
> drm_connector_helper_funcs vmw_stdu_connector_helper_funcs = {
> .get_modes = vmw_connector_get_modes,
> - .mode_valid = vmw_stdu_connector_mode_valid
> + .mode_valid = vmw_stdu_connector_mode_valid,
> + .atomic_check = vmw_stdu_connector_atomic_check,
> };
>
>
Maaz Mombasawala
#define VMWGFX_DRIVER_MAJOR 2
> -#define VMWGFX_DRIVER_MINOR 20
> +#define VMWGFX_DRIVER_MINOR 21
> #define VMWGFX_DRIVER_PATCHLEVEL 0
> #define VMWGFX_FIFO_STATIC_SIZE (1024*1024)
> #define VMWGFX_MAX_DISPLAYS 16
Reviewed-by: Maaz Mombasawala
Maaz Mombasawala
-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 92 -
1 file changed, 90 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 70f816062fd2..e7f224afe338 100644
--- a
A userspace may create a userspace managed surface but not destroy it,
add hw_destroy function for userspace surfaces so that vmwgfx records the
destroy command and submits it when the userspace context is destroyed.
Signed-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
transfer.
Allow userspace submission of surface create and destroy commands.
Userspace submits its own surface id which is mapped to a ttm base object
and a resource with their corresponding ids.
Signed-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 23 ++-
drivers/gpu/drm
This series introduces basic support for userspace managed surfaces. The
lifetime and id's of these surfaces is managed by userspace submitted
commands instead of relying on the kernel to manage them.
Maaz Mombasawala (3):
drm/vmwgfx: Introduce userspace managed surfaces
drm/vmwgfx: Su
-
> drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 40 +-
> 15 files changed, 775 insertions(+), 534 deletions(-)
>
For the series - LGTM!
Reviewed-by: Maaz Mombasawala
Thanks,
Maaz Mombasawala
wgfx/vmwgfx_resource.c | 27 +-
> drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 33 +-
> drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 145 +++
> drivers/gpu/drm/vmwgfx/vmwgfx_surface.c| 277 -
> drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 40 +-
> 15 files changed, 788 insertions(+), 530 deletions(-)
>
For the series - LGTM!
Reviewed-by: Maaz Mombasawala
Thanks,
Maaz Mombasawala
vmw_private, so switch to using that exclusively and stop using
dev_private.
Signed-off-by: Maaz Mombasawala
---
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 --
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 ++--
3 files changed, 3 insertions(+), 5 deletions
data = user_data;
>
> ret = drm_event_reserve_init(dev, file_priv, &event->base,
> &event->event.base);
LGTM!
Reviewed-by: Maaz Mombasawala
Thanks,
Maaz Mombasawala
priv,
> unsigned unit)
> dev->mode_config.suggested_x_property, 0);
> drm_object_attach_property(&connector->base,
> dev->mode_config.suggested_y_property, 0);
> +
> + vmw_du_init(&stdu->base);
&g
> Niels De Graef who reported it and helped to track down the poc.
>
> Fixes: 9c079b8ce8bf ("drm/vmwgfx: Adapt execbuf to the new validation api")
> Cc: # v4.20+
> Reported-by: Niels De Graef
> Signed-off-by: Zack Rusin
> Cc: Martin Krastev
> Cc: Maaz Mom
69d49c9fc00
> FS: 7f1e8f1b4180() GS:969e75f0() knlGS:
> CS: 0010 DS: ES: CR0: 80050033
> CR2: 0028 CR3: 000104006004 CR4: 003706f0
>
> Signed-off-by: Zack Rusin
> Fixes: 485d98d472d5 ("drm/vmwgfx
From: Maaz Mombasawala
Update vmwgfx_drm.h with SPDX-License-Identifier:
(GPL-2.0 WITH Linux-syscall-note) OR MIT
Signed-off-by: Maaz Mombasawala
Reviewed-by: Martin Krastev
Signed-off-by: Maaz Mombasawala (VMware)
---
include/uapi/drm/vmwgfx_drm.h | 1 +
1 file changed, 1 insertion
From: Maaz Mombasawala
There is no real need to have a separate pool for shareable and
non-shareable surfaces. Make all surfaces shareable, regardless of whether
the drm_vmw_surface_flag_shareable has been specified.
Signed-off-by: Maaz Mombasawala
Reviewed-by: Martin Krastev
Signed-off-by
LGTM!
Reviewed-by: Maaz Mombasawala
Maaz Mombasawala (VMware)
On 8/17/2023 9:13 PM, Zack Rusin wrote:
From: Zack Rusin
vmw_bo_unreference sets the input buffer to null on exit, resulting in
null ptr deref's on the subsequent drm gem put calls.
This went unnoticed because only ver
LGTM.
Reviewed-by: Maaz Mombasawala
Maaz Mombasawala (VMware)
On 6/16/2023 12:09 PM, Zack Rusin wrote:
From: Zack Rusin
For multiple commands the driver was not correctly validating the shader
stages resulting in possible kernel oopses. The validation code was only.
if ever, checking the
> __printf(1, 2) int vmw_host_printf(const char *fmt, ...);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> index ca1a3fe44fa5..2651fe0ef518 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
> @@ -1179,3 +1179,12 @@ int vmw_mksstat_remove_ioctl(struct drm_device *dev,
> void *data,
>
> return -EAGAIN;
> }
> +
> +/**
> + * vmw_disable_backdoor: Disables all backdoor communication
> + * with the hypervisor.
> + */
> +void vmw_disable_backdoor(void)
> +{
> + vmw_msg_enabled = 0;
> +}
LGTM
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala (VMware)
vmw_bo_create(dev_priv, ¶ms, p_vbo);
> -
> - (*p_vbo)->tbo.base.funcs = &vmw_gem_object_funcs;
> if (ret != 0)
> goto out_no_bo;
>
> + (*p_vbo)->tbo.base.funcs = &vmw_gem_object_funcs;
> +
> ret = drm_gem_handle_create(filp, &(*p_vbo)->tbo.base, handle);
> /* drop reference from allocate - handle holds it now */
> drm_gem_object_put(&(*p_vbo)->tbo.base);
LGTM!
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala (VMware)
x/vmwgfx_surface.c
> @@ -867,7 +867,6 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void
> *data,
> goto out_unlock;
> }
> vmw_bo_reference(res->guest_memory_bo);
> - drm_gem_object_get(&res->guest_memory_bo->tbo.base);
> }
>
> tmp = vmw_resource_reference(&srf->res);
LGTM!
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala (VMware)
On 1/30/23 19:35, Zack Rusin wrote:
> From: Zack Rusin
>
> Various bits of the driver used raw ttm_buffer_object instead of the
> driver specific vmw_bo object. All those places used to duplicate
> the mapped bo caching policy of vmw_bo.
>
> Instead of duplicating all of that code and special ca
On 1/30/23 19:35, Zack Rusin wrote:
> From: Zack Rusin
>
> Problem with explicit placement selection in vmwgfx is that by the time
> the buffer object needs to be validated the information about which
> placement was supposed to be used is lost. To workaround this the driver
> had a bunch of stat
_mapped) {
> vmw_bo_unmap(vps->surf->res.backup);
> vps->surf_mapped = false;
> }
>
> - if (vps->bo && ttm_kmap_obj_virtual(&vps->bo->map, &dummy)) {
> + if (vps->bo && ttm_kmap_obj_virtual(&vps->bo->map, &is_iomem)) {
> const int ret = ttm_bo_reserve(&vps->bo->base, true, false,
> NULL);
>
> if (likely(ret == 0)) {
LGTM!
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala (VMware)
gt; *plane,
> hotspot_x, hotspot_y);
> }
>
> - if (vps->bo) {
> - if (ttm_kmap_obj_virtual(&vps->bo->map, &dummy))
> - atomic_dec(&vps->bo->base_mapped_count);
> - }
> -
> du->cursor_x = new_state->crtc_x + du->set_gui_x;
> du->cursor_y = new_state->crtc_y + du->set_gui_y;
>
LGTM!
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala (VMware)
; +}
> +
> static int vmw_ldu_del_active(struct vmw_private *vmw_priv,
> struct vmw_legacy_display_unit *ldu)
> {
> @@ -145,8 +188,7 @@ static int vmw_ldu_del_active(struct vmw_private
> *vmw_priv,
> list_del_init(&ldu->active);
> if (--(ld->num_active) == 0) {
> BUG_ON(!ld->fb);
> - if (ld->fb->unpin)
> - ld->fb->unpin(ld->fb);
> + WARN_ON(vmw_ldu_fb_unpin(ld->fb));
> ld->fb = NULL;
> }
>
> @@ -163,11 +205,10 @@ static int vmw_ldu_add_active(struct vmw_private
> *vmw_priv,
>
> BUG_ON(!ld->num_active && ld->fb);
> if (vfb != ld->fb) {
> - if (ld->fb && ld->fb->unpin)
> - ld->fb->unpin(ld->fb);
> + if (ld->fb)
> + WARN_ON(vmw_ldu_fb_unpin(ld->fb));
> vmw_svga_enable(vmw_priv);
> - if (vfb->pin)
> - vfb->pin(vfb);
> + WARN_ON(vmw_ldu_fb_pin(vfb));
> ld->fb = vfb;
> }
>
LGTM!
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala (VMware)
On 1/30/23 19:35, Zack Rusin wrote:
> From: Zack Rusin
>
> The rest of the drivers which are using ttm have mostly standardized on
> driver_prefix_bo as the name for subclasses of the TTM buffer object.
> Make vmwgfx match the rest of the drivers and follow the same naming
> semantics.
>
> This
scrn.c
> @@ -445,7 +445,7 @@ vmw_sou_primary_plane_prepare_fb(struct drm_plane *plane,
> vmw_overlay_pause_all(dev_priv);
> ret = vmw_bo_create(dev_priv, size,
> &vmw_vram_placement,
> - false, true, &vmw_bo_bo_free, &vps->bo);
> + false, true, &vps->bo);
> vmw_overlay_resume_all(dev_priv);
> if (ret) {
> vps->bo = NULL; /* vmw_bo_init frees on error */
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
> index 108a496b5d18..93b1400aed4a 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
> @@ -893,7 +893,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv,
> return -EINVAL;
>
> ret = vmw_bo_create(dev_priv, size, &vmw_sys_placement,
> - true, true, vmw_bo_bo_free, &buf);
> + true, true, &buf);
> if (unlikely(ret != 0))
> goto out;
>
LGTM!
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala (VMware)
m_buffer_object *bo;
> - int ret;
> -
> - if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET_START))
> - return -EINVAL;
> -
> - ret = vmw_bo_vm_lookup(bdev, file_priv, vma->vm_pgoff, vma_pages(vma),
> &bo);
> - if (unlikely(ret != 0))
> - return ret;
> -
> - ret = ttm_bo_mmap_obj(vma, bo);
> - if (unlikely(ret != 0))
> - goto out_unref;
> -
> - vma->vm_ops = &vmw_vm_ops;
> -
> - /* Use VM_PFNMAP rather than VM_MIXEDMAP if not a COW mapping */
> - if (!is_cow_mapping(vma->vm_flags))
> - vma->vm_flags = (vma->vm_flags & ~VM_MIXEDMAP) | VM_PFNMAP;
> -
> - ttm_bo_put(bo); /* release extra ref taken by ttm_bo_mmap_obj() */
> -
> - return 0;
> -
> -out_unref:
> - ttm_bo_put(bo);
> - return ret;
> -}
> -
LGTM!
Reviewed-by: Maaz Mombasawala
--
Maaz Mombasawala (VMware)
LGTM.
Reviewed-by: Maaz Mombasawala
On 12/7/22 09:29, Zack Rusin wrote:
> From: Zack Rusin
>
> User resource lookups used rcu to avoid two extra atomics. Unfortunately
> the rcu paths were buggy and it was easy to make the driver crash by
> submitting command buffers fro
gt; struct drm_device *dev = &dev_priv->drm;
> int i;
>
> + /* Screen objects won't work if GMR's aren't available */
> + if (!dev_priv->has_gmr)
> + return -ENOSYS;
> +
> if (!(dev_priv->capabilities & SVGA_CAP_SCREEN_OBJECT_2)) {
> return -ENOSYS;
> }
LGTM
--
Maaz Mombasawala (VMware)
> * This function copies fence information to user-space. If copying fails,
> the
> * user-space struct drm_vmw_fence_rep::error member is hopefully left
--
Looks good.
Reviewed-by: Maaz Mombasawala
Maaz Mombasawala (VMware)
51 matches
Mail list logo