Jump to content

howto avoid opengl crash and speed up chrome & ms edge browsers


jalavoui
 Share

12 posts in this topic

Recommended Posts

This is a lilu plugin that i've made to fix the slow/crashes that i was getting on chrome/edge.

I expect this to work for most graphic cards.

The kext downgrades opengl version to 3.2 and although some apps work it can break others.

 

 

Install on OC/Kexts and reboot.

 

If you have any issues goto browser flags and make shure youre using opengl

other browsers like opera and brave also have this setting by default

 

image.png.15ce61c7968978c4bda731c84400a61e.png

 

this kext might affect other apps that use opengl.

for instance in firefox i had to use this setting (the app just crashes on some pages no matter what)

 

image.png.b872d1d26f24d3b22ad6806a91a5d6ac.png

 

Tested on big sur and ventura. might work on other os releases.

this was build with lilu 1.6.6

 

todo:

- support other os versions

 

updates:

- fixed lilu req (1.6.4+)

- add other os versions patches

- new approach on post #3

 

BFixup.kext.zipBFixup-master.zip

 

Edited by jalavoui
Link to comment
Share on other sites

  • 4 weeks later...

this release as a new patch for ventura. other os versions use post #1 approach

 

it is closer to my initial idea to change gl_enable flags code

 

not finished but a step forward

 

side effect on opengl:

- same as post #1

- firefox now won't crash because this release makes it disable webgl. meaning the gfx.webrendersoftware can be disabled

- chrome + related apps slower due to some gl extensions disabled

 

BFixup.kext.zipBFixup-master.zip

 

my fav app with post#1 kext test

image.png.36113cc53203b7a1316ba3e7af49448c.png

 

my fav app with this post kext test:

image.png.8a0b42d4e3473cb035c27ccf4b152f90.png

 

; This function takes four arguments: glVersion, extFlags, arg2, and arg3
; The function uses the registers rsi, rdi, rax, and rcx to store some values
; The function also uses some memory locations pointed by rdi and rsi to access some data
void _gleGetFilteredExtensions(int64_t *glVersion, int32_t *extFlags, int32_t arg2, int32_t arg3)
{
    ; Save the arguments in the registers
    rsi = extFlags
    rdi = glVersion

    ; Check if the 4th bit of the 16-bit value at glVersion + 0xc69e is zero
    ; This seems to be a flag that indicates the OpenGL profile
    ; If it is zero, it means the profile is core or compatibility
    ; If it is one, it means the profile is ES
    if ((*(int16_t *)(glVersion + 0xc69e) & 0xffff & 0x8) == 0x0)
    {
        ; Copy the value at glVersion + 0xb4d8 to rax
        ; This seems to be a pointer to a buffer that stores some flags related to the OpenGL extensions
        rax = *(glVersion + 0xb4d8)

        ; Copy four 32-bit values from the buffer pointed by rax + 0x220 to the memory pointed by extFlags
        ; These seem to be the extension flags for the core or compatibility profile
        rcx = 0x0
        do
        {
            *(int32_t *)(extFlags + rcx * 0x4) = *(int32_t *)(rax + rcx * 0x4 + 0x220)
            rcx = rcx + 0x1
        } while (rcx != 0x4)

        ; Check if the 8-bit value at glVersion + 0xc69d is greater than or equal to 7
        ; This seems to be another flag that indicates the OpenGL version
        ; If it is greater than or equal to 7, it means the version is 4.6 or higher
        ; If it is less than 7, it means the version is lower than 4.6
        if (*(int8_t *)(glVersion + 0xc69d) >= 0x7)
        {
            ; Clear the 4th bit of the 8-bit value at extFlags + 0x8
            ; This seems to be a flag that indicates the support for GL_ARB_gl_spirv extension
            *(int8_t *)(extFlags + 0x8) = *(int8_t *)(extFlags + 0x8) & 0xf7
        }

        ; Check if the 2nd bit of the 16-bit value at glVersion + 0xc69e is one
        ; This seems to be another flag that indicates the OpenGL profile
        ; If it is one, it means the profile is compatibility
        ; If it is zero, it means the profile is core
        if ((*(int16_t *)(glVersion + 0xc69e) & 0xffff & 0x2) != 0x0)
        {
            ; Clear the 1st bit of the 8-bit value at extFlags + 0xd
            ; This seems to be a flag that indicates the support for GL_ARB_compatibility extension
            *(int8_t *)(extFlags + 0xd) = *(int8_t *)(extFlags + 0xd) & 0xfe
        }
    }
    else
    {
        ; Set the value at extFlags + 0x4 to 0x30000001000000
        ; This seems to be a flag that indicates the support for GL_OES_texture_3D extension
        *(extFlags + 0x4) = 0x30000001000000

        ; Set the value at extFlags + 0xc to 0x10000000
        ; This seems to be a flag that indicates the support for GL_OES_element_index_uint extension
        *(int32_t *)(extFlags + 0xc) = 0x10000000

        ; Check if the 8-bit value at glVersion + 0xc69d is less than or equal to 6
        ; This seems to be another flag that indicates the OpenGL version
        ; If it is less than or equal to 6, it means the version is 3.2 or lower
        ; If it is greater than 6, it means the version is higher than 3.2
        if (*(int8_t *)(glVersion + 0xc69d) <= 0x6)
        {
            ; Set the value at extFlags + 0x8 to 0x300008
            ; This seems to be a flag that indicates the support for GL_OES_texture_npot and GL_OES_vertex_array_object extensions
            *(int32_t *)(extFlags + 0x8) = 0x300008
        }

        ; Set the value at extFlags to 0x1300000
        ; This seems to be a flag that indicates the support for GL_OES_rgb8_rgba8, GL_OES_depth24, and GL_OES_depth_texture extensions
        *(int32_t *)extFlags = 0x1300000

        ; Copy the value at glVersion + 0xb4d8 to rax
        ; This seems to be a pointer to a buffer that stores some flags related to the OpenGL extensions
        rax = *(glVersion + 0xb4d8)

        ; Perform a bitwise AND operation between the value at extFlags and the value at rax + 0x220, and store the result at extFlags
        ; This seems to be a way to filter out the extensions that are not supported by the ES profile
        *(int32_t *)extFlags = 0x1300000 & *(int32_t *)(rax + 0x220)

        ; Perform a bitwise AND operation between the values at extFlags + 0x4, extFlags + 0x8, and extFlags + 0xc and the values at rax + 0x224, rax + 0x228, and rax + 0x22c, respectively, and store the results at extFlags + 0x4, extFlags + 0x8, and extFlags + 0xc
        ; This seems to be another way to filter out the extensions that are not supported by the ES profile
        rcx = 0x0
        do
        {
            *(int32_t *)(extFlags + rcx * 0x4 + 0x4) = *(int32_t *)(extFlags + rcx * 0x4 + 0x4) & *(int32_t *)(rax + rcx * 0x4 + 0x224)
            rcx = rcx + 0x1
        } while (rcx != 0x3)
    }

    ; Return from the function
    return
}

 

Edited by jalavoui
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...
On 11/29/2023 at 5:00 AM, jalavoui said:

This is a lilu plugin that i've made to fix the slow/crashes that i was getting on chrome/edge.

I expect this to work for most graphic cards.

The kext downgrades opengl version to 3.2 and although some apps work it can break others.

 

 

Install on OC/Kexts and reboot.

 

If you have any issues goto browser flags and make shure youre using opengl

other browsers like opera and brave also have this setting by default

 

image.png.15ce61c7968978c4bda731c84400a61e.png

 

this kext might affect other apps that use opengl.

for instance in firefox i had to use this setting (the app just crashes on some pages no matter what)

 

image.png.b872d1d26f24d3b22ad6806a91a5d6ac.png

 

Tested on big sur and ventura. might work on other os releases.

this was build with lilu 1.6.6

 

todo:

- support other os versions

 

updates:

- fixed lilu req (1.6.4+)

- add other os versions patches

- new approach on post #3

 

BFixup.kext.zip 11.62 kB · 0 downloads BFixup-master.zip 32.03 kB · 0 downloads

 

Is this usable for Monterey too?

Link to comment
Share on other sites

there's a monterey patch for testing on #1 post but idk if it will work.

 

if you have latest monterey i could use the correct GLEngine file to check the patch

 

can you can go here and attach it ?

 

Link to comment
Share on other sites

  • 3 weeks later...
On 1/10/2024 at 1:04 AM, jalavoui said:

there's a monterey patch for testing on #1 post but idk if it will work.

 

if you have latest monterey i could use the correct GLEngine file to check the patch

 

can you can go here and attach it ?

 

Hi hello, sorry for the really late reply. I just ran this from my system and it didn't work... any specific steps would be appreciated, thank you

Screen Shot 2024-01-30 at 22.02.06.png

Edited by vanmoo
Link to comment
Share on other sites

  • 1 month later...

Is this kext still functional under Sonoma? I've added it to my config and it is loaded after Lilu before NootedRed, yet I see no difference. Apps still crash as they always do.

Link to comment
Share on other sites

 Share

×
×
  • Create New...