Collection of patches queued up for vmwgfx-next
Subsystems (3)
cover Collection of patches queued up for vmwgfx-next
These are a collection of patches currently queued for vmwgfx-next
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/9 drm/vmwgfx: Explicityly track screen target width and height
We can no longer make the assumption that vmw_stdu_update_st() will be called when there's a valid display surface attached. So instead of using display_srf for width and height, make a record of these paremeters when the screen target is first defined.
--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +8 -3
@@ -106,6 +106,7 @@ struct vmw_screen_target_display_unit {struct vmw_display_unit base;const struct vmw_surface *display_srf;enum stdu_content_type content_fb_type; +s32 display_width, display_height;bool defined; };
@@ -184,6 +185,8 @@ static int vmw_stdu_define_st(struct vmw_private *dev_priv,vmw_fifo_commit (dev_priv,sizeof (*cmd)); stdu->defined = true; + stdu->display_width = mode->hdisplay; + stdu->display_height = mode->vdisplay;return 0 ; }
@@ -281,7 +284,6 @@ static int vmw_stdu_update_st(struct vmw_private *dev_priv, struct vmw_screen_target_display_unit *stdu) {struct vmw_stdu_update *cmd; -struct drm_crtc *crtc = &stdu->base.crtc;if (!stdu->defined) {DRM_ERROR ("No screen target defined" );
@@ -295,8 +297,9 @@ static int vmw_stdu_update_st(struct vmw_private *dev_priv,return -ENOMEM ; } -vmw_stdu_populate_update (cmd, stdu->base.unit,0 , crtc->mode.hdisplay, -0 , crtc->mode.vdisplay); +vmw_stdu_populate_update (cmd, stdu->base.unit, +0 , stdu->display_width, +0 , stdu->display_height);vmw_fifo_commit (dev_priv,sizeof (*cmd));
@@ -346,6 +349,8 @@ static int vmw_stdu_destroy_st(struct vmw_private *dev_priv,DRM_ERROR ("Failed to sync with HW" ); stdu->defined = false; + stdu->display_width =0 ; + stdu->display_height =0 ;return ret; }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/9 drm/vmwgfx: Skipping fbdev fb pinning for ldu
In reply to Sinclair YehPinning fbdev's FB at the start of VRAM prevents X from pinning its FB. Since for ldu, the fb would be pinned anyway during a mode set, just skip pinning it in fbdev.
This is not the best solution, but since ldu is not used much anymore, it seems like a reasonable workaround.
--- drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +16 -7
@@ -451,13 +451,15 @@ static int vmw_fb_kms_detach(struct vmw_fb_par *par, }if (par->vmw_bo && detach_bo) { +struct vmw_private *vmw_priv = par->vmw_priv; +if (par->bo_ptr) {ttm_bo_kunmap (&par->map); par->bo_ptr =NULL ; }if (unref_bo)vmw_dmabuf_unreference (&par->vmw_bo); -else +else if (vmw_priv->active_display_unit != vmw_du_legacy)vmw_dmabuf_unpin (par->vmw_priv, par->vmw_bo, false); }
@@ -585,18 +587,25 @@ static int vmw_fb_set_par(struct fb_info *info)/* * Pin before mapping. Since we don't know in what placement -* to pin, call into KMS to do it for us. +* to pin, call into KMS to do it for us. LDU doesn't require +* additional pinning because set_config() would've pinned +* it already */ - ret = vfb->pin (vfb); -if (ret) { -DRM_ERROR ("Could not pin the fbdev framebuffer.\n" ); - goto out_unlock; +if (vmw_priv->active_display_unit != vmw_du_legacy) { + ret = vfb->pin (vfb); +if (ret) { +DRM_ERROR ("Could not pin the fbdev " +"framebuffer.\n" ); + goto out_unlock; + } } ret =ttm_bo_kmap (&par->vmw_bo->base,0 , par->vmw_bo->base.num_pages, &par->map);if (ret) { - vfb->unpin (vfb); +if (vmw_priv->active_display_unit != vmw_du_legacy) + vfb->unpin (vfb); +DRM_ERROR ("Could not map the fbdev framebuffer.\n" ); goto out_unlock; }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/9 drm/vmwgfx: Fix LDU X blank screen until mode change issue
In reply to Sinclair Yehvmw_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.
--- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +21 -20
@@ -226,24 +226,6 @@ static void vmw_ldu_crtc_helper_prepare(struct drm_crtc *crtc)*/ static void vmw_ldu_crtc_helper_commit (struct drm_crtc *crtc) { -struct vmw_private *dev_priv; -struct vmw_legacy_display_unit *ldu; -struct vmw_framebuffer *vfb; -struct drm_framebuffer *fb; - - - ldu =vmw_crtc_to_ldu (crtc); - dev_priv =vmw_priv (crtc->dev); - fb = crtc->primary->state->fb; - - vfb = (fb) ?vmw_framebuffer_to_vfb (fb) :NULL ; - -if (vfb) -vmw_ldu_add_active (dev_priv, ldu, vfb); -else -vmw_ldu_del_active (dev_priv, ldu); - -vmw_ldu_commit_list (dev_priv); }/**
@@ -310,7 +292,7 @@ drm_connector_helper_funcs vmw_ldu_connector_helper_funcs = {*/ /** -* vmw_ldu_primary_plane_cleanup_fb - Unpin fb +* vmw_ldu_primary_plane_cleanup_fb - Noop * * @plane: display plane * @old_state: Contains the FB to clean up
@@ -327,7 +309,7 @@ vmw_ldu_primary_plane_cleanup_fb(struct drm_plane *plane,/** -* vmw_ldu_primary_plane_prepare_fb - +* vmw_ldu_primary_plane_prepare_fb - Noop * * @plane: display plane * @new_state: info on the new plane state, including the FB
@@ -346,6 +328,25 @@ static void vmw_ldu_primary_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { + struct vmw_private *dev_priv; +struct vmw_legacy_display_unit *ldu; +struct vmw_framebuffer *vfb; +struct drm_framebuffer *fb; +struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc; + + + ldu =vmw_crtc_to_ldu (crtc); + dev_priv =vmw_priv (plane->dev); + fb = plane->state->fb; + + vfb = (fb) ?vmw_framebuffer_to_vfb (fb) :NULL ; + +if (vfb) +vmw_ldu_add_active (dev_priv, ldu, vfb); +else +vmw_ldu_del_active (dev_priv, ldu); + +vmw_ldu_commit_list (dev_priv); }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/9 drm/vmwgfx: Revert "drm/vmwgfx: Replace numeric parameter like 0444 with macro"
In reply to Sinclair YehFrom: Øyvind A. Holm <[email protected]>
This reverts commit 2d8e60e8b074 ("drm/vmwgfx: Replace numeric parameter like 0444 with macro")
The commit belongs to the series of 1285 patches sent to LKML on 2016-08-02, it changes the representation of file permissions from the octal value "0600" to "S_IRUSR | S_IWUSR".
The general consensus was that the changes does not increase readability, quite the opposite; 0600 is easier to parse mentally than S_IRUSR | S_IWUSR.
It also causes argument inconsistency, due to commit 04319d89fbec ("drm/vmwgfx: Add an option to change assumed FB bpp") that added another call to module_param_named() where the permissions are written as 0600.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +4 -4
@@ -241,13 +241,13 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, void *ptr);MODULE_PARM_DESC (enable_fbdev,"Enable vmwgfx fbdev" ); -module_param_named (enable_fbdev, enable_fbdev, int,S_IRUSR |S_IWUSR ); +module_param_named (enable_fbdev, enable_fbdev, int,0600 );MODULE_PARM_DESC (force_dma_api,"Force using the DMA API for TTM pages" ); -module_param_named (force_dma_api, vmw_force_iommu, int,S_IRUSR |S_IWUSR ); +module_param_named (force_dma_api, vmw_force_iommu, int,0600 );MODULE_PARM_DESC (restrict_iommu,"Try to limit IOMMU usage for TTM pages" ); -module_param_named (restrict_iommu, vmw_restrict_iommu, int,S_IRUSR |S_IWUSR ); +module_param_named (restrict_iommu, vmw_restrict_iommu, int,0600 );MODULE_PARM_DESC (force_coherent,"Force coherent TTM pages" ); -module_param_named (force_coherent, vmw_force_coherent, int,S_IRUSR |S_IWUSR ); +module_param_named (force_coherent, vmw_force_coherent, int,0600 );MODULE_PARM_DESC (restrict_dma_mask,"Restrict DMA mask to 44 bits with IOMMU" );module_param_named (restrict_dma_mask, vmw_restrict_dma_mask, int,S_IRUSR |S_IWUSR );MODULE_PARM_DESC (assume_16bpp,"Assume 16-bpp when filtering modes" );
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/9] drm/vmwgfx: Revert "drm/vmwgfx: Replace numeric parameter like 0444 with macro"
Quoted 27 lines · Sinclair Yeh
From: Øyvind A. Holm <[email protected]>
This reverts commit
2d8e60e8b074("drm/vmwgfx: Replace numeric parameter like 0444 with macro")
[...]
index 45d711e..d31dc34 100644drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +4
-5@@ -241,13 +241,13 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, void *ptr);MODULE_PARM_DESC (enable_fbdev,"Enable vmwgfx fbdev" ); -module_param_named (enable_fbdev, enable_fbdev, int,S_IRUSR |S_IWUSR ); +module_param_named (enable_fbdev, enable_fbdev, int,0600 );MODULE_PARM_DESC (force_dma_api,"Force using the DMA API for TTM pages" ); -module_param_named (force_dma_api, vmw_force_iommu, int,S_IRUSR |S_IWUSR ); +module_param_named (force_dma_api, vmw_force_iommu, int,0600 );MODULE_PARM_DESC (restrict_iommu,"Try to limit IOMMU usage for TTM pages" ); -module_param_named (restrict_iommu, vmw_restrict_iommu, int,S_IRUSR |S_IWUSR ); +module_param_named (restrict_iommu, vmw_restrict_iommu, int,0600 );MODULE_PARM_DESC (force_coherent,"Force coherent TTM pages" ); -module_param_named (force_coherent, vmw_force_coherent, int,S_IRUSR |S_IWUSR ); +module_param_named (force_coherent, vmw_force_coherent, int,0600 );MODULE_PARM_DESC (restrict_dma_mask,"Restrict DMA mask to 44 bits with IOMMU" );module_param_named (restrict_dma_mask, vmw_restrict_dma_mask, int,S_IRUSR |S_IWUSR );MODULE_PARM_DESC (assume_16bpp,"Assume 16-bpp when filtering modes" ); --
Quoted 1 line
2.7.4
It seems as something has happened to the patch when applied, the last change is gone, it was in my original patch sent to the list. This change is missing:
-module_param_named(restrict_dma_mask, vmw_restrict_dma_mask, int, S_IRUSR | S_IWUSR); +module_param_named(restrict_dma_mask, vmw_restrict_dma_mask, int, 0600);
I suppose it's to late to fix this exact commit (50f837371dd9) now because it's part of the request-pull mail sent 2017-03-31 16:32:55 -0700. I can send a new patch created on top of commit 28c954299cd2 ("drm/vmwgfx: Properly check display/scanout surface size") that completes this patch, if it's ok.
Regards,
Øyvind
+-| Øyvind A. Holm <[email protected]> - N 60.37604° E 5.33339° |-+ | OpenPGP: 0xFB0CBEE894A506E5 - http://www.sunbase.org/pubkey.asc | | Fingerprint: A006 05D6 E676 B319 55E2 E77E FB0C BEE8 94A5 06E5 | +------------| 32db7b80-176e-11e7-8de9-db5caa6d21d3 |-------------+
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/9] drm/vmwgfx: Revert "drm/vmwgfx: Replace numeric parameter like 0444 with macro"
Quoted 34 lines · Øyvind A. Holm
Quoted 27 lines · Sinclair Yeh
From: Øyvind A. Holm <[email protected]>
This reverts commit
2d8e60e8b074("drm/vmwgfx: Replace numeric parameter like 0444 with macro")
[...]
index 45d711e..d31dc34 100644drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +4
-5@@ -241,13 +241,13 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, void *ptr);MODULE_PARM_DESC (enable_fbdev,"Enable vmwgfx fbdev" ); -module_param_named (enable_fbdev, enable_fbdev, int,S_IRUSR |S_IWUSR ); +module_param_named (enable_fbdev, enable_fbdev, int,0600 );MODULE_PARM_DESC (force_dma_api,"Force using the DMA API for TTM pages" ); -module_param_named (force_dma_api, vmw_force_iommu, int,S_IRUSR |S_IWUSR ); +module_param_named (force_dma_api, vmw_force_iommu, int,0600 );MODULE_PARM_DESC (restrict_iommu,"Try to limit IOMMU usage for TTM pages" ); -module_param_named (restrict_iommu, vmw_restrict_iommu, int,S_IRUSR |S_IWUSR ); +module_param_named (restrict_iommu, vmw_restrict_iommu, int,0600 );MODULE_PARM_DESC (force_coherent,"Force coherent TTM pages" ); -module_param_named (force_coherent, vmw_force_coherent, int,S_IRUSR |S_IWUSR ); +module_param_named (force_coherent, vmw_force_coherent, int,0600 );MODULE_PARM_DESC (restrict_dma_mask,"Restrict DMA mask to 44 bits with IOMMU" );module_param_named (restrict_dma_mask, vmw_restrict_dma_mask, int,S_IRUSR |S_IWUSR );MODULE_PARM_DESC (assume_16bpp,"Assume 16-bpp when filtering modes" ); --Quoted 1 line
2.7.4
It seems as something has happened to the patch when applied, the last change is gone, it was in my original patch sent to the list. This change is missing:
Quoted 2 lines
-module_param_named(restrict_dma_mask, vmw_restrict_dma_mask, int, S_IRUSR | S_IWUSR); +module_param_named(restrict_dma_mask, vmw_restrict_dma_mask, int, 0600);
Hmm... I'll put this as a new patch then.
thanks for letting me know!
Sinclair
Quoted 7 lines
I suppose it's to late to fix this exact commit (
50f837371dd9) now because it's part of the request-pull mail sent 2017-03-31 16:32:55 -0700. I can send a new patch created on top of commit28c954299cd2("drm/vmwgfx: Properly check display/scanout surface size") that completes this patch, if it's ok.
Quoted 7 lines
Regards,
Øyvind+-| Øyvind A. Holm <[email protected]> - N 60.37604° E 5.33339° |-+ | OpenPGP: 0xFB0CBEE894A506E5 - http://www.sunbase.org/pubkey.asc | | Fingerprint: A006 05D6 E676 B319 55E2 E77E FB0C BEE8 94A5 06E5 | +------------| 32db7b80-176e-11e7-8de9-db5caa6d21d3 |-------------+
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/1 drm/vmwgfx: Convert macro to octal representation
Change "S_IRUSR | S_IWUSR" to "0600", it's easier to parse mentally.
This change should be part of commit 50f837371dd9 ("drm/vmwgfx: Revert "drm/vmwgfx: Replace numeric parameter like 0444 with macro""), but the patch was truncated somewhere in the patch route, so add the missing change. Extract from the original commit message:
commit 50f837371dd9aea5470c06d5d10bc9ca3e8155b6
Author: Øyvind A. Holm <[email protected]>
Date: Thu Mar 23 14:54:48 2017 -0700
drm/vmwgfx: Revert "drm/vmwgfx: Replace numeric parameter like 0444 with macro"
This reverts commit 2d8e60e8b074 ("drm/vmwgfx: Replace numeric parameter like 0444 with macro")
The commit belongs to the series of 1285 patches sent to LKML on 2016-08-02, it changes the representation of file permissions from the octal value "0600" to "S_IRUSR | S_IWUSR".
The general consensus was that the changes does not increase readability, quite the opposite; 0600 is easier to parse mentally than S_IRUSR | S_IWUSR.
---
Hi Sinclair,
I created the patch to save you some work, if you haven't done it already. Thanks for your time.
Regards,
Øyvind
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 -1
@@ -254,7 +254,7 @@ module_param_named(restrict_iommu, vmw_restrict_iommu, int, 0600);MODULE_PARM_DESC (force_coherent,"Force coherent TTM pages" );module_param_named (force_coherent, vmw_force_coherent, int,0600 );MODULE_PARM_DESC (restrict_dma_mask,"Restrict DMA mask to 44 bits with IOMMU" ); -module_param_named (restrict_dma_mask, vmw_restrict_dma_mask, int,S_IRUSR |S_IWUSR ); +module_param_named (restrict_dma_mask, vmw_restrict_dma_mask, int,0600 );MODULE_PARM_DESC (assume_16bpp,"Assume 16-bpp when filtering modes" );module_param_named (assume_16bpp, vmw_assume_16bpp, int,0600 );
Signature · 1 line
2.12.2.575.gb14f27f91770
PATCH 5/9 drm/vmwgfx: Introduce a simple resource type
In reply to Sinclair YehFrom: Thomas Hellstrom <[email protected]>
The callbacks we need to provide to many resources are very similar, so provide a simple resource type with a number of helpers for these callbacks.
--- drivers/gpu/drm/vmwgfx/Makefile | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h | 40 ++++ drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c | 256 ++++++++++++++++++++++++ 3 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
drivers/gpu/drm/vmwgfx/Makefile +2 -1
@@ -8,6 +8,7 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx_fence.o vmwgfx_dmabuf.o vmwgfx_scrn.o vmwgfx_context.o \ vmwgfx_surface.o vmwgfx_prime.o vmwgfx_mob.o vmwgfx_shader.o \ vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \ - vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o + vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \ + vmwgfx_simple_resource.o obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h +40 -0
@@ -30,6 +30,8 @@#include "vmwgfx_drv.h" +#define VMW_IDA_ACC_SIZE 128 +enum vmw_cmdbuf_res_state {VMW_CMDBUF_RES_COMMITTED ,VMW_CMDBUF_RES_ADD ,
@@ -83,6 +85,35 @@ struct vmw_res_func { enum vmw_cmdbuf_res_state state); }; +/** +* struct vmw_simple_resource_func - members and functions common for the +* simple resource helpers. +* @res_func: struct vmw_res_func as described above. +* @ttm_res_type: TTM resource type used for handle recognition. +* @size: Size of the simple resource information struct. +* @init: Initialize the simple resource information. +* @hw_destroy: A resource hw_destroy function. +* @set_arg_handle: Set the handle output argument of the ioctl create struct. +*/ +struct vmw_simple_resource_func { +const struct vmw_res_func res_func; +int ttm_res_type; +size_t size; +int (*init)(struct vmw_resource *res,void *data); +void (*hw_destroy)(struct vmw_resource *res); +void (*set_arg_handle)(void *data,u32 handle); +}; + +/** +* struct vmw_simple_resource - Kernel only side simple resource +* @res: The resource we derive from. +* @func: The method and member virtual table. +*/ +struct vmw_simple_resource { +struct vmw_resource res; +const struct vmw_simple_resource_func *func; +}; +int vmw_resource_alloc_id (struct vmw_resource *res);void vmw_resource_release_id (struct vmw_resource *res); int vmw_resource_init(struct vmw_private *dev_priv, struct vmw_resource *res,
@@ -91,4 +122,13 @@ int vmw_resource_init(struct vmw_private *dev_priv, struct vmw_resource *res, const struct vmw_res_func *func);void vmw_resource_activate (struct vmw_resource *res,void (*hw_destroy) (struct vmw_resource *)); +int +vmw_simple_resource_create_ioctl (struct drm_device *dev, +void *data, +struct drm_file *file_priv, +const struct vmw_simple_resource_func *func); +struct vmw_resource * +vmw_simple_resource_lookup (struct ttm_object_file *tfile, +uint32_t handle, +const struct vmw_simple_resource_func *func);#endif
drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c new file +256 -0
256 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/9 drm/vmwgfx: Re-implement the stream resource as a simple resource.
In reply to Sinclair YehFrom: Thomas Hellstrom <[email protected]>
Provide and document a reference implementation.
--- drivers/gpu/drm/vmwgfx/Makefile | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 254 ------------------------------- drivers/gpu/drm/vmwgfx/vmwgfx_va.c | 168 ++++++++++++++++++++ 3 files changed, 169 insertions(+), 255 deletions(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_va.c
drivers/gpu/drm/vmwgfx/Makefile +1 -1
@@ -9,6 +9,6 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx_surface.o vmwgfx_prime.o vmwgfx_mob.o vmwgfx_shader.o \ vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \ vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \ - vmwgfx_simple_resource.o + vmwgfx_simple_resource.o vmwgfx_va.o obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +0 -254
272 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_va.c new file +168 -0
168 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/9 drm/vmwgfx: Define an overlaid handle_close ioctl.
In reply to Sinclair YehFrom: Thomas Hellstrom <[email protected]>
Instead of providing an ioctl for each handle type, provide a single handle_close ioctl, and reuse the UNREF_DMABUF ioctl.
--- include/uapi/drm/vmwgfx_drm.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
include/uapi/drm/vmwgfx_drm.h +24 -0
@@ -41,6 +41,7 @@ extern "C" {#define DRM_VMW_GET_PARAM 0#define DRM_VMW_ALLOC_DMABUF 1#define DRM_VMW_UNREF_DMABUF 2 +#define DRM_VMW_HANDLE_CLOSE 2#define DRM_VMW_CURSOR_BYPASS 3/* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/ #define DRM_VMW_CONTROL_STREAM 4
@@ -1092,6 +1093,29 @@ union drm_vmw_extended_context_arg {struct drm_vmw_context_arg rep; }; +/*************************************************************************/ +/* +* DRM_VMW_HANDLE_CLOSE - Close a user-space handle and release its +* underlying resource. +* +* Note that this ioctl is overlaid on the DRM_VMW_UNREF_DMABUF Ioctl. +* The ioctl arguments therefore need to be identical in layout. +* +*/ + +/** +* struct drm_vmw_handle_close_arg +* +* @handle: Handle to close. +* +* Argument to the DRM_VMW_HANDLE_CLOSE Ioctl. +*/ +struct drm_vmw_handle_close_arg { +__u32 handle; +__u32 pad64; +}; + +#if defined(__cplusplus) }#endif
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/9 drm/vmwgfx: Support topology greater than texture size
In reply to Sinclair YehMost of the display servers today use a single surface to represent the entire desktop even if it's stretched across multiple screens.
For vmwgfx with STDU, the maximum surface size is limited to the maximum texture size on the host. On a 2D VM, this limits our ability to support configurations with more than one 4K monitor.
To get past this limitation, we will now allow using a large DMA buf as the framebuffer, and take care of blitting contents from this DMA buf to the display buffer.
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 64 ++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 + drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 202 +++++++++++++++++++++++++++++++++++ 3 files changed, 269 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +63 -1
@@ -803,6 +803,11 @@ vmw_du_plane_duplicate_state(struct drm_plane *plane) vps->pinned =0 ; +/* Mapping is managed by prepare_fb/cleanup_fb */ +memset (&vps->guest_map,0 ,sizeof (vps->guest_map)); +memset (&vps->host_map,0 ,sizeof (vps->host_map)); + vps->cpp =0 ; +/* Each ref counted resource needs to be acquired again */ if (vps->surf) (void )vmw_surface_reference (vps->surf);
@@ -861,6 +866,17 @@ vmw_du_plane_destroy_state(struct drm_plane *plane,struct vmw_plane_state *vps =vmw_plane_state_to_vps (state); +/* Should have been freed by cleanup_fb */ +if (vps->guest_map.virtual) { +DRM_ERROR ("Guest mapping not freed\n" ); +ttm_bo_kunmap (&vps->guest_map); + } + +if (vps->host_map.virtual) { +DRM_ERROR ("Host mapping not freed\n" ); +ttm_bo_kunmap (&vps->host_map); + } +if (vps->surf)vmw_surface_unreference (&vps->surf);
@@ -1435,6 +1451,25 @@ static int vmw_kms_new_framebuffer_dmabuf(struct vmw_private *dev_priv,return ret; } + +/** +* vmw_kms_srf_ok - check if a surface can be created +* +* @width: requested width +* @height: requested height +* +* Surfaces need to be less than texture size +*/ +static bool +vmw_kms_srf_ok (struct vmw_private *dev_priv,uint32_t width,uint32_t height) +{ +if (width > dev_priv->texture_max_width || + height > dev_priv->texture_max_height) +return false; + +return true; +} +/** * vmw_kms_new_framebuffer - Create a new framebuffer. *
@@ -1463,7 +1498,8 @@ vmw_kms_new_framebuffer(struct vmw_private *dev_priv,* therefore, wrap the DMA buf in a surface so we can use the * SurfaceCopy command. */ -if (dmabuf && only_2d && +if (vmw_kms_srf_ok (dev_priv, mode_cmd->width, mode_cmd->height) && + dmabuf && only_2d && dev_priv->active_display_unit == vmw_du_screen_target) { ret =vmw_create_dmabuf_proxy (dev_priv->dev, mode_cmd, dmabuf, &surface);
@@ -1556,6 +1592,16 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,if (ret) goto err_out; + +if (!bo && + !vmw_kms_srf_ok (dev_priv, mode_cmd->width, mode_cmd->height)) { +DRM_ERROR ("Surface size cannot exceed %dx%d" , + dev_priv->texture_max_width, + dev_priv->texture_max_height); + goto err_out; + } + + vfb =vmw_kms_new_framebuffer (dev_priv, bo, surface, !(dev_priv->capabilities &SVGA_CAP_3D ), mode_cmd);
@@ -1602,10 +1648,13 @@ vmw_kms_atomic_check_modeset(struct drm_device *dev, {struct drm_crtc_state *crtc_state;struct drm_crtc *crtc; +struct vmw_private *dev_priv =vmw_priv (dev);int i, ret;for_each_crtc_in_state (state, crtc, crtc_state, i) { +unsigned long requested_bb_mem =0 ; +if (crtc_state->mode.crtc_clock ==0 ) {/* * Our virtual device does not have a dot clock,
@@ -1613,6 +1662,19 @@ vmw_kms_atomic_check_modeset(struct drm_device *dev,*/ crtc_state->mode.crtc_clock = crtc_state->mode.clock; } + +if (dev_priv->active_display_unit == vmw_du_screen_target) { +if (crtc->primary->fb) { +int cpp = crtc->primary->fb->pitches[0 ] / + crtc->primary->fb->width; + + requested_bb_mem += crtc->mode.hdisplay * cpp * + crtc->mode.vdisplay; + } + +if (requested_bb_mem > dev_priv->prim_bb_mem) +return -EINVAL ; + } } ret =drm_atomic_helper_check_modeset (dev, state);
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +4 -0
@@ -173,6 +173,10 @@ struct vmw_plane_state {unsigned long dmabuf_size;int pinned; + +/* For CPU Blit */ +struct ttm_bo_kmap_obj host_map, guest_map; +unsigned int cpp; };
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +202 -0
258 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/9 drm/vmwgfx: Properly check display/scanout surface size
In reply to Sinclair YehThe scanout surface size is the smaller of max texture size and max STDU size.
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 3 +++ drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 16 +++++++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3 -0
@@ -2218,7 +2218,10 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,if (dev_priv->active_display_unit == vmw_du_screen_target) { max_width =min (max_width, dev_priv->stdu_max_width); + max_width =min (max_width, dev_priv->texture_max_width); + max_height =min (max_height, dev_priv->stdu_max_height); + max_height =min (max_height, dev_priv->texture_max_height); }/* Add preferred mode */
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +15 -1
@@ -1602,7 +1602,21 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) dev_priv->active_display_unit = vmw_du_screen_target; -if (!(dev_priv->capabilities &SVGA_CAP_3D )) { +if (dev_priv->capabilities &SVGA_CAP_3D ) { +/* +* For 3D VMs, display (scanout) buffer size is the smaller of +* max texture and max STDU +*/ +uint32_t max_width, max_height; + + max_width =min (dev_priv->texture_max_width, + dev_priv->stdu_max_width); + max_height =min (dev_priv->texture_max_height, + dev_priv->stdu_max_height); + + dev->mode_config.max_width = max_width; + dev->mode_config.max_height = max_height; + }else {/* * Given various display aspect ratios, there's no way to * estimate these using prim_bb_mem. So just set these to
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +14 -0
@@ -1479,10 +1479,24 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, *srf_out =NULL ;if (for_scanout) { +uint32_t max_width, max_height; +if (!svga3dsurface_is_screen_target_format (format)) {DRM_ERROR ("Invalid Screen Target surface format." );return -EINVAL ; } + + max_width =min (dev_priv->texture_max_width, + dev_priv->stdu_max_width); + max_height =min (dev_priv->texture_max_height, + dev_priv->stdu_max_height); + +if (size.width > max_width || size.height > max_height) { +DRM_ERROR ("%ux%u\n, exeeds max surface size %ux%u" , + size.width, size.height, + max_width, max_height); +return -EINVAL ; + } }else {const struct svga3d_surface_desc *desc;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel