summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-07-07 09:21:56 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2011-07-07 10:56:59 +0200
commit9cff0a84308723d9790c6365c0d4b1c107794995 (patch)
tree9b75c94cb5d1f927a5f8086590943219daf87466
parent81e7099b6bbd9fdae66a3186dfc3fff2758009cf (diff)
vmwgfx: Various acceleration fixes.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
-rw-r--r--vmwgfx/vmwgfx_saa.c57
-rw-r--r--vmwgfx/vmwgfx_xa_surface.c4
2 files changed, 30 insertions, 31 deletions
diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
index 635fb37..b39bc6d 100644
--- a/vmwgfx/vmwgfx_saa.c
+++ b/vmwgfx/vmwgfx_saa.c
@@ -439,6 +439,9 @@ vmwgfx_hw_kill(struct vmwgfx_saa *vsaa,
{
struct vmwgfx_saa_pixmap *vpix = to_vmwgfx_saa_pixmap(spix);
+ if (!vpix->hw)
+ return TRUE;
+
/*
* Read back any dirty regions from hardware.
*/
@@ -846,9 +849,9 @@ vmwgfx_copy_prepare(struct saa_driver *driver,
if (!has_dirty_hw && !has_valid_hw)
return FALSE;
+ if (!vmwgfx_hw_accel_validate(src_pixmap, 0, 0, 0, src_reg))
+ return FALSE;
if (vmwgfx_present_prepare(vsaa, src_vpix, dst_vpix)) {
- if (!vmwgfx_hw_accel_validate(src_pixmap, 0, 0, 0, src_reg))
- return FALSE;
vsaa->present_copy = TRUE;
return TRUE;
}
@@ -886,21 +889,21 @@ vmwgfx_copy_prepare(struct saa_driver *driver,
return FALSE;
/*
- * Setup copy state.
+ * Migrate data.
*/
- if (xa_copy_prepare(vsaa->xa_ctx, dst_vpix->hw, src_vpix->hw) !=
- XA_ERR_NONE)
+ if (!vmwgfx_hw_validate(src_pixmap, src_reg)) {
+ xa_copy_done(vsaa->xa_ctx);
return FALSE;
+ }
/*
- * Migrate data.
+ * Setup copy state.
*/
- if (!vmwgfx_hw_validate(src_pixmap, src_reg)) {
- xa_copy_done(vsaa->xa_ctx);
+ if (xa_copy_prepare(vsaa->xa_ctx, dst_vpix->hw, src_vpix->hw) !=
+ XA_ERR_NONE)
return FALSE;
- }
return TRUE;
}
@@ -1016,10 +1019,9 @@ vmwgfx_composite_prepare(struct saa_driver *driver, CARD8 op,
/*
* First we define our migration policy. We accelerate only if there
- * is dirty hw regions to be read or if all source data is
+ * are dirty hw regions to be read or if all source data is
* available in hw, and the destination has a hardware surface.
*/
-
dst_vpix = vmwgfx_saa_pixmap(dst_pix);
valid_hw = (dst_vpix->hw != NULL);
if (saa_op_reads_destination(op)) {
@@ -1064,7 +1066,6 @@ vmwgfx_composite_prepare(struct saa_driver *driver, CARD8 op,
/*
* Check that we can create the needed hardware surfaces.
*/
-
if (src_pix && !vmwgfx_hw_composite_src_stage(src_pix, src_pict->format))
goto out_err;
if (mask_pict && mask_pix &&
@@ -1076,7 +1077,6 @@ vmwgfx_composite_prepare(struct saa_driver *driver, CARD8 op,
/*
* Seems OK. Commit the changes, creating hardware surfaces.
*/
-
if (src_pix && !vmwgfx_hw_commit(src_pix))
goto out_err;
if (mask_pict && mask_pix && !vmwgfx_hw_commit(mask_pix))
@@ -1086,34 +1086,33 @@ vmwgfx_composite_prepare(struct saa_driver *driver, CARD8 op,
/*
* Update the XA state with our hardware surfaces and
- * surface formats, and bind the XA state for compositing.
+ * surface formats
*/
-
if (!vmwgfx_xa_update_comp(xa_comp, src_pix, mask_pix, dst_pix))
goto out_err;
- if (xa_composite_prepare(vsaa->xa_ctx, xa_comp))
- goto out_err;
-
/*
- * Migrate data to surfaces, now that we know that the hardware can indeed
- * accelerate.
+ * Migrate data to surfaces.
*/
-
- if (src_pix && src_region && !vmwgfx_hw_validate(src_pix, src_region))
- goto out_err_migrate;
+ if (src_pix && src_region && !vmwgfx_hw_validate(src_pix, NULL))
+ goto out_err;
if (mask_pict && mask_pix && mask_region &&
- !vmwgfx_hw_validate(mask_pix, mask_region))
- goto out_err_migrate;
- if (dst_region && !vmwgfx_hw_validate(dst_pix, dst_region))
- goto out_err_migrate;
+ !vmwgfx_hw_validate(mask_pix, NULL))
+ goto out_err;
+ if (dst_region && !vmwgfx_hw_validate(dst_pix, NULL))
+ goto out_err;
+
+ /*
+ * Bind the XA state. This must be done after data migration, since
+ * migration may change the hardware surfaces.
+ */
+ if (xa_composite_prepare(vsaa->xa_ctx, xa_comp))
+ goto out_err;
REGION_UNINIT(pScreen, &empty);
return TRUE;
- out_err_migrate:
- xa_composite_done(vsaa->xa_ctx);
out_err:
REGION_UNINIT(pScreen, &empty);
return FALSE;
diff --git a/vmwgfx/vmwgfx_xa_surface.c b/vmwgfx/vmwgfx_xa_surface.c
index 6c4ab85..7542413 100644
--- a/vmwgfx/vmwgfx_xa_surface.c
+++ b/vmwgfx/vmwgfx_xa_surface.c
@@ -110,7 +110,7 @@ vmwgfx_old_format_compatible(enum xa_formats format,
enum xa_formats old_format)
{
return (format == old_format ||
- (xa_format_type(old_format) == xa_format_type(old_format) &&
+ (xa_format_type(format) == xa_format_type(old_format) &&
xa_format_a(format) <= xa_format_a(old_format) &&
xa_format_r(format) == xa_format_r(old_format) &&
xa_format_g(format) == xa_format_g(old_format) &&
@@ -133,7 +133,6 @@ vmwgfx_hw_composite_dst_stage(PixmapPtr pixmap,
/*
* Check if we can reuse old hardware format.
*/
-
if (vpix->hw) {
enum xa_formats old_format = xa_surface_format(vpix->hw);
@@ -150,6 +149,7 @@ vmwgfx_hw_composite_dst_stage(PixmapPtr pixmap,
vpix->staging_format = format;
vpix->staging_remove_flags = 0;
vpix->staging_add_flags = XA_FLAG_RENDER_TARGET;
+
return TRUE;
}