* 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:
parent
9469b271e8
commit
b66d753712
@ -139,6 +139,8 @@ enum {
|
||||
AS_GET_TRUNCATED_STRINGS,
|
||||
|
||||
// Screen methods
|
||||
AS_VALID_SCREEN_ID,
|
||||
AS_GET_NEXT_SCREEN_ID,
|
||||
AS_SCREEN_GET_MODE,
|
||||
AS_SCREEN_SET_MODE,
|
||||
AS_PROPOSE_MODE,
|
||||
@ -156,6 +158,7 @@ enum {
|
||||
|
||||
AS_GET_RETRACE_SEMAPHORE,
|
||||
AS_GET_ACCELERANT_INFO,
|
||||
AS_GET_FRAME_BUFFER_CONFIG,
|
||||
|
||||
AS_SET_DPMS,
|
||||
AS_GET_DPMS_STATE,
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <Autolock.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Locker.h>
|
||||
#include <ObjectList.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <new>
|
||||
@ -27,17 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
// TODO: We should define this somewhere else
|
||||
// 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;
|
||||
static BObjectList<BPrivateScreen> sScreens(2, true);
|
||||
|
||||
// used to synchronize creation/deletion of the sScreen object
|
||||
static BLocker sScreenLock("screen lock");
|
||||
@ -46,7 +37,7 @@ static BLocker sScreenLock("screen lock");
|
||||
using namespace BPrivate;
|
||||
|
||||
BPrivateScreen *
|
||||
BPrivateScreen::CheckOut(BWindow *window)
|
||||
BPrivateScreen::Get(BWindow *window)
|
||||
{
|
||||
screen_id id = B_MAIN_SCREEN_ID;
|
||||
|
||||
@ -60,49 +51,112 @@ BPrivateScreen::CheckOut(BWindow *window)
|
||||
link.Read<screen_id>(&id);
|
||||
}
|
||||
|
||||
return CheckOut(id);
|
||||
return _Get(id, false);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
if (sScreen == NULL) {
|
||||
// TODO: If we start supporting multiple monitors, we
|
||||
// should return the right object for the given screen_id
|
||||
sScreen = new BPrivateScreen();
|
||||
// search for the screen ID
|
||||
|
||||
for (int32 i = sScreens.CountItems(); i-- > 0;) {
|
||||
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
|
||||
BPrivateScreen::Return(BPrivateScreen *screen)
|
||||
BPrivateScreen::Put(BPrivateScreen* screen)
|
||||
{
|
||||
// Never delete the sScreen object.
|
||||
// system_colors() expects the colormap to be
|
||||
// permanently stored within libbe.
|
||||
if (screen == NULL)
|
||||
return;
|
||||
|
||||
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::SetToNext()
|
||||
BPrivateScreen*
|
||||
BPrivateScreen::GetNext(BPrivateScreen* screen)
|
||||
{
|
||||
// This function always returns B_ERROR
|
||||
return B_ERROR;
|
||||
BAutolock locker(sScreenLock);
|
||||
|
||||
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
|
||||
BPrivateScreen::ColorSpace()
|
||||
{
|
||||
display_mode mode;
|
||||
if (GetMode(B_CURRENT_WORKSPACE, &mode) == B_OK)
|
||||
return (color_space)mode.space;
|
||||
|
||||
|
||||
return B_NO_COLOR_SPACE;
|
||||
}
|
||||
|
||||
@ -111,20 +165,42 @@ BRect
|
||||
BPrivateScreen::Frame()
|
||||
{
|
||||
// If something goes wrong, we just return this rectangle.
|
||||
BRect rect(0, 0, 0, 0);
|
||||
display_mode mode;
|
||||
if (GetMode(B_CURRENT_WORKSPACE, &mode) == B_OK)
|
||||
rect.Set(0, 0, (float)mode.virtual_width - 1, (float)mode.virtual_height - 1);
|
||||
|
||||
return rect;
|
||||
|
||||
if (system_time() > fLastUpdate + 100000) {
|
||||
// invalidate the settings after 0.1 secs
|
||||
display_mode mode;
|
||||
if (GetMode(B_CURRENT_WORKSPACE, &mode) == B_OK) {
|
||||
fFrame.Set(0, 0, (float)mode.virtual_width - 1,
|
||||
(float)mode.virtual_height - 1);
|
||||
fLastUpdate = system_time();
|
||||
}
|
||||
}
|
||||
|
||||
return fFrame;
|
||||
}
|
||||
|
||||
|
||||
screen_id
|
||||
BPrivateScreen::ID()
|
||||
bool
|
||||
BPrivateScreen::IsValid() const
|
||||
{
|
||||
// TODO: Change this if we start supporting multiple screens
|
||||
return B_MAIN_SCREEN_ID;
|
||||
return BPrivateScreen::_IsValid(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) {
|
||||
BAutolock locker(sScreenLock);
|
||||
|
||||
|
||||
if (fColorMap != NULL) {
|
||||
// someone could have been faster than us
|
||||
return fColorMap;
|
||||
@ -512,42 +588,25 @@ BPrivateScreen::DPMSCapabilites()
|
||||
void *
|
||||
BPrivateScreen::BaseAddress()
|
||||
{
|
||||
screen_desc desc;
|
||||
if (get_screen_desc(&desc) == B_OK)
|
||||
return desc.base_address;
|
||||
frame_buffer_config config;
|
||||
if (_GetFrameBufferConfig(config) != B_OK)
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
return config.frame_buffer;
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
BPrivateScreen::BytesPerRow()
|
||||
{
|
||||
screen_desc desc;
|
||||
if (get_screen_desc(&desc) == B_OK)
|
||||
return desc.bytes_per_row;
|
||||
frame_buffer_config config;
|
||||
if (_GetFrameBufferConfig(config) != B_OK)
|
||||
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
|
||||
|
||||
|
||||
@ -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),
|
||||
fRetraceSem(-1),
|
||||
fOwnsColorMap(false)
|
||||
fOwnsColorMap(false),
|
||||
fFrame(0, 0, 0, 0),
|
||||
fLastUpdate(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,9 @@
|
||||
|
||||
#include <Accelerant.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <ObjectList.h>
|
||||
#include <Rect.h>
|
||||
|
||||
struct screen_desc;
|
||||
struct color_map;
|
||||
struct display_mode;
|
||||
struct display_timing_constraints;
|
||||
@ -26,15 +27,17 @@ class BPrivateScreen {
|
||||
// Constructor and destructor are private. Use the static methods
|
||||
// CheckOut() and Return() instead.
|
||||
public:
|
||||
static BPrivateScreen* CheckOut(BWindow *window);
|
||||
static BPrivateScreen* CheckOut(screen_id id);
|
||||
static void Return(BPrivateScreen *screen);
|
||||
static BPrivateScreen* Get(BWindow *window);
|
||||
static BPrivateScreen* Get(screen_id id);
|
||||
static void Put(BPrivateScreen *screen);
|
||||
|
||||
status_t SetToNext();
|
||||
static BPrivateScreen* GetNext(BPrivateScreen* screen);
|
||||
|
||||
bool IsValid() const;
|
||||
color_space ColorSpace();
|
||||
BRect Frame();
|
||||
screen_id ID();
|
||||
screen_id ID() const { return fID; }
|
||||
status_t GetNextID(screen_id& id);
|
||||
|
||||
status_t WaitForRetrace(bigtime_t timeout);
|
||||
|
||||
@ -68,18 +71,29 @@ class BPrivateScreen {
|
||||
void* BaseAddress();
|
||||
uint32 BytesPerRow();
|
||||
|
||||
status_t get_screen_desc(screen_desc *desc);
|
||||
private:
|
||||
friend class BObjectList<BPrivateScreen>;
|
||||
|
||||
private:
|
||||
BPrivateScreen();
|
||||
BPrivateScreen(screen_id id);
|
||||
~BPrivateScreen();
|
||||
|
||||
void _Acquire() { fRefCount++; }
|
||||
bool _Release() { return --fRefCount == 0; }
|
||||
|
||||
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:
|
||||
color_map *fColorMap;
|
||||
sem_id fRetraceSem;
|
||||
bool fOwnsColorMap;
|
||||
screen_id fID;
|
||||
int32 fRefCount;
|
||||
color_map* fColorMap;
|
||||
sem_id fRetraceSem;
|
||||
bool fOwnsColorMap;
|
||||
BRect fFrame;
|
||||
bigtime_t fLastUpdate;
|
||||
};
|
||||
|
||||
#endif // _PRIVATE_SCREEN_H_
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
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)
|
||||
{
|
||||
fScreen = BPrivateScreen::CheckOut(window);
|
||||
fScreen = BPrivateScreen::Get(window);
|
||||
}
|
||||
|
||||
|
||||
@ -42,8 +42,7 @@ BScreen::BScreen(BWindow *window)
|
||||
*/
|
||||
BScreen::~BScreen()
|
||||
{
|
||||
if (fScreen != NULL)
|
||||
BPrivateScreen::Return(fScreen);
|
||||
BPrivateScreen::Put(fScreen);
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +52,7 @@ BScreen::~BScreen()
|
||||
bool
|
||||
BScreen::IsValid()
|
||||
{
|
||||
return fScreen != NULL;
|
||||
return fScreen != NULL && fScreen->IsValid();
|
||||
}
|
||||
|
||||
|
||||
@ -63,8 +62,13 @@ BScreen::IsValid()
|
||||
status_t
|
||||
BScreen::SetToNext()
|
||||
{
|
||||
if (fScreen != NULL)
|
||||
return fScreen->SetToNext();
|
||||
if (fScreen != NULL) {
|
||||
BPrivateScreen* screen = BPrivateScreen::GetNext(fScreen);
|
||||
if (screen != NULL) {
|
||||
fScreen = screen;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1980,6 +1980,34 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
|
||||
/* 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:
|
||||
{
|
||||
status_t status = B_ENTRY_NOT_FOUND;
|
||||
@ -2193,6 +2221,27 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
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:
|
||||
{
|
||||
STRACE(("ServerApp %s: get retrace semaphore\n", Signature()));
|
||||
|
@ -1,16 +1,14 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright 2002-2005, Haiku, Inc. All rights reserved.
|
||||
// Distributed under the terms of the MIT License.
|
||||
//
|
||||
//
|
||||
// File Name: AccelerantHWInterface.cpp
|
||||
// Authors: Michael Lotz <mmlr@mlotz.ch>
|
||||
// DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Stephan Aßmus <superstippi@gmx.de>
|
||||
// Description: Accelerant based HWInterface implementation
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Lotz <mmlr@mlotz.ch>
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
/** Accelerant based HWInterface implementation */
|
||||
|
||||
#include <new>
|
||||
#include <stdio.h>
|
||||
@ -479,7 +477,7 @@ AccelerantHWInterface::_UpdateFrameBufferConfig()
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
// GetDeviceInfo
|
||||
|
||||
status_t
|
||||
AccelerantHWInterface::GetDeviceInfo(accelerant_device_info *info)
|
||||
{
|
||||
@ -492,7 +490,15 @@ AccelerantHWInterface::GetDeviceInfo(accelerant_device_info *info)
|
||||
return GetAccelerantDeviceInfo(info);
|
||||
}
|
||||
|
||||
// GetModeList
|
||||
|
||||
status_t
|
||||
AccelerantHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
|
||||
{
|
||||
config = fFrameBufferConfig;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
AccelerantHWInterface::GetModeList(display_mode** modes, uint32 *count)
|
||||
{
|
||||
|
@ -1,53 +1,51 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright 2005, Haiku, Inc.
|
||||
// Distributed under the terms of the MIT License.
|
||||
//
|
||||
//
|
||||
// File Name: AccelerantHWInterface.h
|
||||
// Author: Michael Lotz <mmlr@mlotz.ch>
|
||||
// Stephan Aßmus <superstippi@gmx.de>
|
||||
// Description: Accelerant based HWInterface implementation
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Copyright 2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Lotz <mmlr@mlotz.ch>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
#ifndef ACCELERANT_HW_INTERFACE_H
|
||||
#define ACCELERANT_HW_INTERFACE_H
|
||||
|
||||
|
||||
#include "HWInterface.h"
|
||||
#include <image.h>
|
||||
|
||||
class MallocBuffer;
|
||||
class AccelerantBuffer;
|
||||
|
||||
|
||||
class AccelerantHWInterface : public HWInterface {
|
||||
public:
|
||||
AccelerantHWInterface();
|
||||
virtual ~AccelerantHWInterface();
|
||||
virtual ~AccelerantHWInterface();
|
||||
|
||||
virtual status_t Initialize();
|
||||
virtual status_t Shutdown();
|
||||
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 SetMode(const display_mode &mode);
|
||||
virtual void GetMode(display_mode *mode);
|
||||
|
||||
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 GetDeviceInfo(accelerant_device_info *info);
|
||||
virtual status_t GetFrameBufferConfig(frame_buffer_config& config);
|
||||
|
||||
virtual sem_id RetraceSemaphore();
|
||||
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
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 SetDPMSMode(const uint32 &state);
|
||||
virtual uint32 DPMSMode();
|
||||
virtual uint32 DPMSCapabilities();
|
||||
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;
|
||||
|
@ -1,16 +1,13 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright 2002-2005, Haiku, Inc. All rights reserved.
|
||||
// Distributed under the terms of the MIT License.
|
||||
//
|
||||
//
|
||||
// File Name: BitmapHWInterface.cpp
|
||||
// Authors: Michael Lotz <mmlr@mlotz.ch>
|
||||
// DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Stephan Aßmus <superstippi@gmx.de>
|
||||
// Description: Accelerant based HWInterface implementation
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Lotz <mmlr@mlotz.ch>
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
|
||||
#include <new>
|
||||
#include <stdio.h>
|
||||
@ -24,7 +21,7 @@
|
||||
|
||||
using std::nothrow;
|
||||
|
||||
// constructor
|
||||
|
||||
BitmapHWInterface::BitmapHWInterface(ServerBitmap* bitmap)
|
||||
: HWInterface(),
|
||||
fBackBuffer(NULL),
|
||||
@ -32,14 +29,14 @@ BitmapHWInterface::BitmapHWInterface(ServerBitmap* bitmap)
|
||||
{
|
||||
}
|
||||
|
||||
// destructor
|
||||
|
||||
BitmapHWInterface::~BitmapHWInterface()
|
||||
{
|
||||
delete fBackBuffer;
|
||||
delete fFrontBuffer;
|
||||
}
|
||||
|
||||
// Initialize
|
||||
|
||||
status_t
|
||||
BitmapHWInterface::Initialize()
|
||||
{
|
||||
@ -54,9 +51,8 @@ BitmapHWInterface::Initialize()
|
||||
// TODO: Remove once unnecessary...
|
||||
// fall back to double buffered mode until Painter knows how
|
||||
// to draw onto non 32-bit surfaces...
|
||||
if (fFrontBuffer->ColorSpace() != B_RGB32 &&
|
||||
fFrontBuffer->ColorSpace() != B_RGBA32) {
|
||||
|
||||
if (fFrontBuffer->ColorSpace() != B_RGB32
|
||||
&& fFrontBuffer->ColorSpace() != B_RGBA32) {
|
||||
BBitmap* backBitmap = new BBitmap(fFrontBuffer->Bounds(),
|
||||
B_BITMAP_NO_SERVER_LINK,
|
||||
B_RGBA32);
|
||||
@ -80,21 +76,21 @@ BitmapHWInterface::Initialize()
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Shutdown
|
||||
|
||||
status_t
|
||||
BitmapHWInterface::Shutdown()
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
// SetMode
|
||||
|
||||
status_t
|
||||
BitmapHWInterface::SetMode(const display_mode &mode)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
// GetMode
|
||||
|
||||
void
|
||||
BitmapHWInterface::GetMode(display_mode *mode)
|
||||
{
|
||||
@ -103,14 +99,21 @@ BitmapHWInterface::GetMode(display_mode *mode)
|
||||
}
|
||||
}
|
||||
|
||||
// GetDeviceInfo
|
||||
|
||||
status_t
|
||||
BitmapHWInterface::GetDeviceInfo(accelerant_device_info *info)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
// GetModeList
|
||||
|
||||
status_t
|
||||
BitmapHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BitmapHWInterface::GetModeList(display_mode** modes, uint32 *count)
|
||||
{
|
||||
|
@ -1,13 +1,14 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright 2005, Haiku, Inc. All rights reserved.
|
||||
// Distributed under the terms of the MIT License.
|
||||
//
|
||||
// Author: Stephan Aßmus, <superstippi@gmx.de>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Copyright 2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
#ifndef BITMAP_HW_INTERFACE_H
|
||||
#define BITMAP_HW_INTERFACE_H
|
||||
|
||||
|
||||
#include "HWInterface.h"
|
||||
|
||||
class BitmapBuffer;
|
||||
@ -15,10 +16,11 @@ class MallocBuffer;
|
||||
class ServerBitmap;
|
||||
class BBitmapBuffer;
|
||||
|
||||
|
||||
class BitmapHWInterface : public HWInterface {
|
||||
public:
|
||||
BitmapHWInterface(ServerBitmap* bitmap);
|
||||
virtual ~BitmapHWInterface();
|
||||
virtual ~BitmapHWInterface();
|
||||
|
||||
virtual status_t Initialize();
|
||||
virtual status_t Shutdown();
|
||||
@ -28,15 +30,16 @@ virtual ~BitmapHWInterface();
|
||||
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);
|
||||
uint32 *count);
|
||||
virtual status_t GetPixelClockLimits(display_mode *mode,
|
||||
uint32 *low,
|
||||
uint32 *high);
|
||||
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);
|
||||
const display_mode *low,
|
||||
const display_mode *high);
|
||||
|
||||
virtual sem_id RetraceSemaphore();
|
||||
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
|
@ -40,6 +40,7 @@ class HWInterface : public MultiLocker {
|
||||
virtual void GetMode(display_mode *mode) = 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,
|
||||
uint32 *count) = 0;
|
||||
virtual status_t GetPixelClockLimits(display_mode *mode,
|
||||
|
@ -572,21 +572,34 @@ ViewHWInterface::GetDeviceInfo(accelerant_device_info *info)
|
||||
// We really don't have to provide anything here because this is strictly
|
||||
// a software-only driver, but we'll have some fun, anyway.
|
||||
if (ReadLock()) {
|
||||
|
||||
info->version=100;
|
||||
sprintf(info->name,"Haiku, Inc. ViewHWInterface");
|
||||
sprintf(info->chipset,"Haiku, Inc. Chipset");
|
||||
sprintf(info->serial_no,"3.14159265358979323846");
|
||||
info->memory=134217728; // 128 MB, not that we really have that much. :)
|
||||
info->dac_speed=0xFFFFFFFF; // *heh*
|
||||
info->version = 100;
|
||||
sprintf(info->name, "Haiku, Inc. ViewHWInterface");
|
||||
sprintf(info->chipset, "Haiku, Inc. Chipset");
|
||||
sprintf(info->serial_no, "3.14159265358979323846");
|
||||
info->memory = 134217728; // 128 MB, not that we really have that much. :)
|
||||
info->dac_speed = 0xFFFFFFFF; // *heh*
|
||||
|
||||
ReadUnlock();
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
ViewHWInterface::GetModeList(display_mode **_modes, uint32 *_count)
|
||||
{
|
||||
|
@ -1,17 +1,14 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright 2005, Haiku, Inc.
|
||||
// Distributed under the terms of the MIT License.
|
||||
//
|
||||
//
|
||||
// File Name: ViewHWInterface.h
|
||||
// Author: Stephan Aßmus <superstippi@gmx.de>
|
||||
// Description: BView/BWindow combination HWInterface implementation
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
#ifndef VIEW_GRAPHICS_CARD_H
|
||||
#define VIEW_GRAPHICS_CARD_H
|
||||
|
||||
|
||||
#include "HWInterface.h"
|
||||
|
||||
class BBitmap;
|
||||
@ -19,6 +16,7 @@ class BBitmapBuffer;
|
||||
class CardWindow;
|
||||
class UpdateQueue;
|
||||
|
||||
|
||||
class ViewHWInterface : public HWInterface {
|
||||
public:
|
||||
ViewHWInterface();
|
||||
@ -30,8 +28,9 @@ class ViewHWInterface : public HWInterface {
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user