summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-09-03 12:56:56 +1000
committerDave Airlie <airlied@redhat.com>2012-09-03 12:58:38 +1000
commitf7502a11c8ef9c453ceb40d26109977116df88c2 (patch)
treefeb7da4c10f61568566edd5061864c45f8f8a790
parentf71139a2afe8fffb628331402bf829a6d67c9fff (diff)
radeon: add shared support to pixmaps.
this just adds the interface and shared support to the pixmap. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/evergreen_exa.c10
-rw-r--r--src/r600_exa.c10
-rw-r--r--src/radeon.h19
-rw-r--r--src/radeon_exa_funcs.c9
4 files changed, 41 insertions, 7 deletions
diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
index f906cbf2..40e2e96e 100644
--- a/src/evergreen_exa.c
+++ b/src/evergreen_exa.c
@@ -480,7 +480,10 @@ EVERGREENPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst,
480 dst_obj.width = pDst->drawable.width; 480 dst_obj.width = pDst->drawable.width;
481 dst_obj.height = pDst->drawable.height; 481 dst_obj.height = pDst->drawable.height;
482 dst_obj.bpp = pDst->drawable.bitsPerPixel; 482 dst_obj.bpp = pDst->drawable.bitsPerPixel;
483 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM; 483 if (radeon_get_pixmap_shared(pDst) == TRUE)
484 dst_obj.domain = RADEON_GEM_DOMAIN_GTT;
485 else
486 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
484 487
485 if (!R600SetAccelState(pScrn, 488 if (!R600SetAccelState(pScrn,
486 &src_obj, 489 &src_obj,
@@ -1157,7 +1160,10 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture,
1157 dst_obj.width = pDst->drawable.width; 1160 dst_obj.width = pDst->drawable.width;
1158 dst_obj.height = pDst->drawable.height; 1161 dst_obj.height = pDst->drawable.height;
1159 dst_obj.bpp = pDst->drawable.bitsPerPixel; 1162 dst_obj.bpp = pDst->drawable.bitsPerPixel;
1160 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM; 1163 if (radeon_get_pixmap_shared(pDst) == TRUE)
1164 dst_obj.domain = RADEON_GEM_DOMAIN_GTT;
1165 else
1166 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
1161 1167
1162 if (pMaskPicture) { 1168 if (pMaskPicture) {
1163 if (!pMask) { 1169 if (!pMask) {
diff --git a/src/r600_exa.c b/src/r600_exa.c
index 61b6315c..be0a9fae 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -551,7 +551,10 @@ R600PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst,
551 dst_obj.width = pDst->drawable.width; 551 dst_obj.width = pDst->drawable.width;
552 dst_obj.height = pDst->drawable.height; 552 dst_obj.height = pDst->drawable.height;
553 dst_obj.bpp = pDst->drawable.bitsPerPixel; 553 dst_obj.bpp = pDst->drawable.bitsPerPixel;
554 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM; 554 if (radeon_get_pixmap_shared(pDst) == TRUE) {
555 dst_obj.domain = RADEON_GEM_DOMAIN_GTT;
556 } else
557 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
555 558
556 if (!R600SetAccelState(pScrn, 559 if (!R600SetAccelState(pScrn,
557 &src_obj, 560 &src_obj,
@@ -1203,7 +1206,10 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture,
1203 dst_obj.width = pDst->drawable.width; 1206 dst_obj.width = pDst->drawable.width;
1204 dst_obj.height = pDst->drawable.height; 1207 dst_obj.height = pDst->drawable.height;
1205 dst_obj.bpp = pDst->drawable.bitsPerPixel; 1208 dst_obj.bpp = pDst->drawable.bitsPerPixel;
1206 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM; 1209 if (radeon_get_pixmap_shared(pDst) == TRUE)
1210 dst_obj.domain = RADEON_GEM_DOMAIN_GTT;
1211 else
1212 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
1207 1213
1208 if (pMaskPicture) { 1214 if (pMaskPicture) {
1209 if (!pMask) { 1215 if (!pMask) {
diff --git a/src/radeon.h b/src/radeon.h
index 2f05249e..2eac38e5 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -249,6 +249,7 @@ struct radeon_exa_pixmap_priv {
249 uint32_t tiling_flags; 249 uint32_t tiling_flags;
250 struct radeon_surface surface; 250 struct radeon_surface surface;
251 Bool bo_mapped; 251 Bool bo_mapped;
252 Bool shared;
252}; 253};
253 254
254#define RADEON_2D_EXA_COPY 1 255#define RADEON_2D_EXA_COPY 1
@@ -266,6 +267,7 @@ struct radeon_2d_state {
266 uint32_t dp_src_frgd_clr; 267 uint32_t dp_src_frgd_clr;
267 uint32_t dp_src_bkgd_clr; 268 uint32_t dp_src_bkgd_clr;
268 uint32_t default_sc_bottom_right; 269 uint32_t default_sc_bottom_right;
270 uint32_t dst_domain;
269 struct radeon_bo *dst_bo; 271 struct radeon_bo *dst_bo;
270 struct radeon_bo *src_bo; 272 struct radeon_bo *src_bo;
271}; 273};
@@ -624,6 +626,23 @@ static inline struct radeon_bo *radeon_get_pixmap_bo(PixmapPtr pPix)
624 return NULL; 626 return NULL;
625} 627}
626 628
629static inline Bool radeon_get_pixmap_shared(PixmapPtr pPix)
630{
631#ifdef USE_GLAMOR
632 RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(pPix->drawable.pScreen));
633
634 if (info->use_glamor) {
635 ErrorF("glamor sharing todo\n");
636 return FALSE:
637 } else
638#endif
639 {
640 struct radeon_exa_pixmap_priv *driver_priv;
641 driver_priv = exaGetPixmapDriverPrivate(pPix);
642 return driver_priv->shared;
643 }
644 return FALSE;
645}
627 646
628#define CP_PACKET0(reg, n) \ 647#define CP_PACKET0(reg, n) \
629 (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) 648 (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 4c13a000..db44d948 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -80,7 +80,7 @@ static void Emit2DState(ScrnInfoPtr pScrn, int op)
80 OUT_RING_REG(RADEON_DP_CNTL, info->state_2d.dp_cntl); 80 OUT_RING_REG(RADEON_DP_CNTL, info->state_2d.dp_cntl);
81 81
82 OUT_RING_REG(RADEON_DST_PITCH_OFFSET, info->state_2d.dst_pitch_offset); 82 OUT_RING_REG(RADEON_DST_PITCH_OFFSET, info->state_2d.dst_pitch_offset);
83 OUT_RING_RELOC(info->state_2d.dst_bo, 0, RADEON_GEM_DOMAIN_VRAM); 83 OUT_RING_RELOC(info->state_2d.dst_bo, 0, info->state_2d.dst_domain);
84 84
85 if (has_src) { 85 if (has_src) {
86 OUT_RING_REG(RADEON_SRC_PITCH_OFFSET, info->state_2d.src_pitch_offset); 86 OUT_RING_REG(RADEON_SRC_PITCH_OFFSET, info->state_2d.src_pitch_offset);
@@ -145,8 +145,10 @@ RADEONPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
145 RADEON_FALLBACK(("Not enough RAM to hw accel solid operation\n")); 145 RADEON_FALLBACK(("Not enough RAM to hw accel solid operation\n"));
146 146
147 driver_priv = exaGetPixmapDriverPrivate(pPix); 147 driver_priv = exaGetPixmapDriverPrivate(pPix);
148 if (driver_priv) 148 if (driver_priv) {
149 info->state_2d.dst_bo = driver_priv->bo; 149 info->state_2d.dst_bo = driver_priv->bo;
150 info->state_2d.dst_domain = driver_priv->shared ? RADEON_GEM_DOMAIN_GTT : RADEON_GEM_DOMAIN_VRAM;
151 }
150 152
151 info->state_2d.default_sc_bottom_right = (RADEON_DEFAULT_SC_RIGHT_MAX | 153 info->state_2d.default_sc_bottom_right = (RADEON_DEFAULT_SC_RIGHT_MAX |
152 RADEON_DEFAULT_SC_BOTTOM_MAX); 154 RADEON_DEFAULT_SC_BOTTOM_MAX);
@@ -258,8 +260,9 @@ RADEONPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst,
258 info->state_2d.src_bo = driver_priv->bo; 260 info->state_2d.src_bo = driver_priv->bo;
259 261
260 driver_priv = exaGetPixmapDriverPrivate(pDst); 262 driver_priv = exaGetPixmapDriverPrivate(pDst);
261 radeon_cs_space_add_persistent_bo(info->cs, driver_priv->bo, 0, RADEON_GEM_DOMAIN_VRAM);
262 info->state_2d.dst_bo = driver_priv->bo; 263 info->state_2d.dst_bo = driver_priv->bo;
264 info->state_2d.dst_domain = driver_priv->shared ? RADEON_GEM_DOMAIN_GTT : RADEON_GEM_DOMAIN_VRAM;
265 radeon_cs_space_add_persistent_bo(info->cs, driver_priv->bo, 0, info->state_2d.dst_domain);
263 266
264 ret = radeon_cs_space_check(info->cs); 267 ret = radeon_cs_space_check(info->cs);
265 if (ret) 268 if (ret)