summaryrefslogtreecommitdiff
path: root/vmwgfx
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-11-01 08:38:52 +0100
committerThomas Hellstrom <thellstrom@vmware.com>2011-11-01 18:37:10 +0100
commited7bba3cda4b454eec771d3bf0ebed4fd998a82a (patch)
tree2123895f5278c2fbe536f350a8b8c03f70b9f29a /vmwgfx
parentb2c4a7e682e14fa8af42415d429d6735117fefcb (diff)
vmwgfx: Add an option for direct presents
With this option set to true, accelerated copies to a scanout pixmap will be performed as hardware presents instead of copies to an intermediate 3D surface backing the scanout pixmap, followed by a present. Depending on the application this might be a performance boost, but since it might trigger device software readbacks in other situations, for example dri2 copy front->fake_front, it might be a performance hog in other situations, so disable it by default. (Before this commit it was enabled by default). Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Diffstat (limited to 'vmwgfx')
-rw-r--r--vmwgfx/vmwgfx_driver.c16
-rw-r--r--vmwgfx/vmwgfx_driver.h3
-rw-r--r--vmwgfx/vmwgfx_saa.c5
-rw-r--r--vmwgfx/vmwgfx_saa.h3
4 files changed, 22 insertions, 5 deletions
diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
index 132c617..4ac829f 100644
--- a/vmwgfx/vmwgfx_driver.c
+++ b/vmwgfx/vmwgfx_driver.c
@@ -105,13 +105,15 @@ typedef enum
{
OPTION_SW_CURSOR,
OPTION_RENDER_ACCEL,
- OPTION_DRI
+ OPTION_DRI,
+ OPTION_DIRECT_PRESENTS,
} drv_option_enums;
static const OptionInfoRec drv_options[] = {
{OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_RENDER_ACCEL, "RenderAccel", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DIRECT_PRESENTS, "DirectPresents", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@@ -410,6 +412,11 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
&ms->enable_dri) ?
X_CONFIG : X_PROBED;
+ ms->direct_presents = FALSE;
+ ms->from_dp = xf86GetOptValBool(ms->Options, OPTION_DIRECT_PRESENTS,
+ &ms->direct_presents) ?
+ X_CONFIG : X_DEFAULT;
+
/* Allocate an xf86CrtcConfig */
xf86CrtcConfigInit(pScrn, &crtc_config_funcs);
xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -908,7 +915,8 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
- if (!vmwgfx_saa_init(pScreen, ms->fd, ms->xat, &xorg_flush)) {
+ if (!vmwgfx_saa_init(pScreen, ms->fd, ms->xat, &xorg_flush,
+ ms->direct_presents)) {
FatalError("Failed to initialize SAA.\n");
}
@@ -933,6 +941,10 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
(ms->xat != NULL) ? "enabled" : "disabled");
xf86DrvMsg(pScrn->scrnIndex, ms->from_dri, "Direct rendering (3D) is %s.\n",
(ms->dri2_available) ? "enabled" : "disabled");
+ if (ms->xat != NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, ms->from_dp, "Direct presents are %s.\n",
+ (ms->direct_presents) ? "enabled" : "disabled");
+ }
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
diff --git a/vmwgfx/vmwgfx_driver.h b/vmwgfx/vmwgfx_driver.h
index fd750ca..a88fa82 100644
--- a/vmwgfx/vmwgfx_driver.h
+++ b/vmwgfx/vmwgfx_driver.h
@@ -92,8 +92,11 @@ typedef struct _modesettingRec
CursorPtr cursor;
Bool enable_dri;
Bool from_dri;
+ Bool direct_presents;
+ Bool from_dp;
Bool isMaster;
+
/* Broken-out options. */
OptionInfoPtr Options;
diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
index 4638ef0..66c6cfc 100644
--- a/vmwgfx/vmwgfx_saa.c
+++ b/vmwgfx/vmwgfx_saa.c
@@ -1270,7 +1270,8 @@ static const struct saa_driver vmwgfx_saa_driver = {
Bool
vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat,
- void (*present_flush)(ScreenPtr pScreen))
+ void (*present_flush)(ScreenPtr pScreen),
+ Bool direct_presents)
{
struct vmwgfx_saa *vsaa;
@@ -1285,7 +1286,7 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat,
vsaa->drm_fd = drm_fd;
vsaa->present_flush = present_flush;
vsaa->can_optimize_dma = FALSE;
- vsaa->use_present_opt = TRUE;
+ vsaa->use_present_opt = direct_presents;
vsaa->only_hw_presents = FALSE;
WSBMINITLISTHEAD(&vsaa->sync_x_list);
diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h
index 30eeacc..1fd06b6 100644
--- a/vmwgfx/vmwgfx_saa.h
+++ b/vmwgfx/vmwgfx_saa.h
@@ -80,7 +80,8 @@ vmwgfx_saa_pixmap(PixmapPtr pix)
extern Bool
vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat,
- void (*present_flush)(ScreenPtr pScreen));
+ void (*present_flush)(ScreenPtr pScreen),
+ Bool direct_presents);
extern uint32_t
vmwgfx_scanout_ref(struct vmwgfx_screen_entry *box);