Implemented screen to screen blit and cleaned up header.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12067 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2005-03-27 05:29:56 +00:00
parent 65369afd6d
commit 6109122c9b
2 changed files with 86 additions and 60 deletions

View File

@ -193,6 +193,7 @@ AccelerantDriver::Initialize()
accSetCursorShape = (set_cursor_shape)accelerant_hook(B_SET_CURSOR_SHAPE,NULL);
accMoveCursor = (move_cursor)accelerant_hook(B_MOVE_CURSOR,NULL);
accShowCursor = (show_cursor)accelerant_hook(B_SHOW_CURSOR,NULL);
accScreenBlit = (screen_to_screen_blit)accelerant_hook(B_SCREEN_TO_SCREEN_BLIT, NULL);
#ifdef DRAW_TEST
// Commented out to remove a couple warnings
@ -1229,6 +1230,27 @@ AccelerantDriver::GetDepthFromColorspace(int space)
void
AccelerantDriver::Blit(const BRect &src, const BRect &dest, const DrawData *d)
{
#ifndef DISABLE_HARDWARE_ACCELERATION
if (accScreenBlit && AcquireEngine) {
if (AcquireEngine(0, 0, NULL, &mEngineToken) == B_OK) {
blit_params blitParams;
blitParams.src_left = (uint16)src.left;
blitParams.src_top = (uint16)src.top;
blitParams.dest_left = (uint16)dest.left;
blitParams.dest_top = (uint16)dest.top;
blitParams.width = (int16)src.Width() - 1;
blitParams.height = (int16)src.Height() - 1;
accScreenBlit(mEngineToken, &blitParams, 1);
if (ReleaseEngine)
ReleaseEngine(mEngineToken, NULL);
Unlock();
return;
}
}
#endif
}
void

View File

@ -39,82 +39,86 @@
class ServerBitmap;
class ServerCursor;
class AccelerantDriver : public DisplayDriverImpl
{
class AccelerantDriver : public DisplayDriverImpl {
public:
AccelerantDriver();
~AccelerantDriver();
AccelerantDriver();
~AccelerantDriver();
bool Initialize();
void Shutdown();
virtual bool Initialize();
virtual void Shutdown();
/*
virtual bool Lock(bigtime_t timeout = B_INFINITE_TIMEOUT);
virtual void Unlock(void);
virtual bool Lock(bigtime_t timeout = B_INFINITE_TIMEOUT);
virtual void Unlock(void);
*/
virtual void SetMode(const int32 &mode);
virtual void SetMode(const display_mode &mode);
virtual void SetMode(const int32 &mode);
virtual void SetMode(const display_mode &mode);
virtual bool DumpToFile(const char *path);
virtual void InvertRect(const BRect &r);
virtual void StrokeLineArray(const int32 &numlines, const LineArrayData *linedata,const DrawData *d);
virtual bool DumpToFile(const char *path);
virtual void InvertRect(const BRect &r);
virtual void StrokeLineArray(const int32 &numlines, const LineArrayData *linedata,const DrawData *d);
/*
virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode() const;
virtual uint32 DPMSCapabilities() const;
virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode() const;
virtual uint32 DPMSCapabilities() const;
*/
virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
virtual status_t GetTimingConstraints(display_timing_constraints *dtc);
virtual status_t ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high);
virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT);
virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
virtual status_t GetTimingConstraints(display_timing_constraints *dtc);
virtual status_t ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high);
virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT);
protected:
virtual bool AcquireBuffer(FBBitmap *bmp);
virtual void ReleaseBuffer(void);
virtual bool AcquireBuffer(FBBitmap *bmp);
virtual void ReleaseBuffer(void);
void BlitBitmap(ServerBitmap *sourcebmp, BRect sourcerect, BRect destrect, drawing_mode mode=B_OP_COPY);
void ExtractToBitmap(ServerBitmap *destbmp, BRect destrect, BRect sourcerect);
rgb_color GetBlitColor(rgb_color src, rgb_color dest, LayerData *d, bool use_high=true);
int OpenGraphicsDevice(int deviceNumber);
int GetModeFromResolution(int width, int height, int space);
int GetWidthFromMode(int mode);
int GetHeightFromMode(int mode);
int GetDepthFromMode(int mode);
int GetDepthFromColorspace(int space);
void BlitBitmap(ServerBitmap *sourcebmp, BRect sourcerect, BRect destrect, drawing_mode mode=B_OP_COPY);
void ExtractToBitmap(ServerBitmap *destbmp, BRect destrect, BRect sourcerect);
rgb_color GetBlitColor(rgb_color src, rgb_color dest, LayerData *d, bool use_high=true);
int OpenGraphicsDevice(int deviceNumber);
int GetModeFromResolution(int width, int height, int space);
int GetWidthFromMode(int mode);
int GetHeightFromMode(int mode);
int GetDepthFromMode(int mode);
int GetDepthFromColorspace(int space);
// Support functions for the rest of the driver
virtual void Blit(const BRect &src, const BRect &dest, const DrawData *d);
virtual void FillSolidRect(const BRect &rect, const RGBColor &color);
virtual void FillPatternRect(const BRect &rect, const DrawData *d);
virtual void StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2, const RGBColor &color);
virtual void StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, const DrawData *d);
virtual void StrokeSolidRect(const BRect &rect, const RGBColor &color);
virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d);
virtual void CopyToBitmap(ServerBitmap *target, const BRect &source);
virtual void Blit(const BRect &src, const BRect &dest, const DrawData *d);
virtual void FillSolidRect(const BRect &rect, const RGBColor &color);
virtual void FillPatternRect(const BRect &rect, const DrawData *d);
virtual void StrokeSolidLine(int32 x1, int32 y1, int32 x2, int32 y2, const RGBColor &color);
virtual void StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, const DrawData *d);
virtual void StrokeSolidRect(const BRect &rect, const RGBColor &color);
virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d);
virtual void CopyToBitmap(ServerBitmap *target, const BRect &source);
ServerCursor *cursor, *under_cursor;
ServerCursor *cursor;
ServerCursor *under_cursor;
BRect cursorframe;
BRect cursorframe;
int card_fd;
image_id accelerant_image;
GetAccelerantHook accelerant_hook;
engine_token *mEngineToken;
acquire_engine AcquireEngine;
release_engine ReleaseEngine;
fill_rectangle accFillRect;
invert_rectangle accInvertRect;
set_cursor_shape accSetCursorShape;
move_cursor accMoveCursor;
show_cursor accShowCursor;
frame_buffer_config mFrameBufferConfig;
int mode_count;
display_mode *mode_list;
display_mode R5DisplayMode; // This should go away once we stop running under r5
int card_fd;
image_id accelerant_image;
GetAccelerantHook accelerant_hook;
engine_token *mEngineToken;
acquire_engine AcquireEngine;
release_engine ReleaseEngine;
// accelerant hooks
fill_rectangle accFillRect;
invert_rectangle accInvertRect;
set_cursor_shape accSetCursorShape;
move_cursor accMoveCursor;
show_cursor accShowCursor;
screen_to_screen_blit accScreenBlit;
frame_buffer_config mFrameBufferConfig;
int mode_count;
display_mode *mode_list;
display_mode R5DisplayMode; // This should go away once we stop running under r5
};
#endif