* Prepared the BScreen and BPrivateScreen class to be used with multiple monitors.

* BPrivateScreen now buffers its frame for 0.1 seconds (so that calling it several
  times in a row is both consistent and cheap).
* Added GetFrameBufferConfig() call to the HW interface (and implemented it).
* Added server commands AS_VALID_SCREEN_ID, AS_GET_NEXT_SCREEN_ID, and
  AS_GET_FRAME_BUFFER_CONFIG.
* BPrivateScreen::BaseAddress() and BPrivateScreen::BytesPerRow() are now working.
* minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14915 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-14 14:36:12 +00:00
parent 9469b271e8
commit b66d753712
12 changed files with 364 additions and 192 deletions

View File

@ -139,6 +139,8 @@ enum {
AS_GET_TRUNCATED_STRINGS, AS_GET_TRUNCATED_STRINGS,
// Screen methods // Screen methods
AS_VALID_SCREEN_ID,
AS_GET_NEXT_SCREEN_ID,
AS_SCREEN_GET_MODE, AS_SCREEN_GET_MODE,
AS_SCREEN_SET_MODE, AS_SCREEN_SET_MODE,
AS_PROPOSE_MODE, AS_PROPOSE_MODE,
@ -156,6 +158,7 @@ enum {
AS_GET_RETRACE_SEMAPHORE, AS_GET_RETRACE_SEMAPHORE,
AS_GET_ACCELERANT_INFO, AS_GET_ACCELERANT_INFO,
AS_GET_FRAME_BUFFER_CONFIG,
AS_SET_DPMS, AS_SET_DPMS,
AS_GET_DPMS_STATE, AS_GET_DPMS_STATE,

View File

@ -20,6 +20,7 @@
#include <Autolock.h> #include <Autolock.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Locker.h> #include <Locker.h>
#include <ObjectList.h>
#include <Window.h> #include <Window.h>
#include <new> #include <new>
@ -27,17 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
// TODO: We should define this somewhere else static BObjectList<BPrivateScreen> sScreens(2, true);
// We could find how R5 defines this, though it's not strictly necessary
// AFAIK, R5 here keeps also the screen width, height, colorspace, and some other things
// (it's 48 bytes big)
struct screen_desc {
void *base_address;
uint32 bytes_per_row;
};
static BPrivateScreen *sScreen;
// used to synchronize creation/deletion of the sScreen object // used to synchronize creation/deletion of the sScreen object
static BLocker sScreenLock("screen lock"); static BLocker sScreenLock("screen lock");
@ -46,7 +37,7 @@ static BLocker sScreenLock("screen lock");
using namespace BPrivate; using namespace BPrivate;
BPrivateScreen * BPrivateScreen *
BPrivateScreen::CheckOut(BWindow *window) BPrivateScreen::Get(BWindow *window)
{ {
screen_id id = B_MAIN_SCREEN_ID; screen_id id = B_MAIN_SCREEN_ID;
@ -60,49 +51,112 @@ BPrivateScreen::CheckOut(BWindow *window)
link.Read<screen_id>(&id); link.Read<screen_id>(&id);
} }
return CheckOut(id); return _Get(id, false);
} }
BPrivateScreen * BPrivateScreen *
BPrivateScreen::CheckOut(screen_id id) BPrivateScreen::Get(screen_id id)
{
return _Get(id, true);
}
BPrivateScreen *
BPrivateScreen::_Get(screen_id id, bool check)
{ {
BAutolock locker(sScreenLock); BAutolock locker(sScreenLock);
if (sScreen == NULL) { // search for the screen ID
// TODO: If we start supporting multiple monitors, we
// should return the right object for the given screen_id for (int32 i = sScreens.CountItems(); i-- > 0;) {
sScreen = new BPrivateScreen(); BPrivateScreen* screen = sScreens.ItemAt(i);
if (screen->ID().id == id.id) {
screen->_Acquire();
return screen;
}
} }
return sScreen; if (check) {
// check if ID is valid
if (!_IsValid(id))
return NULL;
}
// we need to allocate a new one
BPrivateScreen* screen = new (std::nothrow) BPrivateScreen(id);
if (screen == NULL)
return NULL;
sScreens.AddItem(screen);
return screen;
} }
void void
BPrivateScreen::Return(BPrivateScreen *screen) BPrivateScreen::Put(BPrivateScreen* screen)
{ {
// Never delete the sScreen object. if (screen == NULL)
// system_colors() expects the colormap to be return;
// permanently stored within libbe.
BAutolock locker(sScreenLock);
if (screen->_Release()) {
if (screen->ID().id != B_MAIN_SCREEN_ID.id) {
// we always keep the main screen object around - it will
// never go away, even if you disconnect all monitors.
sScreens.RemoveItem(screen);
}
}
} }
status_t BPrivateScreen*
BPrivateScreen::SetToNext() BPrivateScreen::GetNext(BPrivateScreen* screen)
{ {
// This function always returns B_ERROR BAutolock locker(sScreenLock);
return B_ERROR;
screen_id id;
status_t status = screen->GetNextID(id);
if (status < B_OK)
return NULL;
BPrivateScreen* nextScreen = Get(id);
if (nextScreen == NULL)
return NULL;
Put(screen);
return nextScreen;
} }
bool
BPrivateScreen::_IsValid(screen_id id)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_VALID_SCREEN_ID);
link.Attach<screen_id>(id);
status_t status;
if (link.FlushWithReply(status) != B_OK || status < B_OK)
return false;
return true;
}
// #pragma mark -
color_space color_space
BPrivateScreen::ColorSpace() BPrivateScreen::ColorSpace()
{ {
display_mode mode; display_mode mode;
if (GetMode(B_CURRENT_WORKSPACE, &mode) == B_OK) if (GetMode(B_CURRENT_WORKSPACE, &mode) == B_OK)
return (color_space)mode.space; return (color_space)mode.space;
return B_NO_COLOR_SPACE; return B_NO_COLOR_SPACE;
} }
@ -111,20 +165,42 @@ BRect
BPrivateScreen::Frame() BPrivateScreen::Frame()
{ {
// If something goes wrong, we just return this rectangle. // If something goes wrong, we just return this rectangle.
BRect rect(0, 0, 0, 0);
display_mode mode; if (system_time() > fLastUpdate + 100000) {
if (GetMode(B_CURRENT_WORKSPACE, &mode) == B_OK) // invalidate the settings after 0.1 secs
rect.Set(0, 0, (float)mode.virtual_width - 1, (float)mode.virtual_height - 1); display_mode mode;
if (GetMode(B_CURRENT_WORKSPACE, &mode) == B_OK) {
return rect; fFrame.Set(0, 0, (float)mode.virtual_width - 1,
(float)mode.virtual_height - 1);
fLastUpdate = system_time();
}
}
return fFrame;
} }
screen_id bool
BPrivateScreen::ID() BPrivateScreen::IsValid() const
{ {
// TODO: Change this if we start supporting multiple screens return BPrivateScreen::_IsValid(ID());
return B_MAIN_SCREEN_ID; }
status_t
BPrivateScreen::GetNextID(screen_id& id)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_NEXT_SCREEN_ID);
link.Attach<screen_id>(ID());
status_t status;
if (link.FlushWithReply(status) == B_OK && status == B_OK) {
link.Read<screen_id>(&id);
return B_OK;
}
return status;
} }
@ -188,7 +264,7 @@ BPrivateScreen::ColorMap()
{ {
if (fColorMap == NULL) { if (fColorMap == NULL) {
BAutolock locker(sScreenLock); BAutolock locker(sScreenLock);
if (fColorMap != NULL) { if (fColorMap != NULL) {
// someone could have been faster than us // someone could have been faster than us
return fColorMap; return fColorMap;
@ -512,42 +588,25 @@ BPrivateScreen::DPMSCapabilites()
void * void *
BPrivateScreen::BaseAddress() BPrivateScreen::BaseAddress()
{ {
screen_desc desc; frame_buffer_config config;
if (get_screen_desc(&desc) == B_OK) if (_GetFrameBufferConfig(config) != B_OK)
return desc.base_address; return NULL;
return NULL; return config.frame_buffer;
} }
uint32 uint32
BPrivateScreen::BytesPerRow() BPrivateScreen::BytesPerRow()
{ {
screen_desc desc; frame_buffer_config config;
if (get_screen_desc(&desc) == B_OK) if (_GetFrameBufferConfig(config) != B_OK)
return desc.bytes_per_row; return 0;
return 0; return config.bytes_per_row;
} }
status_t
BPrivateScreen::get_screen_desc(screen_desc *desc)
{
status_t status = B_ERROR;
/*
BPrivate::AppServerLink link;
PortMessage reply;
link.SetOpCode(AS_GET_SCREEN_DESC);
link.Attach<screen_id>(ID());
link.FlushWithReply(&reply);
reply.Read<screen_desc>(*desc);
reply.Read<status_t>(&status);
*/
return status;
}
// #pragma mark - private methods // #pragma mark - private methods
@ -565,11 +624,31 @@ BPrivateScreen::_RetraceSemaphore()
} }
BPrivateScreen::BPrivateScreen() status_t
BPrivateScreen::_GetFrameBufferConfig(frame_buffer_config& config)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
link.Attach<screen_id>(ID());
status_t status = B_ERROR;
if (link.FlushWithReply(status) == B_OK && status == B_OK) {
link.Read<frame_buffer_config>(&config);
return B_OK;
}
return status;
}
BPrivateScreen::BPrivateScreen(screen_id id)
: :
fID(id),
fColorMap(NULL), fColorMap(NULL),
fRetraceSem(-1), fRetraceSem(-1),
fOwnsColorMap(false) fOwnsColorMap(false),
fFrame(0, 0, 0, 0),
fLastUpdate(0)
{ {
} }

View File

@ -12,8 +12,9 @@
#include <Accelerant.h> #include <Accelerant.h>
#include <GraphicsDefs.h> #include <GraphicsDefs.h>
#include <ObjectList.h>
#include <Rect.h>
struct screen_desc;
struct color_map; struct color_map;
struct display_mode; struct display_mode;
struct display_timing_constraints; struct display_timing_constraints;
@ -26,15 +27,17 @@ class BPrivateScreen {
// Constructor and destructor are private. Use the static methods // Constructor and destructor are private. Use the static methods
// CheckOut() and Return() instead. // CheckOut() and Return() instead.
public: public:
static BPrivateScreen* CheckOut(BWindow *window); static BPrivateScreen* Get(BWindow *window);
static BPrivateScreen* CheckOut(screen_id id); static BPrivateScreen* Get(screen_id id);
static void Return(BPrivateScreen *screen); static void Put(BPrivateScreen *screen);
status_t SetToNext(); static BPrivateScreen* GetNext(BPrivateScreen* screen);
bool IsValid() const;
color_space ColorSpace(); color_space ColorSpace();
BRect Frame(); BRect Frame();
screen_id ID(); screen_id ID() const { return fID; }
status_t GetNextID(screen_id& id);
status_t WaitForRetrace(bigtime_t timeout); status_t WaitForRetrace(bigtime_t timeout);
@ -68,18 +71,29 @@ class BPrivateScreen {
void* BaseAddress(); void* BaseAddress();
uint32 BytesPerRow(); uint32 BytesPerRow();
status_t get_screen_desc(screen_desc *desc); private:
friend class BObjectList<BPrivateScreen>;
private: BPrivateScreen(screen_id id);
BPrivateScreen();
~BPrivateScreen(); ~BPrivateScreen();
void _Acquire() { fRefCount++; }
bool _Release() { return --fRefCount == 0; }
sem_id _RetraceSemaphore(); sem_id _RetraceSemaphore();
status_t _GetFrameBufferConfig(frame_buffer_config& config);
static BPrivateScreen* _Get(screen_id id, bool check);
static bool _IsValid(screen_id id);
private: private:
color_map *fColorMap; screen_id fID;
sem_id fRetraceSem; int32 fRefCount;
bool fOwnsColorMap; color_map* fColorMap;
sem_id fRetraceSem;
bool fOwnsColorMap;
BRect fFrame;
bigtime_t fLastUpdate;
}; };
#endif // _PRIVATE_SCREEN_H_ #endif // _PRIVATE_SCREEN_H_

View File

@ -24,7 +24,7 @@
*/ */
BScreen::BScreen(screen_id id) BScreen::BScreen(screen_id id)
{ {
fScreen = BPrivateScreen::CheckOut(id); fScreen = BPrivateScreen::Get(id);
} }
@ -34,7 +34,7 @@ BScreen::BScreen(screen_id id)
*/ */
BScreen::BScreen(BWindow *window) BScreen::BScreen(BWindow *window)
{ {
fScreen = BPrivateScreen::CheckOut(window); fScreen = BPrivateScreen::Get(window);
} }
@ -42,8 +42,7 @@ BScreen::BScreen(BWindow *window)
*/ */
BScreen::~BScreen() BScreen::~BScreen()
{ {
if (fScreen != NULL) BPrivateScreen::Put(fScreen);
BPrivateScreen::Return(fScreen);
} }
@ -53,7 +52,7 @@ BScreen::~BScreen()
bool bool
BScreen::IsValid() BScreen::IsValid()
{ {
return fScreen != NULL; return fScreen != NULL && fScreen->IsValid();
} }
@ -63,8 +62,13 @@ BScreen::IsValid()
status_t status_t
BScreen::SetToNext() BScreen::SetToNext()
{ {
if (fScreen != NULL) if (fScreen != NULL) {
return fScreen->SetToNext(); BPrivateScreen* screen = BPrivateScreen::GetNext(fScreen);
if (screen != NULL) {
fScreen = screen;
return B_OK;
}
}
return B_ERROR; return B_ERROR;
} }

View File

@ -1980,6 +1980,34 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
/* screen commands */ /* screen commands */
case AS_VALID_SCREEN_ID:
{
// Attached data
// 1) screen_id screen
screen_id id;
if (link.Read<screen_id>(&id) == B_OK
&& id.id == B_MAIN_SCREEN_ID.id)
fLink.StartMessage(B_OK);
else
fLink.StartMessage(B_ERROR);
fLink.Flush();
break;
}
case AS_GET_NEXT_SCREEN_ID:
{
// Attached data
// 1) screen_id screen
screen_id id;
link.Read<screen_id>(&id);
// TODO: for now, just say we're the last one
fLink.StartMessage(B_ENTRY_NOT_FOUND);
fLink.Flush();
break;
}
case AS_GET_SCREEN_ID_FROM_WINDOW: case AS_GET_SCREEN_ID_FROM_WINDOW:
{ {
status_t status = B_ENTRY_NOT_FOUND; status_t status = B_ENTRY_NOT_FOUND;
@ -2193,6 +2221,27 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
break; break;
} }
case AS_GET_FRAME_BUFFER_CONFIG:
{
STRACE(("ServerApp %s: get frame buffer config\n", Signature()));
// We aren't using the screen_id for now...
screen_id id;
link.Read<screen_id>(&id);
frame_buffer_config config;
// TODO: I wonder if there should be a "desktop" lock...
status_t status = fDesktop->GetHWInterface()->GetFrameBufferConfig(config);
if (status == B_OK) {
fLink.StartMessage(B_OK);
fLink.Attach<frame_buffer_config>(config);
} else
fLink.StartMessage(status);
fLink.Flush();
break;
}
case AS_GET_RETRACE_SEMAPHORE: case AS_GET_RETRACE_SEMAPHORE:
{ {
STRACE(("ServerApp %s: get retrace semaphore\n", Signature())); STRACE(("ServerApp %s: get retrace semaphore\n", Signature()));

View File

@ -1,16 +1,14 @@
//------------------------------------------------------------------------------ /*
// * Copyright 2001-2005, Haiku.
// Copyright 2002-2005, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License.
// Distributed under the terms of the MIT License. *
// * Authors:
// * Michael Lotz <mmlr@mlotz.ch>
// File Name: AccelerantHWInterface.cpp * DarkWyrm <bpmagic@columbus.rr.com>
// Authors: Michael Lotz <mmlr@mlotz.ch> * Stephan Aßmus <superstippi@gmx.de>
// DarkWyrm <bpmagic@columbus.rr.com> */
// Stephan Aßmus <superstippi@gmx.de>
// Description: Accelerant based HWInterface implementation /** Accelerant based HWInterface implementation */
//
//------------------------------------------------------------------------------
#include <new> #include <new>
#include <stdio.h> #include <stdio.h>
@ -479,7 +477,7 @@ AccelerantHWInterface::_UpdateFrameBufferConfig()
return B_OK; return B_OK;
} }
// GetDeviceInfo
status_t status_t
AccelerantHWInterface::GetDeviceInfo(accelerant_device_info *info) AccelerantHWInterface::GetDeviceInfo(accelerant_device_info *info)
{ {
@ -492,7 +490,15 @@ AccelerantHWInterface::GetDeviceInfo(accelerant_device_info *info)
return GetAccelerantDeviceInfo(info); return GetAccelerantDeviceInfo(info);
} }
// GetModeList
status_t
AccelerantHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
{
config = fFrameBufferConfig;
return B_OK;
}
status_t status_t
AccelerantHWInterface::GetModeList(display_mode** modes, uint32 *count) AccelerantHWInterface::GetModeList(display_mode** modes, uint32 *count)
{ {

View File

@ -1,53 +1,51 @@
//------------------------------------------------------------------------------ /*
// * Copyright 2005, Haiku.
// Copyright 2005, Haiku, Inc. * Distributed under the terms of the MIT License.
// Distributed under the terms of the MIT License. *
// * Authors:
// * Michael Lotz <mmlr@mlotz.ch>
// File Name: AccelerantHWInterface.h * Stephan Aßmus <superstippi@gmx.de>
// Author: Michael Lotz <mmlr@mlotz.ch> */
// Stephan Aßmus <superstippi@gmx.de>
// Description: Accelerant based HWInterface implementation
//
//------------------------------------------------------------------------------
#ifndef ACCELERANT_HW_INTERFACE_H #ifndef ACCELERANT_HW_INTERFACE_H
#define ACCELERANT_HW_INTERFACE_H #define ACCELERANT_HW_INTERFACE_H
#include "HWInterface.h" #include "HWInterface.h"
#include <image.h> #include <image.h>
class MallocBuffer; class MallocBuffer;
class AccelerantBuffer; class AccelerantBuffer;
class AccelerantHWInterface : public HWInterface { class AccelerantHWInterface : public HWInterface {
public: public:
AccelerantHWInterface(); AccelerantHWInterface();
virtual ~AccelerantHWInterface(); virtual ~AccelerantHWInterface();
virtual status_t Initialize(); virtual status_t Initialize();
virtual status_t Shutdown(); virtual status_t Shutdown();
virtual status_t SetMode(const display_mode &mode); virtual status_t SetMode(const display_mode &mode);
virtual void GetMode(display_mode *mode); virtual void GetMode(display_mode *mode);
virtual status_t GetDeviceInfo(accelerant_device_info *info); virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, virtual status_t GetFrameBufferConfig(frame_buffer_config& config);
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 GetModeList(display_mode **mode_list,
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT); 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 SetDPMSMode(const uint32 &state); virtual sem_id RetraceSemaphore();
virtual uint32 DPMSMode(); virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT);
virtual uint32 DPMSCapabilities();
virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode();
virtual uint32 DPMSCapabilities();
// query for available hardware accleration and perform it // query for available hardware accleration and perform it
virtual uint32 AvailableHWAcceleration() const; virtual uint32 AvailableHWAcceleration() const;

View File

@ -1,16 +1,13 @@
//------------------------------------------------------------------------------ /*
// * Copyright 2002-2005, Haiku.
// Copyright 2002-2005, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License.
// Distributed under the terms of the MIT License. *
// * Authors:
// * Michael Lotz <mmlr@mlotz.ch>
// File Name: BitmapHWInterface.cpp * DarkWyrm <bpmagic@columbus.rr.com>
// Authors: Michael Lotz <mmlr@mlotz.ch> * Stephan Aßmus <superstippi@gmx.de>
// DarkWyrm <bpmagic@columbus.rr.com> */
// Stephan Aßmus <superstippi@gmx.de>
// Description: Accelerant based HWInterface implementation
//
//------------------------------------------------------------------------------
#include <new> #include <new>
#include <stdio.h> #include <stdio.h>
@ -24,7 +21,7 @@
using std::nothrow; using std::nothrow;
// constructor
BitmapHWInterface::BitmapHWInterface(ServerBitmap* bitmap) BitmapHWInterface::BitmapHWInterface(ServerBitmap* bitmap)
: HWInterface(), : HWInterface(),
fBackBuffer(NULL), fBackBuffer(NULL),
@ -32,14 +29,14 @@ BitmapHWInterface::BitmapHWInterface(ServerBitmap* bitmap)
{ {
} }
// destructor
BitmapHWInterface::~BitmapHWInterface() BitmapHWInterface::~BitmapHWInterface()
{ {
delete fBackBuffer; delete fBackBuffer;
delete fFrontBuffer; delete fFrontBuffer;
} }
// Initialize
status_t status_t
BitmapHWInterface::Initialize() BitmapHWInterface::Initialize()
{ {
@ -54,9 +51,8 @@ BitmapHWInterface::Initialize()
// TODO: Remove once unnecessary... // TODO: Remove once unnecessary...
// fall back to double buffered mode until Painter knows how // fall back to double buffered mode until Painter knows how
// to draw onto non 32-bit surfaces... // to draw onto non 32-bit surfaces...
if (fFrontBuffer->ColorSpace() != B_RGB32 && if (fFrontBuffer->ColorSpace() != B_RGB32
fFrontBuffer->ColorSpace() != B_RGBA32) { && fFrontBuffer->ColorSpace() != B_RGBA32) {
BBitmap* backBitmap = new BBitmap(fFrontBuffer->Bounds(), BBitmap* backBitmap = new BBitmap(fFrontBuffer->Bounds(),
B_BITMAP_NO_SERVER_LINK, B_BITMAP_NO_SERVER_LINK,
B_RGBA32); B_RGBA32);
@ -80,21 +76,21 @@ BitmapHWInterface::Initialize()
return ret; return ret;
} }
// Shutdown
status_t status_t
BitmapHWInterface::Shutdown() BitmapHWInterface::Shutdown()
{ {
return B_OK; return B_OK;
} }
// SetMode
status_t status_t
BitmapHWInterface::SetMode(const display_mode &mode) BitmapHWInterface::SetMode(const display_mode &mode)
{ {
return B_UNSUPPORTED; return B_UNSUPPORTED;
} }
// GetMode
void void
BitmapHWInterface::GetMode(display_mode *mode) BitmapHWInterface::GetMode(display_mode *mode)
{ {
@ -103,14 +99,21 @@ BitmapHWInterface::GetMode(display_mode *mode)
} }
} }
// GetDeviceInfo
status_t status_t
BitmapHWInterface::GetDeviceInfo(accelerant_device_info *info) BitmapHWInterface::GetDeviceInfo(accelerant_device_info *info)
{ {
return B_UNSUPPORTED; return B_UNSUPPORTED;
} }
// GetModeList
status_t
BitmapHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
{
return B_UNSUPPORTED;
}
status_t status_t
BitmapHWInterface::GetModeList(display_mode** modes, uint32 *count) BitmapHWInterface::GetModeList(display_mode** modes, uint32 *count)
{ {

View File

@ -1,13 +1,14 @@
//------------------------------------------------------------------------------ /*
// Copyright 2005, Haiku, Inc. All rights reserved. * Copyright 2005, Haiku.
// Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
// *
// Author: Stephan Aßmus, <superstippi@gmx.de> * Authors:
//------------------------------------------------------------------------------ * Stephan Aßmus <superstippi@gmx.de>
*/
#ifndef BITMAP_HW_INTERFACE_H #ifndef BITMAP_HW_INTERFACE_H
#define BITMAP_HW_INTERFACE_H #define BITMAP_HW_INTERFACE_H
#include "HWInterface.h" #include "HWInterface.h"
class BitmapBuffer; class BitmapBuffer;
@ -15,10 +16,11 @@ class MallocBuffer;
class ServerBitmap; class ServerBitmap;
class BBitmapBuffer; class BBitmapBuffer;
class BitmapHWInterface : public HWInterface { class BitmapHWInterface : public HWInterface {
public: public:
BitmapHWInterface(ServerBitmap* bitmap); BitmapHWInterface(ServerBitmap* bitmap);
virtual ~BitmapHWInterface(); virtual ~BitmapHWInterface();
virtual status_t Initialize(); virtual status_t Initialize();
virtual status_t Shutdown(); virtual status_t Shutdown();
@ -28,15 +30,16 @@ virtual ~BitmapHWInterface();
virtual void GetMode(display_mode *mode); virtual void GetMode(display_mode *mode);
virtual status_t GetDeviceInfo(accelerant_device_info *info); virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetFrameBufferConfig(frame_buffer_config& config);
virtual status_t GetModeList(display_mode **mode_list, virtual status_t GetModeList(display_mode **mode_list,
uint32 *count); uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, virtual status_t GetPixelClockLimits(display_mode *mode,
uint32 *low, uint32 *low, uint32 *high);
uint32 *high);
virtual status_t GetTimingConstraints(display_timing_constraints *dtc); virtual status_t GetTimingConstraints(display_timing_constraints *dtc);
virtual status_t ProposeMode(display_mode *candidate, virtual status_t ProposeMode(display_mode *candidate,
const display_mode *low, const display_mode *low,
const display_mode *high); const display_mode *high);
virtual sem_id RetraceSemaphore(); virtual sem_id RetraceSemaphore();
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT); virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT);

View File

@ -40,6 +40,7 @@ class HWInterface : public MultiLocker {
virtual void GetMode(display_mode *mode) = 0; virtual void GetMode(display_mode *mode) = 0;
virtual status_t GetDeviceInfo(accelerant_device_info *info) = 0; virtual status_t GetDeviceInfo(accelerant_device_info *info) = 0;
virtual status_t GetFrameBufferConfig(frame_buffer_config& config) = 0;
virtual status_t GetModeList(display_mode **mode_list, virtual status_t GetModeList(display_mode **mode_list,
uint32 *count) = 0; uint32 *count) = 0;
virtual status_t GetPixelClockLimits(display_mode *mode, virtual status_t GetPixelClockLimits(display_mode *mode,

View File

@ -572,21 +572,34 @@ ViewHWInterface::GetDeviceInfo(accelerant_device_info *info)
// We really don't have to provide anything here because this is strictly // We really don't have to provide anything here because this is strictly
// a software-only driver, but we'll have some fun, anyway. // a software-only driver, but we'll have some fun, anyway.
if (ReadLock()) { if (ReadLock()) {
info->version = 100;
info->version=100; sprintf(info->name, "Haiku, Inc. ViewHWInterface");
sprintf(info->name,"Haiku, Inc. ViewHWInterface"); sprintf(info->chipset, "Haiku, Inc. Chipset");
sprintf(info->chipset,"Haiku, Inc. Chipset"); sprintf(info->serial_no, "3.14159265358979323846");
sprintf(info->serial_no,"3.14159265358979323846"); info->memory = 134217728; // 128 MB, not that we really have that much. :)
info->memory=134217728; // 128 MB, not that we really have that much. :) info->dac_speed = 0xFFFFFFFF; // *heh*
info->dac_speed=0xFFFFFFFF; // *heh*
ReadUnlock(); ReadUnlock();
} }
return B_OK; return B_OK;
} }
// GetModeList
status_t
ViewHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
{
if (fFrontBuffer == NULL)
return B_ERROR;
config.frame_buffer = fFrontBuffer->Bits();
config.frame_buffer_dma = NULL;
config.bytes_per_row = fFrontBuffer->BytesPerRow();
return B_OK;
}
status_t status_t
ViewHWInterface::GetModeList(display_mode **_modes, uint32 *_count) ViewHWInterface::GetModeList(display_mode **_modes, uint32 *_count)
{ {

View File

@ -1,17 +1,14 @@
//------------------------------------------------------------------------------ /*
// * Copyright 2005, Haiku.
// Copyright 2005, Haiku, Inc. * Distributed under the terms of the MIT License.
// Distributed under the terms of the MIT License. *
// * Authors:
// * Stephan Aßmus <superstippi@gmx.de>
// File Name: ViewHWInterface.h */
// Author: Stephan Aßmus <superstippi@gmx.de>
// Description: BView/BWindow combination HWInterface implementation
//
//------------------------------------------------------------------------------
#ifndef VIEW_GRAPHICS_CARD_H #ifndef VIEW_GRAPHICS_CARD_H
#define VIEW_GRAPHICS_CARD_H #define VIEW_GRAPHICS_CARD_H
#include "HWInterface.h" #include "HWInterface.h"
class BBitmap; class BBitmap;
@ -19,6 +16,7 @@ class BBitmapBuffer;
class CardWindow; class CardWindow;
class UpdateQueue; class UpdateQueue;
class ViewHWInterface : public HWInterface { class ViewHWInterface : public HWInterface {
public: public:
ViewHWInterface(); ViewHWInterface();
@ -30,8 +28,9 @@ class ViewHWInterface : public HWInterface {
virtual status_t SetMode(const display_mode &mode); virtual status_t SetMode(const display_mode &mode);
virtual void GetMode(display_mode *mode); virtual void GetMode(display_mode *mode);
virtual status_t GetDeviceInfo(accelerant_device_info *info); virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetFrameBufferConfig(frame_buffer_config& config);
virtual status_t GetModeList(display_mode **mode_list, virtual status_t GetModeList(display_mode **mode_list,
uint32 *count); uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, virtual status_t GetPixelClockLimits(display_mode *mode,