UEFI - 如何提高图形性能?

时间:2021-01-31 13:18:54

标签: multithreading graphics rendering uefi gnu-efi

我正在尝试使用 GOP 绘制光标。光标绘制发生在 while 循环中。

我 GOP 所在的文件:https://drive.google.com/file/d/1neifcwzow4WLGId7LRCzEFx5n43narDi/view?usp=sharing

        /*...OTHER CODE...*/
        RunGraphics(...); //CLEAR SCREEN
        setCursorPosition(&cursor, (UINT32)(Info->HorizontalResolution/2), (UINT32)(Info->VerticalResolution/2));
    
        while (1)
            {
                UINTN index;
                Status = gBS->WaitForEvent(2, &Events, &index);
        
                // INDEX 1 IS KEYBOARD MESSAGE
                if (index == 1)
                {
                    Status = gST->ConIn->ReadKeyStroke(gST->ConIn, &Key);
        
                    if ((UINTN)Key.ScanCode == SCAN_ESC)
                    {
                        if(ESC_KEY_DOWN_COUNT == 0)
                        {
                            SystemTable->ConIn->Reset(SystemTable->ConIn, FALSE);
                            SystemTable->RuntimeServices->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
                            return EFI_SUCCESS;
                        }
                        ESC_KEY_DOWN_COUNT--;
                    }
                    else
                    {
                        ESC_KEY_DOWN_COUNT = 2;
                        Print(L"%c", Key.UnicodeChar);
        
                    }
                }
                else if (index == 0)
                {
                    Status = mouse->GetState(mouse, &State);
        
                    Print(L"X:%d Y:%d Z:%d L:%d R:%d\n",
                        State.RelativeMovementX,
                        State.RelativeMovementY,
                        State.RelativeMovementZ,
                        State.LeftButton,
                        State.RightButton
                    );
        
                    setCursorPosition(&cursor, cursor.Position.X + State.RelativeMovementX, cursor.Position.Y + State.RelativeMovementY, info->HorizontalResolution, info->VerticalResolution);

DrawCursorClassic(cursor.Position.X,cursor.Position.Y,255,255,255 /*RGB*/);
//RUNS VERY LAGGY.
        
                }
            }

我应该怎么做才能提高我的表现或我在这里做错了什么?

0 个答案:

没有答案
相关问题