diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2018-05-18 18:49:35 +0200 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2018-07-09 18:28:05 +0200 |
commit | b85b7b11f5b5e792f21951b881bd8433d3d70858 (patch) | |
tree | e079f521cf1a8600ee31d073c56b00088dca3acd /src/radeon_exa_funcs.c | |
parent | 37ba075b34130c41bb7a2261bd666af5b29ffaf3 (diff) |
Add struct radeon_buffer
Inspired by amdgpu, preparation for the following change. For now, this
is mostly a wrapper around struct radeon_bo, no functional change
intended.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_exa_funcs.c')
-rw-r--r-- | src/radeon_exa_funcs.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c index add89458..819b4258 100644 --- a/src/radeon_exa_funcs.c +++ b/src/radeon_exa_funcs.c @@ -138,7 +138,8 @@ RADEONPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) radeon_cs_space_reset_bos(info->cs); driver_priv = exaGetPixmapDriverPrivate(pPix); - radeon_cs_space_add_persistent_bo(info->cs, driver_priv->bo, 0, RADEON_GEM_DOMAIN_VRAM); + radeon_cs_space_add_persistent_bo(info->cs, driver_priv->bo->bo.radeon, 0, + RADEON_GEM_DOMAIN_VRAM); ret = radeon_cs_space_check(info->cs); if (ret) @@ -146,7 +147,7 @@ RADEONPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) driver_priv = exaGetPixmapDriverPrivate(pPix); if (driver_priv) { - info->state_2d.dst_bo = driver_priv->bo; + info->state_2d.dst_bo = driver_priv->bo->bo.radeon; info->state_2d.dst_domain = driver_priv->shared ? RADEON_GEM_DOMAIN_GTT : RADEON_GEM_DOMAIN_VRAM; } @@ -256,13 +257,15 @@ RADEONPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, radeon_cs_space_reset_bos(info->cs); driver_priv = exaGetPixmapDriverPrivate(pSrc); - radeon_cs_space_add_persistent_bo(info->cs, driver_priv->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - info->state_2d.src_bo = driver_priv->bo; + radeon_cs_space_add_persistent_bo(info->cs, driver_priv->bo->bo.radeon, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + info->state_2d.src_bo = driver_priv->bo->bo.radeon; driver_priv = exaGetPixmapDriverPrivate(pDst); - info->state_2d.dst_bo = driver_priv->bo; + info->state_2d.dst_bo = driver_priv->bo->bo.radeon; info->state_2d.dst_domain = driver_priv->shared ? RADEON_GEM_DOMAIN_GTT : RADEON_GEM_DOMAIN_VRAM; - radeon_cs_space_add_persistent_bo(info->cs, driver_priv->bo, 0, info->state_2d.dst_domain); + radeon_cs_space_add_persistent_bo(info->cs, driver_priv->bo->bo.radeon, 0, + info->state_2d.dst_domain); ret = radeon_cs_space_check(info->cs); if (ret) @@ -389,7 +392,7 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, return FALSE; driver_priv = exaGetPixmapDriverPrivate(pDst); - if (!driver_priv || !driver_priv->bo) + if (!driver_priv || !driver_priv->bo->bo.radeon) return FALSE; #if X_BYTE_ORDER == X_BIG_ENDIAN @@ -404,12 +407,12 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, #endif /* If we know the BO won't be busy / in VRAM, don't bother with a scratch */ - copy_dst = driver_priv->bo; + copy_dst = driver_priv->bo->bo.radeon; copy_pitch = pDst->devKind; if (!(driver_priv->tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) { - if (!radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { + if (!radeon_bo_is_referenced_by_cs(driver_priv->bo->bo.radeon, info->cs)) { flush = FALSE; - if (!radeon_bo_is_busy(driver_priv->bo, &dst_domain) && + if (!radeon_bo_is_busy(driver_priv->bo->bo.radeon, &dst_domain) && !(dst_domain & RADEON_GEM_DOMAIN_VRAM)) goto copy; } @@ -446,7 +449,7 @@ copy: r = TRUE; size = w * bpp / 8; dst = copy_dst->ptr; - if (copy_dst == driver_priv->bo) + if (copy_dst == driver_priv->bo->bo.radeon) dst += y * copy_pitch + x * bpp / 8; for (i = 0; i < h; i++) { RADEONCopySwap(dst + i * copy_pitch, (uint8_t*)src, size, swap); @@ -458,7 +461,7 @@ copy: RADEONGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype); RADEONGetPixmapOffsetPitch(pDst, &dst_pitch_offset); RADEON_SWITCH_TO_2D(); - RADEONBlitChunk(pScrn, scratch, driver_priv->bo, datatype, scratch_pitch << 16, + RADEONBlitChunk(pScrn, scratch, driver_priv->bo->bo.radeon, datatype, scratch_pitch << 16, dst_pitch_offset, 0, 0, x, y, w, h, RADEON_GEM_DOMAIN_GTT, RADEON_GEM_DOMAIN_VRAM); } @@ -493,7 +496,7 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, return FALSE; driver_priv = exaGetPixmapDriverPrivate(pSrc); - if (!driver_priv || !driver_priv->bo) + if (!driver_priv || !driver_priv->bo->bo.radeon) return FALSE; #if X_BYTE_ORDER == X_BIG_ENDIAN @@ -508,11 +511,11 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, #endif /* If we know the BO won't end up in VRAM anyway, don't bother with a scratch */ - copy_src = driver_priv->bo; + copy_src = driver_priv->bo->bo.radeon; copy_pitch = pSrc->devKind; if (!(driver_priv->tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) { - if (radeon_bo_is_referenced_by_cs(driver_priv->bo, info->cs)) { - src_domain = radeon_bo_get_src_domain(driver_priv->bo); + if (radeon_bo_is_referenced_by_cs(driver_priv->bo->bo.radeon, info->cs)) { + src_domain = radeon_bo_get_src_domain(driver_priv->bo->bo.radeon); if ((src_domain & (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) == (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) src_domain = 0; @@ -521,7 +524,7 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, } if (!src_domain) - radeon_bo_is_busy(driver_priv->bo, &src_domain); + radeon_bo_is_busy(driver_priv->bo->bo.radeon, &src_domain); if (src_domain & ~(uint32_t)RADEON_GEM_DOMAIN_VRAM) goto copy; @@ -541,8 +544,8 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, RADEONGetDatatypeBpp(pSrc->drawable.bitsPerPixel, &datatype); RADEONGetPixmapOffsetPitch(pSrc, &src_pitch_offset); RADEON_SWITCH_TO_2D(); - RADEONBlitChunk(pScrn, driver_priv->bo, scratch, datatype, src_pitch_offset, - scratch_pitch << 16, x, y, 0, 0, w, h, + RADEONBlitChunk(pScrn, driver_priv->bo->bo.radeon, scratch, datatype, + src_pitch_offset, scratch_pitch << 16, x, y, 0, 0, w, h, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, RADEON_GEM_DOMAIN_GTT); copy_src = scratch; @@ -561,7 +564,7 @@ copy: } r = TRUE; w *= bpp / 8; - if (copy_src == driver_priv->bo) + if (copy_src == driver_priv->bo->bo.radeon) size = y * copy_pitch + x * bpp / 8; else size = 0; |