Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fbturbo_drv_la_SOURCES = \
compat-api.h \
uthash.h \
arm_asm.S \
aarch64_asm.S \
cpuinfo.c \
cpuinfo.h \
cpu_backend.c \
Expand Down
98 changes: 98 additions & 0 deletions src/aarch64_asm.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright © 2016 Siarhei Siamashka <siarhei.siamashka@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

/* Prevent the stack from becoming executable */
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

#ifdef __aarch64__

.cpu cortex-a53+fp+simd
.text
.align 2

/******************************************************************************/

.macro asm_function function_name
.global \function_name
#ifdef __ELF__
.hidden \function_name
.type \function_name, %function
#endif
.func \function_name
\function_name:
.endm

/******************************************************************************/

asm_function aligned_fetch_fbmem_to_scratch_neon
SIZE .req x0
DST .req x1
SRC .req x2

subs SIZE, SIZE, #128
blt 1f
0:
ldp q0, q1, [SRC, #(0 * 32)]
ldp q2, q3, [SRC, #(1 * 32)]
stp q0, q1, [DST, #(0 * 32)]
stp q2, q3, [DST, #(1 * 32)]
ldp q0, q1, [SRC, #(2 * 32)]
ldp q2, q3, [SRC, #(3 * 32)]
add SRC, SRC, #128
stp q0, q1, [DST, #(2 * 32)]
stp q2, q3, [DST, #(3 * 32)]
add DST, DST, #128
subs SIZE, SIZE, #128
bge 0b
1:
tst SIZE, #64
beq 1f
ldp q0, q1, [SRC, #(0 * 32)]
ldp q2, q3, [SRC, #(1 * 32)]
add SRC, SRC, #64
stp q0, q1, [DST, #(0 * 32)]
stp q2, q3, [DST, #(1 * 32)]
add DST, DST, #64
1:
tst SIZE, #32
beq 1f
ldp q0, q1, [SRC, #(0 * 32)]
add SRC, SRC, #32
stp q0, q1, [DST, #(0 * 32)]
add DST, DST, #32
1:
tst SIZE, #31
beq 1f
ldp q0, q1, [SRC]
stp q0, q1, [DST]
1:
ret

.unreq SIZE
.unreq DST
.unreq SRC
.endfunc

#endif
6 changes: 3 additions & 3 deletions src/backing_store_tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ xPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
private->PostValidateTreeNestingLevel++;

/* Disable backing store for the focus window */
if (!private->ForceBackingStore && focusWin->backStorage) {
if (!private->ForceBackingStore && focusWin->backingStore) {
DebugMsg("Disable backing store for the focus window 0x%x\n",
(unsigned int)focusWin->drawable.id);
pScreen->backingStoreSupport = Always;
Expand All @@ -125,7 +125,7 @@ xPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
/* And enable backing store for all the other children of root */
curWin = pScreen->root->firstChild;
while (curWin) {
if (!curWin->backStorage && (private->ForceBackingStore ||
if (!curWin->backingStore && (private->ForceBackingStore ||
curWin != focusWin)) {
DebugMsg("Enable backing store for window 0x%x\n",
(unsigned int)curWin->drawable.id);
Expand Down Expand Up @@ -158,7 +158,7 @@ xReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
}

/* We only want backing store set for direct children of root */
if (pPriorParent == pScreen->root && pWin->backStorage) {
if (pPriorParent == pScreen->root && pWin->backingStore) {
DebugMsg("Reparent window 0x%x from root, disabling backing store\n",
(unsigned int)pWin->drawable.id);
pScreen->backingStoreSupport = Always;
Expand Down
24 changes: 23 additions & 1 deletion src/cpu_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "cpuinfo.h"
#include "cpu_backend.h"

#ifdef __arm__
#if defined(__arm__) || defined(__aarch64__)

#ifdef __GNUC__
#define always_inline inline __attribute__((always_inline))
Expand All @@ -47,6 +47,16 @@ writeback_scratch_to_mem_arm(int size, void *dst, const void *src)
memcpy_armv5te(dst, src, size);
}

#ifdef __aarch64__
static always_inline void
writeback_scratch_to_mem_memcpy(int size, void *dst, const void *src)
{
memcpy(dst, src, size);
}

#define writeback_scratch_to_mem_neon writeback_scratch_to_mem_memcpy
#endif

#define SCRATCHSIZE 2048

/*
Expand Down Expand Up @@ -114,6 +124,8 @@ twopass_memmove_neon(void *dst, const void *src, size_t size)
writeback_scratch_to_mem_neon);
}

#ifdef __arm__

static void
twopass_memmove_vfp(void *dst, const void *src, size_t size)
{
Expand All @@ -130,6 +142,8 @@ twopass_memmove_arm(void *dst, const void *src, size_t size)
writeback_scratch_to_mem_arm);
}

#endif

static void
twopass_blt_8bpp(int width,
int height,
Expand Down Expand Up @@ -226,6 +240,8 @@ overlapped_blt_neon(void *self,
twopass_memmove_neon);
}

#ifdef __arm__

static int
overlapped_blt_vfp(void *self,
uint32_t *src_bits,
Expand Down Expand Up @@ -270,6 +286,8 @@ overlapped_blt_arm(void *self,

#endif

#endif

/* An empty, always failing implementation */
static int
overlapped_blt_noop(void *self,
Expand Down Expand Up @@ -322,6 +340,10 @@ cpu_backend_t *cpu_backend_init(uint8_t *uncached_buffer,
}
#endif

#ifdef __aarch64__
ctx->blt2d.overlapped_blt = overlapped_blt_neon;
#endif

return ctx;
}

Expand Down
14 changes: 10 additions & 4 deletions src/cpuinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ static int parse_proc_cpuinfo(cpuinfo_t *cpuinfo)
}
if ((val = cpuinfo_match_prefix(buffer, "Features"))) {
cpuinfo->has_arm_edsp = find_feature(val, "edsp");
cpuinfo->has_arm_vfp = find_feature(val, "vfp");
cpuinfo->has_arm_neon = find_feature(val, "neon");
cpuinfo->has_arm_vfp = find_feature(val, "vfp") ||
find_feature(val, "fp");
cpuinfo->has_arm_neon = find_feature(val, "neon") ||
find_feature(val, "asimd");
cpuinfo->has_arm_wmmx = find_feature(val, "iwmmxt");
}
else if ((val = cpuinfo_match_prefix(buffer, "CPU implementer"))) {
Expand All @@ -105,7 +107,9 @@ static int parse_proc_cpuinfo(cpuinfo_t *cpuinfo)
}
}
else if ((val = cpuinfo_match_prefix(buffer, "CPU architecture"))) {
if (sscanf(val, "%i", &cpuinfo->arm_architecture) != 1) {
if (strncmp(val, "AArch64", 7) == 0) {
cpuinfo->arm_architecture = 8;
} else if (sscanf(val, "%i", &cpuinfo->arm_architecture) != 1) {
fclose(fd);
free(buffer);
return 0;
Expand Down Expand Up @@ -158,7 +162,9 @@ cpuinfo_t *cpuinfo_init()
return cpuinfo;
}

if (cpuinfo->arm_implementer == 0x41 && cpuinfo->arm_part == 0xC0F) {
if (cpuinfo->arm_implementer == 0x41 && cpuinfo->arm_part == 0xD03) {
cpuinfo->processor_name = strdup("ARM Cortex-A53");
} else if (cpuinfo->arm_implementer == 0x41 && cpuinfo->arm_part == 0xC0F) {
cpuinfo->processor_name = strdup("ARM Cortex-A15");
} else if (cpuinfo->arm_implementer == 0x41 && cpuinfo->arm_part == 0xC09) {
if (cpuinfo->has_arm_neon)
Expand Down
Loading