* Introduced a monitor_info structure and means to let it be filled by the
accelerant (or the app_server via EDID info). It's still experimental API, and opinions are welcome. * Moved BPrivateScreen into the BPrivate namespace. * Rewrote Screen.h. * Introduced a BScreen::GetMonitorInfo() method, and implemented it in the app server as well (ie. AS_GET_MONITOR_INFO). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22563 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#if !defined(_ACCELERANT_H_)
|
#ifndef _ACCELERANT_H_
|
||||||
#define _ACCELERANT_H_
|
#define _ACCELERANT_H_
|
||||||
|
|
||||||
#include <BeBuild.h>
|
#include <BeBuild.h>
|
||||||
@@ -15,7 +15,7 @@ extern "C" {
|
|||||||
|
|
||||||
typedef void * (*GetAccelerantHook)(uint32, void *);
|
typedef void * (*GetAccelerantHook)(uint32, void *);
|
||||||
|
|
||||||
_EXPORT void * get_accelerant_hook(uint32 feature, void *data);
|
void *get_accelerant_hook(uint32 feature, void *data);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* initialization */
|
/* initialization */
|
||||||
@@ -42,6 +42,7 @@ enum {
|
|||||||
B_DPMS_MODE, /* required if driver supports DPMS */
|
B_DPMS_MODE, /* required if driver supports DPMS */
|
||||||
B_SET_DPMS_MODE, /* required if driver supports DPMS */
|
B_SET_DPMS_MODE, /* required if driver supports DPMS */
|
||||||
B_GET_PREFERRED_DISPLAY_MODE, /* optional */
|
B_GET_PREFERRED_DISPLAY_MODE, /* optional */
|
||||||
|
B_GET_MONITOR_INFO, /* optional */
|
||||||
B_GET_EDID_INFO, /* optional */
|
B_GET_EDID_INFO, /* optional */
|
||||||
|
|
||||||
/* cursor managment */
|
/* cursor managment */
|
||||||
@@ -121,6 +122,26 @@ typedef struct {
|
|||||||
uint16 v_blank_max;
|
uint16 v_blank_max;
|
||||||
} display_timing_constraints;
|
} display_timing_constraints;
|
||||||
|
|
||||||
|
// TODO: experimental API
|
||||||
|
typedef struct {
|
||||||
|
uint32 version;
|
||||||
|
char vendor[128];
|
||||||
|
char name[128];
|
||||||
|
char serial_number[128];
|
||||||
|
uint32 product_id;
|
||||||
|
struct {
|
||||||
|
uint16 week;
|
||||||
|
uint16 year;
|
||||||
|
} produced;
|
||||||
|
float width;
|
||||||
|
float height;
|
||||||
|
uint32 min_horizontal_frequency; // in kHz
|
||||||
|
uint32 max_horizontal_frequency;
|
||||||
|
uint32 min_vertical_frequency; // in Hz
|
||||||
|
uint32 max_vertical_frequency;
|
||||||
|
uint32 max_pixel_clock; // in kHz
|
||||||
|
} monitor_info;
|
||||||
|
|
||||||
enum { /* mode flags */
|
enum { /* mode flags */
|
||||||
B_SCROLL = 1 << 0,
|
B_SCROLL = 1 << 0,
|
||||||
B_8_BIT_DAC = 1 << 1,
|
B_8_BIT_DAC = 1 << 1,
|
||||||
@@ -216,6 +237,7 @@ typedef uint32 (*dpms_capabilities)(void);
|
|||||||
typedef uint32 (*dpms_mode)(void);
|
typedef uint32 (*dpms_mode)(void);
|
||||||
typedef status_t (*set_dpms_mode)(uint32 dpms_flags);
|
typedef status_t (*set_dpms_mode)(uint32 dpms_flags);
|
||||||
typedef status_t (*get_preferred_display_mode)(display_mode *preferredMode);
|
typedef status_t (*get_preferred_display_mode)(display_mode *preferredMode);
|
||||||
|
typedef status_t (*get_monitor_info)(monitor_info *info);
|
||||||
typedef status_t (*get_edid_info)(void *info, uint32 size, uint32 *_version);
|
typedef status_t (*get_edid_info)(void *info, uint32 size, uint32 *_version);
|
||||||
typedef sem_id (*accelerant_retrace_semaphore)(void);
|
typedef sem_id (*accelerant_retrace_semaphore)(void);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2006, Haiku.
|
* Copyright 2001-2007, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -13,8 +13,11 @@
|
|||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
|
|
||||||
class BPrivateScreen;
|
class BView;
|
||||||
class BWindow;
|
class BWindow;
|
||||||
|
namespace BPrivate {
|
||||||
|
class BPrivateScreen;
|
||||||
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
B_BITMAP_CLEAR_TO_WHITE = 0x00000001,
|
B_BITMAP_CLEAR_TO_WHITE = 0x00000001,
|
||||||
@@ -91,15 +94,12 @@ class BBitmap : public BArchivable {
|
|||||||
|
|
||||||
BBitmap& operator=(const BBitmap& source);
|
BBitmap& operator=(const BBitmap& source);
|
||||||
|
|
||||||
//----- Private or reserved -----------------------------------------//
|
|
||||||
|
|
||||||
virtual status_t Perform(perform_code d, void *arg);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class BView;
|
friend class BView;
|
||||||
friend class BApplication;
|
friend class BApplication;
|
||||||
friend class BPrivateScreen;
|
friend class BPrivate::BPrivateScreen;
|
||||||
|
|
||||||
|
virtual status_t Perform(perform_code d, void *arg);
|
||||||
virtual void _ReservedBitmap1();
|
virtual void _ReservedBitmap1();
|
||||||
virtual void _ReservedBitmap2();
|
virtual void _ReservedBitmap2();
|
||||||
virtual void _ReservedBitmap3();
|
virtual void _ReservedBitmap3();
|
||||||
|
|||||||
@@ -1,101 +1,95 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
/
|
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||||
/ File: Screen.h
|
* Distributed under the terms of the MIT License.
|
||||||
/
|
*/
|
||||||
/ Description: BScreen provides information about a screen's current
|
|
||||||
/ display settings. It also lets you set the Desktop color.
|
|
||||||
/
|
|
||||||
/ Copyright 1993-98, Be Incorporated, All Rights Reserved
|
|
||||||
/
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef _SCREEN_H
|
#ifndef _SCREEN_H
|
||||||
#define _SCREEN_H
|
#define _SCREEN_H
|
||||||
|
|
||||||
#include <BeBuild.h>
|
|
||||||
#include <Accelerant.h>
|
#include <Accelerant.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
|
||||||
/*----- BScreen structures and declarations ----------------------*/
|
|
||||||
|
|
||||||
class BWindow;
|
class BWindow;
|
||||||
class BPrivateScreen;
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
namespace BPrivate {
|
||||||
/*----- BScreen class --------------------------------------------*/
|
class BPrivateScreen;
|
||||||
|
}
|
||||||
|
|
||||||
class BScreen {
|
class BScreen {
|
||||||
public:
|
public:
|
||||||
BScreen( screen_id id=B_MAIN_SCREEN_ID );
|
BScreen(screen_id id = B_MAIN_SCREEN_ID);
|
||||||
BScreen( BWindow *win );
|
BScreen(BWindow* window);
|
||||||
~BScreen();
|
~BScreen();
|
||||||
|
|
||||||
bool IsValid();
|
bool IsValid();
|
||||||
status_t SetToNext();
|
status_t SetToNext();
|
||||||
|
|
||||||
color_space ColorSpace();
|
|
||||||
BRect Frame();
|
|
||||||
screen_id ID();
|
|
||||||
|
|
||||||
status_t WaitForRetrace();
|
color_space ColorSpace();
|
||||||
status_t WaitForRetrace(bigtime_t timeout);
|
BRect Frame();
|
||||||
|
screen_id ID();
|
||||||
uint8 IndexForColor( rgb_color rgb );
|
|
||||||
uint8 IndexForColor( uint8 r, uint8 g, uint8 b, uint8 a=255 );
|
|
||||||
rgb_color ColorForIndex( const uint8 index );
|
|
||||||
uint8 InvertIndex( uint8 index );
|
|
||||||
|
|
||||||
const color_map* ColorMap();
|
status_t WaitForRetrace();
|
||||||
|
status_t WaitForRetrace(bigtime_t timeout);
|
||||||
|
|
||||||
status_t GetBitmap( BBitmap **screen_shot,
|
uint8 IndexForColor(rgb_color color);
|
||||||
bool draw_cursor = true,
|
uint8 IndexForColor(uint8 red, uint8 green, uint8 blue,
|
||||||
BRect *bound = NULL);
|
uint8 alpha = 255);
|
||||||
status_t ReadBitmap( BBitmap *buffer,
|
rgb_color ColorForIndex(uint8 index);
|
||||||
bool draw_cursor = true,
|
uint8 InvertIndex(uint8 index);
|
||||||
BRect *bound = NULL);
|
|
||||||
|
|
||||||
rgb_color DesktopColor();
|
|
||||||
rgb_color DesktopColor(uint32 index);
|
|
||||||
void SetDesktopColor( rgb_color rgb, bool stick=true );
|
|
||||||
void SetDesktopColor( rgb_color rgb, uint32 index, bool stick=true );
|
|
||||||
|
|
||||||
status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high);
|
const color_map* ColorMap();
|
||||||
status_t GetModeList(display_mode **mode_list, uint32 *count);
|
|
||||||
status_t GetMode(display_mode *mode);
|
|
||||||
status_t GetMode(uint32 workspace, display_mode *mode);
|
|
||||||
status_t SetMode(display_mode *mode, bool makeDefault = false);
|
|
||||||
status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault = false);
|
|
||||||
status_t GetDeviceInfo(accelerant_device_info *adi);
|
|
||||||
status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
|
|
||||||
status_t GetTimingConstraints(display_timing_constraints *dtc);
|
|
||||||
status_t SetDPMS(uint32 dpms_state);
|
|
||||||
uint32 DPMSState(void);
|
|
||||||
uint32 DPMSCapabilites(void);
|
|
||||||
|
|
||||||
BPrivateScreen* private_screen();
|
status_t GetBitmap(BBitmap** _bitmap, bool drawCursor = true,
|
||||||
|
BRect* frame = NULL);
|
||||||
|
status_t ReadBitmap(BBitmap* bitmap, bool drawCursor = true,
|
||||||
|
BRect* frame = NULL);
|
||||||
|
|
||||||
/*----- Private or reserved -----------------------------------------*/
|
rgb_color DesktopColor();
|
||||||
private:
|
rgb_color DesktopColor(uint32 index);
|
||||||
status_t ProposeDisplayMode(display_mode *target, const display_mode *low, const display_mode *high);
|
void SetDesktopColor(rgb_color color, bool makeDefault = true);
|
||||||
BScreen &operator=(const BScreen &screen);
|
void SetDesktopColor(rgb_color color, uint32 index,
|
||||||
BScreen(const BScreen &screen);
|
bool makeDefault = true);
|
||||||
void* BaseAddress();
|
|
||||||
uint32 BytesPerRow();
|
|
||||||
|
|
||||||
BPrivateScreen *fScreen;
|
status_t ProposeMode(display_mode* target, const display_mode* low,
|
||||||
|
const display_mode* high);
|
||||||
|
status_t GetModeList(display_mode** _modeList, uint32* _count);
|
||||||
|
status_t GetMode(display_mode* mode);
|
||||||
|
status_t GetMode(uint32 workspace, display_mode* mode);
|
||||||
|
status_t SetMode(display_mode* mode, bool makeDefault = false);
|
||||||
|
status_t SetMode(uint32 workspace, display_mode* mode,
|
||||||
|
bool makeDefault = false);
|
||||||
|
status_t GetDeviceInfo(accelerant_device_info* info);
|
||||||
|
status_t GetMonitorInfo(monitor_info* info);
|
||||||
|
status_t GetPixelClockLimits(display_mode* mode, uint32* low,
|
||||||
|
uint32* high);
|
||||||
|
status_t GetTimingConstraints(
|
||||||
|
display_timing_constraints* timingConstraints);
|
||||||
|
status_t SetDPMS(uint32 state);
|
||||||
|
uint32 DPMSState();
|
||||||
|
uint32 DPMSCapabilites();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BScreen& operator=(const BScreen& other);
|
||||||
|
BScreen(const BScreen& other);
|
||||||
|
|
||||||
|
// old and deprecated methods - should be faded out
|
||||||
|
BPrivate::BPrivateScreen* private_screen();
|
||||||
|
status_t ProposeDisplayMode(display_mode* target,
|
||||||
|
const display_mode* low, const display_mode* high);
|
||||||
|
void* BaseAddress();
|
||||||
|
uint32 BytesPerRow();
|
||||||
|
|
||||||
|
BPrivate::BPrivateScreen* fScreen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
inline uint8
|
||||||
/*----- inline definitions ---------------------------------------*/
|
BScreen::IndexForColor(rgb_color color)
|
||||||
|
{
|
||||||
|
return IndexForColor(color.red, color.green, color.blue, color.alpha);
|
||||||
|
}
|
||||||
|
|
||||||
inline uint8 BScreen::IndexForColor( rgb_color rgb )
|
#endif // _SCREEN_H
|
||||||
{ return IndexForColor(rgb.red,rgb.green,rgb.blue,rgb.alpha); }
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* _SCREEN_H */
|
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ enum {
|
|||||||
|
|
||||||
AS_GET_RETRACE_SEMAPHORE,
|
AS_GET_RETRACE_SEMAPHORE,
|
||||||
AS_GET_ACCELERANT_INFO,
|
AS_GET_ACCELERANT_INFO,
|
||||||
|
AS_GET_MONITOR_INFO,
|
||||||
AS_GET_FRAME_BUFFER_CONFIG,
|
AS_GET_FRAME_BUFFER_CONFIG,
|
||||||
|
|
||||||
AS_SET_DPMS,
|
AS_SET_DPMS,
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
#include "PrivateScreen.h"
|
#include "PrivateScreen.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
@@ -25,10 +28,8 @@
|
|||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include <new>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
|
using namespace BPrivate;
|
||||||
|
|
||||||
static BObjectList<BPrivateScreen> sScreens(2, true);
|
static BObjectList<BPrivateScreen> sScreens(2, true);
|
||||||
|
|
||||||
@@ -36,8 +37,6 @@ static BObjectList<BPrivateScreen> sScreens(2, true);
|
|||||||
static BLocker sScreenLock("screen lock");
|
static BLocker sScreenLock("screen lock");
|
||||||
|
|
||||||
|
|
||||||
using namespace BPrivate;
|
|
||||||
|
|
||||||
BPrivateScreen *
|
BPrivateScreen *
|
||||||
BPrivateScreen::Get(BWindow *window)
|
BPrivateScreen::Get(BWindow *window)
|
||||||
{
|
{
|
||||||
@@ -514,6 +513,26 @@ BPrivateScreen::GetDeviceInfo(accelerant_device_info *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BPrivateScreen::GetMonitorInfo(monitor_info* info)
|
||||||
|
{
|
||||||
|
if (info == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
BPrivate::AppServerLink link;
|
||||||
|
link.StartMessage(AS_GET_MONITOR_INFO);
|
||||||
|
link.Attach<screen_id>(ID());
|
||||||
|
|
||||||
|
status_t status = B_ERROR;
|
||||||
|
if (link.FlushWithReply(status) == B_OK && status == B_OK) {
|
||||||
|
link.Read<monitor_info>(info);
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BPrivateScreen::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
|
BPrivateScreen::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2005, Haiku Inc.
|
* Copyright 2002-2007, Haiku Inc.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -21,6 +21,8 @@ class BApplication;
|
|||||||
class BWindow;
|
class BWindow;
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
class BPrivateScreen {
|
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.
|
||||||
@@ -59,6 +61,7 @@ class BPrivateScreen {
|
|||||||
status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault);
|
status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault);
|
||||||
|
|
||||||
status_t GetDeviceInfo(accelerant_device_info *info);
|
status_t GetDeviceInfo(accelerant_device_info *info);
|
||||||
|
status_t GetMonitorInfo(monitor_info* info);
|
||||||
status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
|
status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
|
||||||
status_t GetTimingConstraints(display_timing_constraints *constraints);
|
status_t GetTimingConstraints(display_timing_constraints *constraints);
|
||||||
|
|
||||||
@@ -95,4 +98,6 @@ class BPrivateScreen {
|
|||||||
bigtime_t fLastUpdate;
|
bigtime_t fLastUpdate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
#endif // _PRIVATE_SCREEN_H_
|
#endif // _PRIVATE_SCREEN_H_
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2005, Haiku Inc.
|
* Copyright 2003-2007, Haiku Inc.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
* Axel Dörfler, [email protected]
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** BScreen lets you retrieve and change the display settings. */
|
/*! BScreen lets you retrieve and change the display settings. */
|
||||||
|
|
||||||
|
|
||||||
#include "PrivateScreen.h"
|
#include "PrivateScreen.h"
|
||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
using namespace BPrivate;
|
||||||
|
|
||||||
|
|
||||||
static const uint32 kCurrentWorkspaceIndex = ~0;
|
static const uint32 kCurrentWorkspaceIndex = ~0;
|
||||||
|
|
||||||
@@ -385,6 +387,15 @@ BScreen::GetDeviceInfo(accelerant_device_info *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BScreen::GetMonitorInfo(monitor_info* info)
|
||||||
|
{
|
||||||
|
if (fScreen != NULL)
|
||||||
|
return fScreen->GetMonitorInfo(info);
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Returns, in low and high, the minimum and maximum pixel clock rates
|
/*! \brief Returns, in low and high, the minimum and maximum pixel clock rates
|
||||||
that are possible for the given mode.
|
that are possible for the given mode.
|
||||||
\param mode A pointer to a display_mode.
|
\param mode A pointer to a display_mode.
|
||||||
@@ -455,17 +466,19 @@ BScreen::DPMSCapabilites()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - Deprecated methods
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Returns the BPrivateScreen used by the BScreen object.
|
/*! \brief Returns the BPrivateScreen used by the BScreen object.
|
||||||
\return A pointer to the BPrivateScreen class internally used by the BScreen object.
|
\return A pointer to the BPrivateScreen class internally used by the BScreen object.
|
||||||
*/
|
*/
|
||||||
BPrivateScreen*
|
BPrivate::BPrivateScreen*
|
||||||
BScreen::private_screen()
|
BScreen::private_screen()
|
||||||
{
|
{
|
||||||
return fScreen;
|
return fScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----- Private or reserved -----------------------------------------*/
|
|
||||||
/*! \brief Deprecated, use ProposeMode() instead.
|
/*! \brief Deprecated, use ProposeMode() instead.
|
||||||
*/
|
*/
|
||||||
status_t
|
status_t
|
||||||
@@ -475,22 +488,6 @@ BScreen::ProposeDisplayMode(display_mode *target, const display_mode *low, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Copy not allowed.
|
|
||||||
*/
|
|
||||||
BScreen&
|
|
||||||
BScreen::operator=(const BScreen&)
|
|
||||||
{
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Copy not allowed.
|
|
||||||
*/
|
|
||||||
BScreen::BScreen(const BScreen &screen)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Returns the base address of the framebuffer.
|
/*! \brief Returns the base address of the framebuffer.
|
||||||
*/
|
*/
|
||||||
void*
|
void*
|
||||||
|
|||||||
@@ -2287,6 +2287,27 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AS_GET_MONITOR_INFO:
|
||||||
|
{
|
||||||
|
STRACE(("ServerApp %s: get monitor info\n", Signature()));
|
||||||
|
|
||||||
|
// We aren't using the screen_id for now...
|
||||||
|
screen_id id;
|
||||||
|
link.Read<screen_id>(&id);
|
||||||
|
|
||||||
|
monitor_info info;
|
||||||
|
// TODO: I wonder if there should be a "desktop" lock...
|
||||||
|
status_t status = fDesktop->HWInterface()->GetMonitorInfo(&info);
|
||||||
|
if (status == B_OK) {
|
||||||
|
fLink.StartMessage(B_OK);
|
||||||
|
fLink.Attach<monitor_info>(info);
|
||||||
|
} else
|
||||||
|
fLink.StartMessage(status);
|
||||||
|
|
||||||
|
fLink.Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AS_GET_FRAME_BUFFER_CONFIG:
|
case AS_GET_FRAME_BUFFER_CONFIG:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: get frame buffer config\n", Signature()));
|
STRACE(("ServerApp %s: get frame buffer config\n", Signature()));
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ AccelerantHWInterface::_SetupDefaultHooks()
|
|||||||
fAccGetTimingConstraints = (get_timing_constraints)fAccelerantHook(B_GET_TIMING_CONSTRAINTS, NULL);
|
fAccGetTimingConstraints = (get_timing_constraints)fAccelerantHook(B_GET_TIMING_CONSTRAINTS, NULL);
|
||||||
fAccProposeDisplayMode = (propose_display_mode)fAccelerantHook(B_PROPOSE_DISPLAY_MODE, NULL);
|
fAccProposeDisplayMode = (propose_display_mode)fAccelerantHook(B_PROPOSE_DISPLAY_MODE, NULL);
|
||||||
fAccGetPreferredDisplayMode = (get_preferred_display_mode)fAccelerantHook(B_GET_PREFERRED_DISPLAY_MODE, NULL);
|
fAccGetPreferredDisplayMode = (get_preferred_display_mode)fAccelerantHook(B_GET_PREFERRED_DISPLAY_MODE, NULL);
|
||||||
|
fAccGetMonitorInfo = (get_monitor_info)fAccelerantHook(B_GET_MONITOR_INFO, NULL);
|
||||||
fAccGetEDIDInfo = (get_edid_info)fAccelerantHook(B_GET_EDID_INFO, NULL);
|
fAccGetEDIDInfo = (get_edid_info)fAccelerantHook(B_GET_EDID_INFO, NULL);
|
||||||
|
|
||||||
// cursor
|
// cursor
|
||||||
@@ -777,35 +778,71 @@ AccelerantHWInterface::GetPreferredMode(display_mode* mode)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AccelerantHWInterface::GetMonitorInfo(BString& name, BString& serial)
|
AccelerantHWInterface::GetMonitorInfo(monitor_info* info)
|
||||||
{
|
{
|
||||||
if (fAccGetEDIDInfo == NULL)
|
status_t status = B_NOT_SUPPORTED;
|
||||||
return B_NOT_SUPPORTED;
|
|
||||||
|
|
||||||
edid1_info info;
|
if (fAccGetMonitorInfo != NULL) {
|
||||||
|
status = fAccGetMonitorInfo(info);
|
||||||
|
if (status == B_OK)
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fAccGetEDIDInfo == NULL)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
edid1_info edid;
|
||||||
uint32 version;
|
uint32 version;
|
||||||
status_t status = fAccGetEDIDInfo(&info, sizeof(info), &version);
|
status = fAccGetEDIDInfo(&edid, sizeof(edid), &version);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
if (version != EDID_VERSION_1)
|
if (version != EDID_VERSION_1)
|
||||||
return B_NOT_SUPPORTED;
|
return B_NOT_SUPPORTED;
|
||||||
|
|
||||||
uint32 found = 0;
|
memset(info, 0, sizeof(monitor_info));
|
||||||
|
strlcpy(info->vendor, edid.vendor.manufacturer, sizeof(info->vendor));
|
||||||
|
snprintf(info->serial_number, sizeof(info->serial_number), "%lu",
|
||||||
|
edid.vendor.serial);
|
||||||
|
info->product_id = edid.vendor.prod_id;
|
||||||
|
info->width = edid.display.h_size;
|
||||||
|
info->height = edid.display.v_size;
|
||||||
|
|
||||||
|
uint32 found = 0;
|
||||||
for (uint32 i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; ++i) {
|
for (uint32 i = 0; i < EDID1_NUM_DETAILED_MONITOR_DESC; ++i) {
|
||||||
edid1_detailed_monitor *monitor = &info.detailed_monitor[i];
|
edid1_detailed_monitor *monitor = &edid.detailed_monitor[i];
|
||||||
|
|
||||||
switch (monitor->monitor_desc_type) {
|
switch (monitor->monitor_desc_type) {
|
||||||
case EDID1_SERIAL_NUMBER:
|
case EDID1_SERIAL_NUMBER:
|
||||||
serial.SetTo(monitor->data.serial_number);
|
strlcpy(info->serial_number, monitor->data.serial_number,
|
||||||
|
sizeof(info->serial_number));
|
||||||
found++;
|
found++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDID1_MONITOR_NAME:
|
case EDID1_MONITOR_NAME:
|
||||||
name.SetTo(monitor->data.monitor_name);
|
strlcpy(info->name, monitor->data.monitor_name,
|
||||||
|
sizeof(info->name));
|
||||||
found++;
|
found++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EDID1_MONITOR_RANGES:
|
||||||
|
{
|
||||||
|
edid1_monitor_range& range = monitor->data.monitor_range;
|
||||||
|
|
||||||
|
info->min_horizontal_frequency = range.min_h;
|
||||||
|
info->max_horizontal_frequency = range.max_h;
|
||||||
|
info->min_vertical_frequency = range.min_v;
|
||||||
|
info->max_vertical_frequency = range.max_v;
|
||||||
|
info->max_pixel_clock = range.max_clock * 10000;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case EDID1_IS_DETAILED_TIMING:
|
||||||
|
{
|
||||||
|
edid1_detailed_timing& timing = monitor->data.detailed_timing;
|
||||||
|
info->width = timing.h_size / 10.0;
|
||||||
|
info->height = timing.v_size / 10.0;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
const display_mode *low,
|
const display_mode *low,
|
||||||
const display_mode *high);
|
const display_mode *high);
|
||||||
virtual status_t GetPreferredMode(display_mode* mode);
|
virtual status_t GetPreferredMode(display_mode* mode);
|
||||||
virtual status_t GetMonitorInfo(BString& name, BString& serial);
|
virtual status_t GetMonitorInfo(monitor_info* info);
|
||||||
|
|
||||||
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);
|
||||||
@@ -131,6 +131,7 @@ private:
|
|||||||
get_timing_constraints fAccGetTimingConstraints;
|
get_timing_constraints fAccGetTimingConstraints;
|
||||||
propose_display_mode fAccProposeDisplayMode;
|
propose_display_mode fAccProposeDisplayMode;
|
||||||
get_preferred_display_mode fAccGetPreferredDisplayMode;
|
get_preferred_display_mode fAccGetPreferredDisplayMode;
|
||||||
|
get_monitor_info fAccGetMonitorInfo;
|
||||||
get_edid_info fAccGetEDIDInfo;
|
get_edid_info fAccGetEDIDInfo;
|
||||||
fill_rectangle fAccFillRect;
|
fill_rectangle fAccFillRect;
|
||||||
invert_rectangle fAccInvertRect;
|
invert_rectangle fAccInvertRect;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ HWInterface::GetPreferredMode(display_mode* mode)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
HWInterface::GetMonitorInfo(BString& name, BString& serial)
|
HWInterface::GetMonitorInfo(monitor_info* info)
|
||||||
{
|
{
|
||||||
return B_NOT_SUPPORTED;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class HWInterface : protected MultiLocker {
|
|||||||
const display_mode *low,
|
const display_mode *low,
|
||||||
const display_mode *high) = 0;
|
const display_mode *high) = 0;
|
||||||
virtual status_t GetPreferredMode(display_mode* mode);
|
virtual status_t GetPreferredMode(display_mode* mode);
|
||||||
virtual status_t GetMonitorInfo(BString& name, BString& serial);
|
virtual status_t GetMonitorInfo(monitor_info* info);
|
||||||
|
|
||||||
virtual sem_id RetraceSemaphore() = 0;
|
virtual sem_id RetraceSemaphore() = 0;
|
||||||
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT) = 0;
|
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT) = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user