🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1985

Re: Multi-Thread HDC and Video Display

#1985
From: Bob Gonder
Date: Thu, 24 May 2007 22:14
43 lines
2529 bytes
Robert G. Hoover wrote:

>DrawDibDraw(HDRAWDIB hDD, HDC hDC, int left, int top...);
>SetDIBitsToDevice(HDC hDC, int left, int top...)
>StretchDIBitsToDevice(HDC hDC, int left, int top, int width, int height...)

Can't find that function. How about StretchDIBits ?

>Which of these are thread safe? DrawDibDraw only?

Why would any of those be "thread safe" ?  If you only ever use one
thread for display, then that should be "safe".

>Does DrawDibDraw write "directly" to video memory rather than regular memory?
<help>
If the DrawDib DC does not have an off-screen buffer specified,
specifying DDF_DONTDRAW causes the frame to be drawn to the screen
immediately. Subsequent calls to DrawDibDraw specifying DDF_UPDATE
fail.  </help>

> Is there a difference on these modern PCs?

Yes. Except for integrated video which shares memory.

>Which would be best used for video streaming? Are there other options?

Two threads, one for aquiring data, one for displaying it. Proper
buffering techniques can make it safe.
You might even go for three threads, with a data massager in the
middle.

Affinity mask. Set all your threads to one core so it becomes a
single-processor system as far as your app is concerned. (You said it
was faster on a single cpu.)

You might also play with thread priority settings.

>Please forgive my ignorance. I've been writing video streaming apps for nearly
>15 years. Apparently, I've been writing them wrong. ;)

So, what's really the problem?
Is it still slow?
Or are other issues cropping up?
Technical Details
Message-ID: <7a1c535nssuo5u27lunj2nr5j8p4i4dds3@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45f57403@newsgroups.borland.com> <4655cb92@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,411b13b57e2ea81a
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Multi-Thread HDC and Video Display
Date: Thu, 24 May 2007 15:14:53 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <7a1c535nssuo5u27lunj2nr5j8p4i4dds3@4ax.com>
References: <45f57403@newsgroups.borland.com> <4655cb92@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.147.10
X-Trace: newsgroups.borland.com 1180044891 67.77.147.10 (24 May 2007 15:14:51 -0700)
Lines: 47
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail