drm/vmwgfx: Update the user-space interface.
Subsystems (3)
PATCH 1/1 drm/vmwgfx: Update the user-space interface.
From: Thomas Hellstrom <[email protected]>
When time-based throttling is implemented, we need to bump minor. When the old way of detecting scanout is removed, we need to bump major. In the meantime, this change should not break existing user-space.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 6 ++++++ drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 5 +++-- include/drm/vmwgfx_drm.h | 12 +++++++++--- 4 files changed, 21 insertions(+), 8 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +3 -3
@@ -39,10 +39,10 @@#include "ttm/ttm_execbuf_util.h" #include "ttm/ttm_module.h" -#define VMWGFX_DRIVER_DATE "20090724" +#define VMWGFX_DRIVER_DATE "20100118"#define VMWGFX_DRIVER_MAJOR 0 -#define VMWGFX_DRIVER_MINOR 1 -#define VMWGFX_DRIVER_PATCHLEVEL 2 +#define VMWGFX_DRIVER_MINOR 9 +#define VMWGFX_DRIVER_PATCHLEVEL 0#define VMWGFX_FILE_PAGE_OFFSET 0x00100000#define VMWGFX_FIFO_STATIC_SIZE (1024*1024)#define VMWGFX_MAX_RELOCATIONS 2048
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +6 -0
@@ -48,6 +48,12 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,case DRM_VMW_PARAM_FIFO_OFFSET : param->value = dev_priv->mmio_start;break ; +case DRM_VMW_PARAM_HW_CAPS : + param->value = dev_priv->capabilities; +break ; +case DRM_VMW_PARAM_FIFO_CAPS : + param->value = dev_priv->fifo.capabilities; +break ;default :DRM_ERROR ("Illegal vmwgfx get param request: %d\n" , param->param);
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +3 -2
@@ -610,9 +610,10 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,*/ srf->flags &= ~SVGA3D_SURFACE_HINT_SCANOUT ; srf->scanout = true; - }else { + }else if (req->scanout) + srf->scanout = true; +else srf->scanout = false; - } if (srf->scanout && srf->num_sizes == 1 &&
include/drm/vmwgfx_drm.h +9 -3
@@ -68,7 +68,8 @@#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1#define DRM_VMW_PARAM_3D 2#define DRM_VMW_PARAM_FIFO_OFFSET 3 - +#define DRM_VMW_PARAM_HW_CAPS 4 +#define DRM_VMW_PARAM_FIFO_CAPS 5/** * struct drm_vmw_getparam_arg
@@ -181,6 +182,8 @@ struct drm_vmw_context_arg {* The size of the array should equal the total number of mipmap levels. * @shareable: Boolean whether other clients (as identified by file descriptors) * may reference this surface. +* @scanout: Boolean whether the surface is intended to be used as a +* scanout. * * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. * Output data from the DRM_VMW_REF_SURFACE Ioctl.
@@ -192,7 +195,7 @@ struct drm_vmw_surface_create_req {uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES ];uint64_t size_addr;int32_t shareable; -uint32_t pad64; +int32_t scanout; };/**
@@ -295,6 +298,9 @@ union drm_vmw_surface_reference_arg {* * @commands: User-space address of a command buffer cast to an uint64_t. * @command-size: Size in bytes of the command buffer. +* @throttle-us: Sleep until software is less than @throttle_us +* microseconds ahead of hardware. The driver may round this value +* to the nearest kernel tick. * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an * uint64_t. *
@@ -304,7 +310,7 @@ union drm_vmw_surface_reference_arg {struct drm_vmw_execbuf_arg {uint64_t commands;uint32_t command_size; -uint32_t pad64; +uint32_t throttle_us;uint64_t fence_rep; };
Signature · 8 lines
1.6.0.4 ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev --
PATCH 1/1 drm/vmwgfx: Fix a circular locking dependency bug.
From: Thomas Hellstrom <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 3 ++- drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 17 +++++++++-------- drivers/gpu/drm/vmwgfx/vmwgfx_irq.c | 13 +++---------- 3 files changed, 14 insertions(+), 19 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +2 -1
@@ -113,6 +113,7 @@ struct vmw_fifo_state {unsigned long static_buffer_size;bool using_bounce_buffer;uint32_t capabilities; +struct mutex fifo_mutex;struct rw_semaphore rwsem; };
@@ -213,7 +214,7 @@ struct vmw_private {* Fencing and IRQs. */ -uint32_t fence_seq; +atomic_t fence_seq;wait_queue_head_t fence_queue;wait_queue_head_t fifo_queue;atomic_t fence_queue_waiters;
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +9 -8
@@ -74,6 +74,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) fifo->reserved_size =0 ; fifo->using_bounce_buffer = false; +mutex_init (&fifo->fifo_mutex);init_rwsem (&fifo->rwsem);/*
@@ -117,7 +118,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) (unsigned int ) min, (unsigned int) fifo->capabilities); - dev_priv->fence_seq = dev_priv->last_read_sequence; +atomic_set (&dev_priv->fence_seq, dev_priv->last_read_sequence);iowrite32 (dev_priv->last_read_sequence, fifo_mem +SVGA_FIFO_FENCE );return vmw_fifo_send_fence (dev_priv, &dummy);
@@ -283,7 +284,7 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)uint32_t reserveable = fifo_state->capabilities &SVGA_FIFO_CAP_RESERVE ;int ret; -down_write (&fifo_state->rwsem); +mutex_lock (&fifo_state->fifo_mutex); max =ioread32 (fifo_mem +SVGA_FIFO_MAX ); min =ioread32 (fifo_mem +SVGA_FIFO_MIN ); next_cmd =ioread32 (fifo_mem +SVGA_FIFO_NEXT_CMD );
@@ -351,7 +352,7 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes) } out_err: fifo_state->reserved_size =0 ; -up_write (&fifo_state->rwsem); +mutex_unlock (&fifo_state->fifo_mutex);return NULL ; }
@@ -426,6 +427,7 @@ void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes) } +down_write (&fifo_state->rwsem);if (fifo_state->using_bounce_buffer || reserveable) { next_cmd += bytes;if (next_cmd >= max)
@@ -437,8 +439,9 @@ void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes)if (reserveable)iowrite32 (0 , fifo_mem +SVGA_FIFO_RESERVED );mb (); -vmw_fifo_ping_host (dev_priv,SVGA_SYNC_GENERIC );up_write (&fifo_state->rwsem); +vmw_fifo_ping_host (dev_priv,SVGA_SYNC_GENERIC ); +mutex_unlock (&fifo_state->fifo_mutex); }int vmw_fifo_send_fence (struct vmw_private *dev_priv,uint32_t *sequence)
@@ -451,9 +454,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence) fm =vmw_fifo_reserve (dev_priv, bytes);if (unlikely (fm ==NULL )) { -down_write (&fifo_state->rwsem); - *sequence = dev_priv->fence_seq; -up_write (&fifo_state->rwsem); + *sequence =atomic_read (&dev_priv->fence_seq); ret = -ENOMEM ; (void )vmw_fallback_wait (dev_priv, false, true, *sequence, false,3 *HZ );
@@ -461,7 +462,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence) }do { - *sequence = dev_priv->fence_seq++; + *sequence =atomic_add_return (1 , &dev_priv->fence_seq); }while (*sequence ==0 );if (!(fifo_state->capabilities &SVGA_FIFO_CAP_FENCE )) {
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c +3 -10
@@ -85,19 +85,12 @@ bool vmw_fence_signaled(struct vmw_private *dev_priv,return true;/** -* Below is to signal stale fences that have wrapped. -* First, block fence submission. -*/ - -down_read (&fifo_state->rwsem); - -/** * Then check if the sequence is higher than what we've actually * emitted. Then the fence is stale and signaled. */ - ret = ((dev_priv->fence_seq - sequence) >VMW_FENCE_WRAP ); -up_read (&fifo_state->rwsem); + ret = ((atomic_read (&dev_priv->fence_seq) - sequence) + >VMW_FENCE_WRAP );return ret; }
@@ -127,7 +120,7 @@ int vmw_fallback_wait(struct vmw_private *dev_priv,if (fifo_idle)down_read (&fifo_state->rwsem); - signal_seq = dev_priv->fence_seq; + signal_seq =atomic_read (&dev_priv->fence_seq); ret =0 ;for (;;) {
Signature · 8 lines
1.6.0.4 ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev --
PATCH 1/1 drm/vmwgfx: Report propper framebuffer_{max|min}_{width|height}
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +4 -4
@@ -769,10 +769,10 @@ int vmw_kms_init(struct vmw_private *dev_priv)drm_mode_config_init (dev); dev->mode_config.funcs = &vmw_kms_funcs; - dev->mode_config.min_width =640 ; - dev->mode_config.min_height =480 ; - dev->mode_config.max_width =2048 ; - dev->mode_config.max_height =2048 ; + dev->mode_config.min_width =1 ; + dev->mode_config.min_height =1 ; + dev->mode_config.max_width = dev_priv->fb_max_width; + dev->mode_config.max_height = dev_priv->fb_max_height; ret =vmw_kms_init_legacy_display_system (dev_priv);
Signature · 8 lines
1.6.0.4 ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev --
PATCH 1/1 drm/vmwgfx: Bump major and drop scanout flag compat
Even if this bumps the version to 1 it does not mean the driver is out of staging. From what we know this is the last backwards incompatible change to the driver.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 17 +---------------- 2 files changed, 4 insertions(+), 19 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +3 -3
@@ -39,9 +39,9 @@#include "ttm/ttm_execbuf_util.h" #include "ttm/ttm_module.h" -#define VMWGFX_DRIVER_DATE "20100118" -#define VMWGFX_DRIVER_MAJOR 0 -#define VMWGFX_DRIVER_MINOR 9 +#define VMWGFX_DRIVER_DATE "20100209" +#define VMWGFX_DRIVER_MAJOR 1 +#define VMWGFX_DRIVER_MINOR 0#define VMWGFX_DRIVER_PATCHLEVEL 0#define VMWGFX_FILE_PAGE_OFFSET 0x00100000#define VMWGFX_FIFO_STATIC_SIZE (1024*1024)
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +1 -16
@@ -35,11 +35,6 @@#define VMW_RES_SURFACE ttm_driver_type1#define VMW_RES_STREAM ttm_driver_type2 -/* XXX: This isn't a real hardware flag, but just a hack for kernel to -* know about primary surfaces. Find a better way to accomplish this. -*/ -#define SVGA3D_SURFACE_HINT_SCANOUT (1 << 9) -struct vmw_user_context {struct ttm_base_object base;struct vmw_resource res;
@@ -579,6 +574,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, srf->flags = req->flags; srf->format = req->format; + srf->scanout = req->scanout;memcpy (srf->mip_levels, req->mip_levels,sizeof (srf->mip_levels)); srf->num_sizes =0 ;for (i =0 ; i <DRM_VMW_MAX_SURFACE_FACES ; ++i)
@@ -604,17 +600,6 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,if (unlikely (ret !=0 )) goto out_err1; -if (srf->flags &SVGA3D_SURFACE_HINT_SCANOUT ) { -/* we should not send this flag down to hardware since -* its not a official one -*/ - srf->flags &= ~SVGA3D_SURFACE_HINT_SCANOUT ; - srf->scanout = true; - }else if (req->scanout) - srf->scanout = true; -else - srf->scanout = false; - if (srf->scanout && srf->num_sizes == 1 && srf->sizes[0].width == 64 &&
Signature · 8 lines
1.6.0.4 ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev --
PATCH 1/1 drm/vmwgfx: Support old hardware
Also included are overall modesetting improvements
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 9 ++++ drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 ++ drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 81 ++++++++++++---------------------- drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 18 ++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 68 +++++++++++----------------- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 70 ++++++++++++++++++++++++----- 6 files changed, 144 insertions(+), 107 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +9 -0
@@ -318,6 +318,15 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) goto out_err3; } +/* need mmio memory to check for fifo pitchlock cap */ +if (!(dev_priv->capabilities &SVGA_CAP_DISPLAY_TOPOLOGY ) && + !(dev_priv->capabilities &SVGA_CAP_PITCHLOCK ) && + !vmw_fifo_have_pitchlock (dev_priv)) { + ret = -ENOSYS ; +DRM_ERROR ("Hardware has no pitchlock\n" ); + goto out_err4; + } + dev_priv->tdev =ttm_object_device_init (dev_priv->mem_global_ref.object,12 );
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +5 -0
@@ -179,6 +179,7 @@ struct vmw_private {uint32_t vga_red_mask;uint32_t vga_blue_mask;uint32_t vga_green_mask; +uint32_t vga_pitchlock;/* * Framebuffer info.
@@ -393,6 +394,7 @@ extern int vmw_fifo_send_fence(struct vmw_private *dev_priv,extern void vmw_fifo_ping_host (struct vmw_private *dev_priv,uint32_t reason);extern int vmw_fifo_mmap (struct file *filp,struct vm_area_struct *vma);extern bool vmw_fifo_have_3d (struct vmw_private *dev_priv); +extern bool vmw_fifo_have_pitchlock (struct vmw_private *dev_priv);/** * TTM glue - vmwgfx_ttm_glue.c
@@ -466,6 +468,9 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,struct ttm_object_file *tfile, struct ttm_buffer_object *bo, SVGA3dCmdHeader *header); +void vmw_kms_write_svga (struct vmw_private *vmw_priv, +unsigned width,unsigned height,unsigned pitch, +unsigned bbp,unsigned depth);/** * Overlay control - vmwgfx_overlay.c
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +28 -53
131 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +18 -0
@@ -34,6 +34,9 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv)__le32 __iomem *fifo_mem = dev_priv->mmio_virt;uint32_t fifo_min, hwversion; +if (!(dev_priv->capabilities &SVGA_CAP_EXTENDED_FIFO )) +return false; + fifo_min =ioread32 (fifo_mem +SVGA_FIFO_MIN );if (fifo_min <=SVGA_FIFO_3D_HWVERSION *sizeof (unsigned int ))return false;
@@ -48,6 +51,21 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv)return true; } +bool vmw_fifo_have_pitchlock (struct vmw_private *dev_priv) +{ +__le32 __iomem *fifo_mem = dev_priv->mmio_virt; +uint32_t caps; + +if (!(dev_priv->capabilities &SVGA_CAP_EXTENDED_FIFO )) +return false; + + caps =ioread32 (fifo_mem +SVGA_FIFO_CAPABILITIES ); +if (caps &SVGA_FIFO_CAP_PITCHLOCK ) +return true; + +return false; +} +int vmw_fifo_init (struct vmw_private *dev_priv,struct vmw_fifo_state *fifo) {__le32 __iomem *fifo_mem = dev_priv->mmio_virt;
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +27 -41
104 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +57 -13
107 lines not on this page · raw message
Signature · 8 lines
1.6.0.4 ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev --
Re: [PATCH] drm/vmwgfx: Bump major and drop scanout flag compat
In reply to Jakob BornecrantzQuoted 60 lines · Jakob Bornecrantz
Even if this bumps the version to 1 it does not mean the driver is out of staging. From what we know this is the last backwards incompatible change to the driver.
Signed-off-by Jakob Bornecrantz <[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 17 +---------------- 2 files changed, 4 insertions(+), 19 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +3
-3@@ -39,9 +39,9 @@#include "ttm/ttm_execbuf_util.h" #include "ttm/ttm_module.h" -#define VMWGFX_DRIVER_DATE "20100118" -#define VMWGFX_DRIVER_MAJOR 0 -#define VMWGFX_DRIVER_MINOR 9 +#define VMWGFX_DRIVER_DATE "20100209" +#define VMWGFX_DRIVER_MAJOR 1 +#define VMWGFX_DRIVER_MINOR 0#define VMWGFX_DRIVER_PATCHLEVEL 0#define VMWGFX_FILE_PAGE_OFFSET 0x00100000#define VMWGFX_FIFO_STATIC_SIZE (1024*1024)drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +1
-9@@ -35,11 +35,6 @@#define VMW_RES_SURFACE ttm_driver_type1#define VMW_RES_STREAM ttm_driver_type2 -/* XXX: This isn't a real hardware flag, but just a hack for kernel to -* know about primary surfaces. Find a better way to accomplish this. -*/ -#define SVGA3D_SURFACE_HINT_SCANOUT (1 << 9) -struct vmw_user_context {struct ttm_base_object base;struct vmw_resource res;@@ -579,6 +574,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, srf->flags = req->flags; srf->format = req->format; + srf->scanout = req->scanout;memcpy (srf->mip_levels, req->mip_levels,sizeof (srf->mip_levels)); srf->num_sizes =0 ;for (i =0 ; i <DRM_VMW_MAX_SURFACE_FACES ; ++i)@@ -604,17 +600,6 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,if (unlikely (ret !=0 )) goto out_err1; -if (srf->flags &SVGA3D_SURFACE_HINT_SCANOUT ) { -/* we should not send this flag down to hardware since -* its not a official one -*/
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c int vmw_surface_define_ioctl(struct drm_device *dev, void *data, · line 605
Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +0
-7- srf->flags &= ~SVGA3D_SURFACE_HINT_SCANOUT ; - srf->scanout = true; - }else if (req->scanout) - srf->scanout = true; -else - srf->scanout = false; - if (srf->scanout && srf->num_sizes == 1 && srf->sizes[0].width == 64 &&
Nack. There are some more minor pending changes before we bump. I'll resend shortly.
/Thomas
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--