diff options
Diffstat (limited to 'bltsville/bltsville/include')
-rw-r--r-- | bltsville/bltsville/include/bltsville.h | 602 | ||||
-rw-r--r-- | bltsville/bltsville/include/bvblend.h | 508 | ||||
-rw-r--r-- | bltsville/bltsville/include/bvbuffdesc.h | 61 | ||||
-rw-r--r-- | bltsville/bltsville/include/bvcache.h | 45 | ||||
-rw-r--r-- | bltsville/bltsville/include/bventry.h | 32 | ||||
-rw-r--r-- | bltsville/bltsville/include/bverror.h | 307 | ||||
-rw-r--r-- | bltsville/bltsville/include/bvfilter.h | 51 | ||||
-rw-r--r-- | bltsville/bltsville/include/bvinternal.h | 47 | ||||
-rw-r--r-- | bltsville/bltsville/include/bvsurfgeom.h | 41 |
9 files changed, 1694 insertions, 0 deletions
diff --git a/bltsville/bltsville/include/bltsville.h b/bltsville/bltsville/include/bltsville.h new file mode 100644 index 0000000..632628e --- /dev/null +++ b/bltsville/bltsville/include/bltsville.h @@ -0,0 +1,602 @@ +/* + * bltsville.h + * + * Copyright (C) 2011 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +#ifndef BLTSVILLE_H +#define BLTSVILLE_H + +#include "ocd.h" +#include "bverror.h" +#include "bvblend.h" +#include "bvfilter.h" +#include "bvbuffdesc.h" +#include "bvcache.h" +#include "bventry.h" +#include "bvsurfgeom.h" + +/* + * bvrect - This structure is used to specify rectangles in BLTsville. + */ +struct bvrect { + int left; + int top; + unsigned int width; + unsigned int height; +}; + + +/* + * BVFLAG_* - These define the type of BLT to be performed and are placed in + * the bvparams.flags element. + */ +#define BVFLAG_OP_SHIFT 0 +#define BVFLAG_OP_MASK (0xF << BVFLAG_OP_SHIFT) + +/* 0 reserved */ +#define BVFLAG_ROP (0x1 << BVFLAG_OP_SHIFT) /* ROP4 spec'd in rop */ +#define BVFLAG_BLEND (0x2 << BVFLAG_OP_SHIFT) /* blend spec'd in blend */ +/* 3 reserved */ +#define BVFLAG_FILTER (0x4 << BVFLAG_OP_SHIFT) /* filter spec'd in filter */ +/* 5-F reserved */ + +#define BVFLAG_KEY_SRC 0x00000010 /* source color key - value spec'd + by pcolorkey; Mutually exclusive + with BVFLAG_KEY_DST */ +#define BVFLAG_KEY_DST 0x00000020 /* dest color key - value spec'd + by pcolorkey; Mutually exclusive + with BVFLAG_KEY_SRC */ +#define BVFLAG_CLIP 0x00000040 /* clipping rectangle spec'd by + cliprect */ +#define BVFLAG_SRCMASK 0x00000080 /* when scaling a masked copy, mask + at the source instead of the + (default) destination */ + +#define BVFLAG_ASYNC 0x00000100 /* call should return once queued */ + +#define BVFLAG_TILE_SRC1 0x00000200 /* source 1 is tiled */ +#define BVFLAG_TILE_SRC2 0x00000400 /* source 2 is tiled */ +#define BVFLAG_TILE_MASK 0x00000800 /* mask is tiled */ + + +#define BVFLAG_BATCH_SHIFT 12 +#define BVFLAG_BATCH_MASK (3 << BVFLAG_BATCH_SHIFT) + +#define BVFLAG_BATCH_NONE (0 << BVFLAG_BATCH_SHIFT) /* not batched */ +#define BVFLAG_BATCH_BEGIN (1 << BVFLAG_BATCH_SHIFT) /* begin batch */ +#define BVFLAG_BATCH_CONTINUE (2 << BVFLAG_BATCH_SHIFT) /* continue batch */ +#define BVFLAG_BATCH_END (3 << BVFLAG_BATCH_SHIFT) /* end batch */ + + +#define BVFLAG_HORZ_FLIP_SRC1 0x00004000 /* flip src1 horizontally */ +#define BVFLAG_VERT_FLIP_SRC1 0x00008000 /* flip src1 vertically */ +#define BVFLAG_HORZ_FLIP_SRC2 0x00010000 /* flip src2 horizontally */ +#define BVFLAG_VERT_FLIP_SRC2 0x00020000 /* flip src2 vertically */ +#define BVFLAG_HORZ_FLIP_MASK 0x00040000 /* flip mask horizontally */ +#define BVFLAG_VERT_FLIP_MASK 0x00080000 /* flip mask vertically */ + + +#define BVFLAG_SCALE_RETURN 0x00100000 /* return scale type used */ +#define BVFLAG_DITHER_RETURN 0x00200000 /* return dither type used */ + + +#define BVFLAG_SRC2_AUXDSTRECT 0x00400000 /* src2auxdstrect used */ +#define BVFLAG_MASK_AUXDSTRECT 0x00800000 /* maskauxdstrect used */ + +#define BVFLAG_TESTPARAMS_NOP 0x01000000 /* test params only - no BLT */ +/**** Bits 25-31 reserved ****/ + +/* + * BVIMPL_* - BLTsville implementations may be combined under managers to + * allow clients to take advantage of multiple implementations without doing + * so explicitly. The BVIMPL_* definition are placed into the + * bvparams.implementation member by the client to override the manager's + * choice of implementation. + */ +#define BVIMPL_ANY 0 +#define BVIMPL_FIRST_HW (1 << 31) /* Continues to the right */ +#define BVIMPL_FIRST_CPU (1 << 0) /* Continues to the left */ + + +/* + * bvscalemode - This specifies the type of scaling to perform. + */ +#define BVSCALEDEF_VENDOR_SHIFT 24 +#define BVSCALEDEF_VENDOR_MASK (0xFF << BVSCALEDEF_VENDOR_SHIFT) + +#define BVSCALEDEF_VENDOR_ALL (0 << BVSCALEDEF_VENDOR_SHIFT) +#define BVSCALEDEF_VENDOR_TI (1 << BVSCALEDEF_VENDOR_SHIFT) +/* 0xF0-0xFE reserved */ +#define BVSCALEDEF_VENDOR_GENERIC (0xFF << BVSCALEDEF_VENDOR_SHIFT) + +/***** VENDOR_GENERIC definitions *****/ +/**** Bits 23-22 indicate classification ****/ +#define BVSCALEDEF_CLASS_SHIFT 22 +#define BVSCALEDEF_IMPLICIT (0 << BVSCALEDEF_CLASS_SHIFT) +#define BVSCALEDEF_EXPLICIT (1 << BVSCALEDEF_CLASS_SHIFT) +/* 2-3 reserved */ +#define BVSCALEDEF_CLASS_MASK (3 << BVSCALEDEF_CLASS_SHIFT) + +/**** IMPLICIT definitions ****/ +/*** Bits 21-16 indicate the quality (speed) desired ***/ +#define BVSCALEDEF_QUALITY_SHIFT 16 +#define BVSCALEDEF_FASTEST (0x00 << BVSCALEDEF_QUALITY_SHIFT) +#define BVSCALEDEF_GOOD (0x15 << BVSCALEDEF_QUALITY_SHIFT) +#define BVSCALEDEF_BETTER (0x2A << BVSCALEDEF_QUALITY_SHIFT) +#define BVSCALEDEF_BEST (0x3F << BVSCALEDEF_QUALITY_SHIFT) +#define BVSCALEDEF_QUALITY_MASK (0x3F << BVSCALEDEF_QUALITY_SHIFT) +/* Bits 12-15 are reserved */ +/*** Bits 11-8 indicate the desired technique ***/ +#define BVSCALEDEF_TECHNIQUE_SHIFT 8 +#define BVSCALEDEF_DONT_CARE (0x0 << BVSCALEDEF_TECHNIQUE_SHIFT) +#define BVSCALEDEF_NOT_NEAREST_NEIGHBOR (0x1 << BVSCALEDEF_TECHNIQUE_SHIFT) +#define BVSCALEDEF_POINT_SAMPLE (0x2 << BVSCALEDEF_TECHNIQUE_SHIFT) +#define BVSCALEDEF_INTERPOLATED (0x3 << BVSCALEDEF_TECHNIQUE_SHIFT) +#define BVSCALEDEF_TECHNIQUE_MASK (0xF << BVSCALEDEF_TECHNIQUE_SHIFT) +/* Bits 2-7 reserved */ +/*** Bits 1-0 indicate the type of image ***/ +#define BVSCALEDEF_TYPE_SHIFT 0 +/* 0 don't know */ +#define BVSCALEDEF_PHOTO (1 << BVSCALEDEF_TYPE_SHIFT) +#define BVSCALEDEF_DRAWING (2 << BVSCALEDEF_TYPE_SHIFT) +/* 3 reserved */ +#define BVSCALEDEF_TYPE_MASK (3 << BVSCALEDEF_TYPE_SHIFT) + +/**** EXPLICIT definitions ****/ +/* Bits 16-21 reserved */ +#define BVSCALEDEF_HORZ_SHIFT 8 +#define BVSCALEDEF_HORZ_MASK (0xFF << BVSCALEDEF_HORZ_SHIFT) + +#define BVSCALEDEF_VERT_SHIFT 0 +#define BVSCALEDEF_VERT_MASK (0xFF << BVSCALEDEF_VERT_SHIFT) + +#define BVSCALEDEF_NEAREST_NEIGHBOR 0x00 +#define BVSCALEDEF_LINEAR 0x01 +#define BVSCALEDEF_CUBIC 0x02 +#define BVSCALEDEF_3_TAP 0x03 +/* 0x04 reserved */ +#define BVSCALEDEF_5_TAP 0x05 +/* 0x06 reserved */ +#define BVSCALEDEF_7_TAP 0x07 +/* 0x08 reserved */ +#define BVSCALEDEF_9_TAP 0x09 +/* 0x0A-0xFF reserved */ + +enum bvscalemode { + BVSCALE_FASTEST = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_FASTEST | + BVSCALEDEF_DONT_CARE, + BVSCALE_FASTEST_NOT_NEAREST_NEIGHBOR = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_FASTEST | + BVSCALEDEF_NOT_NEAREST_NEIGHBOR, + BVSCALE_FASTEST_POINT_SAMPLE = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_FASTEST | + BVSCALEDEF_POINT_SAMPLE, + BVSCALE_FASTEST_INTERPOLATED = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_FASTEST | + BVSCALEDEF_INTERPOLATED, + BVSCALE_FASTEST_PHOTO = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_FASTEST | + BVSCALEDEF_PHOTO, + BVSCALE_FASTEST_DRAWING = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_FASTEST | + BVSCALEDEF_DRAWING, + BVSCALE_GOOD = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_GOOD | + BVSCALEDEF_DONT_CARE, + BVSCALE_GOOD_POINT_SAMPLE = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_GOOD | + BVSCALEDEF_POINT_SAMPLE, + BVSCALE_GOOD_INTERPOLATED = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_GOOD | + BVSCALEDEF_INTERPOLATED, + BVSCALE_GOOD_PHOTO = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_GOOD | + BVSCALEDEF_PHOTO, + BVSCALE_GOOD_DRAWING = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_GOOD | + BVSCALEDEF_DRAWING, + BVSCALE_BETTER = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BETTER | + BVSCALEDEF_DONT_CARE, + BVSCALE_BETTER_POINT_SAMPLE = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BETTER | + BVSCALEDEF_POINT_SAMPLE, + BVSCALE_BETTER_INTERPOLATED = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BETTER | + BVSCALEDEF_INTERPOLATED, + BVSCALE_BETTER_PHOTO = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BETTER | + BVSCALEDEF_PHOTO, + BVSCALE_BETTER_DRAWING = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BETTER | + BVSCALEDEF_DRAWING, + BVSCALE_BEST = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BEST | + BVSCALEDEF_DONT_CARE, + BVSCALE_BEST_POINT_SAMPLE = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BEST | + BVSCALEDEF_POINT_SAMPLE, + BVSCALE_BEST_INTERPOLATED = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BEST | + BVSCALEDEF_INTERPOLATED, + BVSCALE_BEST_PHOTO = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BEST | + BVSCALEDEF_PHOTO, + BVSCALE_BEST_DRAWING = BVSCALEDEF_VENDOR_ALL | + BVSCALEDEF_IMPLICIT | + BVSCALEDEF_BEST | + BVSCALEDEF_DRAWING, + + BVSCALE_NEAREST_NEIGHBOR = BVSCALEDEF_VENDOR_GENERIC | + BVSCALEDEF_EXPLICIT | + (BVSCALEDEF_NEAREST_NEIGHBOR << BVSCALEDEF_HORZ_SHIFT) | + (BVSCALEDEF_NEAREST_NEIGHBOR << BVSCALEDEF_VERT_SHIFT), + BVSCALE_BILINEAR = BVSCALEDEF_VENDOR_GENERIC | + BVSCALEDEF_EXPLICIT | + (BVSCALEDEF_LINEAR << BVSCALEDEF_HORZ_SHIFT) | + (BVSCALEDEF_LINEAR << BVSCALEDEF_VERT_SHIFT), + BVSCALE_BICUBIC = BVSCALEDEF_VENDOR_GENERIC | + BVSCALEDEF_EXPLICIT | + (BVSCALEDEF_CUBIC << BVSCALEDEF_HORZ_SHIFT) | + (BVSCALEDEF_CUBIC << BVSCALEDEF_VERT_SHIFT), + BVSCALE_3x3_TAP = BVSCALEDEF_VENDOR_GENERIC | + BVSCALEDEF_EXPLICIT | + (BVSCALEDEF_3_TAP << BVSCALEDEF_HORZ_SHIFT) | + (BVSCALEDEF_3_TAP << BVSCALEDEF_VERT_SHIFT), + BVSCALE_5x5_TAP = BVSCALEDEF_VENDOR_GENERIC | + BVSCALEDEF_EXPLICIT | + (BVSCALEDEF_5_TAP << BVSCALEDEF_HORZ_SHIFT) | + (BVSCALEDEF_5_TAP << BVSCALEDEF_VERT_SHIFT), + BVSCALE_7x7_TAP = BVSCALEDEF_VENDOR_GENERIC | + BVSCALEDEF_EXPLICIT | + (BVSCALEDEF_7_TAP << BVSCALEDEF_HORZ_SHIFT) | + (BVSCALEDEF_7_TAP << BVSCALEDEF_VERT_SHIFT), + BVSCALE_9x9_TAP = BVSCALEDEF_VENDOR_GENERIC | + BVSCALEDEF_EXPLICIT | + (BVSCALEDEF_9_TAP << BVSCALEDEF_HORZ_SHIFT) | + (BVSCALEDEF_9_TAP << BVSCALEDEF_VERT_SHIFT), + +#ifdef BVSCALE_EXTERNAL_INCLUDE +#include BVSCALE_EXTERNAL_INCLUDE +#endif +}; + + +/* + * bvdithermode - This defines the type of dithering to use. + */ +#define BVDITHERDEF_VENDOR_SHIFT 24 +#define BVDITHERDEF_VENDOR_MASK (0xFF << BVDITHERDEF_VENDOR_SHIFT) + +#define BVDITHERDEF_VENDOR_ALL (0 << BVDITHERDEF_VENDOR_SHIFT) +#define BVDITHERDEF_VENDOR_TI (1 << BVDITHERDEF_VENDOR_SHIFT) +/* 0xF0-0xFE reserved */ +#define BVDITHERDEF_VENDOR_GENERIC (0xFF << BVDITHERDEF_VENDOR_SHIFT) + +/***** VENDOR_GENERIC definitions *****/ +/* Bits 18-23 reserved */ +/**** Bits 17-16 indicate the type of image - 0 = don't know ****/ +#define BVDITHERDEF_TYPE_SHIFT 16 +#define BVDITHERDEF_PHOTO (0x01 << BVDITHERDEF_TYPE_SHIFT) +#define BVDITHERDEF_DRAWING (0x02 << BVDITHERDEF_TYPE_SHIFT) +/**** Bits 15-8 indicate the desired technique ****/ +#define BVDITHERDEF_TECHNIQUE_SHIFT 8 +#define BVDITHERDEF_DONT_CARE (0x00 << BVDITHERDEF_TECHNIQUE_SHIFT) +#define BVDITHERDEF_RANDOM (0x01 << BVDITHERDEF_TECHNIQUE_SHIFT) +#define BVDITHERDEF_ORDERED (0x02 << BVDITHERDEF_TECHNIQUE_SHIFT) +#define BVDITHERDEF_DIFFUSED (0x04 << BVDITHERDEF_TECHNIQUE_SHIFT) +#define BVDITHERDEF_ON (0xFF << BVDITHERDEF_TECHNIQUE_SHIFT) +/**** Bits 7-0 indicate the quality (speed) desired ****/ +#define BVDITHERDEF_QUALITY_SHIFT 0 +#define BVDITHERDEF_FASTEST (0x00 << BVDITHERDEF_QUALITY_SHIFT) +#define BVDITHERDEF_GOOD (0x55 << BVDITHERDEF_QUALITY_SHIFT) +#define BVDITHERDEF_BETTER (0xAA << BVDITHERDEF_QUALITY_SHIFT) +#define BVDITHERDEF_BEST (0xFF << BVDITHERDEF_QUALITY_SHIFT) + +enum bvdithermode { + BVDITHER_FASTEST = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_FASTEST | + BVDITHERDEF_DONT_CARE, + BVDITHER_FASTEST_ON = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_FASTEST | + BVDITHERDEF_ON, + BVDITHER_FASTEST_RANDOM = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_FASTEST | + BVDITHERDEF_RANDOM, + BVDITHER_FASTEST_ORDERED = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_FASTEST | + BVDITHERDEF_ORDERED, + BVDITHER_FASTEST_DIFFUSED = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_FASTEST | + BVDITHERDEF_DIFFUSED, + BVDITHER_FASTEST_PHOTO = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_FASTEST | + BVDITHERDEF_PHOTO, + BVDITHER_FASTEST_DRAWING = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_FASTEST | + BVDITHERDEF_DRAWING, + BVDITHER_GOOD = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_GOOD | + BVDITHERDEF_DONT_CARE, + BVDITHER_GOOD_ON = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_GOOD | + BVDITHERDEF_ON, + BVDITHER_GOOD_RANDOM = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_GOOD | + BVDITHERDEF_RANDOM, + BVDITHER_GOOD_ORDERED = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_GOOD | + BVDITHERDEF_ORDERED, + BVDITHER_GOOD_DIFFUSED = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_GOOD | + BVDITHERDEF_DIFFUSED, + BVDITHER_GOOD_PHOTO = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_GOOD | + BVDITHERDEF_PHOTO, + BVDITHER_GOOD_DRAWING = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_GOOD | + BVDITHERDEF_DRAWING, + BVDITHER_BETTER = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BETTER | + BVDITHERDEF_DONT_CARE, + BVDITHER_BETTER_ON = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BETTER | + BVDITHERDEF_ON, + BVDITHER_BETTER_RANDOM = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BETTER | + BVDITHERDEF_RANDOM, + BVDITHER_BETTER_ORDERED = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BETTER | + BVDITHERDEF_ORDERED, + BVDITHER_BETTER_DIFFUSED = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BETTER | + BVDITHERDEF_DIFFUSED, + BVDITHER_BETTER_PHOTO = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BETTER | + BVDITHERDEF_PHOTO, + BVDITHER_BETTER_DRAWING = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BETTER | + BVDITHERDEF_DRAWING, + BVDITHER_BEST = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BEST | + BVDITHERDEF_DONT_CARE, + BVDITHER_BEST_ON = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BEST | + BVDITHERDEF_ON, + BVDITHER_BEST_RANDOM = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BEST | + BVDITHERDEF_RANDOM, + BVDITHER_BEST_ORDERED = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BEST | + BVDITHERDEF_ORDERED, + BVDITHER_BEST_DIFFUSED = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BEST | + BVDITHERDEF_DIFFUSED, + BVDITHER_BEST_PHOTO = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BEST | + BVDITHERDEF_PHOTO, + BVDITHER_BEST_DRAWING = BVDITHERDEF_VENDOR_ALL | + BVDITHERDEF_BEST | + BVDITHERDEF_DRAWING, + + BVDITHER_NONE = BVDITHERDEF_VENDOR_GENERIC + 0, + BVDITHER_ORDERED_2x2 = BVDITHERDEF_VENDOR_GENERIC + 4, + BVDITHER_ORDERED_4x4 = BVDITHERDEF_VENDOR_GENERIC + 16, + BVDITHER_ORDERED_2x2_4x4 = BVDITHERDEF_VENDOR_GENERIC + 4 + 16, + /* 2x2 for 6->8, 4x4 for 5->8 */ + +#ifdef BVDITHER_EXTERNAL_INCLUDE +#include BVDITHER_EXTERNAL_INCLUDE +#endif +}; + + +/* + * BVTILE_* flags - These specify parameters used when tiling. + */ +#define BVTILE_LEFT_SHIFT 0 +#define BVTILE_TOP_SHIFT (BVTILE_LEFT_SHIFT + 2) +#define BVTILE_RIGHT_SHIFT (BVTILE_TOP_SHIFT + 2) +#define BVTILE_BOTTOM_SHIFT (BVTILE_RIGHT_SHIFT + 2) +#define BVTILE_LEFT_REPEAT (0 << BVTILE_LEFT_SHIFT) /* ...012301230123 */ +#define BVTILE_TOP_REPEAT (0 << BVTILE_TOP_SHIFT) /* ...012301230123 */ +#define BVTILE_RIGHT_REPEAT (0 << BVTILE_RIGHT_SHIFT) /* 012301230123... */ +#define BVTILE_BOTTOM_REPEAT (0 << BVTILE_BOTTOM_SHIFT) /* 012301230123... */ +#define BVTILE_LEFT_MIRROR (1 << BVTILE_LEFT_SHIFT) /* ...012332100123 */ +#define BVTILE_TOP_MIRROR (1 << BVTILE_TOP_SHIFT) /* ...012332100123 */ +#define BVTILE_RIGHT_MIRROR (1 << BVTILE_RIGHT_SHIFT) /* 012332100123... */ +#define BVTILE_BOTTOM_MIRROR (1 << BVTILE_BOTTOM_SHIFT) /* 012332100123... */ + +/* + * bvtileparams - This structure provides additional parameters needed when + * tiling. This structure replaces the bvbuffdesc in bvbltparams when the + * associated BVFLAG_TILE_* flag is set in bvbltparams.flags. + */ +struct bvtileparams { + unsigned int structsize; /* used to ID structure version */ + unsigned long flags; /* tile flags */ + void *virtaddr; /* pointer to the brush */ + int dstleft; /* horizontal offset */ + int dsttop; /* vertical offset */ + unsigned int srcwidth; /* w/dst width to spec horz scale */ + unsigned int srcheight; /* w/dst height to spec vert scale */ +}; + +/* + * BVBATCH_* - These flags specify the parameters that change between + * batched BLTs, when BVFLAG_CONTINUE or BVFLAG_END set. + */ +#define BVBATCH_OP 0x00000001 /* type of operation changed */ +#define BVBATCH_KEY 0x00000002 /* color key changed */ +#define BVBATCH_MISCFLAGS 0x00000004 /* other flags changed */ +#define BVBATCH_ALPHA 0x00000008 /* global alpha changed */ +#define BVBATCH_DITHER 0x00000010 /* dither changed */ +#define BVBATCH_SCALE 0x00000020 /* scaling type changed */ +/* Bits 6-7 reserved */ +#define BVBATCH_DST 0x00000100 /* destination surface changed */ +#define BVBATCH_SRC1 0x00000200 /* source 1 surface changed */ +#define BVBATCH_SRC2 0x00000400 /* source 2 surface changed */ +#define BVBATCH_MASK 0x00000800 /* mask surface changed */ +#define BVBATCH_DSTRECT_ORIGIN 0x00001000 /* dest rect origin changed */ +#define BVBATCH_DSTRECT_SIZE 0x00002000 /* dest rect dimensions changed */ +#define BVBATCH_SRC1RECT_ORIGIN 0x00004000 /* src 1 rect origin changed */ +#define BVBATCH_SRC1RECT_SIZE 0x00008000 /* src 1 rect dimensions changed */ +#define BVBATCH_SRC2RECT_ORIGIN 0x00010000 /* src 2 rect origin changed */ +#define BVBATCH_SRC2RECT_SIZE 0x00020000 /* src 2 rect dimensions changed */ +#define BVBATCH_MASKRECT_ORIGIN 0x00040000 /* mask rect origin changed */ +#define BVBATCH_MASKRECT_SIZE 0x00080000 /* mask rect dimensions changed */ +#define BVBATCH_CLIPRECT_ORIGIN 0x00100000 /* Clip rect origin changed */ +#define BVBATCH_CLIPRECT_SIZE 0x00200000 /* Clip rect dimensions changed */ +#define BVBATCH_CLIPRECT (BVBATCH_CLIPRECT_ORIGIN | \ + BVBATCH_CLIPRECT_SIZE) /* clip rect... */ + /* ...changed */ +#define BVBATCH_TILE_SRC1 0x00400000 /* tile params for src 1 changed */ +#define BVBATCH_TILE_SRC2 0x00800000 /* tile params for src 2 changed */ +#define BVBATCH_TILE_MASK 0x00100000 /* tile params for mask changed */ +/* Bits 21-30 reserved */ +#define BVBATCH_ENDNOP 0x80000000 /* just end batch, don't do BLT; + only with BVFLAG_BATCH_END */ + +/* + * bvcallbackerror - This structure is passed into the callback function + * if an error occurs. + */ +struct bvcallbackerror { + unsigned int structsize; /* used to ID structure version */ + enum bverror error; /* error during async BLT */ + char *errdesc; /* 0-terminated ASCII string + with extended error info (not + for end users) */ +}; + +/* + * bvbatch - an implementation-specific container for batch information; + * not used by client; forward declaration here + */ +struct bvbatch; + +/* + * bvinbuff - provides the buffer in bvbltparams + */ +union bvinbuff { + struct bvbuffdesc *desc; /* buffer description when + associated BVFLAG_TILE_* + is not set */ + struct bvtileparams *tileparams; /* tile params when associated + BVFLAG_TILE_* flag is set */ +}; + +/* + * bvop - used to hold the operation in bvbltparams + */ +union bvop { + unsigned short rop; /* when BVFLAG_ROP set */ + enum bvblend blend; /* when BVFLAG_BLEND set */ + struct bvfilter *filter; /* when BVFLAG_FILTER set */ +}; + + +/* + * bvbltparams - This structure is passed into bv_blt() to specify the + * parameters for a BLT. + */ +struct bvbltparams { + unsigned int structsize; /* (i) used to ID structure version */ + char *errdesc; /* (o) 0-terminated ASCII string + with extended error info (not + for end users) */ + + unsigned long implementation; /* (i) override manager choice */ + + unsigned long flags; /* (i) see BVFLAG_* above */ + + union bvop op; /* (i) operation; determined by + BVFLAG_OP_MASK bits in flags */ + + void *colorkey; /* (i) pointer to color key pixel + matching non-SUBSAMPLE format + of the keyed surface when + BVFLAG_KEY_* is set */ + + union bvalpha globalalpha; /* (i) global alpha when BVFLAG_BLEND + set in flags and + BVBLENDDEF_GLOBAL_* is set in + blend; typed determined by + BVBLENDDEF_GLOBAL_* */ + + enum bvscalemode scalemode; /* (i/o) type of scaling */ + enum bvdithermode dithermode; /* (i/o) type of dither */ + + struct bvbuffdesc *dstdesc; /* (i) dest after bv_map() */ + struct bvsurfgeom *dstgeom; /* (i) dest surf fmt and geometry */ + struct bvrect dstrect; /* (i) rect into which data written */ + + union bvinbuff src1; /* (i) src1 buffer */ + struct bvsurfgeom *src1geom; /* (i) src1 surf fmt and geometry */ + struct bvrect src1rect; /* (i) rect from which data is read */ + + union bvinbuff src2; /* (i) src2 buffer */ + struct bvsurfgeom *src2geom; /* (i) src2 surf fmt and geometry */ + struct bvrect src2rect; /* (i) rect from which data is read */ + + union bvinbuff mask; /* (i) mask buffer */ + struct bvsurfgeom *maskgeom; /* (i) mask surf fmt and geometry */ + struct bvrect maskrect; /* (i) rect from which data is read */ + + struct bvrect cliprect; /* (i) dest clipping rect when + BVFLAG_CLIP flag set */ + + unsigned long batchflags; /* (i) BVBATCH_* flags used to + indicate params changed between + batch BLTs */ + struct bvbatch *batch; /* (i/o) handle for associated batch; + returned when + BVFLAG_BATCH_BEGIN set; + provided to subsequent BLTs + with BVFLAG_BATCH_CONTINUE */ + + void (*callbackfn)(struct bvcallbackerror *err, + unsigned long callbackdata); /* (i) callback + function when + BVFLAG_ASYNC is set - + err is 0 when no + error; handle contains + callbackdata below */ + unsigned long callbackdata; /* (i) callback data */ + + struct bvrect src2auxdstrect; + struct bvrect maskauxdstrect; +}; + +#endif /* BLTSVILLE_H */ diff --git a/bltsville/bltsville/include/bvblend.h b/bltsville/bltsville/include/bvblend.h new file mode 100644 index 0000000..f187d81 --- /dev/null +++ b/bltsville/bltsville/include/bvblend.h @@ -0,0 +1,508 @@ +/* + * bvblend.h + * + * Copyright (C) 2011 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +/* + * This file defines the types of shared blends available. + * + * To extend the list of blends, create a file containing additional + * enumerations to be added to enum bvblend below. Then #define + * BVBLEND_EXTERNAL_INCLUDE as the name of that file before including + * this file in your project. + */ + +#ifndef BVBLEND_H +#define BVBLEND_H + +/* + * bvblend - specifies the type of blending operation to perform; only valid + * when BVFLAG_BLEND is set in the bvbltparams.flags field. + */ + +/* + * The blendmode value is divided into two sections. + * + * [31:28] The most significant 4 bits indicate the blend format. + * + * [27:0] The remainder of the bits is defined by the format chosen. + * + * 3322222222221111111111 + * 10987654321098765432109876543210 + * [ ][ ] + * | | + * format defined by format + */ + +#define BVBLENDDEF_FORMAT_SHIFT 28 +#define BVBLENDDEF_FORMAT_MASK (0xF << BVBLENDDEF_FORMAT_SHIFT) + +#define BVBLENDDEF_FORMAT_CLASSIC (0x0 << BVBLENDDEF_FORMAT_SHIFT) +#define BVBLENDDEF_FORMAT_ESSENTIAL (0x1 << BVBLENDDEF_FORMAT_SHIFT) + +/* + * The BVBLENDDEF_FORMAT_CLASSIC is meant to handle the classic Porter-Duff + * equations. It can also handle the DirectFB blending. + * BVBLENDDEF_FORMAT_CLASSIC is based on the following equations: + * + * Cd = K1 x C1 + K2 x C2 + * Ad = K3 x A1 + K4 x A2 + * + * where: + * Cd: destination color + * C1: source 1 color + * C2: source 2 color + * Ad: destination alpha + * A1: source 1 alpha + * A2: source 2 alpha + * K#: one of the constants defined using the bitfields below. + */ + +/* + * The 28 bits for BVBLENDDEF_FORMAT_CLASSIC are divided into 5 sections. + * + * The most significant 4 bits are modifiers, used to include additional + * alpha values from global or remote sources. + * + * [27] The most significant bit indicates that a remote alpha is to be + * included in the blend. The format of this is defined by + * bvbltparams.maskgeom.format. + * + * [26] The next bit is reserved. + * + * [25:24] The next 2 bits are used to indicate that a global alpha is to be + * included, and what its format is: + * 00: no global included + * 01: global included; bvbltparams.globalalpha.size8 is used (0 -> 255) + * 10: this value is reserved + * 11: global included; bvbltparams.flogalalpha.fp is used (0.0 -> 1.0) + * + * The remaining bits are divided into 4 sections, one to define each of the + * constants: + * + * [23:18] - K1 + * [17:12] - K2 + * [11:6] - K3 + * [5:0] - K4 + * + * The format is the same for all 4 constant fields: + * + * [5:4] The first 2 bits of each field indicates the way in which the other + * 2 fields are interpreted: + * 00: only As: the other two fields contain only As; there should be only + * one valid A value between the two fields + * 01: minimum: the value of the constant is the minimum of the two fields + * 10: maximum: the value of the constant is the maximum of the two fields + * 11: only Cs: the other two fields contain only Cs; there should be only + * one valid C value between the two fields + * + * [3:2] The middle 2 bits of each field contain the inverse field: + * 00: 1-C1 ("don't care" for "only As") + * 01: 1-A1 ("don't care" for "only Cs") + * 10: 1-C2 ("don't care" for "only As") + * 11: 1-A2 ("don't care" for "only Cs") + * + * [1:0] The last 2 bits if each field contain the normal field: + * 00: C1 ("don't care" for "only As") + * 01: A1 ("don't care" for "only Cs") + * 10: C2 ("don't care" for "only As") + * 11: A2 ("don't care" for "only Cs") + * + * EXCEPTIONS: + * + * 00 00 00 - The value 00 00 00, which normally would indicate "only As" + * with two "don't care" fields, is interpreted as a 0. + * + * 11 11 11 - The value 11 11 11, which normally would indicate "only Cs" + * with two "don't care" fields, is interpreted as a 1. + * + * -------------------------------------------------------------------------- + * + * Put together, these can define portions of the blend equations that can be + * put together in a variety of ways: + * + * 00 00 00: undefined -> zero + * 00 00 01: A1 (preferred) + * 00 00 10: undefined + * 00 00 11: A2 (preferred) + * 00 01 00: 1-A1 (preferred) + * 00 01 01: undefined + * 00 01 10: 1-A1 (use 00 01 00) + * 00 01 11: undefined + * 00 10 00: undefined + * 00 10 01: A1 (use 00 00 01) + * 00 10 10: undefined + * 00 10 11: A2 (use 00 00 11) + * 00 11 00: 1-A2 (preferred) + * 00 11 01: undefined + * 00 11 10: 1-A2 (use 00 11 00) + * 00 11 11: undefined + * + * 01 00 00: min(C1,1-C1) + * 01 00 01: min(A1,1-C1) + * 01 00 10: min(C2,1-C1) + * 01 00 11: min(A2,1-C1) + * 01 01 00: min(C1,1-A1) + * 01 01 01: min(A1,1-A1) + * 01 01 10: min(C2,1-A1) + * 01 01 11: min(A2,1-A1) + * 01 10 00: min(C1,1-C2) + * 01 10 01: min(A1,1-C2) + * 01 10 10: min(C2,1-C2) + * 01 10 11: min(A2,1-C2) + * 01 11 00: min(C1,1-A2) + * 01 11 01: min(A1,1-A2) + * 01 11 10: min(C2,1-A2) + * 01 11 11: min(A2,1-A2) + * + * 10 00 00: max(C1,1-C1) + * 10 00 01: max(A1,1-C1) + * 10 00 10: max(C2,1-C1) + * 10 00 11: max(A2,1-C1) + * 10 01 00: max(C1,1-A1) + * 10 01 01: max(A1,1-A1) + * 10 01 10: max(C2,1-A1) + * 10 01 11: max(A2,1-A1) + * 10 10 00: max(C1,1-C2) + * 10 10 01: max(A1,1-C2) + * 10 10 10: max(C2,1-C2) + * 10 10 11: max(A2,1-C2) + * 10 11 00: max(C1,1-A2) + * 10 11 01: max(A1,1-A2) + * 10 11 10: max(C2,1-A2) + * 10 11 11: max(A2,1-A2) + * + * 11 00 00: undefined + * 11 00 01: 1-C1 (use 11 00 11) + * 11 00 10: undefined + * 11 00 11: 1-C1 (preferred) + * 11 01 00: C1 (use 11 11 00) + * 11 01 01: undefined + * 11 01 10: C2 (use 11 11 10) + * 11 01 11: undefined + * 11 10 00: undefined + * 11 10 01: 1-C2 (use 11 10 11) + * 11 10 10: undefined + * 11 10 11: 1-C2 (preferred) + * 11 11 00: C1 (preferred) + * 11 11 01: undefined + * 11 11 10: C2 (preferred) + * 11 11 11: undefined -> one + * + * ========================================================================== + * DirectFB + * ========================================================================== + * + * Putting these together into the proper constants, the blending equations + * can be built for DirectFB as well: + * + * For DirectFB, the SetSrcBlendFunction() and SetDstBlendFunction() can + * specify 121 combinations of blends (11 x 11). It's impractical to + * specify these combinations individually. Instead, the settings indicated + * by each call should be bitwise OR'd to make the proper single value used in + * BLTsville. + * + * binary value <- SetSrcBlendFunction() + * [--K1--] [--K2--] [--K3--] [--K4--] + * 0000 0000 00 00 00 xx xx xx 00 00 00 xx xx xx <- DSBF_ZERO + * 0000 0000 11 11 11 xx xx xx 11 11 11 xx xx xx <- DSBF_ONE + * 0000 0000 11 11 00 xx xx xx 00 00 01 xx xx xx <- DSBF_SRCCOLOR + * 0000 0000 11 00 11 xx xx xx 00 01 00 xx xx xx <- DSBF_INVSRCCOLOR + * 0000 0000 00 00 01 xx xx xx 00 00 01 xx xx xx <- DSBF_SRCALPHA + * 0000 0000 00 01 00 xx xx xx 00 01 00 xx xx xx <- DSBF_INVSRCALPHA + * 0000 0000 11 11 10 xx xx xx 00 00 11 xx xx xx <- DSBF_DESTCOLOR + * 0000 0000 11 10 11 xx xx xx 00 11 00 xx xx xx <- DSBF_INVDESTCOLOR + * 0000 0000 00 00 11 xx xx xx 00 00 11 xx xx xx <- DSBF_DESTALPHA + * 0000 0000 00 11 00 xx xx xx 00 11 00 xx xx xx <- DSBF_INVDESTALPHA + * 0000 0000 01 11 01 xx xx xx 11 11 11 xx xx xx <- DSBF_SRCALPHASAT + * + * binary value <- SetDstBlendFunction() + * [--K1--] [--K2--] [--K3--] [--K4--] + * 0000 0000 xx xx xx 00 00 00 xx xx xx 00 00 00 <- DSBF_ZERO + * 0000 0000 xx xx xx 11 11 11 xx xx xx 11 11 11 <- DSBF_ONE + * 0000 0000 xx xx xx 11 11 00 xx xx xx 00 00 01 <- DSBF_SRCCOLOR + * etc. + * + * ========================================================================== + * Porter-Duff + * ========================================================================== + * + * For Porter-Duff, the equations can be more specifically defined. For + * convenience, these are enumerated below. These utilize the local alpha as + * indicated. To use global or remote alpha, these enumerations need to be + * modified. For example, to include the global alpha in the Porter-Duff + * SRC1OVER blend, the blend could be defined like this: + * params.op.blend = BVBLEND_SRC1OVER + + * BVBLENDDEF_GLOBAL_UCHAR; + * + * To include the remote alpha, the blend could be defined like this: + * params.op.blend = BVBLEND_SRC1OVER + + * BVBLENDDEF_REMOTE; + * + * And to include both: + * params.op.blend = BVBLEND_SRC1OVER + + * BVBLENDDEF_GLOBAL_UCHAR + + * BVBLENDDEF_REMOTE; + * + * Note that if the source color formats include local alphas, the local + * alphas, global alpha, and remote alpha will be used together. + * + * Note also that the equations assume the surfaces are premultiplied. So + * if the surface formats indicate that they are not premultiplied, the + * alpha multiplication of each color is done prior to using the surface + * values in the equations. + * + * For example, BVBLEND_SRC1OVER specifies the equations: + * Cd = 1 x C1 + (1 - A1) x C2 + * Ad = 1 x A1 + (1 - A1) x A2 + * + * If the format of surface 1 is non-premultiplied, the equations + * are modified to include the multiplication explicitly: + * Cd = 1 x A1 x C1 + (1 - A1) x C2 + * Ad = 1 x A1 + (1 - A1) x A2 + * + * Likewise, if the format of surface 2 is non-premultiplied, the + * equations are modified for this: + * Cd = 1 x C1 + (1 - A1) x A2 x C2 + * Ad = 1 x A1 + (1 - A1) x A2 + * + * When including global or remote alphas, these values are used to modify + * the source 1 value values before being used in the blend equation: + * C1 = Ag x C1 + * A1 = Ag x A1 + * -or- + * C1 = Ar x C1 + * A1 = Ar x A1 + * -or- + * C1 = Ag x Ar x C1 + * A1 = Ag x Ar x A1 + * + */ + +#define BVBLENDDEF_MODE_SHIFT 4 +#define BVBLENDDEF_INV_SHIFT 2 +#define BVBLENDDEF_NORM_SHIFT 0 + +#define BVBLENDDEF_ONLY_A (0 << BVBLENDDEF_MODE_SHIFT) +#define BVBLENDDEF_MIN (1 << BVBLENDDEF_MODE_SHIFT) +#define BVBLENDDEF_MAX (2 << BVBLENDDEF_MODE_SHIFT) +#define BVBLENDDEF_ONLY_C (3 << BVBLENDDEF_MODE_SHIFT) +#define BVBLENDDEF_MODE_MASK (3 << BVBLENDDEF_MODE_SHIFT) + +#define BVBLENDDEF_NORM_C1 (0 << BVBLENDDEF_NORM_SHIFT) +#define BVBLENDDEF_NORM_A1 (1 << BVBLENDDEF_NORM_SHIFT) +#define BVBLENDDEF_NORM_C2 (2 << BVBLENDDEF_NORM_SHIFT) +#define BVBLENDDEF_NORM_A2 (3 << BVBLENDDEF_NORM_SHIFT) +#define BVBLENDDEF_NORM_MASK (3 << BVBLENDDEF_NORM_SHIFT) + +#define BVBLENDDEF_INV_C1 (0 << BVBLENDDEF_INV_SHIFT) +#define BVBLENDDEF_INV_A1 (1 << BVBLENDDEF_INV_SHIFT) +#define BVBLENDDEF_INV_C2 (2 << BVBLENDDEF_INV_SHIFT) +#define BVBLENDDEF_INV_A2 (3 << BVBLENDDEF_INV_SHIFT) +#define BVBLENDDEF_INV_MASK (3 << BVBLENDDEF_INV_SHIFT) + +#define BVBLENDDEF_ONLY_A_NORM_xx BVBLENDDEF_NORM_C1 +#define BVBLENDDEF_ONLY_A_INV_xx BVBLENDDEF_INV_C1 +#define BVBLENDDEF_ONLY_C_NORM_xx BVBLENDDEF_NORM_A2 +#define BVBLENDDEF_ONLY_C_INV_xx BVBLENDDEF_INV_A2 + +#define BVBLENDDEF_ZERO \ + (BVBLENDDEF_ONLY_A | \ + BVBLENDDEF_ONLY_A_NORM_xx | \ + BVBLENDDEF_ONLY_A_INV_xx) +#define BVBLENDDEF_C1 \ + (BVBLENDDEF_ONLY_C | \ + BVBLENDDEF_NORM_C1 | \ + BVBLENDDEF_ONLY_C_INV_xx) +#define BVBLENDDEF_A1 \ + (BVBLENDDEF_ONLY_A | \ + BVBLENDDEF_NORM_A1 | \ + BVBLENDDEF_ONLY_A_INV_xx) +#define BVBLENDDEF_C2 \ + (BVBLENDDEF_ONLY_C | \ + BVBLENDDEF_NORM_C2 | \ + BVBLENDDEF_ONLY_C_INV_xx) +#define BVBLENDDEF_A2 \ + (BVBLENDDEF_ONLY_A | \ + BVBLENDDEF_NORM_A2 | \ + BVBLENDDEF_ONLY_A_INV_xx) +#define BVBLENDDEF_ONE_MINUS_C1 \ + (BVBLENDDEF_ONLY_C | \ + BVBLENDDEF_ONLY_C_NORM_xx | \ + BVBLENDDEF_INV_C1) +#define BVBLENDDEF_ONE_MINUS_A1 \ + (BVBLENDDEF_ONLY_A | \ + BVBLENDDEF_ONLY_A_NORM_xx | \ + BVBLENDDEF_INV_A1) +#define BVBLENDDEF_ONE_MINUS_C2 \ + (BVBLENDDEF_ONLY_C | \ + BVBLENDDEF_ONLY_C_NORM_xx | \ + BVBLENDDEF_INV_C2) +#define BVBLENDDEF_ONE_MINUS_A2 \ + (BVBLENDDEF_ONLY_A | \ + BVBLENDDEF_ONLY_A_NORM_xx | \ + BVBLENDDEF_INV_A2) +#define BVBLENDDEF_ONE \ + (BVBLENDDEF_ONLY_C | \ + BVBLENDDEF_ONLY_C_NORM_xx | \ + BVBLENDDEF_ONLY_C_INV_xx) + +#define BVBLENDDEF_K_MASK \ + (BVBLENDDEF_MODE_MASK | \ + BVBLENDDEF_INV_MASK | \ + BVBLENDDEF_NORM_MASK) + +#define BVBLENDDEF_K1_SHIFT 18 +#define BVBLENDDEF_K2_SHIFT 12 +#define BVBLENDDEF_K3_SHIFT 6 +#define BVBLENDDEF_K4_SHIFT 0 + +#define BVBLENDDEF_K1_MASK \ + (BVBLENDDEF_K_MASK << BVBLENDDEF_K1_SHIFT) +#define BVBLENDDEF_K2_MASK \ + (BVBLENDDEF_K_MASK << BVBLENDDEF_K2_SHIFT) +#define BVBLENDDEF_K3_MASK \ + (BVBLENDDEF_K_MASK << BVBLENDDEF_K3_SHIFT) +#define BVBLENDDEF_K4_MASK \ + (BVBLENDDEF_K_MASK << BVBLENDDEF_K4_SHIFT) + +#define BVBLENDDEF_CLASSIC_EQUATION_MASK 0x00FFFFFF + +/* + * The following definitions are be used to modify the enumerations. + */ +#define BVBLENDDEF_REMOTE 0x08000000 /* mask surface provides alpha + for source 1 */ + +/* Bit 26 reserved */ + +/* These enable global alpha and define the type of globalalpha */ +#define BVBLENDDEF_GLOBAL_SHIFT 24 +#define BVBLENDDEF_GLOBAL_MASK (3 << BVBLENDDEF_GLOBAL_SHIFT) + +#define BVBLENDDEF_GLOBAL_NONE (0 << BVBLENDDEF_GLOBAL_SHIFT) +#define BVBLENDDEF_GLOBAL_UCHAR (1 << BVBLENDDEF_GLOBAL_SHIFT) +/* 2 reserved */ +#define BVBLENDDEF_GLOBAL_FLOAT (3 << BVBLENDDEF_GLOBAL_SHIFT) + +union bvalpha { + unsigned char size8; /* btwn 0 (0.0) and 255 (1.0) */ + float fp; /* btwn 0.0 and 1.0 */ +}; + + +enum bvblend { + /* Porter-Duff blending equations */ + BVBLEND_CLEAR = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ZERO << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC1 = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ONE << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC2 = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ZERO << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC1OVER = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ONE << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A1 << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A1 << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC2OVER = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ONE_MINUS_A2 << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A2 << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC1IN = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_A2 << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_A2 << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC2IN = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ZERO << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_A1 << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_A1 << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC1OUT = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ONE_MINUS_A2 << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A2 << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC2OUT = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ZERO << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A1 << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ZERO << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A1 << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC1ATOP = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_A2 << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A1 << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_A2 << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A1 << BVBLENDDEF_K4_SHIFT), + BVBLEND_SRC2ATOP = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ONE_MINUS_A2 << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_A1 << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A2 << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_A1 << BVBLENDDEF_K4_SHIFT), + BVBLEND_XOR = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ONE_MINUS_A2 << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A1 << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A2 << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ONE_MINUS_A1 << BVBLENDDEF_K4_SHIFT), + BVBLEND_PLUS = BVBLENDDEF_FORMAT_CLASSIC | + (BVBLENDDEF_ONE << BVBLENDDEF_K1_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K2_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K3_SHIFT) | + (BVBLENDDEF_ONE << BVBLENDDEF_K4_SHIFT), + +/* + * For FORMAT_ESSENTIAL, the variety of well-known blending functions from + * popular image manipulation programs are specified. + */ + + BVBLEND_NORMAL = BVBLENDDEF_FORMAT_ESSENTIAL + 0, + BVBLEND_LIGHTEN = BVBLENDDEF_FORMAT_ESSENTIAL + 1, + BVBLEND_DARKEN = BVBLENDDEF_FORMAT_ESSENTIAL + 2, + BVBLEND_MULTIPLY = BVBLENDDEF_FORMAT_ESSENTIAL + 3, + BVBLEND_AVERAGE = BVBLENDDEF_FORMAT_ESSENTIAL + 4, + BVBLEND_ADD = BVBLENDDEF_FORMAT_ESSENTIAL + 5, + BVBLEND_LINEAR_DODGE = BVBLEND_ADD, + BVBLEND_SUBTRACT = BVBLENDDEF_FORMAT_ESSENTIAL + 6, + BVBLEND_LINEAR_BURN = BVBLEND_SUBTRACT, + BVBLEND_DIFFERENCE = BVBLENDDEF_FORMAT_ESSENTIAL + 7, + BVBLEND_NEGATE = BVBLENDDEF_FORMAT_ESSENTIAL + 8, + BVBLEND_SCREEN = BVBLENDDEF_FORMAT_ESSENTIAL + 9, + BVBLEND_EXCLUSION = BVBLENDDEF_FORMAT_ESSENTIAL + 10, + BVBLEND_OVERLAY = BVBLENDDEF_FORMAT_ESSENTIAL + 11, + BVBLEND_SOFT_LIGHT = BVBLENDDEF_FORMAT_ESSENTIAL + 12, + BVBLEND_HARD_LIGHT = BVBLENDDEF_FORMAT_ESSENTIAL + 13, + BVBLEND_COLOR_DODGE = BVBLENDDEF_FORMAT_ESSENTIAL + 14, + BVBLEND_COLOR_BURN = BVBLENDDEF_FORMAT_ESSENTIAL + 15, + BVBLEND_LINEAR_LIGHT = BVBLENDDEF_FORMAT_ESSENTIAL + 16, + BVBLEND_VIVID_LIGHT = BVBLENDDEF_FORMAT_ESSENTIAL + 17, + BVBLEND_PIN_LIGHT = BVBLENDDEF_FORMAT_ESSENTIAL + 18, + BVBLEND_HARD_MIX = BVBLENDDEF_FORMAT_ESSENTIAL + 19, + BVBLEND_REFLECT = BVBLENDDEF_FORMAT_ESSENTIAL + 20, + BVBLEND_GLOW = BVBLENDDEF_FORMAT_ESSENTIAL + 21, + BVBLEND_PHOENIX = BVBLENDDEF_FORMAT_ESSENTIAL + 22, + +#ifdef BVBLEND_EXTERNAL_INCLUDE +#define BVBLEND_EXTERNAL_INCLUDE +#endif +}; + +#endif /* BVBLEND_H */ diff --git a/bltsville/bltsville/include/bvbuffdesc.h b/bltsville/bltsville/include/bvbuffdesc.h new file mode 100644 index 0000000..98934bc --- /dev/null +++ b/bltsville/bltsville/include/bvbuffdesc.h @@ -0,0 +1,61 @@ +/* + * bvbuffdesc.h + * + * Copyright (C) 2011 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +#ifndef BVBUFFDESC_H +#define BVBUFFDESC_H + +/* + * bvbuffmap - This is a private structure used by BLTsville + * implementations to manage resources associated with a buffer. A pointer + * to this is returned from bv_map() and used in subsequent bv_blt() and + * bv_unmap() calls. + */ +struct bvbuffmap; + +#define BVATDEF_VENDOR_SHIFT 24 +#define BVATDEF_VENDOR_MASK (0xFF << BVATDEF_VENDOR_SHIFT) + +/* Common aux type */ +#define BVATDEF_VENDOR_ALL (0x00 << BVATDEF_VENDOR_SHIFT) + +/* Texas Instruments, Inc. */ +#define BVATDEF_VENDOR_TI (0x01 << BVATDEF_VENDOR_SHIFT) + +enum bvauxtype { + BVAT_NONE = 0, /* auxptr not used */ + BVAT_reserved1 = /* reserved */ + BVATDEF_VENDOR_ALL + 1, + BVAT_reserved2 = /* reserved */ + BVATDEF_VENDOR_ALL + 2, +#ifdef BVAT_EXTERNAL_INCLUDE +#include BVAT_EXTERNAL_INCLUDE +#endif +}; + +/* + * bvbuffdesc - This structure is used to specify the buffer parameters + * in a call to bv_map(). + */ +struct bvbuffdesc { + unsigned int structsize; /* used to identify struct version */ + void *virtaddr; /* virtual ptr to start of buffer */ + unsigned long length; /* length of the buffer in bytes */ + struct bvbuffmap *map; /* resource(s) associated w/buffer */ + enum bvauxtype auxtype; /* type of auxptr */ + void *auxptr; /* additional buffer description data; + type depends on auxtype */ +}; + +#endif /* BVBUFFDESC_H */ diff --git a/bltsville/bltsville/include/bvcache.h b/bltsville/bltsville/include/bvcache.h new file mode 100644 index 0000000..d9a3f6d --- /dev/null +++ b/bltsville/bltsville/include/bvcache.h @@ -0,0 +1,45 @@ +/* + * bvcache.h + * + * Copyright (C) 2012 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +#ifndef BVCACHE_H_ +#define BVCACHE_H_ + +/* Forward declarations */ +struct bvbuffdesc; +struct bvsurfgeom; +struct bvrect; + +/* + * This defines which cache operation the user intends to use + * BVCACHE_CPU_TO_DEVICE = clean + * BVCACHE_CPU_FROM_DEVICE = invalidate + * BVCACHE_BIDIRECTIONAL = flush + */ +enum bvcacheop { + BVCACHE_BIDIRECTIONAL = 0, + BVCACHE_CPU_TO_DEVICE = 1, + BVCACHE_CPU_FROM_DEVICE = 2, + BVCACHE_RESERVED3 = 3, +}; + +struct bvcopparams { + unsigned int structsize; /* used to identify struct version */ + struct bvbuffdesc *desc; + struct bvsurfgeom *geom; + struct bvrect *rect; + enum bvcacheop cacheop; +}; + +#endif /* BVCACHE_H_ */ diff --git a/bltsville/bltsville/include/bventry.h b/bltsville/bltsville/include/bventry.h new file mode 100644 index 0000000..0ccfc05 --- /dev/null +++ b/bltsville/bltsville/include/bventry.h @@ -0,0 +1,32 @@ +/* + * bventry.h + * + * Copyright (C) 2011 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +#ifndef BVENTRY_H +#define BVENTRY_H + +/* Forward declarations */ +struct bvbuffdesc; +struct bvbltparams; +struct bvcopparams; +/* + * bv_*() - These are the API calls for BLTsville. The client needs to + * import these from the shared library. + */ +typedef enum bverror (*BVFN_MAP)(struct bvbuffdesc *buffdesc); +typedef enum bverror (*BVFN_BLT)(struct bvbltparams *bltparms); +typedef enum bverror (*BVFN_UNMAP)(struct bvbuffdesc *buffdesc); +typedef enum bverror (*BVFN_CACHE)(struct bvcopparams *copparams); + +#endif /* BVENTRY_H */ diff --git a/bltsville/bltsville/include/bverror.h b/bltsville/bltsville/include/bverror.h new file mode 100644 index 0000000..15c3ba7 --- /dev/null +++ b/bltsville/bltsville/include/bverror.h @@ -0,0 +1,307 @@ +/* + * bverror.h + * + * Copyright (C) 2011 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +#ifndef BVERROR_H +#define BVERROR_H + +/* + * bverror - These are error codes returned by BLTsville functions. + */ +#define BVERRDEF_VENDOR_SHIFT 24 +#define BVERRDEF_VENDOR_MASK (0xFF << BVERRDEF_VENDOR_SHIFT) + +#define BVERRDEF_VENDOR_ALL (0x00 << BVERRDEF_VENDOR_SHIFT) +#define BVERRDEF_VENDOR_TI (0x01 << BVERRDEF_VENDOR_SHIFT) +/* 0xF0-0xFF reserved */ + +enum bverror { + BVERR_NONE = 0, /* no error */ + + BVERR_UNK = /* unknown error */ + BVERRDEF_VENDOR_ALL + 1, + BVERR_OOM = /* memory allocation failure */ + BVERRDEF_VENDOR_ALL + 2, + BVERR_RSRC = /* required resource unavailable */ + BVERRDEF_VENDOR_ALL + 3, + + BVERR_VIRTADDR = /* virtaddr is bad */ + BVERRDEF_VENDOR_ALL + 1000, + BVERR_VIRTPTR = + BVERR_VIRTADDR, /* for backwards compatibility*/ + + BVERR_BUFFERDESC = /* invalid bvbufferdesc */ + BVERRDEF_VENDOR_ALL + 10000, + BVERR_BUFFERDESC_VERS = /* bvbufferdesc.structsize too small */ + BVERRDEF_VENDOR_ALL + 11000, + BVERR_BUFFERDESC_VIRTADDR = /* bad bvbufferdesc.virtaddr */ + BVERRDEF_VENDOR_ALL + 12000, + BVERR_BUFFERDESC_LEN = /* bvbufferdesc.length not supported */ + BVERRDEF_VENDOR_ALL + 13000, + BVERR_BUFFERDESC_ALIGNMENT = /* unsupported buffer base address */ + BVERRDEF_VENDOR_ALL + 14000, + + BVERR_BLTPARAMS_VERS = /* bvbltparams.structsize too small */ + BVERRDEF_VENDOR_ALL + 20000, + BVERR_IMPLEMENTATION = /* bvbltparams.implementation unsupported */ + BVERRDEF_VENDOR_ALL + 21000, + BVERR_FLAGS = /* bvbltparams.flags unsupported */ + BVERRDEF_VENDOR_ALL + 22000, + BVERR_OP = /* unsupported operation */ + BVERRDEF_VENDOR_ALL + 22100, + BVERR_KEY = /* type of color key not supported */ + BVERRDEF_VENDOR_ALL + 22200, + BVERR_SRC1_TILE = /* src1 tiling not supported */ + BVERRDEF_VENDOR_ALL + 22300, + BVERR_SRC2_TILE = /* src2 tiling not supported */ + BVERRDEF_VENDOR_ALL + 22310, + BVERR_MASK_TILE = /* mask tiling not supported */ + BVERRDEF_VENDOR_ALL + 22320, + BVERR_FLIP = /* flipping not supported */ + BVERRDEF_VENDOR_ALL + 22400, + BVERR_ROP = /* ROP code not supported */ + BVERRDEF_VENDOR_ALL + 23000, + BVERR_BLEND = /* blend not supported */ + BVERRDEF_VENDOR_ALL + 23100, + BVERR_GLOBAL_ALPHA = /* type of global alpha not supported */ + BVERRDEF_VENDOR_ALL + 23110, + BVERR_FILTER = /* filter type not supported */ + BVERRDEF_VENDOR_ALL + 23200, + BVERR_FILTER_PARAMS_VERS = /* filter parameter structsize too small */ + BVERRDEF_VENDOR_ALL + 23210, + BVERR_FILTER_PARAMS = /* filter parameters not supported */ + BVERRDEF_VENDOR_ALL + 23220, + BVERR_SCALE_MODE = /* bvbltparams.scalemode not supported */ + BVERRDEF_VENDOR_ALL + 24000, + BVERR_DITHER_MODE = /* bvbltparams.dithermode not supported */ + BVERRDEF_VENDOR_ALL + 25000, + + BVERR_DSTDESC = /* invalid bvbltparams.dstdesc */ + BVERRDEF_VENDOR_ALL + 26000, + BVERR_DSTDESC_VERS = /* bvbufferdesc.structsize too small */ + BVERRDEF_VENDOR_ALL + 26100, + BVERR_DSTDESC_VIRTADDR = /* bad bvbufferdesc.virtaddr */ + BVERRDEF_VENDOR_ALL + 26200, + BVERR_DSTDESC_LEN = /* bvbufferdesc.length not supported */ + BVERRDEF_VENDOR_ALL + 26300, + BVERR_DST_ALIGNMENT = /* unsupported buffer base address */ + BVERRDEF_VENDOR_ALL + 26400, + + BVERR_DSTGEOM = /* invalid bvbltparams.dstgeom */ + BVERRDEF_VENDOR_ALL + 27000, + BVERR_DSTGEOM_VERS = /* dstgeom.structsize too small */ + BVERRDEF_VENDOR_ALL + 27100, + BVERR_DSTGEOM_FORMAT = /* bltparams.dstgeom.format not supported */ + BVERRDEF_VENDOR_ALL + 27200, + BVERR_DSTGEOM_STRIDE = /* bltparams.dstgeom.stride not supported */ + BVERRDEF_VENDOR_ALL + 27300, + BVERR_DSTGEOM_PALETTE = /* dstgeom.paletteformat not supported */ + BVERRDEF_VENDOR_ALL + 27400, + + + BVERR_DSTRECT = /* bvbltparams.dstrect not supported */ + BVERRDEF_VENDOR_ALL + 28000, + + BVERR_SRC1DESC = /* invalid bvbltparams.src1.desc */ + BVERRDEF_VENDOR_ALL + 29000, + BVERR_SRC1DESC_VERS = /* bvbufferdesc.structsize too small */ + BVERRDEF_VENDOR_ALL + 29100, + BVERR_SRC1DESC_VIRTADDR = /* bad bvbufferdesc.virtaddr */ + BVERRDEF_VENDOR_ALL + 29200, + BVERR_SRC1DESC_LEN = /* bvbufferdesc.length not supported */ + BVERRDEF_VENDOR_ALL + 29300, + BVERR_SRC1DESC_ALIGNMENT = /* unsupported buffer base address */ + BVERRDEF_VENDOR_ALL + 29400, + + BVERR_SRC1GEOM = /* invalid bvbltparams.src1geom */ + BVERRDEF_VENDOR_ALL + 30000, + BVERR_SRC1GEOM_VERS = /* src1geom.structsize too small */ + BVERRDEF_VENDOR_ALL + 30100, + BVERR_SRC1GEOM_FORMAT = /* bltparams.src1geom.format not supported */ + BVERRDEF_VENDOR_ALL + 30200, + BVERR_SRC1GEOM_STRIDE = /* bltparams.src1geom.stride not supported */ + BVERRDEF_VENDOR_ALL + 30300, + BVERR_SRC1GEOM_PALETTE = /* src1geom.paletteformat not supported */ + BVERRDEF_VENDOR_ALL + 30400, + + BVERR_SRC1RECT = /* bvbltparams.src1rect not supported */ + BVERRDEF_VENDOR_ALL + 31000, + + BVERR_SRC1_HORZSCALE = /* horz scale for src1->dst not supported */ + BVERRDEF_VENDOR_ALL + 31100, + BVERR_SRC1_VERTSCALE = /* vert scale for src1->dst not supported */ + BVERRDEF_VENDOR_ALL + 31200, + BVERR_SRC1_ROT = /* src1->dst rotation angle not supported */ + BVERRDEF_VENDOR_ALL + 31300, + + BVERR_SRC1_TILEPARAMS = /* invalid src1.tileparams */ + BVERR_SRC1DESC, + BVERR_SRC1_TILE_VERS = /* src1.tileparams.structsize too small */ + BVERRDEF_VENDOR_ALL + 32000, + BVERR_SRC1_TILEPARAMS_VERS = + BVERR_SRC1_TILE_VERS, + BVERR_SRC1_TILE_FLAGS = /* tileparams.flags not supported */ + BVERRDEF_VENDOR_ALL + 32100, + BVERR_SRC1_TILEPARAMS_FLAGS = + BVERR_SRC1_TILE_FLAGS, + BVERR_SRC1_TILE_VIRTADDR = + BVERR_SRC1DESC_VIRTADDR, + BVERR_SRC1_TILEPARAMS_VIRTADDR = + BVERR_SRC1_TILE_VIRTADDR, + BVERR_SRC1_TILE_ORIGIN = /* tileparams.left or .top not supported */ + BVERRDEF_VENDOR_ALL + 32200, + BVERR_SRC1_TILEPARAMS_ORIGIN = + BVERR_SRC1_TILE_ORIGIN, + BVERR_SRC1_TILE_SIZE = /* tileparams.width or .height not supported */ + BVERRDEF_VENDOR_ALL + 32300, + BVERR_SRC1_TILEPARAMS_SIZE = + BVERR_SRC1_TILE_SIZE, + + BVERR_SRC2DESC = /* invalid bvbltparams.src2.desc */ + BVERRDEF_VENDOR_ALL + 33000, + BVERR_SRC2DESC_VERS = /* bvbufferdesc.structsize too small */ + BVERRDEF_VENDOR_ALL + 33100, + BVERR_SRC2DESC_VIRTADDR = /* bad bvbufferdesc.virtaddr */ + BVERRDEF_VENDOR_ALL + 33200, + BVERR_SRC2DESC_LEN = /* bvbufferdesc.length not supported */ + BVERRDEF_VENDOR_ALL + 33300, + BVERR_SRC2DESC_ALIGNMENT = /* unsupported buffer base address */ + BVERRDEF_VENDOR_ALL + 33400, + + BVERR_SRC2GEOM = /* invalid bvbltparams.src2geom */ + BVERRDEF_VENDOR_ALL + 34000, + BVERR_SRC2GEOM_VERS = /* src2geom.structsize too small */ + BVERRDEF_VENDOR_ALL + 34100, + BVERR_SRC2GEOM_FORMAT = /* bltparams.src2geom.format not supported */ + BVERRDEF_VENDOR_ALL + 34200, + BVERR_SRC2GEOM_STRIDE = /* bltparams.src2geom.stride not supported */ + BVERRDEF_VENDOR_ALL + 34300, + BVERR_SRC2GEOM_PALETTE = /* src2geom.paletteformat not supported */ + BVERRDEF_VENDOR_ALL + 34400, + + BVERR_SRC2RECT = /* bvbltparams.src2rect not supported */ + BVERRDEF_VENDOR_ALL + 35000, + + BVERR_SRC2_HORZSCALE = /* horz scale for src2->dst not supported */ + BVERRDEF_VENDOR_ALL + 35100, + BVERR_SRC2_VERTSCALE = /* vert scale for src2->dst not supported */ + BVERRDEF_VENDOR_ALL + 35200, + BVERR_SRC2_ROT = /* src2->dst rotation angle not supported */ + BVERRDEF_VENDOR_ALL + 35300, + + BVERR_SRC2_TILEPARAMS = /* invalid src2.tileparams */ + BVERR_SRC2DESC, + BVERR_SRC2_TILE_VERS = /* src2.tileparams.structsize too small */ + BVERRDEF_VENDOR_ALL + 36000, + BVERR_SRC2_TILEPARAMS_VERS = + BVERR_SRC2_TILE_VERS, + BVERR_SRC2_TILE_FLAGS = /* tileparams.flags not supported */ + BVERRDEF_VENDOR_ALL + 36100, + BVERR_SRC2_TILEPARAMS_FLAGS = + BVERR_SRC2_TILE_FLAGS, + BVERR_SRC2_TILE_VIRTADDR = + BVERR_SRC2DESC_VIRTADDR, + BVERR_SRC2_TILEPARAMS_VIRTADDR = + BVERR_SRC2_TILE_VIRTADDR, + BVERR_SRC2_TILE_ORIGIN = /* tileparams.left or .top not supported */ + BVERRDEF_VENDOR_ALL + 36200, + BVERR_SRC2_TILEPARAMS_ORIGIN = + BVERR_SRC2_TILE_ORIGIN, + BVERR_SRC2_TILE_SIZE = /* tileparams.width or .height not supported */ + BVERRDEF_VENDOR_ALL + 36300, + BVERR_SRC2_TILEPARAMS_SIZE = + BVERR_SRC2_TILE_SIZE, + + BVERR_MASKDESC = /* invalid bvbltparams.mask.desc */ + BVERRDEF_VENDOR_ALL + 37000, + BVERR_MASKDESC_VERS = /* bvbufferdesc.structsize too small */ + BVERRDEF_VENDOR_ALL + 37100, + BVERR_MASKDESC_VIRTADDR = /* bad bvbufferdesc.virtaddr */ + BVERRDEF_VENDOR_ALL + 37200, + BVERR_MASKDESC_LEN = /* bvbufferdesc.length not supported */ + BVERRDEF_VENDOR_ALL + 37300, + BVERR_MASKDESC_ALIGNMENT = /* unsupported buffer base address */ + BVERRDEF_VENDOR_ALL + 37400, + + BVERR_MASKGEOM = /* invalid bvbltparams.maskgeom */ + BVERRDEF_VENDOR_ALL + 38000, + BVERR_MASKGEOM_VERS = /* maskgeom.structsize too small */ + BVERRDEF_VENDOR_ALL + 38100, + BVERR_MASKGEOM_FORMAT = /* bltparams.maskgeom.format not supported */ + BVERRDEF_VENDOR_ALL + 38200, + BVERR_MASKGEOM_STRIDE = /* bltparams.maskgeom.stride not supported */ + BVERRDEF_VENDOR_ALL + 38300, + BVERR_MASKGEOM_PALETTE = /* maskgeom.paletteformat not supported */ + BVERRDEF_VENDOR_ALL + 38400, + + BVERR_MASKRECT = /* bvbltparams.maskrect not supported */ + BVERRDEF_VENDOR_ALL + 39000, + + BVERR_MASK_HORZSCALE = /* horz scale for mask->dst not supported */ + BVERRDEF_VENDOR_ALL + 39100, + BVERR_MASK_VERTSCALE = /* vert scale for mask->dst not supported */ + BVERRDEF_VENDOR_ALL + 39200, + BVERR_MASK_ROT = /* mask->dst rotation angle not supported */ + BVERRDEF_VENDOR_ALL + 39300, + + BVERR_MASK_TILEPARAMS = /* invalid mask.tileparams */ + BVERR_MASKDESC, + BVERR_MASK_TILE_VERS = /* mask.tileparams.structsize too small */ + BVERRDEF_VENDOR_ALL + 40000, + BVERR_MASK_TILEPARAMS_VERS = + BVERR_MASK_TILE_VERS, + BVERR_MASK_TILE_FLAGS = /* tileparams.flags not supported */ + BVERRDEF_VENDOR_ALL + 40100, + BVERR_MASK_TILEPARAMS_FLAGS = + BVERR_MASK_TILE_FLAGS, + BVERR_MASK_TILE_VIRTADDR = + BVERR_MASKDESC_VIRTADDR, + BVERR_MASK_TILEPARAMS_VIRTADDR = + BVERR_MASK_TILE_VIRTADDR, + BVERR_MASK_TILE_ORIGIN = /* tileparams.left or .top not supported */ + BVERRDEF_VENDOR_ALL + 40200, + BVERR_MASK_TILEPARAMS_ORIGIN = + BVERR_MASK_TILE_ORIGIN, + BVERR_MASK_TILE_SIZE = /* tileparams.width or .height not supported */ + BVERRDEF_VENDOR_ALL + 40300, + BVERR_MASK_TILEPARAMS_SIZE = + BVERR_MASK_TILE_SIZE, + + BVERR_CLIP_RECT = /* bvbltparams.cliprect not supported */ + BVERRDEF_VENDOR_ALL + 41000, + + BVERR_BATCH_FLAGS = /* bvbltparams.batchflags not supported */ + BVERRDEF_VENDOR_ALL + 42000, + BVERR_BATCH = /* bvbltparams.batch not valid */ + BVERRDEF_VENDOR_ALL + 43000, + + BVERR_OP_FAILED = /* async operation failed to start */ + BVERRDEF_VENDOR_ALL + 50000, + BVERR_OP_INCOMPLETE = /* async operation failed mid-way */ + BVERRDEF_VENDOR_ALL + 50001, + BVERR_MEMORY_ERROR = /* async operation triggered memory error */ + BVERRDEF_VENDOR_ALL + 51000, + + BVERR_FORMAT = /* unsupported format */ + BVERRDEF_VENDOR_ALL + 52000, + + BVERR_CACHEOP = /* unsupported cache operation */ + BVERRDEF_VENDOR_ALL + 60000, + +#ifdef BVERR_EXTERNAL_INCLUDE +#include BVERR_EXTERNAL_INCLUDE +#endif +}; + +#endif /* BVERROR_H */ diff --git a/bltsville/bltsville/include/bvfilter.h b/bltsville/bltsville/include/bvfilter.h new file mode 100644 index 0000000..2c98d94 --- /dev/null +++ b/bltsville/bltsville/include/bvfilter.h @@ -0,0 +1,51 @@ +/* + * bvfilter.h + * + * Copyright (C) 2011 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +/* + * This file defines the types of shared filters available and the associated + * parameters. + * + * To extend the list of filters, create a file containing additional + * enumerations to be added to enum bvfilter below. Then #define + * BVFILTER_EXTERNAL_INCLUDE as the name of that file before including + * this file in your project. Parameters need to be in a different file. + */ + +#ifndef BVFILTER_H +#define BVFILTER_H + +/* + * bvfilter is an enumeration used to designate the type of filter being used. + */ +enum bvfiltertype { + BVFILTER_DUMMY + /* TBD */ + +#ifdef BVFILTER_EXTERNAL_INCLUDE +#include BVFILTER_EXTERNAL_INCLUDE +#endif +}; + +/* + * bvfilterop contains the filter type and a pointer to the associated + * parameters when the BVFLAG_FILTER operation is specified in + * bvbltparams.flags. + */ +struct bvfilter { + enum bvfiltertype filter; + void *params; +}; + +#endif /* BVFILTER_H */ diff --git a/bltsville/bltsville/include/bvinternal.h b/bltsville/bltsville/include/bvinternal.h new file mode 100644 index 0000000..06e1bed --- /dev/null +++ b/bltsville/bltsville/include/bvinternal.h @@ -0,0 +1,47 @@ +/* + * bvinternal.h + * + * Copyright (C) 2011 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +/* + * This file contains definitions used by implementations of BLTsville + * 2-D libraries. It should not be used by clients. + */ + +#ifndef BVINTERNAL_H +#define BVINTENRAL_H + +/* + * bvbuffmap - The bvbuffmap structure is used to track resources + * associated with a buffer, such as a h/w MMU entry. The implementations + * add bvbuffmap objects when they allocate the resources. Then when a + * buffer is accessed, the implementations can regain access to the + * associated resources. The implementations allocate and populate this + * structure when a bv_map() call is made. It is used in subsequent + * bv_blt() and bv_unmap() calls. The latter frees the associated resource + * and the structure (if applicable). Note that a given resource might be + * used by more than one implementation. + */ +struct bvbuffmap { + unsigned int structsize; /* used to ID structure ver */ + + /* function to unmap this resource */ + BVFN_UNMAP bv_unmap; + + unsigned long handle; /* resource-specific info */ + + /* pointer to next resource mapping structure */ + struct bvbuffmap *nextmap; +}; + +#endif /* BVINTERNAL_H */ diff --git a/bltsville/bltsville/include/bvsurfgeom.h b/bltsville/bltsville/include/bvsurfgeom.h new file mode 100644 index 0000000..70029fc --- /dev/null +++ b/bltsville/bltsville/include/bvsurfgeom.h @@ -0,0 +1,41 @@ +/* + * bvsurfgeom.h + * + * Copyright (C) 2011 Texas Instruments, Inc. + * + * This file is part of BLTsville, an open application programming interface + * (API) for accessing 2-D software or hardware implementations. + * + * This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 + * Unported License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to + * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, + * 94041, USA. + */ + +#ifndef BVSURFGEOM_H +#define BVSURFGEOM_H + +/* + * bvsurfdesc - This structure specifies the way a buffer should be used in a + * 2-D context. + */ + +struct bvsurfgeom { + unsigned int structsize; /* used to identify struct version */ + enum ocdformat format; /* color format of surface */ + unsigned int width; /* width of the surface in pixels */ + unsigned int height; /* height of the surface in lines */ + int orientation; /* angle of the surface in degrees + (multiple of 90 only) */ + long virtstride; /* distance from one pixel to the + pixel immediately below it in + virtual space */ + enum ocdformat paletteformat; /* format of palette */ + void *palette; /* array of palette entries of + paletteformat; only valid when + format includes BVFMTDEF_LUT; + number of entries is 2^bpp. */ +}; + +#endif /* BVSURFGEOM_H */ |