OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Apr 23, 2017 9:26 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 12:46 pm 
Offline
Member
Member

Joined: Wed Jan 25, 2017 3:37 pm
Posts: 71
Pascal Graph functions is slow. Slow like ah=9ch. But why? It must be fast because write direct in video memory


Top
 Profile  
 
 Post subject: Re: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 1:15 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 757
Location: Athens, GA, USA
monobogdan wrote:
Pascal Graph functions is slow. Slow like ah=9ch. But why? It must be fast because write direct in video memory


We would really need more details about this. Which library do you mean (I am expecting you meant your own, but I don't want to assume)? What OS platform and compiler (ditto for both)? What sort of graphics (or did you mean 'graphing', which would be somewhat different)? How is it implemented?

If you can provide the source code (or better still, a link to the repo the source is in), it would also help a great deal.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
μή εἶναι βασιλικήν ἀτραπόν ἐπί γεωμετρίαν
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 1:34 pm 
Offline
Member
Member

Joined: Wed Jan 25, 2017 3:37 pm
Posts: 71
Schol-R-LEA wrote:
monobogdan wrote:
Pascal Graph functions is slow. Slow like ah=9ch. But why? It must be fast because write direct in video memory


We would really need more details about this. Which library do you mean (I am expecting you meant your own, but I don't want to assume)? What OS platform and compiler (ditto for both)? What sort of graphics (or did you mean 'graphing', which would be somewhat different)? How is it implemented?

If you can provide the source code (or better still, a link to the repo the source is in), it would also help a great deal.


I mean unit graph built in pascal. It's VESA wrapper.


Top
 Profile  
 
 Post subject: Re: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 1:55 pm 
Offline
Member
Member

Joined: Wed Jan 25, 2017 3:37 pm
Posts: 71
So, it's really too slow.

Is really VESA slow?

Code:

Code:
while true do
   begin
      DrawDesktop;
      DrawStatusPanel;
      DrawTime;
      DrawRect(GetMouseX, GetMouseY, GetMouseX + 5, GetMouseY +5, 1);
   end;


Top
 Profile  
 
 Post subject: Re: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 1:56 pm 
Offline
Member
Member

Joined: Wed Jan 25, 2017 3:37 pm
Posts: 71
monobogdan wrote:
So, it's really too slow.

Is really VESA slow?

Code:

Code:
while true do
   begin
      DrawDesktop;
      DrawStatusPanel;
      DrawTime;
      DrawRect(GetMouseX, GetMouseY, GetMouseX + 5, GetMouseY +5, 1);
   end;


DrawDesktop, DrawStatusPanel, DrawTime is internal functions, it's draw rects and lines.


Top
 Profile  
 
 Post subject: Re: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 2:19 pm 
Offline

Joined: Sun Apr 05, 2015 3:15 pm
Posts: 11
Location: Belgium
I don't know how DrawDesktop and DrawStatusPanel etc are implemented, but I think the real problem is in there. Don't redraw the whole desktop constantly, only draw the changed parts since previous drawing time. Also you probably don't want to keep looping and drawing, but just check if there's something to draw that has changed.

_________________
OS: https://github.com/SharpNative/


Top
 Profile  
 
 Post subject: Re: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 2:19 pm 
Offline
Member
Member

Joined: Wed Oct 12, 2016 11:32 am
Posts: 34
Location: At my PC
What does DrawRect do?


Top
 Profile  
 
 Post subject: Re: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 2:58 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 757
Location: Athens, GA, USA
I agree with ndke (and Brendan in the other thread) here; I recommend reading up on Double Buffering and blitting before you proceed. Generally speaking, you want to do something like the following:

  1. Set aside two sections of the graphics memory to serve as video buffers (which I will call gbuffers).
  2. Set a flag to show which of the two gbuffers is current driving the display. Clear both the display gbuffer and the shadowed gbuffer.
  3. Draw the initial display to a buffer in system memory (an sbuffer).
  4. Create a second (shadowed) sbuffer and copy the first sbuffer to it.
  5. Create a third sbuffer for the blitter mask (mbuffer).
  6. set a shadowed/display flag for the sbuffers.
  7. loop:
    1. if the window's contents have changed,
      1. Blit the mbuffer to the shadowed gbuffer.
      2. flip the shadowed gbuffer to displayed, and the other gbuffer as shadowed.
      3. flip the sbuffers.
    2. loop:
      1. sleep the drawing process until the next vertical refresh, or a change is made to the display.
      2. If a change request is made,
        1. redraw the shadowed sbuffer with the new changes.
        2. Use the sbuffers to generate a new mbuffer.
      3. else break the inner loop

This is a general sketch, and will need to be adapted to how you intend your OS to work.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
μή εἶναι βασιλικήν ἀτραπόν ἐπί γεωμετρίαν
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Last edited by Schol-R-LEA on Mon Jan 30, 2017 3:06 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Graph too slow. Seriously?
PostPosted: Mon Jan 30, 2017 3:04 pm 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 245
Location: East Riding of Yorkshire, UK
monobogdan wrote:
Is really VESA slow?
I think that writing to video memory is just incredibly slow.

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Wiki
Compiler Development Forum


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: MSNbot Media and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group