void Surface::Set(u32 sw, u32 sh, const SurfaceFormat & fm) { FreeSurface(*this); #if SDL_VERSION_ATLEAST(2, 0, 0) surface = SDL_CreateRGBSurface(0, sw, sh, fm.depth, fm.rmask, fm.gmask, fm.bmask, fm.amask); #else surface = SDL_CreateRGBSurface(SDL_SWSURFACE, sw, sh, fm.depth, fm.rmask, fm.gmask, fm.bmask, fm.amask); #endif if(!surface) Error::Except(__FUNCTION__, SDL_GetError()); if(8 == depth()) { SetPalette(); Fill(fm.ckey); SetColorKey(fm.ckey); } else if(amask()) { #if SDL_VERSION_ATLEAST(2, 0, 0) Fill(RGBA(0, 0, 0, 0)); // no color key only amask #else Fill(RGBA(fm.ckey.r(), fm.ckey.g(), fm.ckey.b(), 0)); SetColorKey(fm.ckey); #endif } else if(fm.ckey.pack()) { Fill(fm.ckey); SetColorKey(fm.ckey); } if(amask()) { #if SDL_VERSION_ATLEAST(2, 0, 0) SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND); #else SDL_SetAlpha(surface, SDL_SRCALPHA, 255); #endif } else { #if SDL_VERSION_ATLEAST(2, 0, 0) SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE); #else SDL_SetAlpha(surface, 0, 0); #endif } }
static void __init sx164_init_arch(void) { /* */ struct percpu_struct *cpu = (struct percpu_struct*) ((char*)hwrpb + hwrpb->processor_offset); if (amask(AMASK_MAX) != 0 && alpha_using_srm && (cpu->pal_revision & 0xffff) <= 0x117) { __asm__ __volatile__( "lda $16,8($31)\n" "call_pal 9\n" /* */ ".long 0x64000118\n\n" /* */ "ldah $16,(1<<(19-16))($31)\n" "or $0,$16,$0\n" /* */ ".long 0x74000118\n" /* */ "lda $16,9($31)\n" "call_pal 9" /* */ : : : "$0", "$16"); printk("PCA56 MVI set enabled\n"); }
asmlinkage void do_entArith(unsigned long summary, unsigned long write_mask, struct pt_regs *regs) { long si_code = FPE_FLTINV; siginfo_t info; if (summary & 1) { /* Software-completion summary bit is set, so try to emulate the instruction. If the processor supports precise exceptions, we don't have to search. */ if (!amask(AMASK_PRECISE_TRAP)) si_code = alpha_fp_emul(regs->pc - 4); else si_code = alpha_fp_emul_imprecise(regs, write_mask); if (si_code == 0) return; } die_if_kernel("Arithmetic fault", regs, 0, NULL); info.si_signo = SIGFPE; info.si_errno = 0; info.si_code = si_code; info.si_addr = (void __user *) regs->pc; send_sig_info(SIGFPE, &info, current); }
static void __init sx164_init_arch(void) { /* * OSF palcode v1.23 forgets to enable PCA56 Motion Video * Instructions. Let's enable it. * We have to check palcode revision because CSERVE interface * is subject to change without notice. For example, it * has been changed completely since v1.16 (found in MILO * distribution). -ink */ struct percpu_struct *cpu = (struct percpu_struct*) ((char*)hwrpb + hwrpb->processor_offset); if (amask(AMASK_MAX) != 0 && alpha_using_srm && (cpu->pal_revision & 0xffff) <= 0x117) { __asm__ __volatile__( "lda $16,8($31)\n" "call_pal 9\n" /* Allow PALRES insns in kernel mode */ ".long 0x64000118\n\n" /* hw_mfpr $0,icsr */ "ldah $16,(1<<(19-16))($31)\n" "or $0,$16,$0\n" /* set MVE bit */ ".long 0x74000118\n" /* hw_mtpr $0,icsr */ "lda $16,9($31)\n" "call_pal 9" /* Disable PALRES insns */ : : : "$0", "$16"); printk("PCA56 MVI set enabled\n"); }
asmlinkage void do_entArith(unsigned long summary, unsigned long write_mask, struct pt_regs *regs) { long si_code = FPE_FLTINV; siginfo_t info; if (summary & 1) { /* */ if (!amask(AMASK_PRECISE_TRAP)) si_code = alpha_fp_emul(regs->pc - 4); else si_code = alpha_fp_emul_imprecise(regs, write_mask); if (si_code == 0) return; } die_if_kernel("Arithmetic fault", regs, 0, NULL); info.si_signo = SIGFPE; info.si_errno = 0; info.si_code = si_code; info.si_addr = (void __user *) regs->pc; send_sig_info(SIGFPE, &info, current); }
asmlinkage void do_entArith(unsigned long summary, unsigned long write_mask, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5, struct pt_regs regs) { if (summary & 1) { /* Software-completion summary bit is set, so try to emulate the instruction. */ if (!amask(AMASK_PRECISE_TRAP)) { /* 21264 (except pass 1) has precise exceptions. */ if (alpha_fp_emul(regs.pc - 4)) return; } else { if (alpha_fp_emul_imprecise(®s, write_mask)) return; } } #if 0 printk("%s: arithmetic trap at %016lx: %02lx %016lx\n", current->comm, regs.pc, summary, write_mask); #endif die_if_kernel("Arithmetic fault", ®s, 0, 0); send_sig(SIGFPE, current, 1); }
/* format surface */ void Surface::SetDisplayFormat(void) { if(surface) { SDL_Surface *osurface = surface; surface = amask() ? SDL_DisplayFormatAlpha(osurface) : SDL_DisplayFormat(osurface); if(osurface) SDLFreeSurface(osurface); } }
/* set color key */ void Surface::SetDefaultColorKey(void) { if(isValid()) { const u32 clkey = amask() ? SDL_MapRGBA(surface->format, 0xFF, 0, 0xFF, 0) : SDL_MapRGB(surface->format, 0xFF, 0, 0xFF); Fill(clkey); SetColorKey(clkey); } }
u32 Surface::GetColorKey(void) const { #if SDL_VERSION_ATLEAST(2, 0, 0) if(isValid() && ! amask()) { u32 res = 0; SDL_GetColorKey(surface, &res); return res; } return 0; #else return isValid() && (surface->flags & SDL_SRCCOLORKEY) ? surface->format->colorkey : 0; #endif }
RGBA Surface::GetRGB(u32 pixel) const { u8 r = 0; u8 g = 0; u8 b = 0; u8 a = 0; if(amask()) { SDL_GetRGBA(pixel, surface->format, &r, &g, &b, &a); return RGBA(r, g, b, a); } SDL_GetRGB(pixel, surface->format, &r, &g, &b); return RGBA(r, g, b); }
av_cold void ff_idctdsp_init_alpha(IDCTDSPContext *c, AVCodecContext *avctx, unsigned high_bit_depth) { /* amask clears all bits that correspond to present features. */ if (amask(AMASK_MVI) == 0) { c->put_pixels_clamped = put_pixels_clamped_mvi_asm; c->add_pixels_clamped = add_pixels_clamped_mvi_asm; } put_pixels_clamped_axp_p = c->put_pixels_clamped; add_pixels_clamped_axp_p = c->add_pixels_clamped; if (!high_bit_depth && !avctx->lowres && (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) { c->idct_put = ff_simple_idct_put_axp; c->idct_add = ff_simple_idct_add_axp; c->idct = ff_simple_idct_axp; } }
void Surface::GetRGB(u32 pixel, u8 *r, u8 *g, u8 *b, u8 *a) const { return amask() && a ? SDL_GetRGBA(pixel, surface->format, r, g, b, a) : SDL_GetRGB(pixel, surface->format, r, g, b); }
u32 Surface::MapRGB(u8 r, u8 g, u8 b, u8 a) const { return amask() ? SDL_MapRGBA(surface->format, r, g, b, a) : SDL_MapRGB(surface->format, r, g, b); }
u32 Surface::MapRGB(const RGBA & color) const { return amask() ? SDL_MapRGBA(surface->format, color.r(), color.g(), color.b(), color.a()) : SDL_MapRGB(surface->format, color.r(), color.g(), color.b()); }