drm/vmwgfx: Add "quirk" to handling command verification exceptions
Subsystems (3)
PATCH 5/6 drm/vmwgfx: Add "quirk" to handling command verification exceptions
For certain surface copies, we don't have a user space handle for the destination surface. In such cases, we are going to trust that our caller is giving us the right surface ID.
To do this case, we created a quirk flag that may be useful in the future for handling other cases.
Signed-off-by Thomas Hellstrom <[email protected]>
Signed-off-by Sinclair Yeh <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 4 ++++ drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 10 ++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 6 +++--- 4 files changed, 19 insertions(+), 5 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +4 -0
@@ -341,6 +341,8 @@ enum vmw_display_unit_type { }; +#define VMW_QUIRK_SCREENTARGET (1U << 0) +struct vmw_sw_context {struct drm_open_hash res_ht;bool res_ht_initialized;
@@ -363,6 +365,7 @@ struct vmw_sw_context{struct vmw_resource *error_resource;struct vmw_ctx_binding_state staged_bindings;struct list_head staged_cmd_res; +uint32_t quirks; };struct vmw_legacy_display ;
@@ -821,6 +824,7 @@ extern int vmw_execbuf_process(struct drm_file *file_priv,void *kernel_commands, uint32_t command_size, uint64_t throttle_us, + uint32_t quirks, struct drm_vmw_fence_rep __user *user_fence_rep, struct vmw_fence_obj **out_fence);
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +10 -0
@@ -679,6 +679,10 @@ static int vmw_cmd_surface_copy_check(struct vmw_private *dev_priv, &cmd->body.src.sid, NULL);if (unlikely (ret !=0 ))return ret; + +if (sw_context->quirks &VMW_QUIRK_SCREENTARGET ) +return 0 ; +return vmw_cmd_res_check (dev_priv, sw_context, vmw_res_surface, user_surface_converter, &cmd->body.dest.sid,NULL );
@@ -1258,6 +1262,9 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,if (unlikely (suffix->maximumOffset > bo_size)) suffix->maximumOffset = bo_size; +if (sw_context->quirks &VMW_QUIRK_SCREENTARGET ) + goto out_no_surface; + ret =vmw_cmd_res_check (dev_priv, sw_context, vmw_res_surface, user_surface_converter, &cmd->dma.host.sid,NULL );
@@ -2423,6 +2430,7 @@ int vmw_execbuf_process(struct drm_file *file_priv,void *kernel_commands, uint32_t command_size, uint64_t throttle_us, + uint32_t quirks, struct drm_vmw_fence_rep __user *user_fence_rep, struct vmw_fence_obj **out_fence) {
@@ -2462,6 +2470,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, sw_context->fp =vmw_fpriv (file_priv); sw_context->cur_reloc =0 ; sw_context->cur_val_buf =0 ; + sw_context->quirks = quirks;INIT_LIST_HEAD (&sw_context->resource_list); sw_context->cur_query_bo = dev_priv->pinned_bo; sw_context->last_query_ctx =NULL ;
@@ -2778,6 +2787,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data, ret =vmw_execbuf_process (file_priv, dev_priv, (void __user *)(unsigned long )arg->commands,NULL , arg->command_size, arg->throttle_us, +0 , (void __user *)(unsigned long )arg->fence_rep,NULL );
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +2 -2
@@ -990,7 +990,7 @@ int vmw_kms_generic_present(struct vmw_private *dev_priv, fifo_size =sizeof (*cmd) +sizeof (SVGASignedRect) * num; cmd->header.size =cpu_to_le32 (fifo_size -sizeof (cmd->header)); ret =vmw_execbuf_process (file_priv, dev_priv,NULL , cmd, - fifo_size,0 ,NULL ,NULL ); + fifo_size,0 ,0 ,NULL ,NULL );if (unlikely (ret !=0 ))break ;
@@ -1116,7 +1116,7 @@ int vmw_kms_readback(struct vmw_private *dev_priv, fifo_size =sizeof (*cmd) +sizeof (*blits) * blits_pos; ret =vmw_execbuf_process (file_priv, dev_priv,NULL , cmd, fifo_size, -0 , user_fence_rep,NULL ); +0 ,0 , user_fence_rep,NULL );kfree (cmd);
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +3 -3
@@ -684,7 +684,7 @@ static int do_dmabuf_define_gmrfb(struct drm_file *file_priv, cmd->body.ptr.offset =0 ; ret =vmw_execbuf_process (file_priv, dev_priv,NULL , cmd, - fifo_size,0 ,NULL ,NULL ); + fifo_size,0 ,0 ,NULL ,NULL );kfree (cmd);
@@ -826,7 +826,7 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, fifo_size =sizeof (*cmd) +sizeof (SVGASignedRect) * num; cmd->header.size =cpu_to_le32 (fifo_size -sizeof (cmd->header)); ret =vmw_execbuf_process (file_priv, dev_priv,NULL , cmd, - fifo_size,0 ,NULL , out_fence); + fifo_size,0 ,0 ,NULL , out_fence);if (unlikely (ret !=0 ))break ;
@@ -928,7 +928,7 @@ int vmw_kms_sou_do_dmabuf_dirty(struct drm_file *file_priv, fifo_size =sizeof (*blits) * hit_num; ret =vmw_execbuf_process (file_priv, dev_priv,NULL , blits, - fifo_size,0 ,NULL , out_fence); + fifo_size,0 ,0 ,NULL , out_fence);if (unlikely (ret !=0 ))break ;
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/6 drm/vmwgfx: Implement screen targets
From: Sinclair Yeh <[email protected]>
Add support for the screen target device interface. Add a getparam parameter and bump minor to signal availability.
Signed-off-by Sinclair Yeh <[email protected]>
Signed-off-by Thomas Hellstrom <[email protected]>
--- drivers/gpu/drm/vmwgfx/Makefile | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 21 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 15 +- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 4 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 47 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 20 + drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 3 +- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 1360 +++++++++++++++++++++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 + include/uapi/drm/vmwgfx_drm.h | 1 + 10 files changed, 1459 insertions(+), 18 deletions(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
drivers/gpu/drm/vmwgfx/Makefile +1 -1
@@ -7,6 +7,6 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx_overlay.o vmwgfx_marker.o vmwgfx_gmrid_manager.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_res.o vmwgfx_stdu.o\ obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +14 -7
@@ -673,6 +673,20 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM); dev_priv->max_mob_size =vmw_read (dev_priv,SVGA_REG_MOB_MAX_SIZE ); + dev_priv->stdu_max_width = +vmw_read (dev_priv,SVGA_REG_SCREENTARGET_MAX_WIDTH ); + dev_priv->stdu_max_height = +vmw_read (dev_priv,SVGA_REG_SCREENTARGET_MAX_HEIGHT ); + +vmw_write (dev_priv,SVGA_REG_DEV_CAP , +SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH ); + dev_priv->texture_max_width =vmw_read (dev_priv, +SVGA_REG_DEV_CAP ); +vmw_write (dev_priv,SVGA_REG_DEV_CAP , +SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT ); + dev_priv->texture_max_height =vmw_read (dev_priv, +SVGA_REG_DEV_CAP ); + }else dev_priv->prim_bb_mem = dev_priv->vram_size;
@@ -680,13 +694,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)if (unlikely (ret !=0 )) goto out_err0; -/* -* Limit back buffer size to VRAM size. Remove this once -* screen targets are implemented. -*/ -if (dev_priv->prim_bb_mem > dev_priv->vram_size) - dev_priv->prim_bb_mem = dev_priv->vram_size; -vmw_print_capabilities (dev_priv->capabilities);if (dev_priv->capabilities &SVGA_CAP_GMR2 ) {
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +10 -5
@@ -40,17 +40,17 @@#include <drm/ttm/ttm_module.h> #include "vmwgfx_fence.h" -#define VMWGFX_DRIVER_DATE "20140704" +#define VMWGFX_DRIVER_DATE "20150223"#define VMWGFX_DRIVER_MAJOR 2 -#define VMWGFX_DRIVER_MINOR 6 -#define VMWGFX_DRIVER_PATCHLEVEL 1 +#define VMWGFX_DRIVER_MINOR 7 +#define VMWGFX_DRIVER_PATCHLEVEL 0#define VMWGFX_FILE_PAGE_OFFSET 0x00100000#define VMWGFX_FIFO_STATIC_SIZE (1024*1024)#define VMWGFX_MAX_RELOCATIONS 2048#define VMWGFX_MAX_VALIDATIONS 2048#define VMWGFX_MAX_DISPLAYS 16#define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 -#define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 0 +#define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 1/* * Perhaps we should have sysfs entries for these.
@@ -337,7 +337,8 @@ struct vmw_ctx_binding_state {enum vmw_display_unit_type { vmw_du_invalid =0 , vmw_du_legacy, - vmw_du_screen_object + vmw_du_screen_object, + vmw_du_screen_target };
@@ -402,6 +403,10 @@ struct vmw_private {uint32_t mmio_size;uint32_t fb_max_width;uint32_t fb_max_height; +uint32_t texture_max_width; +uint32_t texture_max_height; +uint32_t stdu_max_width; +uint32_t stdu_max_height;uint32_t initial_width;uint32_t initial_height;__le32 __iomem *mmio_virt;
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +4 -0
@@ -105,6 +105,10 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,case DRM_VMW_PARAM_MAX_MOB_SIZE : param->value = dev_priv->max_mob_size;break ; +case DRM_VMW_PARAM_SCREEN_TARGET : + param->value = + (dev_priv->active_display_unit == vmw_du_screen_target); +break ;default :DRM_ERROR ("Illegal vmwgfx get param request: %d\n" , param->param);
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +43 -4
95 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +20 -0
@@ -205,4 +205,24 @@ int vmw_kms_sou_do_dmabuf_dirty(struct drm_file *file_priv,struct drm_clip_rect *clips, unsigned num_clips, int increment, struct vmw_fence_obj **out_fence); + + +/* +* Screen Target Display Unit functions - vmwgfx_stdu.c +*/ +int vmw_kms_stdu_init_display (struct vmw_private *dev_priv); +int vmw_kms_stdu_close_display (struct vmw_private *dev_priv); +int vmw_kms_stdu_do_surface_dirty (struct vmw_private *dev_priv, +struct drm_file *file_priv, +struct vmw_framebuffer *framebuffer, +struct drm_clip_rect *clips, +unsigned num_clips,int increment); +int vmw_kms_stdu_present (struct vmw_private *dev_priv, +struct drm_file *file_priv, +struct vmw_framebuffer *vfb, +uint32_t user_handle, +int32_t dest_x,int32_t dest_y, +struct drm_vmw_rect *clips, +uint32_t num_clips); +#endif
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +2 -1
@@ -31,7 +31,8 @@* If we set up the screen target otable, screen objects stop working. */ -#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE) ? 0 : 1) +#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE && \ + (dev_priv->capabilities & SVGA_CAP_3D)) ? 0 : 1)#ifdef CONFIG_64BIT #define VMW_PPN_SIZE 8
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c new file +1360 -0
1,360 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +4 -0
@@ -1486,6 +1486,10 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, srf->mip_levels[0 ], srf->flags & SVGA3D_SURFACE_CUBEMAP); +if (dev_priv->active_display_unit == vmw_du_screen_target && + for_scanout) + srf->flags |=SVGA3D_SURFACE_SCREENTARGET ; +/* * From this point, the generic resource management functions * destroy the object on failure.
include/uapi/drm/vmwgfx_drm.h +1 -0
@@ -88,6 +88,7 @@#define DRM_VMW_PARAM_3D_CAPS_SIZE 8#define DRM_VMW_PARAM_MAX_MOB_MEMORY 9#define DRM_VMW_PARAM_MAX_MOB_SIZE 10 +#define DRM_VMW_PARAM_SCREEN_TARGET 11/** * enum drm_vmw_handle_type - handle type for ref ioctls
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel