Lines Matching refs:vsaa

159 vmwgfx_pixmap_create_gmr(struct vmwgfx_saa *vsaa, PixmapPtr pixmap)
170 gmr = vmwgfx_dmabuf_alloc(vsaa->drm_fd, size);
199 vmwgfx_pixmap_create_sw(struct vmwgfx_saa *vsaa, PixmapPtr pixmap)
213 return vmwgfx_pixmap_create_gmr(vsaa, pixmap);
232 vmwgfx_pixmap_present_readback(struct vmwgfx_saa *vsaa,
240 if (!spix->damage || !REGION_NOTEMPTY(vsaa->pScreen, &spix->dirty_hw) ||
248 REGION_NULL(vsaa->pScreen, &intersection);
249 REGION_COPY(vsaa->pScreen, &intersection, &spix->dirty_hw);
250 REGION_INTERSECT(vsaa->pScreen, &intersection, &intersection,
254 REGION_INTERSECT(vsaa->pScreen, &intersection, &intersection, region);
256 if (!REGION_NOTEMPTY(vsaa->pScreen, &intersection))
263 if (!vmwgfx_pixmap_create_gmr(vsaa, pixmap))
266 if (vmwgfx_present_readback(vsaa->drm_fd, vpix->fb_id,
270 REGION_SUBTRACT(vsaa->pScreen, &spix->dirty_hw,
273 REGION_UNINIT(vsaa->pScreen, &intersection);
277 REGION_UNINIT(vsaa->pScreen, &intersection);
282 vmwgfx_saa_dma(struct vmwgfx_saa *vsaa,
298 if (vpix->gmr && vsaa->can_optimize_dma) {
322 ret = xa_surface_dma(vsaa->xa_ctx, srf, data, pixmap->devKind,
327 xa_context_flush(vsaa->xa_ctx);
347 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
353 if (!vmwgfx_pixmap_present_readback(vsaa, pixmap, readback))
356 if (!REGION_NOTEMPTY(vsaa->pScreen, &spix->dirty_hw))
362 REGION_NULL(vsaa->pScreen, &intersection);
363 REGION_INTERSECT(vsaa->pScreen, &intersection, readback,
367 if (!vmwgfx_pixmap_create_sw(vsaa, pixmap))
370 if (!vmwgfx_saa_dma(vsaa, pixmap, readback, FALSE, 0, 0, NULL))
372 REGION_SUBTRACT(vsaa->pScreen, &spix->dirty_hw, &spix->dirty_hw, readback);
373 REGION_UNINIT(vsaa->pScreen, &intersection);
377 REGION_UNINIT(vsaa->pScreen, &intersection);
453 vmwgfx_hw_kill(struct vmwgfx_saa *vsaa,
465 if (!vmwgfx_download_from_hw(&vsaa->driver, spix->pixmap,
485 struct vmwgfx_saa *vsaa =
493 WSBMLISTFOREACHSAFE(list, next, &vsaa->sync_x_list) {
499 if (vmwgfx_upload_to_hw(&vsaa->driver, pixmap, &spix->dirty_shadow)) {
500 REGION_EMPTY(vsaa->pScreen, &spix->dirty_shadow);
557 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen));
588 gmr = vmwgfx_dmabuf_alloc(vsaa->drm_fd, size);
651 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen));
696 WSBMLISTADDTAIL(&vpix->pixmap_list, &vsaa->pixmaps);
705 vmwgfx_present_prepare(struct vmwgfx_saa *vsaa,
709 ScreenPtr pScreen = vsaa->pScreen;
714 _xa_surface_handle(src_vpix->hw, &vsaa->src_handle, &dummy) != 0)
717 REGION_NULL(pScreen, &vsaa->present_region);
718 vsaa->diff_valid = FALSE;
719 vsaa->dst_vpix = dst_vpix;
720 vsaa->present_flush(pScreen);
737 vmwgfx_check_hw_contents(struct vmwgfx_saa *vsaa,
753 *has_dirty_hw = REGION_NOTEMPTY(vsaa->pScreen,
755 *has_valid_hw = !REGION_NOTEMPTY(vsaa->pScreen,
760 REGION_NULL(vsaa->pScreen, &intersection);
761 REGION_INTERSECT(vsaa->pScreen, &intersection, &vpix->base.dirty_hw,
763 *has_dirty_hw = REGION_NOTEMPTY(vsaa->pScreen, &intersection);
764 REGION_INTERSECT(vsaa->pScreen, &intersection, &vpix->base.dirty_shadow,
766 *has_valid_hw = !REGION_NOTEMPTY(vsaa->pScreen, &intersection);
767 REGION_UNINIT(vsaa->pScreen, &intersection);
774 * @vsaa: Pointer to a struct vmwgfx_saa accelerator.
784 vmwgfx_prefer_gmr(struct vmwgfx_saa *vsaa, PixmapPtr pixmap)
788 if (vsaa->can_optimize_dma) {
790 (void) vmwgfx_pixmap_create_gmr(vsaa, pixmap);
799 vmwgfx_create_hw(struct vmwgfx_saa *vsaa,
807 if (!vsaa->xat)
817 hw = xa_surface_create(vsaa->xat,
845 vmwgfx_prefer_gmr(vsaa, pixmap);
859 struct vmwgfx_saa *vsaa =
865 if (!vmwgfx_pixmap_present_readback(vsaa, pixmap, region))
868 REGION_NULL(vsaa->pScreen, &intersection);
869 REGION_COPY(vsaa->pScreen, &intersection, &spix->dirty_shadow);
872 REGION_UNION(vsaa->pScreen, &intersection, vpix->dirty_present,
875 if (spix->damage && REGION_NOTEMPTY(vsaa->pScreen, &intersection)) {
883 REGION_INTERSECT(vsaa->pScreen, &intersection, region,
888 if (REGION_NOTEMPTY(vsaa->pScreen, upload)) {
889 Bool ret = vmwgfx_upload_to_hw(&vsaa->driver, pixmap, upload);
891 REGION_SUBTRACT(vsaa->pScreen, &spix->dirty_shadow,
894 REGION_SUBTRACT(vsaa->pScreen, vpix->dirty_present,
897 REGION_UNINIT(vsaa->pScreen, &intersection);
902 REGION_UNINIT(vsaa->pScreen, &intersection);
916 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
922 if (!vsaa->xat || !SAA_PM_IS_SOLID(&dst_pixmap->drawable, plane_mask) ||
923 alu != GXcopy || !vsaa->is_master)
929 vmwgfx_check_hw_contents(vsaa, src_vpix, src_reg,
940 if (vmwgfx_present_prepare(vsaa, src_vpix, dst_vpix)) {
941 vsaa->present_copy = TRUE;
947 vsaa->present_copy = FALSE;
995 xa_copy_done(vsaa->xa_ctx);
996 xa_context_flush(vsaa->xa_ctx);
1004 if (xa_copy_prepare(vsaa->xa_ctx, dst_vpix->hw, src_vpix->hw) !=
1016 vmwgfx_present_done(struct vmwgfx_saa *vsaa)
1018 ScreenPtr pScreen = vsaa->pScreen;
1019 struct vmwgfx_saa_pixmap *dst_vpix = vsaa->dst_vpix;
1022 if (!vsaa->diff_valid)
1025 (void) vmwgfx_present(vsaa->drm_fd, dst_vpix->fb_id,
1026 vsaa->xdiff, vsaa->ydiff,
1027 &vsaa->present_region, vsaa->src_handle);
1029 REGION_TRANSLATE(pScreen, &vsaa->present_region, vsaa->xdiff, vsaa->ydiff);
1031 &vsaa->present_region);
1032 vsaa->diff_valid = FALSE;
1033 REGION_UNINIT(pScreen, &vsaa->present_region);
1037 vmwgfx_present_copy(struct vmwgfx_saa *vsaa,
1050 if (vsaa->diff_valid && ((xdiff != vsaa->xdiff) || (ydiff != vsaa->ydiff)))
1051 (void) vmwgfx_present_done(vsaa);
1053 if (!vsaa->diff_valid) {
1054 vsaa->xdiff = xdiff;
1055 vsaa->ydiff = ydiff;
1056 vsaa->diff_valid = TRUE;
1065 REGION_UNION(pScreen, &vsaa->present_region, &vsaa->present_region, &reg);
1078 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
1080 if (vsaa->present_copy) {
1081 vmwgfx_present_copy(vsaa, src_x, src_y, dst_x, dst_y, w, h);
1084 xa_copy(vsaa->xa_ctx, dst_x, dst_y, src_x, src_y, w, h);
1090 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
1092 if (vsaa->present_copy) {
1093 vmwgfx_present_done(vsaa);
1096 xa_copy_done(vsaa->xa_ctx);
1097 xa_context_flush(vsaa->xa_ctx);
1110 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
1120 if (!vsaa->is_master)
1133 vmwgfx_check_hw_contents(vsaa, dst_vpix, dst_region,
1143 vmwgfx_check_hw_contents(vsaa, src_vpix, src_region,
1150 vmwgfx_check_hw_contents(vsaa, mask_vpix, mask_region,
1160 if (!valid_hw && !dirty_hw && !vsaa->rendercheck)
1170 xa_comp = vmwgfx_xa_setup_comp(vsaa->vcomp, op,
1222 if (xa_composite_prepare(vsaa->xa_ctx, xa_comp))
1237 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
1239 xa_composite_rect(vsaa->xa_ctx, src_x, src_y, mask_x, mask_y,
1246 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
1248 xa_composite_done(vsaa->xa_ctx);
1249 xa_context_flush(vsaa->xa_ctx);
1255 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
1257 if (vsaa->vcomp)
1258 vmwgfx_free_composite(vsaa->vcomp);
1259 free(vsaa);
1271 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
1274 ScrnInfoPtr pScrn = xf86ScreenToScrn(vsaa->pScreen);
1291 REGION_EMPTY(vsaa->pScreen, &spix->dirty_shadow);
1296 WSBMLISTADDTAIL(&vpix->sync_x_head, &vsaa->sync_x_list);
1309 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver);
1327 if (!hw && !vmwgfx_upload_to_hw(&vsaa->driver, pixmap, damage))
1330 REGION_SUBTRACT(&vsaa->pScreen, &spix->dirty_shadow,
1344 REGION_NOTEMPTY(vsaa->pScreen, vpix->present_damage)) {
1345 REGION_UNION(vsaa->pScreen, vpix->dirty_present,
1347 REGION_EMPTY(vsaa->pScreen, vpix->present_damage);
1349 if (REGION_NOTEMPTY(vsaa->pScreen, vpix->pending_update)) {
1352 REGION_NULL(vsaa->pScreen, &reg);
1353 REGION_INTERSECT(vsaa->pScreen, &reg, vpix->pending_update,
1355 if (REGION_NOTEMPTY(vsaa->pScreen, &reg))
1356 vsaa->present_flush(vsaa->pScreen);
1359 REGION_UNION(vsaa->pScreen, vpix->pending_present,
1362 REGION_SUBTRACT(vsaa->pScreen, vpix->dirty_present,
1366 if (REGION_NOTEMPTY(vsaa->pScreen, vpix->pending_present)) {
1369 REGION_NULL(vsaa->pScreen, &reg);
1370 REGION_INTERSECT(vsaa->pScreen, &reg, vpix->pending_present,
1372 if (REGION_NOTEMPTY(vsaa->pScreen, &reg))
1373 vsaa->present_flush(vsaa->pScreen);
1376 REGION_UNION(vsaa->pScreen, vpix->pending_update,
1379 REGION_SUBTRACT(vsaa->pScreen, vpix->dirty_present,
1419 struct vmwgfx_saa *vsaa;
1421 vsaa = calloc(1, sizeof(*vsaa));
1422 if (!vsaa)
1431 vsaa->pScreen = pScreen;
1432 vsaa->xat = xat;
1434 vsaa->xa_ctx = xa_context_default(xat);
1435 vsaa->drm_fd = drm_fd;
1436 vsaa->present_flush = present_flush;
1437 vsaa->can_optimize_dma = TRUE;
1438 vsaa->use_present_opt = direct_presents;
1439 vsaa->only_hw_presents = only_hw_presents;
1440 vsaa->rendercheck = rendercheck;
1441 vsaa->is_master = TRUE;
1442 vsaa->known_prime_format = FALSE;
1443 vsaa->has_screen_targets = has_screen_targets;
1444 WSBMINITLISTHEAD(&vsaa->sync_x_list);
1445 WSBMINITLISTHEAD(&vsaa->pixmaps);
1447 vsaa->driver = vmwgfx_saa_driver;
1448 vsaa->vcomp = vmwgfx_alloc_composite();
1450 if (!vsaa->vcomp)
1451 vsaa->driver.composite_prepare = NULL;
1453 if (!saa_driver_init(pScreen, &vsaa->driver))
1458 free(vsaa);
1486 REGION_RESET(vsaa->pScreen, vpix->pending_present, &box);
1488 REGION_SUBTRACT(vsaa->pScreen, vpix->pending_present,
1490 REGION_SUBTRACT(vsaa->pScreen, vpix->pending_present,
1492 REGION_COPY(vsaa->pScreen, vpix->pending_update,
1507 struct vmwgfx_saa *vsaa =
1515 vpix->scanout_hw = vsaa->only_hw_presents ||
1516 (vsaa->has_screen_targets && scanout_equals_pixmap);
1535 if (!vmwgfx_pixmap_create_gmr(vsaa, pixmap))
1543 if (!vmwgfx_pixmap_add_present(pixmap, vsaa->use_present_opt))
1546 if (drmModeAddFB(vsaa->drm_fd,
1577 struct vmwgfx_saa *vsaa;
1584 vsaa = to_vmwgfx_saa(saa_get_driver(pixmap->drawable.pScreen));
1589 REGION_EMPTY(vsaa->pScreen, vpix->pending_update);
1590 drmModeRmFB(vsaa->drm_fd, vpix->fb_id);
1592 vmwgfx_pixmap_present_readback(vsaa, pixmap, NULL);
1604 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen));
1606 vsaa->is_master = TRUE;
1613 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen));
1618 WSBMLISTFOREACH(list, &vsaa->pixmaps) {
1625 (void) vmwgfx_download_from_hw(&vsaa->driver, spix->pixmap,
1630 vsaa->is_master = FALSE;
1658 struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen));
1671 if (vmwgfx_prime_fd_to_handle(vsaa->drm_fd, surface_fd, &handle) < 0)
1674 dst = xa_surface_from_handle(vsaa->xat, pDraw->width, pDraw->height,
1705 vmwgfx_prefer_gmr(vsaa, src);
1711 if (vsaa->known_prime_format) {
1723 if (vmwgfx_saa_dma(vsaa, src, &intersection, TRUE, dx, dy, dst)) {
1744 if (xa_copy_prepare(vsaa->xa_ctx, dst, vpix->hw) != XA_ERR_NONE) {
1750 xa_copy(vsaa->xa_ctx, box->x1 + dx, box->y1 + dy, box->x1, box->y1,
1755 xa_copy_done(vsaa->xa_ctx);
1756 xa_context_flush(vsaa->xa_ctx);
1759 if (vsaa->known_prime_format)
1765 vmwgfx_prime_release_handle(vsaa->drm_fd, handle);