classes needed for the new cloned Accelerant based test environment
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15470 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <DirectWindow.h>
|
||||
|
||||
#include "DWindowBuffer.h"
|
||||
|
||||
// constructor
|
||||
DWindowBuffer::DWindowBuffer()
|
||||
: fBits(NULL),
|
||||
fWidth(0),
|
||||
fHeight(0),
|
||||
fBytesPerRow(0),
|
||||
fFormat(B_NO_COLOR_SPACE),
|
||||
fWindowClipping()
|
||||
{
|
||||
}
|
||||
|
||||
// destructor
|
||||
DWindowBuffer::~DWindowBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
// InitCheck
|
||||
status_t
|
||||
DWindowBuffer::InitCheck() const
|
||||
{
|
||||
if (fBits)
|
||||
return B_OK;
|
||||
|
||||
return B_NO_INIT;
|
||||
}
|
||||
|
||||
// ColorSpace
|
||||
color_space
|
||||
DWindowBuffer::ColorSpace() const
|
||||
{
|
||||
return fFormat;
|
||||
}
|
||||
|
||||
// Bits
|
||||
void*
|
||||
DWindowBuffer::Bits() const
|
||||
{
|
||||
return (void*)fBits;
|
||||
}
|
||||
|
||||
// BytesPerRow
|
||||
uint32
|
||||
DWindowBuffer::BytesPerRow() const
|
||||
{
|
||||
return fBytesPerRow;
|
||||
}
|
||||
|
||||
// Width
|
||||
uint32
|
||||
DWindowBuffer::Width() const
|
||||
{
|
||||
return fWidth;
|
||||
}
|
||||
|
||||
// Height
|
||||
uint32
|
||||
DWindowBuffer::Height() const
|
||||
{
|
||||
return fHeight;
|
||||
}
|
||||
|
||||
// Set
|
||||
void
|
||||
DWindowBuffer::SetTo(direct_buffer_info* info)
|
||||
{
|
||||
printf("DWindowBuffer::SetTo(%p)\n", info);
|
||||
fWindowClipping.MakeEmpty();
|
||||
|
||||
if (info) {
|
||||
int32 xOffset = info->window_bounds.left;
|
||||
int32 yOffset = info->window_bounds.top;
|
||||
// Get clipping information
|
||||
for (uint32 i = 0; i < info->clip_list_count; i++) {
|
||||
fWindowClipping.Include(info->clip_list[i]);
|
||||
}
|
||||
fWindowClipping.OffsetBy(xOffset, yOffset);
|
||||
|
||||
fBytesPerRow = info->bytes_per_row;
|
||||
fBits = (uint8*)info->bits;
|
||||
fFormat = info->pixel_format;
|
||||
fWidth = info->window_bounds.right - info->window_bounds.left + 1;
|
||||
fHeight = info->window_bounds.bottom - info->window_bounds.top + 1;
|
||||
printf(" width: %ld, height: %ld\n", fWidth, fHeight);
|
||||
// offset bits to left top corner of window
|
||||
fBits += xOffset * 4 + yOffset * fBytesPerRow;
|
||||
} else {
|
||||
fBits = NULL;
|
||||
fWidth = 0;
|
||||
fHeight = 0;
|
||||
fBytesPerRow = 0;
|
||||
fFormat = B_NO_COLOR_SPACE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef D_WINDOW_BUFFER_H
|
||||
#define D_WINDOW_BUFFER_H
|
||||
|
||||
#include "RenderingBuffer.h"
|
||||
|
||||
struct direct_buffer_info;
|
||||
|
||||
class DWindowBuffer : public RenderingBuffer {
|
||||
public:
|
||||
DWindowBuffer();
|
||||
virtual ~DWindowBuffer();
|
||||
|
||||
virtual status_t InitCheck() const;
|
||||
|
||||
virtual color_space ColorSpace() const;
|
||||
virtual void* Bits() const;
|
||||
virtual uint32 BytesPerRow() const;
|
||||
virtual uint32 Width() const;
|
||||
virtual uint32 Height() const;
|
||||
|
||||
void SetTo(direct_buffer_info* info);
|
||||
|
||||
BRegion& WindowClipping()
|
||||
{ return fWindowClipping; }
|
||||
private:
|
||||
uint8* fBits;
|
||||
uint32 fWidth;
|
||||
uint32 fHeight;
|
||||
uint32 fBytesPerRow;
|
||||
color_space fFormat;
|
||||
|
||||
BRegion fWindowClipping;
|
||||
};
|
||||
|
||||
#endif // D_WINDOW_BUFFER_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Lotz <[email protected]>
|
||||
* Stephan Aßmus <[email protected]>
|
||||
*/
|
||||
#ifndef D_WINDOW_HW_INTERACE_H
|
||||
#define D_WINDOW_HW_INTERACE_H
|
||||
|
||||
|
||||
#include <Accelerant.h>
|
||||
#include <Region.h>
|
||||
#include <String.h>
|
||||
|
||||
#include "HWInterface.h"
|
||||
|
||||
class DWindowBuffer;
|
||||
class DWindow;
|
||||
class UpdateQueue;
|
||||
|
||||
|
||||
class DWindowHWInterface : public HWInterface {
|
||||
public:
|
||||
DWindowHWInterface();
|
||||
virtual ~DWindowHWInterface();
|
||||
|
||||
virtual status_t Initialize();
|
||||
virtual status_t Shutdown();
|
||||
|
||||
virtual status_t SetMode(const display_mode &mode);
|
||||
virtual void GetMode(display_mode *mode);
|
||||
|
||||
virtual status_t GetDeviceInfo(accelerant_device_info *info);
|
||||
virtual status_t GetFrameBufferConfig(frame_buffer_config& config);
|
||||
|
||||
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 sem_id RetraceSemaphore();
|
||||
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
|
||||
virtual status_t SetDPMSMode(const uint32 &state);
|
||||
virtual uint32 DPMSMode();
|
||||
virtual uint32 DPMSCapabilities();
|
||||
|
||||
// query for available hardware accleration and perform it
|
||||
virtual uint32 AvailableHWAcceleration() const;
|
||||
|
||||
virtual void CopyRegion(const clipping_rect* sortedRectList,
|
||||
uint32 count,
|
||||
int32 xOffset, int32 yOffset);
|
||||
virtual void FillRegion(/*const*/ BRegion& region,
|
||||
const RGBColor& color);
|
||||
virtual void InvertRegion(/*const*/ BRegion& region);
|
||||
|
||||
// frame buffer access
|
||||
virtual RenderingBuffer* FrontBuffer() const;
|
||||
virtual RenderingBuffer* BackBuffer() const;
|
||||
virtual bool IsDoubleBuffered() const;
|
||||
|
||||
virtual status_t Invalidate(const BRect& frame);
|
||||
|
||||
private:
|
||||
DWindowBuffer* fFrontBuffer;
|
||||
|
||||
DWindow* fWindow;
|
||||
|
||||
display_mode fDisplayMode;
|
||||
|
||||
// accelerant stuff
|
||||
int _OpenGraphicsDevice(int deviceNumber);
|
||||
status_t _OpenAccelerant(int device);
|
||||
status_t _SetupDefaultHooks();
|
||||
|
||||
void _RegionToRectParams(/*const*/ BRegion* region,
|
||||
fill_rect_params** params,
|
||||
uint32* count) const;
|
||||
uint32 _NativeColor(const RGBColor& color) const;
|
||||
|
||||
|
||||
|
||||
int fCardFD;
|
||||
image_id fAccelerantImage;
|
||||
GetAccelerantHook fAccelerantHook;
|
||||
engine_token *fEngineToken;
|
||||
sync_token fSyncToken;
|
||||
|
||||
// required hooks - guaranteed to be valid
|
||||
acquire_engine fAccAcquireEngine;
|
||||
release_engine fAccReleaseEngine;
|
||||
sync_to_token fAccSyncToToken;
|
||||
accelerant_mode_count fAccGetModeCount;
|
||||
get_mode_list fAccGetModeList;
|
||||
get_frame_buffer_config fAccGetFrameBufferConfig;
|
||||
set_display_mode fAccSetDisplayMode;
|
||||
get_display_mode fAccGetDisplayMode;
|
||||
get_pixel_clock_limits fAccGetPixelClockLimits;
|
||||
|
||||
// optional accelerant hooks
|
||||
get_timing_constraints fAccGetTimingConstraints;
|
||||
propose_display_mode fAccProposeDisplayMode;
|
||||
fill_rectangle fAccFillRect;
|
||||
invert_rectangle fAccInvertRect;
|
||||
screen_to_screen_blit fAccScreenBlit;
|
||||
set_cursor_shape fAccSetCursorShape;
|
||||
move_cursor fAccMoveCursor;
|
||||
show_cursor fAccShowCursor;
|
||||
|
||||
BString fCardNameInDevFS;
|
||||
};
|
||||
|
||||
#endif // D_WINDOW_HW_INTERACE_H
|
||||
Reference in New Issue
Block a user