tr-demoscene

the scene => coding => console => Konuyu başlatan: jimqode - 24.03.2007 02:05:19

Başlık: Vertical Blank
Gönderen: jimqode - 24.03.2007 02:05:19
Yine ben!

Yazdigim herseyde ekranin her tarafi ayri oynuyor. Galiba gp2x_video_waitvsync() benim dusundugum sey degil. Buffer'i flip etmeden once bir sekilde vertical blanki beklemek gerek ama nasil?

Asagida problemi kisa ve oz anlatan bir kod veriyorum. ekranda bir anda bir renk gormeyi beklerken renkli yatay bantlar goruyorum. Nette bayagi arandim. LCD registerlerinden birini poll eden bi fonskiyon buldum ama bende kilitlendi orada alet. Belki de o kod gp32 icindi tam bilemiyorum.

Kod: [Seç]
#include <stdio.h>
#include &quot;minimal.h&quot;

int
main (int argc, char* argv[])
{
    gp2x_init(1000, 16, 11025,16,0,60,1);
    while(1)
    {
        memset(gp2x_video_RGB[0].screen16,gp2x_timer_read()<<3,320*240*2);
        gp2x_video_waitvsync();
        gp2x_video_RGB_flip(0);
    }
}

void gp2x_sound_frame(void *blah, void *buff, int samples) {}
Başlık: Vertical Blank
Gönderen: GnoStiC - 24.03.2007 08:11:27
su an yazdigin code'u deneme sansim yok.. pazar gecesi sanirim deneyebilirim.. o zamana kadar hizli bir memset;

Kod: [Seç]
/* Copyright (C) 1998 Free Software Foundation, Inc.
   This file is part of the GNU C Library.
   Contributed by Philip Blundell <philb@gnu.org>

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

/*#include <sys/syscall.h>*/

        .text
        .global  gp2x_memset;
        .type  gp2x_memset,%function
        .align 4;                                                               \

gp2x_memset:
    mov    a4, a1
    cmp    a3, $8        @ at least 8 bytes to do?
    blt    2f
    orr    a2, a2, a2, lsl $8
    orr    a2, a2, a2, lsl $16
1:
    tst    a4, $3        @ aligned yet?
    strneb    a2, [a4], $1
    subne    a3, a3, $1
    bne    1b
    mov    ip, a2
1:
    cmp    a3, $8        @ 8 bytes still to do?
    blt    2f
    stmia    a4!, {a2, ip}
    sub    a3, a3, $8
    cmp    a3, $8        @ 8 bytes still to do?
    blt    2f
    stmia    a4!, {a2, ip}
    sub    a3, a3, $8
    cmp    a3, $8        @ 8 bytes still to do?
    blt    2f
    stmia    a4!, {a2, ip}
    sub    a3, a3, $8
    cmp    a3, $8        @ 8 bytes still to do?
    stmgeia    a4!, {a2, ip}
    subge    a3, a3, $8
    bge    1b
2:
    movs    a3, a3        @ anything left?
    moveq    pc, lr        @ nope
    rsb    a3, a3, $7
    add    pc, pc, a3, lsl $2
    mov    r0, r0
    strb    a2, [a4], $1
    strb    a2, [a4], $1
    strb    a2, [a4], $1
    strb    a2, [a4], $1
    strb    a2, [a4], $1
    strb    a2, [a4], $1
    strb    a2, [a4], $1
    mov    pc, lr

.size  gp2x_memset,.- gp2x_memset;
Kod: [Seç]
void *gp2x_memset(void *s, int c, size_t n);
#undef memset
#define memset gp2x_memset
Başlık: Vertical Blank
Gönderen: jimqode - 31.03.2007 11:38:09
Bu vertical blank problemini hala cozemedim. dokumanlarda sadece vsync ve hsynci yakalamak icin ilgili registerlari bulabildim ama o sirada cizilen satir numarasini okuyabilecegim bir register bulamadim. yok mudur bir babayigit sunu cozmus olan :)
Başlık: Vertical Blank
Gönderen: GnoStiC - 31.03.2007 13:13:30
bu konuyu tamamen unutmusum, benim hatam. eve gectigimde bilgi veririm.
Başlık: Vertical Blank
Gönderen: GnoStiC - 01.04.2007 01:58:09
senin code'u denedim;
vbl bekleyince tum ekran tek renk,
vbl beklemeyince decrunch efekti gibi yatay cizgiler gormek mumkun..

asagida code ve compile edilmis hali mevcut..
Başlık: Vertical Blank
Gönderen: jimqode - 01.04.2007 11:41:29
hay allah ya ben bu vsync'i denemistim sonuc alamamıştım. şimdi yanımda değil alet ama en kısa zamanda bakıcam. Gnostic, kod tarzına hastayım bu arada. Senin koduna bakınca ben hep kulağı tersten gösteriyormuşum gibi geliyor :) Bi kutu donut da benden kazandın. Eğer burdaki tüm dunkin donutslar kapanmadıysa alıp göndericem :)