* [PATCH -fixes 0/5] vmwgfx fixes
@ 2011-11-02 8:43 Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 1/5] vmwgfx: Screen object cleanups Thomas Hellstrom
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-02 8:43 UTC (permalink / raw)
To: airlied; +Cc: dri-devel
The patch series was intended to be preceded by this mail.
A bunch of fixes for 3.2 for vmwgfx.
/Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] vmwgfx: Screen object cleanups
2011-11-02 8:43 [PATCH -fixes 0/5] vmwgfx fixes Thomas Hellstrom
@ 2011-11-02 8:43 ` Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 2/5] vmwgfx: Remove screen object active list Thomas Hellstrom
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-02 8:43 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
Remove unused member.
No need to pin / unpin fb.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 16 ++--------------
1 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index 0660d3c..edfecc7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -39,7 +39,6 @@ struct vmw_screen_object_display {
struct list_head active;
unsigned num_active;
- unsigned last_num_active;
struct vmw_framebuffer *fb;
};
@@ -84,12 +83,8 @@ static int vmw_sou_del_active(struct vmw_private *vmw_priv,
/* Must init otherwise list_empty(&sou->active) will not work. */
list_del_init(&sou->active);
- if (--(ld->num_active) == 0) {
- BUG_ON(!ld->fb);
- if (ld->fb->unpin)
- ld->fb->unpin(ld->fb);
+ if (--(ld->num_active) == 0)
ld->fb = NULL;
- }
return 0;
}
@@ -103,13 +98,7 @@ static int vmw_sou_add_active(struct vmw_private *vmw_priv,
struct list_head *at;
BUG_ON(!ld->num_active && ld->fb);
- if (vfb != ld->fb) {
- if (ld->fb && ld->fb->unpin)
- ld->fb->unpin(ld->fb);
- if (vfb->pin)
- vfb->pin(vfb);
- ld->fb = vfb;
- }
+ ld->fb = vfb;
if (!list_empty(&sou->active))
return 0;
@@ -522,7 +511,6 @@ int vmw_kms_init_screen_object_display(struct vmw_private *dev_priv)
INIT_LIST_HEAD(&dev_priv->sou_priv->active);
dev_priv->sou_priv->num_active = 0;
- dev_priv->sou_priv->last_num_active = 0;
dev_priv->sou_priv->fb = NULL;
ret = drm_vblank_init(dev, VMWGFX_NUM_DISPLAY_UNITS);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] vmwgfx: Remove screen object active list
2011-11-02 8:43 [PATCH -fixes 0/5] vmwgfx fixes Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 1/5] vmwgfx: Screen object cleanups Thomas Hellstrom
@ 2011-11-02 8:43 ` Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 3/5] vmwgfx: Make the preferred autofit mode have a 60Hz vrefresh Thomas Hellstrom
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-02 8:43 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
It isn't used for anything. Replace with an active bool.
Also make a couple of functions return void instead of int
since their return value wasn't checked anyway.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakbo Bornecrantz <jakob@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 52 ++++++++++------------------------
1 files changed, 15 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index edfecc7..ea65834 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -36,8 +36,6 @@
container_of(x, struct vmw_screen_object_unit, base.connector)
struct vmw_screen_object_display {
- struct list_head active;
-
unsigned num_active;
struct vmw_framebuffer *fb;
@@ -53,13 +51,11 @@ struct vmw_screen_object_unit {
struct vmw_dma_buffer *buffer; /**< Backing store buffer */
bool defined;
-
- struct list_head active;
+ bool active;
};
static void vmw_sou_destroy(struct vmw_screen_object_unit *sou)
{
- list_del_init(&sou->active);
vmw_display_unit_cleanup(&sou->base);
kfree(sou);
}
@@ -74,48 +70,31 @@ static void vmw_sou_crtc_destroy(struct drm_crtc *crtc)
vmw_sou_destroy(vmw_crtc_to_sou(crtc));
}
-static int vmw_sou_del_active(struct vmw_private *vmw_priv,
+static void vmw_sou_del_active(struct vmw_private *vmw_priv,
struct vmw_screen_object_unit *sou)
{
struct vmw_screen_object_display *ld = vmw_priv->sou_priv;
- if (list_empty(&sou->active))
- return 0;
-
- /* Must init otherwise list_empty(&sou->active) will not work. */
- list_del_init(&sou->active);
- if (--(ld->num_active) == 0)
- ld->fb = NULL;
- return 0;
+ if (sou->active) {
+ if (--(ld->num_active) == 0)
+ ld->fb = NULL;
+ sou->active = false;
+ }
}
-static int vmw_sou_add_active(struct vmw_private *vmw_priv,
+static void vmw_sou_add_active(struct vmw_private *vmw_priv,
struct vmw_screen_object_unit *sou,
struct vmw_framebuffer *vfb)
{
struct vmw_screen_object_display *ld = vmw_priv->sou_priv;
- struct vmw_screen_object_unit *entry;
- struct list_head *at;
BUG_ON(!ld->num_active && ld->fb);
- ld->fb = vfb;
- if (!list_empty(&sou->active))
- return 0;
-
- at = &ld->active;
- list_for_each_entry(entry, &ld->active, active) {
- if (entry->base.unit > sou->base.unit)
- break;
-
- at = &entry->active;
+ if (!sou->active) {
+ ld->fb = vfb;
+ sou->active = true;
+ ld->num_active++;
}
-
- list_add(&sou->active, at);
-
- ld->num_active++;
-
- return 0;
}
/**
@@ -303,7 +282,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set)
/* sou only supports one fb active at the time */
if (dev_priv->sou_priv->fb && vfb &&
!(dev_priv->sou_priv->num_active == 1 &&
- !list_empty(&sou->active)) &&
+ sou->active) &&
dev_priv->sou_priv->fb != vfb) {
DRM_ERROR("Multiple framebuffers not supported\n");
return -EINVAL;
@@ -460,7 +439,7 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
encoder = &sou->base.encoder;
connector = &sou->base.connector;
- INIT_LIST_HEAD(&sou->active);
+ sou->active = false;
sou->base.pref_active = (unit == 0);
sou->base.pref_width = 800;
@@ -509,7 +488,6 @@ int vmw_kms_init_screen_object_display(struct vmw_private *dev_priv)
if (unlikely(!dev_priv->sou_priv))
goto err_no_mem;
- INIT_LIST_HEAD(&dev_priv->sou_priv->active);
dev_priv->sou_priv->num_active = 0;
dev_priv->sou_priv->fb = NULL;
@@ -546,7 +524,7 @@ int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv)
drm_vblank_cleanup(dev);
- if (!list_empty(&dev_priv->sou_priv->active))
+ if (dev_priv->sou_priv->num_active > 0)
DRM_ERROR("Still have active outputs when unloading driver");
kfree(dev_priv->sou_priv);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] vmwgfx: Make the preferred autofit mode have a 60Hz vrefresh
2011-11-02 8:43 [PATCH -fixes 0/5] vmwgfx fixes Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 1/5] vmwgfx: Screen object cleanups Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 2/5] vmwgfx: Remove screen object active list Thomas Hellstrom
@ 2011-11-02 8:43 ` Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 4/5] vmwgfx: Infrastructure for explicit placement Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 5/5] vmwgfx: Fix hw cursor position Thomas Hellstrom
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-02 8:43 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index f9a0f98..1cebf64 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1662,6 +1662,28 @@ static struct drm_display_mode vmw_kms_connector_builtin[] = {
{ DRM_MODE("", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) },
};
+/**
+ * vmw_guess_mode_timing - Provide fake timings for a
+ * 60Hz vrefresh mode.
+ *
+ * @mode - Pointer to a struct drm_display_mode with hdisplay and vdisplay
+ * members filled in.
+ */
+static void vmw_guess_mode_timing(struct drm_display_mode *mode)
+{
+ mode->hsync_start = mode->hdisplay + 50;
+ mode->hsync_end = mode->hsync_start + 50;
+ mode->htotal = mode->hsync_end + 50;
+
+ mode->vsync_start = mode->vdisplay + 50;
+ mode->vsync_end = mode->vsync_start + 50;
+ mode->vtotal = mode->vsync_end + 50;
+
+ mode->clock = (u32)mode->htotal * (u32)mode->vtotal / 100 * 6;
+ mode->vrefresh = drm_mode_vrefresh(mode);
+}
+
+
int vmw_du_connector_fill_modes(struct drm_connector *connector,
uint32_t max_width, uint32_t max_height)
{
@@ -1684,7 +1706,7 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
return 0;
mode->hdisplay = du->pref_width;
mode->vdisplay = du->pref_height;
- mode->vrefresh = drm_mode_vrefresh(mode);
+ vmw_guess_mode_timing(mode);
if (vmw_kms_validate_mode_vram(dev_priv, mode->hdisplay * 2,
mode->vdisplay)) {
drm_mode_probed_add(connector, mode);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] vmwgfx: Infrastructure for explicit placement
2011-11-02 8:43 [PATCH -fixes 0/5] vmwgfx fixes Thomas Hellstrom
` (2 preceding siblings ...)
2011-11-02 8:43 ` [PATCH 3/5] vmwgfx: Make the preferred autofit mode have a 60Hz vrefresh Thomas Hellstrom
@ 2011-11-02 8:43 ` Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 5/5] vmwgfx: Fix hw cursor position Thomas Hellstrom
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-02 8:43 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
Make it possible to use explicit placement
(although not hooked up with a user-space interface yet)
and relax the single framebuffer limit to only apply to implicit placement.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 1 +
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 1 +
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 52 ++++++++++++++++++---------------
3 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
index 815cf99..af8e6e5 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
@@ -102,6 +102,7 @@ struct vmw_display_unit {
*/
int gui_x;
int gui_y;
+ bool is_implicit;
};
#define vmw_crtc_to_du(x) \
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index bbfe381..90c5e39 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -337,6 +337,7 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
ldu->base.pref_width = 800;
ldu->base.pref_height = 600;
ldu->base.pref_mode = NULL;
+ ldu->base.is_implicit = true;
drm_connector_init(dev, connector, &vmw_legacy_connector_funcs,
DRM_MODE_CONNECTOR_VIRTUAL);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
index ea65834..4defdcf 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
@@ -36,9 +36,9 @@
container_of(x, struct vmw_screen_object_unit, base.connector)
struct vmw_screen_object_display {
- unsigned num_active;
+ unsigned num_implicit;
- struct vmw_framebuffer *fb;
+ struct vmw_framebuffer *implicit_fb;
};
/**
@@ -51,7 +51,7 @@ struct vmw_screen_object_unit {
struct vmw_dma_buffer *buffer; /**< Backing store buffer */
bool defined;
- bool active;
+ bool active_implicit;
};
static void vmw_sou_destroy(struct vmw_screen_object_unit *sou)
@@ -75,10 +75,10 @@ static void vmw_sou_del_active(struct vmw_private *vmw_priv,
{
struct vmw_screen_object_display *ld = vmw_priv->sou_priv;
- if (sou->active) {
- if (--(ld->num_active) == 0)
- ld->fb = NULL;
- sou->active = false;
+ if (sou->active_implicit) {
+ if (--(ld->num_implicit) == 0)
+ ld->implicit_fb = NULL;
+ sou->active_implicit = false;
}
}
@@ -88,12 +88,12 @@ static void vmw_sou_add_active(struct vmw_private *vmw_priv,
{
struct vmw_screen_object_display *ld = vmw_priv->sou_priv;
- BUG_ON(!ld->num_active && ld->fb);
+ BUG_ON(!ld->num_implicit && ld->implicit_fb);
- if (!sou->active) {
- ld->fb = vfb;
- sou->active = true;
- ld->num_active++;
+ if (!sou->active_implicit && sou->base.is_implicit) {
+ ld->implicit_fb = vfb;
+ sou->active_implicit = true;
+ ld->num_implicit++;
}
}
@@ -132,8 +132,13 @@ static int vmw_sou_fifo_create(struct vmw_private *dev_priv,
(sou->base.unit == 0 ? SVGA_SCREEN_IS_PRIMARY : 0);
cmd->obj.size.width = mode->hdisplay;
cmd->obj.size.height = mode->vdisplay;
- cmd->obj.root.x = x;
- cmd->obj.root.y = y;
+ if (sou->base.is_implicit) {
+ cmd->obj.root.x = x;
+ cmd->obj.root.y = y;
+ } else {
+ cmd->obj.root.x = sou->base.gui_x;
+ cmd->obj.root.y = sou->base.gui_y;
+ }
/* Ok to assume that buffer is pinned in vram */
vmw_bo_get_guest_ptr(&sou->buffer->base, &cmd->obj.backingStore.ptr);
@@ -280,10 +285,11 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set)
}
/* sou only supports one fb active at the time */
- if (dev_priv->sou_priv->fb && vfb &&
- !(dev_priv->sou_priv->num_active == 1 &&
- sou->active) &&
- dev_priv->sou_priv->fb != vfb) {
+ if (sou->base.is_implicit &&
+ dev_priv->sou_priv->implicit_fb && vfb &&
+ !(dev_priv->sou_priv->num_implicit == 1 &&
+ sou->active_implicit) &&
+ dev_priv->sou_priv->implicit_fb != vfb) {
DRM_ERROR("Multiple framebuffers not supported\n");
return -EINVAL;
}
@@ -439,12 +445,13 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
encoder = &sou->base.encoder;
connector = &sou->base.connector;
- sou->active = false;
+ sou->active_implicit = false;
sou->base.pref_active = (unit == 0);
sou->base.pref_width = 800;
sou->base.pref_height = 600;
sou->base.pref_mode = NULL;
+ sou->base.is_implicit = true;
drm_connector_init(dev, connector, &vmw_legacy_connector_funcs,
DRM_MODE_CONNECTOR_VIRTUAL);
@@ -488,8 +495,8 @@ int vmw_kms_init_screen_object_display(struct vmw_private *dev_priv)
if (unlikely(!dev_priv->sou_priv))
goto err_no_mem;
- dev_priv->sou_priv->num_active = 0;
- dev_priv->sou_priv->fb = NULL;
+ dev_priv->sou_priv->num_implicit = 0;
+ dev_priv->sou_priv->implicit_fb = NULL;
ret = drm_vblank_init(dev, VMWGFX_NUM_DISPLAY_UNITS);
if (unlikely(ret != 0))
@@ -524,9 +531,6 @@ int vmw_kms_close_screen_object_display(struct vmw_private *dev_priv)
drm_vblank_cleanup(dev);
- if (dev_priv->sou_priv->num_active > 0)
- DRM_ERROR("Still have active outputs when unloading driver");
-
kfree(dev_priv->sou_priv);
return 0;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] vmwgfx: Fix hw cursor position
2011-11-02 8:43 [PATCH -fixes 0/5] vmwgfx fixes Thomas Hellstrom
` (3 preceding siblings ...)
2011-11-02 8:43 ` [PATCH 4/5] vmwgfx: Infrastructure for explicit placement Thomas Hellstrom
@ 2011-11-02 8:43 ` Thomas Hellstrom
4 siblings, 0 replies; 6+ messages in thread
From: Thomas Hellstrom @ 2011-11-02 8:43 UTC (permalink / raw)
To: airlied; +Cc: Thomas Hellstrom, dri-devel
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 1cebf64..5ccce1c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -176,7 +176,9 @@ err_unreserve:
return 0;
}
- vmw_cursor_update_position(dev_priv, true, du->cursor_x, du->cursor_y);
+ vmw_cursor_update_position(dev_priv, true,
+ du->cursor_x + du->hotspot_x,
+ du->cursor_y + du->hotspot_y);
return 0;
}
@@ -191,7 +193,8 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
du->cursor_y = y + crtc->y;
vmw_cursor_update_position(dev_priv, shown,
- du->cursor_x, du->cursor_y);
+ du->cursor_x + du->hotspot_x,
+ du->cursor_y + du->hotspot_y);
return 0;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-11-02 8:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-02 8:43 [PATCH -fixes 0/5] vmwgfx fixes Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 1/5] vmwgfx: Screen object cleanups Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 2/5] vmwgfx: Remove screen object active list Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 3/5] vmwgfx: Make the preferred autofit mode have a 60Hz vrefresh Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 4/5] vmwgfx: Infrastructure for explicit placement Thomas Hellstrom
2011-11-02 8:43 ` [PATCH 5/5] vmwgfx: Fix hw cursor position Thomas Hellstrom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox