vmwgfx fixes
Subsystems (3)
cover vmwgfx fixes
The patch series was intended to be preceded by this mail. A bunch of fixes for 3.2 for vmwgfx.
/Thomas
PATCH 1/5 vmwgfx: Screen object cleanups
Remove unused member.
No need to pin / unpin fb.
--- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 16 ++-------------- 1 files changed, 2 insertions(+), 14 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +2 -14
@@ -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 );
Signature · 1 line
1.7.4.4
PATCH 2/5 vmwgfx: Remove screen object active list
In reply to Thomas HellstromIt 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.
--- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 52 ++++++++++------------------------ 1 files changed, 15 insertions(+), 37 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +15 -37
@@ -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);
Signature · 1 line
1.7.4.4
PATCH 3/5 vmwgfx: Make the preferred autofit mode have a 60Hz vrefresh
In reply to Thomas Hellstrom--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +23 -1
@@ -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);
Signature · 1 line
1.7.4.4
PATCH 4/5 vmwgfx: Infrastructure for explicit placement
In reply to Thomas HellstromMake 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.
--- 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(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +1 -0
@@ -102,6 +102,7 @@ struct vmw_display_unit {*/ int gui_x;int gui_y; +bool is_implicit; };#define vmw_crtc_to_du (x) \
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +1 -0
@@ -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 );
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +28 -24
113 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 5/5 vmwgfx: Fix hw cursor position
In reply to Thomas Hellstrom--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +5 -2
@@ -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 ; }
Signature · 1 line
1.7.4.4