More vmwgfx fixes for 3.2
Subsystems (3)
cover More vmwgfx fixes for 3.2
A number of fixes for bugs discovered by Jakob while doing Wayland/EGL testing.
PATCH 1/5 vmwgfx: Use pointer return error codes
From: Jakob Bornecrantz <[email protected]>
Signed-off-by Jakob Bornecrantz <[email protected]>
Signed-off-by Thomas Hellstrom <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
@@ -997,7 +997,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, required_size = mode_cmd->pitch * mode_cmd->height;if (unlikely (required_size > (u64 ) dev_priv->vram_size)) {DRM_ERROR ("VRAM size is too small for requested mode.\n" ); -return NULL ; +return ERR_PTR (-ENOMEM ); }/*
Signature · 1 line
1.7.4.4
PATCH 2/5 vmwgfx: Free prefered mode on error path
In reply to Thomas HellstromFrom: Jakob Bornecrantz <[email protected]>
Signed-off-by Jakob Bornecrantz <[email protected]>
Signed-off-by Thomas Hellstrom <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +11 -6
@@ -1710,17 +1710,22 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, mode->hdisplay = du->pref_width; mode->vdisplay = du->pref_height;vmw_guess_mode_timing (mode); +if (vmw_kms_validate_mode_vram (dev_priv, mode->hdisplay *2 , mode->vdisplay)) {drm_mode_probed_add (connector, mode); + }else { +drm_mode_destroy (dev, mode); + mode =NULL ; + } -if (du->pref_mode) { -list_del_init (&du->pref_mode->head); -drm_mode_destroy (dev, du->pref_mode); - } - - du->pref_mode = mode; +if (du->pref_mode) { +list_del_init (&du->pref_mode->head); +drm_mode_destroy (dev, du->pref_mode); } + +/* mode might be null here, this is intended */ + du->pref_mode = mode; }for (i =0 ; vmw_kms_connector_builtin[i].type !=0 ; i++) {
Signature · 1 line
1.7.4.4
PATCH 3/5 vmwgfx: Unreference surface on cursor error path
In reply to Thomas HellstromFrom: Jakob Bornecrantz <[email protected]>
Signed-off-by Jakob Bornecrantz <[email protected]>
Reviewed-by Thomas Hellstrom <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -0
@@ -111,6 +111,7 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,if (!ret) {if (!surface->snooper.image) {DRM_ERROR ("surface not suitable for cursor\n" ); +vmw_surface_unreference (&surface);return -EINVAL ; } }else {
Signature · 1 line
1.7.4.4
PATCH 4/5 vmwgfx: Move the prefered mode first in the list
In reply to Thomas HellstromFrom: Jakob Bornecrantz <[email protected]>
Signed-off-by Jakob Bornecrantz <[email protected]>
Signed-off-by Thomas Hellstrom <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +4 -0
@@ -1747,6 +1747,10 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,drm_mode_probed_add (connector, mode); } +/* Move the prefered mode first, help apps pick the right mode. */ +if (du->pref_mode) +list_move (&du->pref_mode->head, &connector->probed_modes); +drm_mode_connector_list_update (connector);return 1 ;
Signature · 1 line
1.7.4.4
PATCH 5/5 vmwgfx: Snoop DMA transfers with non-covering sizes
In reply to Thomas HellstromFrom: Jakob Bornecrantz <[email protected]>
Enough to get cursors working under Wayland.
Signed-off-by Jakob Bornecrantz <[email protected]>
Signed-off-by Thomas Hellstrom <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 30 +++++++++++++++++++++--------- 1 files changed, 21 insertions(+), 9 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +21 -9
@@ -216,7 +216,7 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,SVGA3dCmdHeader header;SVGA3dCmdSurfaceDMA dma; } *cmd; -int ret; +int i, ret; cmd = container_of(header, struct vmw_dma_cmd, header);
@@ -238,16 +238,19 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, box_count = (cmd->header.size -sizeof (SVGA3dCmdSurfaceDMA)) /sizeof (SVGA3dCopyBox); -if (cmd->dma.guest.pitch != (64 *4 ) || - cmd->dma.guest.ptr.offset %PAGE_SIZE || +if (cmd->dma.guest.ptr.offset %PAGE_SIZE || box->x !=0 || box->y !=0 || box->z !=0 || box->srcx !=0 || box->srcy !=0 || box->srcz !=0 || - box->w !=64 || box->h !=64 || box->d !=1 || - box_count !=1 ) { + box->d !=1 || box_count !=1 ) {/* TODO handle none page aligned offsets */ -/* TODO handle partial uploads and pitch != 256 */ -/* TODO handle more then one copy (size != 64) */ -DRM_ERROR ("lazy programmer, can't handle weird stuff\n" ); +/* TODO handle more dst & src != 0 */ +/* TODO handle more then one copy */ +DRM_ERROR ("Cant snoop dma request for cursor!\n" ); +DRM_ERROR ("(%u, %u, %u) (%u, %u, %u) (%ux%ux%u) %u %u\n" , + box->srcx, box->srcy, box->srcz, + box->x, box->y, box->z, + box->w, box->h, box->d, box_count, + cmd->dma.guest.ptr.offset);return ; }
@@ -266,7 +269,16 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, virtual =ttm_kmap_obj_virtual (&map, &dummy); -memcpy (srf->snooper.image, virtual,64 *64 *4 ); +if (box->w ==64 && cmd->dma.guest.pitch ==64 *4 ) { +memcpy (srf->snooper.image, virtual,64 *64 *4 ); + }else { +/* Image is unsigned pointer. */ +for (i =0 ; i < box->h; i++) +memcpy (srf->snooper.image + i *64 , + virtual + i * cmd->dma.guest.pitch, + box->w *4 ); + } + srf->snooper.age++;/* we can't call this function from this function since execbuf has
Signature · 1 line
1.7.4.4