summaryrefslogtreecommitdiff
path: root/vmwgfx/vmwgfx_driver.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2015-02-25 01:51:11 -0800
committerThomas Hellstrom <thellstrom@vmware.com>2015-05-04 23:26:34 -0700
commit1e443c4717a8b107c0c9283e222482703ac0f358 (patch)
tree1ea708f3e0929d325e1e0263c72126996dfddb33 /vmwgfx/vmwgfx_driver.c
parent8f0cf7c03597532feb1a8ccf3bb1cafcd6170f89 (diff)
vmware/vmwgfx: Try to use only_hw_present semantics if screen targets are enabled
If screen targets are enabled and there is a reasonable chance that the vmwgfx drm driver can use the surface backing a pixmap as a screen target surface, then make that surface a modesetting framebuffer rather than the corresponding DMA buffer. In practice this applies when we start scanning out from the origin (0,0) of the pixmap. However, we would also like to apply the constraint that the scanout area is the entire pixmap, since that is the constraint used by the drm driver, but that would currently require drm framebuffer reallocations and possible flicker, so disable that for now. The drm driver will correctly handle the possibly oversized surface handed to it anyway, and the cost we pay for this is an extra hardware copy of the dirtied area when doing a software update of the scanout. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Diffstat (limited to 'vmwgfx/vmwgfx_driver.c')
-rw-r--r--vmwgfx/vmwgfx_driver.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
index 2925227..48f8a63 100644
--- a/vmwgfx/vmwgfx_driver.c
+++ b/vmwgfx/vmwgfx_driver.c
@@ -541,6 +541,14 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
ms->drm_major, ms->drm_minor, ms->drm_patch);
}
+ ms->has_screen_targets = ms->drm_major > 2 ||
+ (ms->drm_major == 2 && ms->drm_minor >= 7);
+ ms->has_screen_targets = (ms->has_screen_targets &&
+ !vmwgfx_get_param(ms->fd,
+ DRM_VMW_PARAM_SCREEN_TARGET,
+ &cap) &&
+ cap != 0);
+
ms->check_fb_size = (vmwgfx_max_fb_size(ms->fd, &ms->max_fb_size) == 0);
if (vmwgfx_get_param(ms->fd, DRM_VMW_PARAM_HW_CAPS, &cap) != 0) {
@@ -744,7 +752,7 @@ void xorg_flush(ScreenPtr pScreen)
if (vpix->fb_id != -1) {
if (vpix->pending_update) {
- if (ms->only_hw_presents &&
+ if (vpix->scanout_hw &&
REGION_NOTEMPTY(pscreen, vpix->pending_update)) {
(void) vmwgfx_hw_accel_validate(pixmap, 0, XA_FLAG_SCANOUT,
0, NULL);
@@ -756,7 +764,7 @@ void xorg_flush(ScreenPtr pScreen)
REGION_EMPTY(pScreen, vpix->pending_update);
}
if (vpix->pending_present) {
- if (ms->only_hw_presents)
+ if (vpix->scanout_hw)
(void) vmwgfx_scanout_update(ms->fd, vpix->fb_id,
vpix->pending_present);
else
@@ -1071,7 +1079,8 @@ drv_screen_init(SCREEN_INIT_ARGS_DECL)
if (!vmwgfx_saa_init(pScreen, ms->fd, ms->xat, &xorg_flush,
ms->direct_presents,
ms->only_hw_presents,
- ms->rendercheck)) {
+ ms->rendercheck,
+ ms->has_screen_targets)) {
FatalError("Failed to initialize SAA.\n");
}
@@ -1102,9 +1111,14 @@ drv_screen_init(SCREEN_INIT_ARGS_DECL)
if (ms->xat != NULL) {
xf86DrvMsg(pScrn->scrnIndex, ms->from_dp, "Direct presents are %s.\n",
(ms->direct_presents) ? "enabled" : "disabled");
- xf86DrvMsg(pScrn->scrnIndex, ms->from_hwp, "Hardware only presents "
- "are %s.\n",
- (ms->only_hw_presents) ? "enabled" : "disabled");
+ if (ms->only_hw_presents)
+ xf86DrvMsg(pScrn->scrnIndex, ms->from_hwp, "Hardware only presents "
+ "are enabled.\n");
+ else
+ xf86DrvMsg(pScrn->scrnIndex, ms->from_hwp, "Hardware only presents "
+ "are %s.\n",
+ (ms->has_screen_targets) ? "automatic per scanout" :
+ "disabled");
}
xf86SetBackingStore(pScreen);