OSDev.org
https://forum.osdev.org/

Graph too slow. Seriously?
https://forum.osdev.org/viewtopic.php?f=13&t=31323
Page 1 of 1

Author:  monobogdan [ Mon Jan 30, 2017 12:46 pm ]
Post subject:  Graph too slow. Seriously?

Pascal Graph functions is slow. Slow like ah=9ch. But why? It must be fast because write direct in video memory

Author:  Schol-R-LEA [ Mon Jan 30, 2017 1:15 pm ]
Post subject:  Re: Graph too slow. Seriously?

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.

Author:  monobogdan [ Mon Jan 30, 2017 1:34 pm ]
Post subject:  Re: Graph too slow. Seriously?

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.

Author:  monobogdan [ Mon Jan 30, 2017 1:55 pm ]
Post subject:  Re: Graph too slow. Seriously?

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;

Author:  monobogdan [ Mon Jan 30, 2017 1:56 pm ]
Post subject:  Re: Graph too slow. Seriously?

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.

Author:  nielsd [ Mon Jan 30, 2017 2:19 pm ]
Post subject:  Re: Graph too slow. Seriously?

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.

Author:  hannah [ Mon Jan 30, 2017 2:19 pm ]
Post subject:  Re: Graph too slow. Seriously?

What does DrawRect do?

Author:  Schol-R-LEA [ Mon Jan 30, 2017 2:58 pm ]
Post subject:  Re: Graph too slow. Seriously?

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.

Author:  matt11235 [ Mon Jan 30, 2017 3:04 pm ]
Post subject:  Re: Graph too slow. Seriously?

monobogdan wrote:
Is really VESA slow?
I think that writing to video memory is just incredibly slow.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/