* [PATCH 1/5] vmwgfx: Use pointer return error codes
2011-11-03 20:03 [PATCH 0/5 -fixes] More vmwgfx fixes for 3.2 Thomas Hellstrom
@ 2011-11-03 20:03 ` Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 2/5] vmwgfx: Free prefered mode on error path Thomas Hellstrom
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-03 20:03 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
From: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 5ccce1c..41a905d 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -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);
}
/*
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/5] vmwgfx: Free prefered mode on error path
2011-11-03 20:03 [PATCH 0/5 -fixes] More vmwgfx fixes for 3.2 Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 1/5] vmwgfx: Use pointer return error codes Thomas Hellstrom
@ 2011-11-03 20:03 ` Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 3/5] vmwgfx: Unreference surface on cursor " Thomas Hellstrom
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-03 20:03 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
From: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 41a905d..667437b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -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++) {
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/5] vmwgfx: Unreference surface on cursor error path
2011-11-03 20:03 [PATCH 0/5 -fixes] More vmwgfx fixes for 3.2 Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 1/5] vmwgfx: Use pointer return error codes Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 2/5] vmwgfx: Free prefered mode on error path Thomas Hellstrom
@ 2011-11-03 20:03 ` Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 4/5] vmwgfx: Move the prefered mode first in the list Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 5/5] vmwgfx: Snoop DMA transfers with non-covering sizes Thomas Hellstrom
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-03 20:03 UTC (permalink / raw)
To: airlied; +Cc: dri-devel
From: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 667437b..66e92ac 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -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 {
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 4/5] vmwgfx: Move the prefered mode first in the list
2011-11-03 20:03 [PATCH 0/5 -fixes] More vmwgfx fixes for 3.2 Thomas Hellstrom
` (2 preceding siblings ...)
2011-11-03 20:03 ` [PATCH 3/5] vmwgfx: Unreference surface on cursor " Thomas Hellstrom
@ 2011-11-03 20:03 ` Thomas Hellstrom
2011-11-03 20:03 ` [PATCH 5/5] vmwgfx: Snoop DMA transfers with non-covering sizes Thomas Hellstrom
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-03 20:03 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
From: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 66e92ac..8de2483 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -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;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 5/5] vmwgfx: Snoop DMA transfers with non-covering sizes
2011-11-03 20:03 [PATCH 0/5 -fixes] More vmwgfx fixes for 3.2 Thomas Hellstrom
` (3 preceding siblings ...)
2011-11-03 20:03 ` [PATCH 4/5] vmwgfx: Move the prefered mode first in the list Thomas Hellstrom
@ 2011-11-03 20:03 ` Thomas Hellstrom
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-03 20:03 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
From: Jakob Bornecrantz <jakob@vmware.com>
Enough to get cursors working under Wayland.
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 8de2483..03daefa 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -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
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread