my vertex shader document

Discussion in 'Other OS (Linux)' started by Sombat Tragoongoson, Sep 23, 2018.

  1. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    I hope my document will help some. I used it to write for translating readable form to binary code a few years ago. Actually, I learned it from cgcomp tools code. This tool quite nice and clean but not what I want. Anyway, I cannot say it a "document". It is just the instruction decomposition for me to examine and find a way to do a reverse. If there are some like I will gather my fragment shader document.

    Please see my attached file. At the end of it I just add some samples to translate assembly form to binary. It may be some not properly, just for a guide.
     

    Attached Files:

  2. 2,925
    2,444
    372
    sandungas

    sandungas Moderator Developer

    Joined:
    Dec 31, 2014
    Messages:
    2,925
    Likes Received:
    2,444
    Trophy Points:
    372
    Location:
    Babylon 20xxE series
    Have you tryed to decompile (back to standard Cg format) the FPO and VPO files inside QRC files ?
    http://www.psdevwiki.com/ps3/Qt_Resource_Container_(QRC)#FPO_.26_VPO

    Specially... the files lines0.fpo and lines0.vpo inside http://www.psdevwiki.com/ps3/Lines.qrc
    You have a partial decompilation example here: http://www.psdevwiki.com/ps3/Talk:Qt_Resource_Container_(QRC)

    That files im mentioning could be interesting because are the XMB wave :) (vertex and pixel info, and code functions in Cg)


    Edit:
    Also, not a question but something very interesting to be mentioned
    from all the QRC files used in PS3 firmwares, there is one that is an excelent candidate for being a guinea pig
    http://www.psdevwiki.com/ps3/Canyon.qrc
    The reason why this one is so good is because is the animation inside the music player.... so even in the worst scenario, if you corrupt canyon.qrc entirelly the PS3 will keep booting normally

    Also, is just a collection of "abstract" surface animations... so it allows for any kind of experiment or modifications of the originals, and allows to replace them
     
    Last edited: Sep 23, 2018
    Louis Garry and Death_Dealer like this.
  3. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    No, Actually I don't know about it. My interest is only how to make my toy live in Linux. It is stay still for over two or three years. After I heard someone talking about classic fb hw accelator again, i get hope.
    Anyway, for my thinking it is possible and able to.
     
    sandungas likes this.
  4. 2,925
    2,444
    372
    sandungas

    sandungas Moderator Developer

    Joined:
    Dec 31, 2014
    Messages:
    2,925
    Likes Received:
    2,444
    Trophy Points:
    372
    Location:
    Babylon 20xxE series
    Which toy ? :)
     
  5. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    Just my joke for fun, don't be serious.

    First of all, I don't claim any for mine. It is the master piece work of ...group.

    I am just a generic linux user, not a developer and looking for any information that I can find
    and learn in an old and a new talking about linux.

    In ps3ware project, I find something interesting.

    In ps3l1ght_v2 project, I find my answer about cubemap.

    however, I think you know about freebsd test. I think you know what I mean who?.
    And I think you will see his report on hypervisor reverse engineering for the last update;
    and he talk about linux kernel and any function he testes right.

    Everything is open for doing something for a very long time, but no one like to talk about.

    You see my open issue about texture cache, in there, i talk about memory resources.
    This is quite stupid right. But my meaning is to almost everything work fine.
    and is now looking for how to manage the resource.

    Any way, as for my view, the thing to do is making new environment and using linux resource.
    for example, if you like to have your own XMB, you can do as you right but without X.
    The psl1ght_v2, show you how to use the fifo command. It is working the same that I can say.

    I hope there some movement in linux. My toy will live again.
     
    bguerville and sandungas like this.
  6. 2,925
    2,444
    372
    sandungas

    sandungas Moderator Developer

    Joined:
    Dec 31, 2014
    Messages:
    2,925
    Likes Received:
    2,444
    Trophy Points:
    372
    Location:
    Babylon 20xxE series
    that post needs a decompiler too :cool2:
     
    bguerville likes this.
  7. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    Sorry to reply late. you mean the source right. I will leave all. As I say, I am not developer. The source is quite a mess. I just do it as my need for my test drawing a simple primitive such as cube with 8-vertex lighting, two side light, point sprite, and etc. As far as, I can say it works ok (may need to re-write it in the nice way).

    By the way, if there some love to have do some test, I have some pettitboot(kernel 3.18) and kernel patch for 4.4 up to 4.18 and ps3fb with additional ioctl interface function and memory map for using in user space. And also the user space function interface. So you can make some creative work as the same as psli1ght does in graphics.

    Note:
    the pettitboot and kernel patches are not mine, they are derived from Glevand's master piece works. I just keep update. Or I can say all most of my part is just using his work from freebsd project and some other projects.

    Please let me know where I can leave all. Here or some where.
     
    bguerville likes this.
  8. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    I drop my source, not all. It is just the first step. No kernel module source. If you find the freebsd test project. You will make it on your own. for ioctl, no need to do memory heap on kernel. You can do in user space. Just do the memory map. This is just for one don't know how to start by your own. You can examine my source. I think you will know the way. It is easy. you will see my memory map in drr.c file.
     

    Attached Files:

    bguerville and sandungas like this.
  9. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    I drop the kernel patches 4.14 and ps3fb sample
    for additional ioctl and memory mapping.

    for ps3fb sample, you need to find the reset program from freebsd test project
    and replace it. There are some marks you will see them.
    Then you can test my sample. The test is clearing the screen to yellow color.
    You can exit test by control-C. If it works, it means you are ready to add more command
    and test some drawing.

    For shader, you can use mine or you can use cgcomp. It is your choice.
    It is open for you to do. If you use mine, it will be confused to use at first.

    Hope to see some move and some competition.
     

    Attached Files:

    bguerville likes this.
  10. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    Just update my sample status.

    My sample is confirm working on Gentoo pcc64 with pure 64-bit user land(otheros++355).
    But I've tried on Red ribbon-debian 7.0 (kernel ppc64 with 32bit user land) is not working.
    I don't know the root cause of the problem.
    I can now tell there is a problem on mmap in user space. So the fifo command is not working.
    Why I'm sure it's because my ps3fb driver is compatible with the old.
    It can run X without any problem and this driver uses fifo command for flipping frame buffer on GART memory to video ram and then scan out to the screen.

    The difference that I can see is 64 bits user land and 32 bits user land if necklect the linux destro. I think almost of the linux destros are 32 bits userland with 64bits kernel.

    Btw, I'm not good at kernel coding. If there some one is good at this, please do help.

    Anyway, for me I think the direct render by low API is quite challenge worth for developing even if without X. If one see what I see I'm pleasure to cooperation.
     
  11. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    update my test sample for RED ribbon(32 bits userland).

    this for one need fun and challenge for direct render with low API.

    test on RED ribbon(debian 7.0) with kernel 3.16.60. It works fine and no any issues.

    the mmap handle differences for 32 bits and 64 bits user land.
    So my previous is for 64bit user land. So it didn't work on Red ribbon.

    the linux kernel, ps3fb compile in module for test( can load/unload).

    kernel patch 3.16, config and sample in the attached file.

    as the same, provide fifo command just for test to clear screen to yellow.
    if you need to do more just add more the fifo commands.

    have to remove GUI when login because test without X, need delete some services as below
    /etc/rc2.d
    rm S01ps3-rsx-swapon
    rm S03lightdm
    /etc/rc6.d
    rm K01ps3-rsx-swapon
    rm K01lightdm
     

    Attached Files:

    bguerville likes this.
  12. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    my test bin apps for testing on Red ribbon more.
    just for testing if get yellow screen in the previous my update.

    1) twosidelight
    vert_test_basic_def.tbl
    -- global unifrom constant table like predefined model view matrix in opengl.
    used by all vertex shader if having more than one
    vert_basic1.tbl --dummy 1st load for my checking jump label of vert_test_basic.asm.
    frag_basic1.tbl --dummy.
    vert_test_basic.tbl --2nd load.
    frag_test_basic.tbl.
    Draw simple cube with front/back material lighting.

    2) cubemap
    vert_cubemap_def.tbl
    vert_cubemap.tbl
    frag_cubemap.tbl
    63PbS.raw ---cubemap raw image: left->right->top->bottom->top->front->back
    Draw simple cubemap texture.

    There is a ps3fb.c in drr32.tar.gz. This is my driver used by my test app.
    need to build it to ps3fb.ko.

    how to build kernel
    tar xvfj ps3linux_kernel_patches_316.tar.bz2
    tar xvf linux-3.16.60
    cd linux-3.16.60
    cp ../config-3.16.60 .config
    for file in ../ps3linux_kernel_patches_316/*.patch; do patch -p1 <$file; done
    make menuconfig and save
    make
    make modules_install
    cp vmlinux /boot/vmlinuz-3.16.60
    cp .config /boot/config-3.16.60
    cp System.map /boot/System.map-3.16.60
    rm drivers/video/fbdev/ps3fb.o
    rm drivers/video/fbdev/ps3fb.ko
    mv drivers/video/fbdev/ps3fb.c drivers/video/fbdev/ps3fb.org
    cp ../drr32/ps3fb.c drivers/video/fbdev/
    make drivers/video/fbdev/ps3fb.ko
    cp make drivers/video/fbdev/ps3fb.ko to your want path
    cd /boot
    strip --strip-unneeded --strip-debug vmlinux-3.16.60
    vi /etc/kboot.conf
    add vmlinux-3.16.60 to boot entry
     

    Attached Files:

    bguerville likes this.
  13. 19
    13
    7
    Sombat Tragoongoson

    Sombat Tragoongoson Forum Noob

    Joined:
    Sep 4, 2018
    Messages:
    19
    Likes Received:
    13
    Trophy Points:
    7
    Gender:
    Male
    My point of view on direct render without X

    First of all, I'd like to say thank for this good site.

    In the past, gitbrew forum was very nice place.
    at there, I at first knew nothing but I loved to learn.
    and most of all, I will say thank Glavand.
    Actually, He didn't know me and the opposite way.
    he is kind and helps me to learn something.
    I give up for some times(sleep and wake up).
    Until now, I find here one of the best.
    There are many skillful of people.
    So then, I drop my sample here.
    Don't look at my codes, I know them direct, simple and ugly.
    see the result is not bad at all.

    anyway, if my test bin apps are working, you will see my point.

    2D and 3D are working well. This way will get high performance.
    you can control all the resources. Homebrew app is awating to do now.

    The only problem I see is the way to use fifo command correctly and properly.
    this will open and wait one to work on. As I see, there are some samples how to use,
    for example, pslight_v2, rsxgl, ps3ware, nouveau and etc.
    and any errors related with it, they are not be recovered as ps3 hypervisor document.
    In gameos you can recovery them by power-button in some kind of errors.
    It should be the way to handle about these.

    btw, I forget to tell the way to exit my test bin apps.
    1) if run on PC terminal, ctrl-C
    2) if run on ps3 itself, you need mouse attached. press middle mouse.
    The mouse can only move do nothing update in every frame if moving.
    this is for my test about the hardware cursor.

    There are two issues that are not able to be tested.
    1) Tile
    2) Zcull
    cannot find any resources.
    It may be have in private.

    What I see about the resources.

    GART memory 9MB ( static mmap in user space)
    0 4k 64k 9M
    reset program main fifo cmd ring buffer free area
    VRAM 254M ( dynamic mmap in userspace)
    0 > > > 254M
    framebuffer0 freebuffer1 depth buffer free area
    vram, you can mmap in a whole one. Low address will be ok but high address is a problem.
    So just map only need to use and have to calculate the map range in page size.

    virtual memory
    any lefts from resident processes.
    hardisk
    ...

    What I'd like to see(just my thinking).

    Two tasks

    user space driver
    interface with ps3fb, do only processing the stream of graphic command in his own.
    (The named pipe, the server like X or in any ways).

    user space application
    do process input and generate the stream of graphic command sending to userspace driver.
    (The gamepad response is quite slow and have some delay. So work here is best choice).

    Yes, I'd tried to complete my want after freebsd release for a while,
    but it is not easy and complicated. Also, I'm used to use name piped, it works fine.
    But it has manny things to do. My knowledge is so small.
    I accept I failed, so I hope some make my dream come true.

    I will be leave here a while.
    I will try find the way to do some sample for fun.
    (I see "Hero city" in homebrew forum very nice)
    Finally, talking to myself it is not fun and challenge.
     
    bguerville and kozarovv like this.

Share This Page