diff options
Diffstat (limited to 'libpixelflinger/codeflinger/load_store.cpp')
-rw-r--r-- | libpixelflinger/codeflinger/load_store.cpp | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/libpixelflinger/codeflinger/load_store.cpp b/libpixelflinger/codeflinger/load_store.cpp index e5a1ae010..d68f6dc73 100644 --- a/libpixelflinger/codeflinger/load_store.cpp +++ b/libpixelflinger/codeflinger/load_store.cpp @@ -2,22 +2,24 @@ ** ** Copyright 2006, 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 +** 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 +** 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 +** 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 <assert.h> #include <stdio.h> -#include <cutils/log.h> + +#include <android/log.h> + #include "GGLAssembler.h" namespace android { @@ -25,7 +27,7 @@ namespace android { // ---------------------------------------------------------------------------- void GGLAssembler::store(const pointer_t& addr, const pixel_t& s, uint32_t flags) -{ +{ const int bits = addr.size; const int inc = (flags & WRITE_BACK)?1:0; switch (bits) { @@ -59,8 +61,8 @@ void GGLAssembler::store(const pointer_t& addr, const pixel_t& s, uint32_t flags } void GGLAssembler::load(const pointer_t& addr, const pixel_t& s, uint32_t flags) -{ - Scratch scratches(registerFile()); +{ + Scratch scratches(registerFile()); int s0; const int bits = addr.size; @@ -72,7 +74,7 @@ void GGLAssembler::load(const pointer_t& addr, const pixel_t& s, uint32_t flags) break; case 24: // 24 bits formats are a little special and used only for RGB - // R,G,B is packed as 0x00BBGGRR + // R,G,B is packed as 0x00BBGGRR s0 = scratches.obtain(); if (s.reg != addr.reg) { LDRB(AL, s.reg, addr.reg, immed12_pre(0)); // R @@ -90,7 +92,7 @@ void GGLAssembler::load(const pointer_t& addr, const pixel_t& s, uint32_t flags) } if (inc) ADD(AL, 0, addr.reg, addr.reg, imm(3)); - break; + break; case 16: if (inc) LDRH(AL, s.reg, addr.reg, immed8_post(2)); else LDRH(AL, s.reg, addr.reg); @@ -112,7 +114,7 @@ void GGLAssembler::extract(integer_t& d, int s, int h, int l, int bits) assert(maskLen<=8); #endif assert(h); - + if (h != bits) { const int mask = ((1<<maskLen)-1) << l; if (isValidImmediate(mask)) { @@ -126,12 +128,12 @@ void GGLAssembler::extract(integer_t& d, int s, int h, int l, int bits) } s = d.reg; } - + if (l) { MOV(AL, 0, d.reg, reg_imm(s, LSR, l)); // component = packed >> l; s = d.reg; } - + if (s != d.reg) { MOV(AL, 0, d.reg, s); } @@ -212,12 +214,12 @@ void GGLAssembler::expand(integer_t& dst, const integer_t& src, int dbits) } while(dbits>0); return; } - + dbits -= sbits; do { ORR(AL, 0, d, s, reg_imm(s, LSL, sbits)); // d |= d<<sbits; - s = d; + s = d; dbits -= sbits; if (sbits*2 < dbits) { sbits *= 2; @@ -241,14 +243,14 @@ void GGLAssembler::downshift( int dl = d.format.c[component].l; int dbits = dh - dl; int dithering = 0; - + ALOGE_IF(sbits<dbits, "sbits (%d) < dbits (%d) in downshift", sbits, dbits); if (sbits>dbits) { // see if we need to dither dithering = mDithering; } - + int ireg = d.reg; if (!(d.flags & FIRST)) { if (s.flags & CORRUPTIBLE) { @@ -271,7 +273,7 @@ void GGLAssembler::downshift( if (isValidImmediate(mask) || isValidImmediate(~mask)) { build_and_immediate(ireg, s.reg, mask, 32); sl = offset; - s.reg = ireg; + s.reg = ireg; sbits = dbits; maskLoBits = maskHiBits = 0; } @@ -281,7 +283,7 @@ void GGLAssembler::downshift( const uint32_t mask = ((1<<sbits)-1) << sl; if (isValidImmediate(mask) || isValidImmediate(~mask)) { build_and_immediate(ireg, s.reg, mask, 32); - s.reg = ireg; + s.reg = ireg; maskLoBits = maskHiBits = 0; } } @@ -325,7 +327,7 @@ void GGLAssembler::downshift( MOV(AL, 0, ireg, reg_imm(s.reg, LSR, sl)); sh -= sl; sl = 0; - s.reg = ireg; + s.reg = ireg; } // scaling (V-V>>dbits) SUB(AL, 0, ireg, s.reg, reg_imm(s.reg, LSR, dbits)); @@ -333,7 +335,7 @@ void GGLAssembler::downshift( if (shift>0) ADD(AL, 0, ireg, ireg, reg_imm(dither.reg, LSR, shift)); else if (shift<0) ADD(AL, 0, ireg, ireg, reg_imm(dither.reg, LSL,-shift)); else ADD(AL, 0, ireg, ireg, dither.reg); - s.reg = ireg; + s.reg = ireg; } if ((maskLoBits|dithering) && (sh > dbits)) { |