Commit 8bbe9411 by Wolfgang Wiedmeyer

remove proprietary bltsville code

Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
1 parent 7ad6643d
Showing with 0 additions and 2229 deletions
#
# Copyright (C) 2011 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include $(call all-subdir-makefiles)
Welcome to the bltsville & friends repositoty. Please add 2D
acceleration libs, src, and supporting headers in whatver manner you
see fit.
Thanks!
\ No newline at end of file
git://github.com/graphics/bltsville.git
/*
* 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 */
/*
* 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_ */
/*
* 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 */
/*
* 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 */
/*
* 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 */
/*
* 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 */
This diff could not be displayed because it is too large.
#
# Copyright (c) 2012,
# Texas Instruments, Inc. and Vivante Corporation.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Texas Instruments, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL TEXAS INSTRUMENTS, INC. BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
gcmain.c \
mirror/gcbv.c \
mirror/gcparser.c \
mirror/gcmap.c \
mirror/gcbuffer.c \
mirror/gcfill.c \
mirror/gcblit.c \
mirror/gcfilter.c \
mirror/gcdbglog.c
LOCAL_CFLAGS :=
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/mirror \
$(LOCAL_PATH)/mirror/include \
$(LOCAL_PATH)/../bltsville/include \
$(LOCAL_PATH)/../ocd/include
VERSION_H := $(LOCAL_PATH)/version.h
BV_VERSION := $(shell grep "VER_FILEVERSION_STR" $(VERSION_H) | sed "s,.*\"\([0-9.]*\)\\\0.*,\1,")
LOCAL_SHARED_LIBRARIES := \
libcutils \
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libbltsville_gc2d
LOCAL_MODULE_SUFFIX := .$(BV_VERSION).so
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/../vendor/lib
include $(BUILD_SHARED_LIBRARY)
#Creating SymLinks
#libbltsville_gc2d.so -> libbltsville_gc2d.VERSION.so
#libbltsville_hw2d.so -> libbltsville_gc2d.so
SYMLINKS := $(TARGET_OUT_VENDOR)/lib/libbltsville_gc2d.so
$(SYMLINKS): GC2D_BINARY := ./$(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX)
$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk
@echo "Symlink: $@ -> $(GC2D_BINARY)"
@rm -rf $@
$(hide) ln -fs $(GC2D_BINARY) $@
SYMLINKS1 := $(TARGET_OUT_VENDOR)/lib/libbltsville_hw2d.so
$(SYMLINKS1): LINK_BINARY := ./libbltsville_gc2d.so
$(SYMLINKS1): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk
@echo "Symlink: $@ -> $(LINK_BINARY)"
@rm -rf $@
$(hide) ln -fs $(LINK_BINARY) $@
ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) $(SYMLINKS1)
# for mm/mmm
all_modules: $(SYMLINKS) $(SYMLINKS1)
/*
* Copyright (c) 2012,
* Texas Instruments, Inc. and Vivante Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Texas Instruments, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL TEXAS INSTRUMENTS, INC. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GCMAIN_H
#define GCMAIN_H
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <gcx.h>
#include <gcioctl.h>
#include <bltsville.h>
#include <bvinternal.h>
#include <bverror.h>
#define GC_DEV_NAME "gc2duser"
/*******************************************************************************
* Miscellaneous macros.
*/
/* Not present in userspace bltsville headers */
#define BVAT_PHYSDESC 0xDEADBEEF
#define gcalloc(type, size) \
(type *) malloc(size)
#define gcfree(ptr) \
free(ptr)
#define max(x, y) (x > y ? x : y)
#define min(x, y) (x < y ? x : y)
#define EXPORT_SYMBOL(sym)
#define gc_debug_blt(...)
typedef int64_t s64;
typedef uint64_t u64;
#define div_u64(x, y) ((x) / (y))
#define div_s64(x, y) ((x) / (y))
#define div64_u64(x, y) ((x) / (y))
#define div64_s64(x, y) ((x) / (y))
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
/*******************************************************************************
* Not defined in bltsville userspace headers.
*/
struct bvphysdesc {
unsigned int structsize; /* used to identify struct version */
unsigned long pagesize; /* page size in bytes */
unsigned long *pagearray; /* array of physical pages */
unsigned int pagecount; /* number of pages in the pagearray */
unsigned long pageoffset; /* page offset in bytes */
};
/*******************************************************************************
* IOCTL wrappers.
*/
void gc_getcaps_wrapper(struct gcicaps *gcicaps);
void gc_map_wrapper(struct gcimap *gcimap);
void gc_unmap_wrapper(struct gcimap *gcimap);
void gc_commit_wrapper(struct gcicommit *gcicommit);
void gc_callback_wrapper(struct gcicallbackarm *gcicallbackarm);
/*******************************************************************************
* Surface allocation.
*/
enum bverror allocate_surface(struct bvbuffdesc **bvbuffdesc,
void **buffer,
unsigned int size);
void free_surface(struct bvbuffdesc *bvbuffdesc,
void *buffer);
/*******************************************************************************
* Floating point conversions.
*/
unsigned char gcfp2norm8(float value);
/*******************************************************************************
* Cache operation wrapper.
*/
enum bverror gcbvcacheop(int count, struct c2dmrgn rgn[],
enum bvcacheop cacheop);
/*******************************************************************************
* BLTsville API.
*/
void bv_init(void);
void bv_exit(void);
enum bverror bv_map(struct bvbuffdesc *buffdesc);
enum bverror bv_unmap(struct bvbuffdesc *buffdesc);
enum bverror bv_blt(struct bvbltparams *bltparams);
enum bverror bv_cache(struct bvcopparams *copparams);
#endif
/*
* Copyright(c) 2012,
* Texas Instruments, Inc. and Vivante Corporation.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Vivante Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "gcbv.h"
#define GCZONE_NONE 0
#define GCZONE_ALL (~0U)
#define GCZONE_COLOR (1 << 0)
#define GCZONE_FILL (1 << 1)
GCDBG_FILTERDEF(fill, GCZONE_NONE,
"color",
"fill")
static inline unsigned int extract_component(unsigned int pixel,
const struct bvcomponent *desc)
{
unsigned int component;
unsigned int component8;
component = (pixel & desc->mask) >> desc->shift;
GCDBG(GCZONE_COLOR, "mask=0x%08X, shift=%d, component=0x%08X\n",
desc->mask, desc->shift, component);
switch (desc->size) {
case 0:
component8 = 0xFF;
GCDBG(GCZONE_COLOR, "component8=0x%08X\n", component8);
break;
case 1:
component8 = component ? 0xFF : 0x00;
GCDBG(GCZONE_COLOR, "component8=0x%08X\n", component8);
break;
case 4:
component8 = component | (component << 4);
GCDBG(GCZONE_COLOR, "component8=0x%08X\n", component8);
break;
case 5:
component8 = (component << 3) | (component >> 2);
GCDBG(GCZONE_COLOR, "component8=0x%08X\n", component8);
break;
case 6:
component8 = (component << 2) | (component >> 4);
GCDBG(GCZONE_COLOR, "component8=0x%08X\n", component8);
break;
default:
component8 = component;
GCDBG(GCZONE_COLOR, "component8=0x%08X\n", component8);
}
return component8;
}
static unsigned int getinternalcolor(void *ptr, struct bvformatxlate *format)
{
unsigned int srcpixel, dstpixel;
unsigned int r, g, b, a;
switch (format->bitspp) {
case 16:
srcpixel = *(unsigned short *) ptr;
GCDBG(GCZONE_COLOR, "srcpixel=0x%08X\n", srcpixel);
break;
case 32:
srcpixel = *(unsigned int *) ptr;
GCDBG(GCZONE_COLOR, "srcpixel=0x%08X\n", srcpixel);
break;
default:
srcpixel = 0;
GCDBG(GCZONE_COLOR, "srcpixel=0x%08X\n", srcpixel);
}
r = extract_component(srcpixel, &format->cs.rgb.comp->r);
g = extract_component(srcpixel, &format->cs.rgb.comp->g);
b = extract_component(srcpixel, &format->cs.rgb.comp->b);
a = extract_component(srcpixel, &format->cs.rgb.comp->a);
GCDBG(GCZONE_COLOR, "(r,g,b,a)=0x%02X,0x%02X,0x%02X,0x%02X\n",
r, g, b, a);
dstpixel = (a << 24) | (r << 16) | (g << 8) | b;
GCDBG(GCZONE_COLOR, "dstpixel=0x%08X\n", dstpixel);
return dstpixel;
}
enum bverror do_fill(struct bvbltparams *bvbltparams,
struct gcbatch *batch,
struct surfaceinfo *srcinfo)
{
enum bverror bverror;
struct gccontext *gccontext = get_context();
struct surfaceinfo *dstinfo;
struct gcmofill *gcmofill;
unsigned char *fillcolorptr;
struct bvbuffmap *dstmap = NULL;
GCENTER(GCZONE_FILL);
/* Finish previous batch if any. */
bverror = batch->batchend(bvbltparams, batch);
if (bverror != BVERR_NONE)
goto exit;
/* Parse destination parameters. */
bverror = parse_destination(bvbltparams, batch);
if (bverror != BVERR_NONE)
goto exit;
/* Setup rotation. */
process_dest_rotation(bvbltparams, batch);
/* Get a shortcut to the destination surface. */
dstinfo = &batch->dstinfo;
/* Verify if the destination parameter have been modified. */
if ((batch->dstbyteshift != dstinfo->bytealign) ||
(batch->dstphyswidth != dstinfo->physwidth) ||
(batch->dstphysheight != dstinfo->physheight)) {
/* Set new values. */
batch->dstbyteshift = dstinfo->bytealign;
batch->dstphyswidth = dstinfo->physwidth;
batch->dstphysheight = dstinfo->physheight;
/* Mark as modified. */
batch->batchflags |= BVBATCH_DST;
}
/* Map the destination. */
bverror = do_map(bvbltparams->dstdesc, batch, &dstmap);
if (bverror != BVERR_NONE) {
bvbltparams->errdesc = gccontext->bverrorstr;
goto exit;
}
/* Set the new destination. */
bverror = set_dst(bvbltparams, batch, dstmap);
if (bverror != BVERR_NONE)
goto exit;
/* Reset the modified flag. */
batch->batchflags &= ~(BVBATCH_DST |
BVBATCH_CLIPRECT |
BVBATCH_DESTRECT);
/***********************************************************************
** Allocate command buffer.
*/
bverror = claim_buffer(bvbltparams, batch,
sizeof(struct gcmofill),
(void **) &gcmofill);
if (bverror != BVERR_NONE)
goto exit;
/***********************************************************************
** Set dummy source.
*/
/* Set surface dummy width and height. */
gcmofill->src.rotation_ldst = gcmofillsrc_rotation_ldst;
gcmofill->src.rotation.raw = 0;
gcmofill->src.rotation.reg.surf_width = 1;
gcmofill->src.config.raw = 0;
gcmofill->src.rotationheight_ldst = gcmofillsrc_rotationheight_ldst;
gcmofill->src.rotationheight.reg.height = 1;
gcmofill->src.rotationangle.raw = 0;
gcmofill->src.rotationangle.reg.dst = GCREG_ROT_ANGLE_ROT0;
gcmofill->src.rotationangle.reg.dst_mirror = GCREG_MIRROR_NONE;
/* Disable alpha blending. */
gcmofill->src.alphacontrol_ldst = gcmofillsrc_alphacontrol_ldst;
gcmofill->src.alphacontrol.raw = 0;
gcmofill->src.alphacontrol.reg.enable = GCREG_ALPHA_CONTROL_ENABLE_OFF;
/***********************************************************************
** Set fill color.
*/
fillcolorptr
= (unsigned char *) srcinfo->buf.desc->virtaddr
+ srcinfo->rect.top * srcinfo->geom->virtstride
+ srcinfo->rect.left * srcinfo->format.bitspp / 8;
gcmofill->clearcolor_ldst = gcmofill_clearcolor_ldst;
gcmofill->clearcolor.raw = getinternalcolor(fillcolorptr,
&srcinfo->format);
/***********************************************************************
** Configure and start fill.
*/
/* Set destination configuration. */
gcmofill->dstconfig_ldst = gcmofill_dstconfig_ldst;
gcmofill->dstconfig.raw = 0;
gcmofill->dstconfig.reg.swizzle = dstinfo->format.swizzle;
gcmofill->dstconfig.reg.format = dstinfo->format.format;
gcmofill->dstconfig.reg.command = GCREG_DEST_CONFIG_COMMAND_CLEAR;
/* Set ROP3. */
gcmofill->rop_ldst = gcmofill_rop_ldst;
gcmofill->rop.raw = 0;
gcmofill->rop.reg.type = GCREG_ROP_TYPE_ROP3;
gcmofill->rop.reg.fg = (unsigned char) bvbltparams->op.rop;
/* Set START_DE command. */
gcmofill->startde.cmd.fld = gcfldstartde;
/* Set destination rectangle. */
gcmofill->rect.left = batch->dstadjusted.left;
gcmofill->rect.top = batch->dstadjusted.top;
gcmofill->rect.right = batch->dstadjusted.right;
gcmofill->rect.bottom = batch->dstadjusted.bottom;
exit:
GCEXITARG(GCZONE_FILL, "bv%s = %d\n",
(bverror == BVERR_NONE) ? "result" : "error", bverror);
return bverror;
}
/*
* Copyright(c) 2012,
* Texas Instruments, Inc. and Vivante Corporation.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Vivante Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "gcbv.h"
#define GCZONE_NONE 0
#define GCZONE_ALL (~0U)
#define GCZONE_MAPPING (1 << 0)
GCDBG_FILTERDEF(map, GCZONE_NONE,
"mapping")
/*******************************************************************************
* Memory management.
*/
enum bverror do_map(struct bvbuffdesc *bvbuffdesc,
struct gcbatch *batch,
struct bvbuffmap **map)
{
static const int mapsize
= sizeof(struct bvbuffmap)
+ sizeof(struct bvbuffmapinfo);
enum bverror bverror;
struct gccontext *gccontext = get_context();
struct bvbuffmap *bvbuffmap;
struct bvbuffmapinfo *bvbuffmapinfo;
struct bvphysdesc *bvphysdesc;
bool mappedbyothers;
struct gcimap gcimap;
struct gcschedunmap *gcschedunmap;
GCENTERARG(GCZONE_MAPPING, "bvbuffdesc = 0x%08X\n",
(unsigned int) bvbuffdesc);
/* Lock access to the mapping list. */
GCLOCK(&gccontext->maplock);
/* Try to find existing mapping. */
bvbuffmap = bvbuffdesc->map;
while (bvbuffmap