1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
/* $Id: crossblit.c,v 1.2 2005/07/30 11:39:57 cegger Exp $
******************************************************************************
LibGGI - DirectFB acceleration for fbdev target
Copyright (C) 2001 Brian S. Julin [bri@calyx.com]
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************
*/
#include "ggidirectfb.h"
static inline void
dbblit_32bpp(ggi_visual *src, int sx, int sy, int w, int h,
ggi_visual *dst, int dx, int dy, uint32_t srcfmt)
{
/* Later */
#if 0
struct directfb_priv *priv = DIRECTFB_PRIV(dst);
volatile uint8_t *mmioaddr = FBDEV_PRIV(dst)->mmioaddr;
int yadd = dst->w_frame_num * LIBGGI_VIRTY(dst);
volatile uint32_t *dstptr;
uint32_t dwgctl, bltmod = BLTMOD_BU32RGB;
uint16_t opmode;
uint8_t *srcptr;
int srcinc;
int maxpix;
dstptr = priv->dmaaddr;
srcinc = LIBGGI_FB_R_STRIDE(src);
srcptr = (uint8_t*) LIBGGI_CURWRITE(src) + sy*srcinc + sx*4;
srcinc -= w*4;
maxpix = priv->dma_len/4;
dy += yadd;
switch (srcfmt) {
#if 0 /* This case is the default. */
case GGI_DB_STD_24a32u8r8g8b8:
bltmod = BLTMOD_BU32RGB;
break;
#endif
case GGI_DB_STD_24a32u8b8g8r8:
bltmod = BLTMOD_BU32BGR;
break;
}
dwgctl = bltmod | BOP_COPY | SHFTZERO | OP_ILOAD | SGNZERO;
#ifdef GGI_BIG_ENDIAN
opmode = OPMODE_DMA_BLIT_WRITE | OPMODE_DMA_BE_32BPP;
#else
opmode = OPMODE_DMA_BLIT_WRITE | OPMODE_DMA_LE;
#endif
directfb_gcupdate(vis, priv, LIBGGI_MODE(vis), LIBGGI_GC(vis),
LIBGGI_VIRTX(vis), yadd);
if (priv->curopmode != opmode) {
priv->curopmode = opmode;
mga_waitidle(mmioaddr);
mga_out16(mmioaddr, opmode, OPMODE);
}
if (priv->dwgctl != dwgctl) {
mga_waitfifo(mmioaddr, 6);
mga_setdwgctl(mmioaddr, priv, dwgctl);
} else {
mga_waitfifo(mmioaddr, 5);
}
mga_out32(mmioaddr, RS18(w-1), AR0);
mga_out32(mmioaddr, 0, AR3);
mga_out32(mmioaddr, 0, AR5);
mga_out32(mmioaddr, (RS16(dx + w - 1) << 16) | RS16(dx), FXBNDRY);
mga_out32(mmioaddr, (RS16(dy) << 16) | RS16(h), YDSTLEN | EXECUTE);
dst->accelactive = 1;
if (w > maxpix) {
while (h--) {
int tmpw = w;
while (tmpw) {
int tmpw2 = (tmpw > maxpix ? maxpix : tmpw);
tmpw -= tmpw2;
while (tmpw2--) {
*(dstptr++) = *(((uint32_t*)srcptr)++);
}
dstptr = priv->dmaaddr;
}
srcptr += srcinc;
}
} else {
while (h--) {
int tmpw = w;
while (tmpw--) {
*(dstptr++) = *(((uint32_t*)srcptr)++);
}
srcptr += srcinc;
dstptr = priv->dmaaddr;
}
}
#endif
}
int GGI_directfb_crossblit(ggi_visual *src, int sx, int sy, int w, int h,
ggi_visual *dst, int dx, int dy)
{
/* Later */
#if 0
/* Software clip so we don't read/write unused data. */
LIBGGICLIP_COPYBOX(dst, sx, sy, w, h, dx, dy);
if (src->r_frame && src->r_frame->layout == dst->w_frame->layout) {
uint32_t srcformat
= src->r_frame->buffer.plb.pixelformat->stdformat;
PREPARE_FB(src);
switch (srcformat) {
case GGI_DB_STD_24a32u8r8g8b8:
case GGI_DB_STD_24a32u8b8g8r8:
dbblit_32bpp(src, sx, sy, w, h, dst, dx, dy, srcformat);
return 0;
}
}
return DIRECTFB_PRIV(dst)->crossblit(src, sx, sy, w, h, dst, dx, dy);
#endif
return 0;
}
|