[common] add runtime detection and selection of AVX/AVX2 support

This commit is contained in:
Geoffrey McRae
2023-11-19 02:52:11 +11:00
parent 5d4c1d348c
commit 3330f83af6
6 changed files with 245 additions and 14 deletions

View File

@@ -29,4 +29,19 @@ bool cpuInfo_get(char * model, size_t modelSize, int * procs, int * cores,
void cpuInfo_log(void);
typedef struct
{
bool sse, sse2, sse3, ssse3;
bool fma;
bool sse4_1, sse4_2;
bool popcnt;
bool aes;
bool xsave, osxsave;
bool avx, avx2;
bool bmi1, bmi2;
}
CPUInfoFeatures;
const CPUInfoFeatures * cpuInfo_getFeatures(void);
#endif

View File

@@ -70,7 +70,8 @@ void framebuffer_prepare(FrameBuffer * frame);
/**
* Write data from the src buffer into the KVMFRFrame
*/
bool framebuffer_write(FrameBuffer * frame, const void * src, size_t size);
extern bool (*framebuffer_write)(FrameBuffer * frame,
const void * restrict src, size_t size);
/**
* Gets the underlying data buffer of the framebuffer.

View File

@@ -27,18 +27,8 @@
#include "common/framebuffer.h"
#include "common/types.h"
inline static void rectCopyUnaligned(uint8_t * dst, const uint8_t * src,
int ystart, int yend, int dx, int dstPitch, int srcPitch, int width)
{
src += ystart * srcPitch + dx;
dst += ystart * dstPitch + dx;
for (int i = ystart; i < yend; ++i)
{
memcpy(dst, src, width);
src += srcPitch;
dst += dstPitch;
}
}
extern void (*rectCopyUnaligned)(uint8_t * dst, const uint8_t * src,
int ystart, int yend, int dx, int dstPitch, int srcPitch, int width);
void rectsBufferToFramebuffer(FrameDamageRect * rects, int count, int bpp,
FrameBuffer * frame, int dstPitch, int height,