- transfer_block(fbdev, src, dst, img_width, enumber, height,
- stripe_esize, trans_color, flags);
- }
-
- DBGLEAVE(2);
-}
-
-/* Copy a rectangular area in the frame buffer to another rectangular area.
- * Calculate the source and destination addresses.
- * Transfer direction will be determined taking care of possible area
- * overlapping.
- * Currently both source and destination area must be entirely contained in
- * frame buffer memory, in case of frame flipping source and destination frame
- * respectively.
- */
-static int omapfb_copyarea(void *data)
-{
- struct omapfb_copyarea_params *par = data;
- struct omapfb_device *fbdev = (struct omapfb_device *)par->fbi->par;
-
- int width = par->area.width, height = par->area.height;
- int sx = par->area.sx, sy = par->area.sy;
- int dx = par->area.dx, dy = par->area.dy;
- unsigned long dst, dst_ofs, src, src_ofs;
- unsigned long end_ofs;
- int bpp = par->fbi->var.bits_per_pixel;
- int flags;
- int r = 0;
-
- DBGENTER(2);
-
- if (!width || !height)
- goto exit;
-
- /* Bpp < 8 is tbd. If IRQs are disabled we can't use DMA */
- if (bpp < 8 || irqs_disabled()) {
- r = OMAPFB_COPYAREA_FAILED;
- goto exit;
- }
-
- src = fbdev->lcddma_handle;
- dst = src;
- src_ofs = fbdev->src_frame_org + sx * bpp / 8 +
- sy * par->fbi->fix.line_length;
- dst_ofs = fbdev->dst_frame_org + dx * bpp / 8 +
- dy * par->fbi->fix.line_length;
- end_ofs = (height - 1) * par->fbi->fix.line_length + width * bpp / 8;
- src += src_ofs;
- dst += dst_ofs;
-
- DBGPRINT(2, "src:%#010lx dst:%#010lx end_ofs:%#010lx\n",
- src, dst, end_ofs);
-
- /* Currently we support only transfers where both source and destination
- * area is contained entirely in fbmem. This is because of DMA memory
- * constraints.
- */
- if (src_ofs + end_ofs > fbdev->lcddma_mem_size ||
- dst_ofs + end_ofs > fbdev->lcddma_mem_size) {
- r = OMAPFB_COPYAREA_FAILED;
- goto exit;
- }
-
- flags = 0;
- if (par->area.rev_dir) {
- flags = COPY_MODE_REV_DIR;
- src += end_ofs;
- dst += end_ofs;
- }
- if (par->area.trans_color != -1)
- flags |= COPY_MODE_TRANSPARENT;
-
- width = width * bpp / 8;
- copy_data(fbdev, src, dst, width, height, par->area.trans_color, flags);
-exit:
- DBGLEAVE(2);
- return r;
-}
-
-static int omapfb_schedule_copyarea(struct fb_info *fbi,
- const struct fb_copyarea_ext *area)
-{
- struct omapfb_device *fbdev = (struct omapfb_device *)fbi->par;
- struct omapfb_request *req;
-
- if ((req = omapfb_rqueue_alloc_req(&fbdev->rqueue)) == NULL)
- return -ENOMEM;
- req->function = omapfb_copyarea;
- req->par.copyarea.fbi = fbi;
- req->par.copyarea.area = *area;
- omapfb_rqueue_schedule_req(&fbdev->rqueue, req);
- return fbdev->rqueue.status ? OMAPFB_GFX_STATUS_CHANGED : 0;
-}
-
-/* Copy an image to a rectangular area in the frame buffer.
- * A color parameter can be specified for transparent copy.
- * Calculate the source and destination addresses.
- * Transfer direction will be determined taking care of possible area
- * overlapping.
- * Currently both source and destination area must be entirely contained in
- * frame buffer memory, in case of frame flipping source and destination frame
- * respectively.
- */
-static int do_imageblit(void *data)
-{
- struct omapfb_imageblit_params *par = data;
- struct omapfb_device *fbdev = (struct omapfb_device *)par->fbi->par;
-
- int width = par->image.width, height = par->image.height;
- int dx = par->image.dx, dy = par->image.dy;
- const char *img_data = par->image.data;
- unsigned long dst, dst_ofs;
- unsigned long dst_end_ofs;
- int bpp = par->fbi->var.bits_per_pixel;
- u32 bg_color;
- int r = 0;
-
- DBGENTER(2);
-
- if (!width || !height)
- goto exit;
-
- /* bpp conversion is not supported, let the default function handle it.
- * Note that image->depth is either 1 for monochrome image, or equals
- * bpp of the current video mode, so we can't rely on it.
- * If IRQs are disabled we can't use DMA.
- */
- if (bpp < 8 || par->image.depth != bpp || irqs_disabled()) {
- r = OMAPFB_IMGBLIT_FAILED;
- goto exit;
- }
-
- dst = fbdev->lcddma_handle;
- dst_ofs = fbdev->dst_frame_org +
- dx * bpp / 8 + dy * par->fbi->fix.line_length;
- dst_end_ofs = (height - 1) * par->fbi->fix.line_length +
- width * bpp / 8;
- dst += dst_ofs;
-
- DBGPRINT(2, "data:%#010lx dst:%#010lx dst_end_ofs:%#010lx\n",
- img_data, dst, dst_end_ofs);
-
- /* Check that both source and destination is DMA -able */
- if (dst_ofs + dst_end_ofs > fbdev->lcddma_mem_size) {
- r = OMAPFB_IMGBLIT_FAILED;
- goto exit;