Re: [Lazarus] How to program with time in milliseconds?

2014-05-13 Thread Michael Schnell

On 05/12/2014 10:37 PM, Henry Vermaak wrote:
On linux, glibc (and others) will route gettimeofday() (and 
clock_gettime() for certain clock IDs) via vDSO and no syscall will be 
called, so it's very fast. I don't think the fpc rtl does this, though? 


I checked with X86 32 Bit Linux: you are right.

e.g. http://x86.renejeschke.de/html/file_module_x86_id_277.html

talks about the ASM instruction RDPMC:

When in protected or virtual 8086 mode, the performance-monitoring 
counters enabled (PCE) flag in register CR4 restricts the use of the 
RDPMC instruction as follows. When the PCE flag is set, the RDPMC 
instruction can be executed at any privilege level; when the flag is 
clear, the instruction can only be executed at privilege level 0.


Hence, I don't know if accessing the  performance-monitoring counter 
this is possible / viable in the fpc RTL.


-Michael


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-13 Thread Mark Morgan Lloyd

Michael Schnell wrote:

On 05/12/2014 10:37 PM, Henry Vermaak wrote:
On linux, glibc (and others) will route gettimeofday() (and 
clock_gettime() for certain clock IDs) via vDSO and no syscall will be 
called, so it's very fast. I don't think the fpc rtl does this, though? 


I checked with X86 32 Bit Linux: you are right.

e.g. http://x86.renejeschke.de/html/file_module_x86_id_277.html

talks about the ASM instruction RDPMC:


That's hardly surprising, since the various processor ID etc. registers 
were available in real mode.


When in protected or virtual 8086 mode, the performance-monitoring 
counters enabled (PCE) flag in register CR4 restricts the use of the 
RDPMC instruction as follows. When the PCE flag is set, the RDPMC 
instruction can be executed at any privilege level; when the flag is 
clear, the instruction can only be executed at privilege level 0.


Hence, I don't know if accessing the  performance-monitoring counter 
this is possible / viable in the fpc RTL.


There's an obvious pitfall there: a poor implementation might /think/ 
that it's directly accessing the counters when in actual fact it's being 
virtualised or fixed up by a signal handler. There's debate elsewhere 
about inadvertently relying on the OS to fix up e.g. alignment errors, 
with a vast performance hit being suggested for e.g. Solaris if poor 
coding practice forces the OS to straighten things out.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-13 Thread Michael Schnell

On 05/13/2014 10:45 AM, Mark Morgan Lloyd wrote:


There's an obvious pitfall there: a poor implementation might /think/ 
that it's directly accessing the counters when in actual fact it's 
being virtualised or fixed up by a signal handler. 


Regarding just reading the performance-monitoring counter Register 
(not creating a timer event e.g. by means of a signal) it seemingly just 
depends on the allowance bit that is (or is no) set by the os if or if 
not this can be done in user mode. Of course we would need a guaranteed 
behavior of an Arch/OS to do a viable implementation


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-13 Thread Mark Morgan Lloyd

Michael Schnell wrote:

On 05/13/2014 10:45 AM, Mark Morgan Lloyd wrote:


There's an obvious pitfall there: a poor implementation might /think/ 
that it's directly accessing the counters when in actual fact it's 
being virtualised or fixed up by a signal handler. 


Regarding just reading the performance-monitoring counter Register 
(not creating a timer event e.g. by means of a signal) it seemingly just 
depends on the allowance bit that is (or is no) set by the os if or if 
not this can be done in user mode. Of course we would need a guaranteed 
behavior of an Arch/OS to do a viable implementation


Plus confidence that it wasn't being emulated slowly in a virtualisation 
layer.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-13 Thread Henry Vermaak
On Tue, May 13, 2014 at 09:51:39AM +0200, Michael Schnell wrote:
 On 05/12/2014 10:37 PM, Henry Vermaak wrote:
 On linux, glibc (and others) will route gettimeofday() (and
 clock_gettime() for certain clock IDs) via vDSO and no syscall
 will be called, so it's very fast. I don't think the fpc rtl does
 this, though?
 
 I checked with X86 32 Bit Linux: you are right.

This doesn't happen on x86 for me (with Debian stable, at least).  I
can't find the implementation in glibc, either.

 e.g. http://x86.renejeschke.de/html/file_module_x86_id_277.html
 
 talks about the ASM instruction RDPMC:
 
 When in protected or virtual 8086 mode, the performance-monitoring
 counters enabled (PCE) flag in register CR4 restricts the use of
 the RDPMC instruction as follows. When the PCE flag is set, the
 RDPMC instruction can be executed at any privilege level; when the
 flag is clear, the instruction can only be executed at privilege
 level 0.
 
 Hence, I don't know if accessing the  performance-monitoring
 counter this is possible / viable in the fpc RTL.

If you really want to use the performance counters, you'll have to use
the perf subsystem.

This doesn't have anything to do with vDSO, though.  The standard
library doesn't use any assembler to read these registers.  It calls
into a page that the kernel makes available to userspace that contains
certain functions where the overhead of a syscall is deemed
excessive/undesirable.  This kernel code will then read the time (using
HPET/TSC to get nanoseconds):

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/vdso/vclock_gettime.c

Henry

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-13 Thread Michael Schnell

On 05/13/2014 12:00 PM, Henry Vermaak wrote:
This doesn't have anything to do with vDSO, though. The standard 
library doesn't use any assembler to read these registers. It calls 
into a page that the kernel makes available to userspace that contains 
certain functions where the overhead of a syscall is deemed 
excessive/undesirable.


This is a good idea, as the same stuff might be available for other CPU 
archs, potentially doing system calls that just do some software based 
things instead of using CPU hardware.


It might be viable to do the implementation of this in the RTL or LCL to 
provide arch and OS independent calls to the users. (i.e. integrating an 
advanced version of the Epik Timer package in the library)


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] icons (SynEdit tab)

2014-05-13 Thread Junior
The icons (SynEdit tab) are higher compared to the other tabs (IDE 
Lazarus - Pallet)



-
Lazarus 1.3 r45030 FPC 2.6.4 i386-linux-gtk 2




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] icons (SynEdit tab)

2014-05-13 Thread Martin Frb

On 13/05/2014 15:00, Junior wrote:
The icons (SynEdit tab) are higher compared to the other tabs (IDE 
Lazarus - Pallet)


If I open the files they are all 24 by 24 pixel

images\components\tbutton.png
images\components\tframe.png
images\components\timagelist.png
components\synedit\design\tsynedit.png

Though yes the components actually are only partly 24x24, some are 22x22
images\components\tcoolbar.png


Anyway, the palette afaik should be fine with 24x24

What exactly is the problem?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] icons (SynEdit tab)

2014-05-13 Thread Junior
Merely the preview. I resize (mainform IDE) to not get too big, the 
icons of the other tabs are normal, but the SynEdit pops a ScrollBar 
horrible.


thanks

Em 13-05-2014 11:26, Martin Frb escreveu:

On 13/05/2014 15:00, Junior wrote:
The icons (SynEdit tab) are higher compared to the other tabs (IDE 
Lazarus - Pallet)


If I open the files they are all 24 by 24 pixel

images\components\tbutton.png
images\components\tframe.png
images\components\timagelist.png
components\synedit\design\tsynedit.png

Though yes the components actually are only partly 24x24, some are 22x22
images\components\tcoolbar.png


Anyway, the palette afaik should be fine with 24x24

What exactly is the problem?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] icons (SynEdit tab)

2014-05-13 Thread Martin Frb

On 13/05/2014 15:45, Junior wrote:
Merely the preview. I resize (mainform IDE) to not get too big, the 
icons of the other tabs are normal, but the SynEdit pops a ScrollBar 
horrible.


I can not reproduce that.

I resize the eight to the minimum possible without scrollbar on the 
first tab (Standard)


Then go to SyneEdit. No scroll bar. That is: If the window is wide enough.

If the width is to small, the SynEdit needs 2 rows (as it has so many 
icons), and 2 rows of course means scrollbar


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] GetFormImage bug

2014-05-13 Thread Chris Crori
Hi guys,
I am not very sure on how I can describe this...

I have a thumbnail section in my main program form. In the forms, I use 
GetFormImage to make an image and send it to the mainform.
The bug is that some components are not visible in this image.
TDBGrid is one and a custom component derived from TBitBtn is another.

I use the latest stable Lazarus 1.2.2 with FPC 2.6.4 on windows7, both 32 and 
64 bit

Regards,

Chris--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetFormImage bug

2014-05-13 Thread Howard Page-Clark

On 13/05/2014 16:49, Chris Crori wrote:

I have a thumbnail section in my main program form. In the forms, I use
GetFormImage to make an image and send it to the mainform.
The bug is that some components are not visible in this image.
TDBGrid is one and a custom component derived from TBitBtn is another.
I use the latest stable Lazarus 1.2.2 with FPC 2.6.4 on windows7, both
32 and 64 bit


This method
//-
procedure TForm1.Button1Click(Sender: TObject);
var
  bmp: TBitmap;
begin
  form2.Show;
  bmp:=form2.GetFormImage;
  try
Image1.Canvas.StretchDraw(Image1.ClientRect, bmp);
  finally
bmp.Free;
  end;
end;
//-
shows a DBGrid (and everything else I dropped on form2) nicely on my 
Win7 32bit setup.
Perhaps you need to share the code that drops parts of the bitmap (and 
perhaps the lfm of the imaged form as well).



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] icons (SynEdit tab)

2014-05-13 Thread Junior
If the width is to small, the SynEdit needs 2 rows (as it has so many 
icons), and 2 rows of course means scrollbar


I am not referring to the width, but the height.


Em 13-05-2014 11:59, Martin Frb escreveu:

On 13/05/2014 15:45, Junior wrote:
Merely the preview. I resize (mainform IDE) to not get too big, the 
icons of the other tabs are normal, but the SynEdit pops a ScrollBar 
horrible.


I can not reproduce that.

I resize the eight to the minimum possible without scrollbar on the 
first tab (Standard)


Then go to SyneEdit. No scroll bar. That is: If the window is wide 
enough.


If the width is to small, the SynEdit needs 2 rows (as it has so many 
icons), and 2 rows of course means scrollbar


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] icons (SynEdit tab)

2014-05-13 Thread Martin Frb

On 13/05/2014 20:16, Junior wrote:
If the width is to small, the SynEdit needs 2 rows (as it has so many 
icons), and 2 rows of course means scrollbar


I am not referring to the width, but the height.


Yes.

But as I said, I can not reproduce what you describe. If all icons fit 
into a single line  (so if the form is wide enough) then the SynEdit 
tabs shows the scrollbar at the exact same time as the Standard tab.




Em 13-05-2014 11:59, Martin Frb escreveu:

On 13/05/2014 15:45, Junior wrote:
Merely the preview. I resize (mainform IDE) to not get too big, the 
icons of the other tabs are normal, but the SynEdit pops a ScrollBar 
horrible.


I can not reproduce that.

I resize the eight to the minimum possible without scrollbar on the 
first tab (Standard)


Then go to SyneEdit. No scroll bar. That is: If the window is wide 
enough.


If the width is to small, the SynEdit needs 2 rows (as it has so many 
icons), and 2 rows of course means scrollbar



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] icons (SynEdit tab)

2014-05-13 Thread Martin Frb

On 13/05/2014 20:28, Martin Frb wrote:

On 13/05/2014 20:16, Junior wrote:
If the width is to small, the SynEdit needs 2 rows (as it has so 
many icons), and 2 rows of course means scrollbar


I am not referring to the width, but the height.


Yes.

But as I said, I can not reproduce what you describe. If all icons fit 
into a single line  (so if the form is wide enough) then the SynEdit 
tabs shows the scrollbar at the exact same time as the Standard tab.


You are aware, that if the form is not wide enough, the icans do NOT 
scroll horizontally? They are wrapped into a 2nd line, and a vertical 
scrollbar shows, because of the 2nd line.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] [ANN] Brook 3.0.0 release!

2014-05-13 Thread silvioprog
The Brook team is glad to announce the release 3.0.0.

This version was compiled and tested successfully with Free Pascal 2.6.4.
Here is the list of changes between version 2.6.4 and 3.0.0 of the Brook:

https://github.com/silvioprog/brookframework/compare/57f8e01868dbec9708129bc789940df2a93c1637...v3.0.0(or
short URL here:
http://goo.gl/kr9oX0)

The release is available for download on Github:

https://github.com/silvioprog/brookframework/releases/tag/v3.0.0

Or through the Latest Release button on the project home page:

http://silvioprog.github.io/brookframework/

Minimum requirements:

Free Pascal 2.6.4. If you prefer the Lazarus interface, choose the 1.2.2
version.

Enjoy!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] opengl Could not find FB config

2014-05-13 Thread Mattias Gaertner
On Tue, 06 May 2014 11:00:37 +0200
Andrea Mauri andrea.mauri...@gmail.com wrote:

 Dear all,
 
 I developed an application using LazOpenGLContext, one of the 
 application user reported me that he got an error when running my app 
 remotely on CentOS (kernel 2.6.32-431.5.1.el6.x86_64). The application 
 works locally but running remotely he got this error:
 'Could not find FB config'

It means, it can not find a suitable opengl context.
Maybe the remote connection does not support opengl?


 My application is compiled using laz_1.0.15_r44348M_FPC_2.6.2_x86_64-linux
 Could you help me trying to identify the problem? Is it possible that 
 some libraries is missing on the local machine?
 What may I ask to better understand the problem and how to solve it?

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetFormImage bug

2014-05-13 Thread Chris Crori
Since the problem is in my code I will try to figure it out and report any 
results. The system is a bit complex to post everything, but the basics are the 
same. If I fail in this I will try to duplicate the problem in smaller forms, 
so I can post a bug report

Thanks for testing Howard :)


From: Howard Page-Clark 
Sent: Tuesday, May 13, 2014 7:44 PM
To: lazarus@lists.lazarus.freepascal.org 
Subject: Re: [Lazarus] GetFormImage bug
On 13/05/2014 16:49, Chris Crori wrote:
 I have a thumbnail section in my main program form. In the forms, I use
 GetFormImage to make an image and send it to the mainform.
 The bug is that some components are not visible in this image.
 TDBGrid is one and a custom component derived from TBitBtn is another.
 I use the latest stable Lazarus 1.2.2 with FPC 2.6.4 on windows7, both
 32 and 64 bit

This method
//-
procedure TForm1.Button1Click(Sender: TObject);
var
   bmp: TBitmap;
begin
   form2.Show;
   bmp:=form2.GetFormImage;
   try
 Image1.Canvas.StretchDraw(Image1.ClientRect, bmp);
   finally
 bmp.Free;
   end;
end;
//-
shows a DBGrid (and everything else I dropped on form2) nicely on my 
Win7 32bit setup.
Perhaps you need to share the code that drops parts of the bitmap (and 
perhaps the lfm of the imaged form as well).


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
 --
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus