mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Analyze DRM backend
This commit is contained in:
parent
1f0167192b
commit
8b7429b9c0
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@ -145,8 +145,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: Linux, os: ubuntu-22.04 }
|
||||
- { name: macOS, os: macos-12 }
|
||||
- { name: Linux, os: ubuntu-22.04 }
|
||||
- { name: Linux DRM, os: ubuntu-22.04, flags: -DSFML_USE_DRM=TRUE }
|
||||
- { name: macOS, os: macos-12 }
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
@ -154,7 +155,7 @@ jobs:
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
|
||||
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev
|
||||
|
||||
- name: Install macOS Dependencies
|
||||
if: runner.os == 'macOS'
|
||||
@ -163,7 +164,7 @@ jobs:
|
||||
echo /usr/local/opt/llvm/bin >> $GITHUB_PATH
|
||||
|
||||
- name: Configure
|
||||
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSFML_BUILD_EXAMPLES=TRUE -DSFML_BUILD_TEST_SUITE=TRUE
|
||||
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSFML_BUILD_EXAMPLES=TRUE -DSFML_BUILD_TEST_SUITE=TRUE ${{matrix.platform.flags}}
|
||||
|
||||
- name: Analyze Code
|
||||
run: cmake --build $GITHUB_WORKSPACE/build --target tidy
|
||||
|
@ -121,7 +121,7 @@ void cleanup()
|
||||
close(drmNode.fileDescriptor);
|
||||
|
||||
drmNode.fileDescriptor = -1;
|
||||
drmNode.mode = 0;
|
||||
drmNode.mode = nullptr;
|
||||
|
||||
pollFD = {};
|
||||
drmEventCtx = {};
|
||||
@ -161,8 +161,8 @@ DrmFb* drmFbGetFromBo(gbm_bo& bo)
|
||||
std::uint32_t offsets[4] = {0};
|
||||
std::uint64_t modifiers[4] = {0};
|
||||
modifiers[0] = gbm_bo_get_modifier(&bo);
|
||||
const int num_planes = gbm_bo_get_plane_count(&bo);
|
||||
for (int i = 0; i < num_planes; ++i)
|
||||
const int numPlanes = gbm_bo_get_plane_count(&bo);
|
||||
for (int i = 0; i < numPlanes; ++i)
|
||||
{
|
||||
strides[i] = gbm_bo_get_stride_for_plane(&bo, i);
|
||||
handles[i] = gbm_bo_get_handle(&bo).u32;
|
||||
|
@ -63,8 +63,8 @@ int touchFd = -1; // file descriptor we have seen MT event
|
||||
std::vector<TouchSlot> touchSlots; // track the state of each touch "slot"
|
||||
int currentSlot = 0; // which slot are we currently updating?
|
||||
|
||||
std::queue<sf::Event> eventQueue; // events received and waiting to be consumed
|
||||
const int MAX_QUEUE = 64; // The maximum size we let eventQueue grow to
|
||||
std::queue<sf::Event> eventQueue; // events received and waiting to be consumed
|
||||
const int maxQueue = 64; // The maximum size we let eventQueue grow to
|
||||
|
||||
termios newTerminalConfig, oldTerminalConfig; // Terminal configurations
|
||||
|
||||
@ -101,30 +101,30 @@ void uninitFileDescriptors()
|
||||
// Joysticks are handled in /src/SFML/Window/Unix/JoystickImpl.cpp
|
||||
bool keepFileDescriptor(int fileDesc)
|
||||
{
|
||||
unsigned long bitmask_ev[NBITS(EV_MAX)];
|
||||
unsigned long bitmask_key[NBITS(KEY_MAX)];
|
||||
unsigned long bitmask_abs[NBITS(ABS_MAX)];
|
||||
unsigned long bitmask_rel[NBITS(REL_MAX)];
|
||||
unsigned long bitmaskEv[NBITS(EV_MAX)];
|
||||
unsigned long bitmaskKey[NBITS(KEY_MAX)];
|
||||
unsigned long bitmaskAbs[NBITS(ABS_MAX)];
|
||||
unsigned long bitmaskRel[NBITS(REL_MAX)];
|
||||
|
||||
ioctl(fileDesc, EVIOCGBIT(0, sizeof(bitmask_ev)), &bitmask_ev);
|
||||
ioctl(fileDesc, EVIOCGBIT(EV_KEY, sizeof(bitmask_key)), &bitmask_key);
|
||||
ioctl(fileDesc, EVIOCGBIT(EV_ABS, sizeof(bitmask_abs)), &bitmask_abs);
|
||||
ioctl(fileDesc, EVIOCGBIT(EV_REL, sizeof(bitmask_rel)), &bitmask_rel);
|
||||
ioctl(fileDesc, EVIOCGBIT(0, sizeof(bitmaskEv)), &bitmaskEv);
|
||||
ioctl(fileDesc, EVIOCGBIT(EV_KEY, sizeof(bitmaskKey)), &bitmaskKey);
|
||||
ioctl(fileDesc, EVIOCGBIT(EV_ABS, sizeof(bitmaskAbs)), &bitmaskAbs);
|
||||
ioctl(fileDesc, EVIOCGBIT(EV_REL, sizeof(bitmaskRel)), &bitmaskRel);
|
||||
|
||||
// This is the keyboard test used by SDL.
|
||||
// The first 32 bits are ESC, numbers and Q to D; If we have any of those,
|
||||
// consider it a keyboard device; do not test for KEY_RESERVED, though
|
||||
bool is_keyboard = (bitmask_key[0] & 0xFFFFFFFE);
|
||||
bool isKeyboard = (bitmaskKey[0] & 0xFFFFFFFE);
|
||||
|
||||
bool is_abs = TEST_BIT(EV_ABS, bitmask_ev) && TEST_BIT(ABS_X, bitmask_abs) && TEST_BIT(ABS_Y, bitmask_abs);
|
||||
bool isAbs = TEST_BIT(EV_ABS, bitmaskEv) && TEST_BIT(ABS_X, bitmaskAbs) && TEST_BIT(ABS_Y, bitmaskAbs);
|
||||
|
||||
bool is_rel = TEST_BIT(EV_REL, bitmask_ev) && TEST_BIT(REL_X, bitmask_rel) && TEST_BIT(REL_Y, bitmask_rel);
|
||||
bool isRel = TEST_BIT(EV_REL, bitmaskEv) && TEST_BIT(REL_X, bitmaskRel) && TEST_BIT(REL_Y, bitmaskRel);
|
||||
|
||||
bool is_mouse = (is_abs || is_rel) && TEST_BIT(BTN_MOUSE, bitmask_key);
|
||||
bool isMouse = (isAbs || isRel) && TEST_BIT(BTN_MOUSE, bitmaskKey);
|
||||
|
||||
bool is_touch = is_abs && (TEST_BIT(BTN_TOOL_FINGER, bitmask_key) || TEST_BIT(BTN_TOUCH, bitmask_key));
|
||||
bool isTouch = isAbs && (TEST_BIT(BTN_TOOL_FINGER, bitmaskKey) || TEST_BIT(BTN_TOUCH, bitmaskKey));
|
||||
|
||||
return is_keyboard || is_mouse || is_touch;
|
||||
return isKeyboard || isMouse || isTouch;
|
||||
}
|
||||
|
||||
void initFileDescriptors()
|
||||
@ -302,7 +302,7 @@ sf::Keyboard::Key toKey(int code)
|
||||
|
||||
void pushEvent(sf::Event& event)
|
||||
{
|
||||
if (eventQueue.size() >= MAX_QUEUE)
|
||||
if (eventQueue.size() >= maxQueue)
|
||||
eventQueue.pop();
|
||||
|
||||
eventQueue.push(event);
|
||||
@ -534,6 +534,8 @@ bool eventProcess(sf::Event& event)
|
||||
}
|
||||
}
|
||||
|
||||
(void)bytesRead; // Ignore clang-tidy dead store warning
|
||||
|
||||
newTerminalConfig.c_lflag |= ICANON;
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &newTerminalConfig);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user