Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

xv: stop using custom m2mf code

  • Loading branch information...
commit 57c62228e2e67370feeeb421c369fbf940d30ca4 1 parent ad40233
Ben Skeggs authored
View
27 src/nouveau_exa.c
@@ -42,24 +42,24 @@ NVAccelMemcpyRect(char *dst, const char *src, int height, int dst_pitch,
return TRUE;
}
-static Bool
-NVAccelM2MF(NVPtr pNv, int w, int h, int cpp,
+Bool
+NVAccelM2MF(NVPtr pNv, int w, int h, int cpp, uint32_t srcoff, uint32_t dstoff,
struct nouveau_bo *src, int sd, int sp, int sh, int sx, int sy,
struct nouveau_bo *dst, int dd, int dp, int dh, int dx, int dy)
{
if (pNv->Architecture >= NV_ARCH_C0)
return NVC0EXARectM2MF(pNv, w, h, cpp,
- src, sd, sp, sh, sx, sy,
- dst, dd, dp, dh, dx, dy);
+ src, srcoff, sd, sp, sh, sx, sy,
+ dst, dstoff, dd, dp, dh, dx, dy);
else
if (pNv->Architecture >= NV_ARCH_50)
return NV50EXARectM2MF(pNv, w, h, cpp,
- src, sd, sp, sh, sx, sy,
- dst, dd, dp, dh, dx, dy);
+ src, srcoff, sd, sp, sh, sx, sy,
+ dst, dstoff, dd, dp, dh, dx, dy);
else
return NV04EXARectM2MF(pNv, w, h, cpp,
- src, sd, sp, sh, sx, sy,
- dst, dd, dp, dh, dx, dy);
+ src, srcoff, sd, sp, sh, sx, sy,
+ dst, dstoff, dd, dp, dh, dx, dy);
return FALSE;
}
@@ -181,10 +181,11 @@ nouveau_exa_download_from_screen(PixmapPtr pspix, int x, int y, int w, int h,
if (lines > h)
lines = h;
- if (!NVAccelM2MF(pNv, w, lines, cpp, nouveau_pixmap_bo(pspix),
- NOUVEAU_BO_VRAM, src_pitch,
- pspix->drawable.height, x, y, pNv->GART,
- NOUVEAU_BO_GART, tmp_pitch, lines, 0, 0))
+ if (!NVAccelM2MF(pNv, w, lines, cpp, 0, 0,
+ nouveau_pixmap_bo(pspix), NOUVEAU_BO_VRAM,
+ src_pitch, pspix->drawable.height, x, y,
+ pNv->GART, NOUVEAU_BO_GART, tmp_pitch,
+ lines, 0, 0))
goto memcpy;
nouveau_bo_map(pNv->GART, NOUVEAU_BO_RD);
@@ -281,7 +282,7 @@ nouveau_exa_upload_to_screen(PixmapPtr pdpix, int x, int y, int w, int h,
}
nouveau_bo_unmap(pNv->GART);
- if (!NVAccelM2MF(pNv, w, lines, cpp, pNv->GART,
+ if (!NVAccelM2MF(pNv, w, lines, cpp, 0, 0, pNv->GART,
NOUVEAU_BO_GART, tmp_pitch, lines, 0, 0,
nouveau_pixmap_bo(pdpix), NOUVEAU_BO_VRAM,
dst_pitch, pdpix->drawable.height, x, y))
View
76 src/nouveau_xv.c
@@ -937,8 +937,6 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
* and lines we are interested in
*/
int top = 0, left = 0, right = 0, bottom = 0, npixels = 0, nlines = 0;
- struct nouveau_channel *chan = pNv->chan;
- struct nouveau_grobj *m2mf = pNv->NvMemFormat;
Bool skip = FALSE;
BoxRec dstBox;
CARD32 tmp = 0;
@@ -1112,70 +1110,21 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
nouveau_bo_unmap(destination_buffer);
- if (pNv->Architecture >= NV_ARCH_C0) {
- nvc0_xv_m2mf(m2mf, pPriv->video_mem, uv_offset, dstPitch,
- nlines, destination_buffer, line_len);
- goto put_image;
+ if (uv_offset) {
+ NVAccelM2MF(pNv, line_len, nlines / 2, 1,
+ line_len * nlines, uv_offset,
+ destination_buffer, NOUVEAU_BO_GART,
+ line_len, nlines >> 1, 0, 0,
+ pPriv->video_mem, NOUVEAU_BO_VRAM,
+ dstPitch, nlines >> 1, 0, 0);
}
- if (MARK_RING(chan, 64, 4))
- return FALSE;
+ NVAccelM2MF(pNv, line_len, nlines, 1, 0, 0,
+ destination_buffer, NOUVEAU_BO_GART,
+ line_len, nlines, 0, 0,
+ pPriv->video_mem, NOUVEAU_BO_VRAM,
+ dstPitch, nlines, 0, 0);
- BEGIN_NV04(chan, NV03_M2MF(DMA_BUFFER_IN), 2);
- OUT_RING (chan, pNv->chan->gart->handle);
- OUT_RING (chan, pNv->chan->vram->handle);
-
- if (pNv->Architecture >= NV_ARCH_50) {
- BEGIN_NV04(chan, NV50_M2MF(LINEAR_IN), 1);
- OUT_RING (chan, 1);
-
- BEGIN_NV04(chan, NV50_M2MF(LINEAR_OUT), 7);
- OUT_RING (chan, 0);
- OUT_RING (chan, destination_buffer->tile_mode << 4);
- OUT_RING (chan, dstPitch);
- OUT_RING (chan, nlines);
- OUT_RING (chan, 1);
- OUT_RING (chan, 0);
- OUT_RING (chan, 0);
- }
-
- /* DMA to VRAM */
- if ( (action_flags & IS_YV12) &&
- !(action_flags & CONVERT_TO_YUY2)) {
- /* we start the color plane transfer separately */
-
- BEGIN_NV04(chan, NV03_M2MF(OFFSET_IN), 8);
- if (OUT_RELOCl(chan, destination_buffer,
- line_len * nlines,
- NOUVEAU_BO_GART | NOUVEAU_BO_RD) ||
- OUT_RELOCl(chan, pPriv->video_mem,
- offset + uv_offset,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR)) {
- MARK_UNDO(chan);
- return BadAlloc;
- }
- OUT_RING (chan, line_len);
- OUT_RING (chan, dstPitch);
- OUT_RING (chan, line_len);
- OUT_RING (chan, (nlines >> 1));
- OUT_RING (chan, (1<<8)|1);
- OUT_RING (chan, 0);
- }
-
- BEGIN_NV04(chan, NV03_M2MF(OFFSET_IN), 8);
- if (OUT_RELOCl(chan, destination_buffer, 0,
- NOUVEAU_BO_GART | NOUVEAU_BO_RD) ||
- OUT_RELOCl(chan, pPriv->video_mem, offset,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR)) {
- MARK_UNDO(chan);
- return BadAlloc;
- }
- OUT_RING (chan, line_len);
- OUT_RING (chan, dstPitch);
- OUT_RING (chan, line_len);
- OUT_RING (chan, nlines);
- OUT_RING (chan, (1<<8)|1);
- OUT_RING (chan, 0);
} else {
CPU_copy:
nouveau_bo_map(pPriv->video_mem, NOUVEAU_BO_WR);
@@ -1254,7 +1203,6 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
if (pPriv->currentHostBuffer != NO_PRIV_HOST_BUFFER_AVAILABLE)
pPriv->currentHostBuffer ^= 1;
-put_image:
/* If we're not using the hw overlay, we're rendering into a pixmap
* and need to take a couple of additional steps...
*/
View
12 src/nv04_exa.c
@@ -418,13 +418,15 @@ NV04EXAUploadIFC(ScrnInfoPtr pScrn, const char *src, int src_pitch,
Bool
NV04EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
- struct nouveau_bo *src, int src_dom, int src_pitch,
- int src_h, int src_x, int src_y, struct nouveau_bo *dst,
- int dst_dom, int dst_pitch, int dst_h, int dst_x, int dst_y)
+ struct nouveau_bo *src, uint32_t src_off, int src_dom,
+ int src_pitch, int src_h, int src_x, int src_y,
+ struct nouveau_bo *dst, uint32_t dst_off, int dst_dom,
+ int dst_pitch, int dst_h, int dst_x, int dst_y)
{
struct nouveau_channel *chan = pNv->chan;
- unsigned src_off = src_y * src_pitch + src_x * cpp;
- unsigned dst_off = dst_y * dst_pitch + dst_x * cpp;
+
+ src_off += src_y * src_pitch + src_x * cpp;
+ dst_off += dst_y * dst_pitch + dst_x * cpp;
while (h) {
int line_count = h;
View
38 src/nv50_exa.c
@@ -998,13 +998,13 @@ NV50EXADoneComposite(PixmapPtr pdpix)
Bool
NV50EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
- struct nouveau_bo *src, int src_dom, int src_pitch,
- int src_h, int src_x, int src_y, struct nouveau_bo *dst,
- int dst_dom, int dst_pitch, int dst_h, int dst_x, int dst_y)
+ struct nouveau_bo *src, uint32_t src_off, int src_dom,
+ int src_pitch, int src_h, int src_x, int src_y,
+ struct nouveau_bo *dst, uint32_t dst_off, int dst_dom,
+ int dst_pitch, int dst_h, int dst_x, int dst_y)
{
struct nouveau_grobj *m2mf = pNv->NvMemFormat;
struct nouveau_channel *chan = m2mf->channel;
- unsigned src_off = 0, dst_off = 0;
if (src->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
BEGIN_NV04(chan, NV50_M2MF(LINEAR_IN), 6);
@@ -1019,6 +1019,7 @@ NV50EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
OUT_RING (chan, 1);
BEGIN_NV04(chan, NV03_M2MF(PITCH_IN), 1);
OUT_RING (chan, src_pitch);
+ src_off += src_y * src_pitch + src_x * cpp;
}
if (dst->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
@@ -1034,6 +1035,7 @@ NV50EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
OUT_RING (chan, 1);
BEGIN_NV04(chan, NV03_M2MF(PITCH_OUT), 1);
OUT_RING (chan, dst_pitch);
+ dst_off += dst_y * dst_pitch + dst_x * cpp;
}
while (h) {
@@ -1044,20 +1046,6 @@ NV50EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
if (MARK_RING (chan, 32, 4))
return FALSE;
- if (src->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
- BEGIN_NV04(chan, NV50_M2MF(TILING_POSITION_IN), 1);
- OUT_RING (chan, (src_y << 16) | (src_x * cpp));
- } else {
- src_off = src_y * src_pitch + src_x * cpp;
- }
-
- if (dst->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
- BEGIN_NV04(chan, NV50_M2MF(TILING_POSITION_OUT), 1);
- OUT_RING (chan, (dst_y << 16) | (dst_x * cpp));
- } else {
- dst_off = dst_y * dst_pitch + dst_x * cpp;
- }
-
BEGIN_NV04(chan, NV50_M2MF(OFFSET_IN_HIGH), 2);
if (OUT_RELOCh(chan, src, src_off, src_dom | NOUVEAU_BO_RD) ||
OUT_RELOCh(chan, dst, dst_off, dst_dom | NOUVEAU_BO_WR)) {
@@ -1072,6 +1060,20 @@ NV50EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
return FALSE;
}
+ if (src->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
+ BEGIN_NV04(chan, NV50_M2MF(TILING_POSITION_IN), 1);
+ OUT_RING (chan, (src_y << 16) | (src_x * cpp));
+ } else {
+ src_off += line_count * src_pitch;
+ }
+
+ if (dst->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
+ BEGIN_NV04(chan, NV50_M2MF(TILING_POSITION_OUT), 1);
+ OUT_RING (chan, (dst_y << 16) | (dst_x * cpp));
+ } else {
+ dst_off += line_count * dst_pitch;
+ }
+
BEGIN_NV04(chan, NV03_M2MF(LINE_LENGTH_IN), 4);
OUT_RING (chan, w * cpp);
OUT_RING (chan, line_count);
View
18 src/nv_proto.h
@@ -43,6 +43,10 @@ void NVTakedownDma(ScrnInfoPtr pScrn);
Bool nouveau_exa_init(ScreenPtr pScreen);
Bool nouveau_exa_pixmap_is_onscreen(PixmapPtr pPixmap);
bool nv50_style_tiled_pixmap(PixmapPtr ppix);
+Bool NVAccelM2MF(NVPtr pNv, int w, int h, int cpp, uint32_t srco, uint32_t dsto,
+ struct nouveau_bo *s, int sd, int sp, int sh, int sx, int sy,
+ struct nouveau_bo *d, int dd, int dp, int dh, int dx, int dy);
+
/* in nouveau_wfb.c */
void nouveau_wfb_setup_wrap(ReadMemoryProcPtr *, WriteMemoryProcPtr *,
@@ -79,8 +83,8 @@ void NV04EXADoneCopy(PixmapPtr);
Bool NV04EXAUploadIFC(ScrnInfoPtr, const char *src, int src_pitch,
PixmapPtr pdPix, int x, int y, int w, int h, int cpp);
Bool NV04EXARectM2MF(NVPtr pNv, int, int, int,
- struct nouveau_bo *, int, int, int, int, int,
- struct nouveau_bo *, int, int, int, int, int);
+ struct nouveau_bo *, uint32_t, int, int, int, int, int,
+ struct nouveau_bo *, uint32_t, int, int, int, int, int);
/* in nv10_exa.c */
Bool NVAccelInitNV10TCL(ScrnInfoPtr pScrn);
@@ -157,8 +161,8 @@ void NV50EXADoneComposite(PixmapPtr);
Bool NV50EXAUploadSIFC(const char *src, int src_pitch,
PixmapPtr pdPix, int x, int y, int w, int h, int cpp);
Bool NV50EXARectM2MF(NVPtr pNv, int, int, int,
- struct nouveau_bo *, int, int, int, int, int,
- struct nouveau_bo *, int, int, int, int, int);
+ struct nouveau_bo *, uint32_t, int, int, int, int, int,
+ struct nouveau_bo *, uint32_t, int, int, int, int, int);
/* in nvc0_exa.c */
Bool NVC0AccelUploadM2MF(PixmapPtr pdpix, int x, int y, int w, int h,
@@ -180,8 +184,8 @@ void NVC0EXADoneComposite(PixmapPtr);
Bool NVC0EXAUploadSIFC(const char *src, int src_pitch,
PixmapPtr pdPix, int x, int y, int w, int h, int cpp);
Bool NVC0EXARectM2MF(NVPtr pNv, int, int, int,
- struct nouveau_bo *, int, int, int, int, int,
- struct nouveau_bo *, int, int, int, int, int);
+ struct nouveau_bo *, uint32_t, int, int, int, int, int,
+ struct nouveau_bo *, uint32_t, int, int, int, int, int);
/* nv50_xv.c */
int nv50_xv_image_put(ScrnInfoPtr, struct nouveau_bo *, int, int, int, int,
@@ -199,8 +203,6 @@ int nvc0_xv_image_put(ScrnInfoPtr, struct nouveau_bo *, int, int, int, int,
BoxPtr, int, int, int, int, uint16_t, uint16_t,
uint16_t, uint16_t, uint16_t, uint16_t,
RegionPtr, PixmapPtr, NVPortPrivPtr);
-void nvc0_xv_m2mf(struct nouveau_grobj *, struct nouveau_bo *, int, int, int,
- struct nouveau_bo *, int);
void nvc0_xv_csc_update(NVPtr, float, float *, float *, float *);
/* To support EXA 2.0, 2.1 has this in the header */
View
42 src/nvc0_exa.c
@@ -1024,13 +1024,13 @@ NVC0EXADoneComposite(PixmapPtr pdpix)
Bool
NVC0EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
- struct nouveau_bo *src, int src_dom, int src_pitch,
- int src_h, int src_x, int src_y, struct nouveau_bo *dst,
- int dst_dom, int dst_pitch, int dst_h, int dst_x, int dst_y)
+ struct nouveau_bo *src, uint32_t src_off, int src_dom,
+ int src_pitch, int src_h, int src_x, int src_y,
+ struct nouveau_bo *dst, uint32_t dst_off, int dst_dom,
+ int dst_pitch, int dst_h, int dst_x, int dst_y)
{
struct nouveau_grobj *m2mf = pNv->NvMemFormat;
struct nouveau_channel *chan = m2mf->channel;
- unsigned src_off = 0, dst_off = 0;
unsigned exec = 0;
if (src->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
@@ -1044,6 +1044,7 @@ NVC0EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
BEGIN_NVC0(chan, NVC0_M2MF(PITCH_IN), 1);
OUT_RING (chan, src_pitch);
+ src_off += src_y * src_pitch + src_x * cpp;
exec |= NVC0_M2MF_EXEC_LINEAR_IN;
}
@@ -1058,6 +1059,7 @@ NVC0EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
BEGIN_NVC0(chan, NVC0_M2MF(PITCH_OUT), 1);
OUT_RING (chan, dst_pitch);
+ dst_off += dst_y * dst_pitch + dst_x * cpp;
exec |= NVC0_M2MF_EXEC_LINEAR_OUT;
}
@@ -1069,22 +1071,6 @@ NVC0EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
if (MARK_RING (chan, 32, 4))
return FALSE;
- if (src->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
- BEGIN_NVC0(chan, NVC0_M2MF(TILING_POSITION_IN_X), 2);
- OUT_RING (chan, src_x * cpp);
- OUT_RING (chan, src_y);
- } else {
- src_off = src_y * src_pitch + src_x * cpp;
- }
-
- if (dst->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
- BEGIN_NVC0(chan, NVC0_M2MF(TILING_POSITION_OUT_X), 2);
- OUT_RING (chan, dst_x * cpp);
- OUT_RING (chan, dst_y);
- } else {
- dst_off = dst_y * dst_pitch + dst_x * cpp;
- }
-
BEGIN_NVC0(chan, NVC0_M2MF(OFFSET_OUT_HIGH), 2);
if (OUT_RELOCh(chan, dst, dst_off, dst_dom | NOUVEAU_BO_WR) ||
OUT_RELOCl(chan, dst, dst_off, dst_dom | NOUVEAU_BO_WR)) {
@@ -1099,6 +1085,22 @@ NVC0EXARectM2MF(NVPtr pNv, int w, int h, int cpp,
return FALSE;
}
+ if (src->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
+ BEGIN_NVC0(chan, NVC0_M2MF(TILING_POSITION_IN_X), 2);
+ OUT_RING (chan, src_x * cpp);
+ OUT_RING (chan, src_y);
+ } else {
+ src_off += line_count * src_pitch;
+ }
+
+ if (dst->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK) {
+ BEGIN_NVC0(chan, NVC0_M2MF(TILING_POSITION_OUT_X), 2);
+ OUT_RING (chan, dst_x * cpp);
+ OUT_RING (chan, dst_y);
+ } else {
+ dst_off += line_count * dst_pitch;
+ }
+
BEGIN_NVC0(chan, NVC0_M2MF(LINE_LENGTH_IN), 2);
OUT_RING (chan, w * cpp);
OUT_RING (chan, line_count);
View
52 src/nvc0_xv.c
@@ -36,58 +36,6 @@
extern Atom xvSyncToVBlank, xvSetDefaults;
-void
-nvc0_xv_m2mf(struct nouveau_grobj *m2mf,
- struct nouveau_bo *dst, int uv_offset, int dst_pitch, int nlines,
- struct nouveau_bo *src, int line_len)
-{
- struct nouveau_channel *chan = m2mf->channel;
-
- BEGIN_NVC0(chan, NVC0_M2MF(TILING_MODE_OUT), 5);
- OUT_RING (chan, dst->tile_mode);
- OUT_RING (chan, dst_pitch);
- OUT_RING (chan, nlines);
- OUT_RING (chan, 1);
- OUT_RING (chan, 0);
- BEGIN_NVC0(chan, NVC0_M2MF(TILING_POSITION_OUT_X), 2);
- OUT_RING (chan, 0);
- OUT_RING (chan, 0);
-
- if (uv_offset) {
- BEGIN_NVC0(chan, NVC0_M2MF(OFFSET_IN_HIGH), 2);
- OUT_RELOCh(chan, src, line_len * nlines,
- NOUVEAU_BO_GART | NOUVEAU_BO_RD);
- OUT_RELOCl(chan, src, line_len * nlines,
- NOUVEAU_BO_GART | NOUVEAU_BO_RD);
- BEGIN_NVC0(chan, NVC0_M2MF(OFFSET_OUT_HIGH), 2);
- OUT_RELOCh(chan, dst, uv_offset,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- OUT_RELOCl(chan, dst, uv_offset,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- BEGIN_NVC0(chan, NVC0_M2MF(PITCH_IN), 4);
- OUT_RING (chan, line_len);
- OUT_RING (chan, dst_pitch);
- OUT_RING (chan, line_len);
- OUT_RING (chan, nlines >> 1);
- BEGIN_NVC0(chan, NVC0_M2MF(EXEC), 1);
- OUT_RING (chan, 0x00100010);
- }
-
- BEGIN_NVC0(chan, NVC0_M2MF(OFFSET_IN_HIGH), 2);
- OUT_RELOCh(chan, src, 0, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
- OUT_RELOCl(chan, src, 0, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
- BEGIN_NVC0(chan, NVC0_M2MF(OFFSET_OUT_HIGH), 2);
- OUT_RELOCh(chan, dst, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- OUT_RELOCl(chan, dst, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- BEGIN_NVC0(chan, NVC0_M2MF(PITCH_IN), 4);
- OUT_RING (chan, line_len);
- OUT_RING (chan, dst_pitch);
- OUT_RING (chan, line_len);
- OUT_RING (chan, nlines);
- BEGIN_NVC0(chan, NVC0_M2MF(EXEC), 1);
- OUT_RING (chan, 0x00100010);
-}
-
static Bool
nvc0_xv_check_image_put(PixmapPtr ppix)
{
Please sign in to comment.
Something went wrong with that request. Please try again.