180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2009 The Android Open Source Project 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkBitmapProcState_opts_SSE2.h" 980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkBitmapProcState_opts_SSSE3.h" 1058190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger#include "SkBitmapFilter_opts_SSE2.h" 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkBlitMask.h" 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkBlitRow.h" 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkBlitRect_opts_SSE2.h" 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkBlitRow_opts_SSE2.h" 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkUtils_opts_SSE2.h" 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkUtils.h" 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1858190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger#include "SkRTConf.h" 1958190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if defined(_MSC_VER) && defined(_WIN64) 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include <intrin.h> 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* This file must *not* be compiled with -msse or -msse2, otherwise 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru gcc may generate sse2 even for scalar ops (and thus give an invalid 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru instruction on Pentium3 on the code below). Only files named *_SSE2.cpp 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru in this directory should be compiled with -msse2. */ 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifdef _MSC_VER 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic inline void getcpuid(int info_type, int info[4]) { 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if defined(_WIN64) 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru __cpuid(info, info_type); 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else 3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru __asm { 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru mov eax, [info_type] 3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cpuid 3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru mov edi, [info] 3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru mov [edi], eax 4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru mov [edi+4], ebx 4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru mov [edi+8], ecx 4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru mov [edi+12], edx 4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else 4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if defined(__x86_64__) 4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic inline void getcpuid(int info_type, int info[4]) { 4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru asm volatile ( 5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "cpuid \n\t" 5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru : "=a"(info[0]), "=b"(info[1]), "=c"(info[2]), "=d"(info[3]) 5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru : "a"(info_type) 5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ); 5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else 5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic inline void getcpuid(int info_type, int info[4]) { 5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // We save and restore ebx, so this code can be compatible with -fPIC 5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru asm volatile ( 5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "pushl %%ebx \n\t" 6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "cpuid \n\t" 6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "movl %%ebx, %1 \n\t" 6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru "popl %%ebx \n\t" 6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3]) 6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru : "a"(info_type) 6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ); 6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if defined(__x86_64__) || defined(_WIN64) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* All x86_64 machines have SSE2, or we know it's supported at compile time, so don't even bother checking. */ 7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic inline bool hasSSE2() { 7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return true; 7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else 7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic inline bool hasSSE2() { 7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru int cpu_info[4] = { 0 }; 7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru getcpuid(1, cpu_info); 8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return (cpu_info[3] & (1<<26)) != 0; 8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3 8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* If we know SSSE3 is supported at compile time, don't even bother checking. */ 8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic inline bool hasSSSE3() { 8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return true; 8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#else 9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic inline bool hasSSSE3() { 9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru int cpu_info[4] = { 0 }; 9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru getcpuid(1, cpu_info); 9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return (cpu_info[2] & 0x200) != 0; 9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic bool cachedHasSSE2() { 9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static bool gHasSSE2 = hasSSE2(); 10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return gHasSSE2; 10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic bool cachedHasSSSE3() { 10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static bool gHasSSSE3 = hasSSSE3(); 10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return gHasSSSE3; 10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 10858190644c30e1c4aa8e527f3503c58f841e0fcf3Derek SollenbergerSK_CONF_DECLARE( bool, c_hqfilter_sse, "bitmap.filter.highQualitySSE", false, "Use SSE optimized version of high quality image filters"); 10958190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger 11058190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenbergervoid SkBitmapProcState::platformConvolutionProcs() { 11158190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger if (cachedHasSSE2()) { 11258190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger fConvolutionProcs->fExtraHorizontalReads = 3; 11358190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger fConvolutionProcs->fConvolveVertically = &convolveVertically_SSE2; 11458190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger fConvolutionProcs->fConvolve4RowsHorizontally = &convolve4RowsHorizontally_SSE2; 11558190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger fConvolutionProcs->fConvolveHorizontally = &convolveHorizontally_SSE2; 11658190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger fConvolutionProcs->fApplySIMDPadding = &applySIMDPadding_SSE2; 11758190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger } 11858190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger} 11958190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger 12080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruvoid SkBitmapProcState::platformProcs() { 12180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSSE3()) { 12280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (fSampleProc32 == S32_opaque_D32_filter_DX) { 12380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3; 12480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { 12580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3; 12680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 12780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (fSampleProc32 == S32_opaque_D32_filter_DXDY) { 12980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fSampleProc32 = S32_opaque_D32_filter_DXDY_SSSE3; 13080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else if (fSampleProc32 == S32_alpha_D32_filter_DXDY) { 13180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fSampleProc32 = S32_alpha_D32_filter_DXDY_SSSE3; 13280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 13380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else if (cachedHasSSE2()) { 13480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (fSampleProc32 == S32_opaque_D32_filter_DX) { 13580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fSampleProc32 = S32_opaque_D32_filter_DX_SSE2; 13680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { 13780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fSampleProc32 = S32_alpha_D32_filter_DX_SSE2; 13880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 13980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (fSampleProc16 == S32_D16_filter_DX) { 14180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fSampleProc16 = S32_D16_filter_DX_SSE2; 14280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 14380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 14480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSSE3() || cachedHasSSE2()) { 14680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (fMatrixProc == ClampX_ClampY_filter_scale) { 14780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fMatrixProc = ClampX_ClampY_filter_scale_SSE2; 14880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else if (fMatrixProc == ClampX_ClampY_nofilter_scale) { 14980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fMatrixProc = ClampX_ClampY_nofilter_scale_SSE2; 15080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 15180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 15280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (fMatrixProc == ClampX_ClampY_filter_affine) { 15380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fMatrixProc = ClampX_ClampY_filter_affine_SSE2; 15480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else if (fMatrixProc == ClampX_ClampY_nofilter_affine) { 15580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru fMatrixProc = ClampX_ClampY_nofilter_affine_SSE2; 15680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 15758190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger if (c_hqfilter_sse) { 15858190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger if (fShaderProc32 == highQualityFilter) { 15958190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger fShaderProc32 = highQualityFilter_SSE2; 16058190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger } 16158190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger } 16280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 16380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 16480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 16580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic SkBlitRow::Proc32 platform_32_procs[] = { 16680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru NULL, // S32_Opaque, 16780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru S32_Blend_BlitRow32_SSE2, // S32_Blend, 16880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque 16980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru S32A_Blend_BlitRow32_SSE2, // S32A_Blend, 17080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}; 17180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 17280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) { 17380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 17480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 17580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 17680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkBlitRow::ColorProc SkBlitRow::PlatformColorProc() { 17780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSE2()) { 17880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return Color32_SSE2; 17980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else { 18080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 18180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 18280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 18380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 18480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { 18580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSE2()) { 18680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return platform_32_procs[flags]; 18780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else { 18880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 18980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 19080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 19180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 19280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 19380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig, 19480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkMask::Format maskFormat, 19580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkColor color) { 19680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (SkMask::kA8_Format != maskFormat) { 19780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 19880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 19980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 20080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ColorProc proc = NULL; 20180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSE2()) { 20280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru switch (dstConfig) { 20380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru case SkBitmap::kARGB_8888_Config: 20480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // The SSE2 version is not (yet) faster for black, so we check 20580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // for that. 20680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (SK_ColorBLACK != color) { 20780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru proc = SkARGB32_A8_BlitMask_SSE2; 20880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 20980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru break; 21080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru default: 21180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru break; 21280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 21380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 21480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return proc; 21580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 21680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 21780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkBlitMask::BlitLCD16RowProc SkBlitMask::PlatformBlitRowProcs16(bool isOpaque) { 21880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSE2()) { 21980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (isOpaque) { 22080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return SkBlitLCD16OpaqueRow_SSE2; 22180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else { 22280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return SkBlitLCD16Row_SSE2; 22380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 22480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else { 22580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 22680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 22780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 22880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 22980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig, 23080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkMask::Format maskFormat, 23180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru RowFlags flags) { 23280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 23380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 23480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 23580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkMemset16Proc SkMemset16GetPlatformProc() { 23680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSE2()) { 23780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return sk_memset16_SSE2; 23880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else { 23980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 24080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 24180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 24280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 24380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkMemset32Proc SkMemset32GetPlatformProc() { 24480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSE2()) { 24580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return sk_memset32_SSE2; 24680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else { 24780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 24880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 24980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 25080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 25180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkBlitRow::ColorRectProc PlatformColorRectProcFactory(); // suppress warning 25280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 25380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkBlitRow::ColorRectProc PlatformColorRectProcFactory() { 25480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (cachedHasSSE2()) { 25580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return ColorRect32_SSE2; 25680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } else { 25780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 25880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 25980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 260