* 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:
Axel Dörfler
2007-10-15 11:41:47 +00:00
parent 4ff2178120
commit c278448653
12 changed files with 220 additions and 123 deletions
+24 -2
View File
@@ -1,4 +1,4 @@
#if !defined(_ACCELERANT_H_)
#ifndef _ACCELERANT_H_
#define _ACCELERANT_H_
#include <BeBuild.h>
@@ -15,7 +15,7 @@ extern "C" {
typedef void * (*GetAccelerantHook)(uint32, void *);
_EXPORT void * get_accelerant_hook(uint32 feature, void *data);
void *get_accelerant_hook(uint32 feature, void *data);
enum {
/* initialization */
@@ -42,6 +42,7 @@ enum {
B_DPMS_MODE, /* required if driver supports DPMS */
B_SET_DPMS_MODE, /* required if driver supports DPMS */
B_GET_PREFERRED_DISPLAY_MODE, /* optional */
B_GET_MONITOR_INFO, /* optional */
B_GET_EDID_INFO, /* optional */
/* cursor managment */
@@ -121,6 +122,26 @@ typedef struct {
uint16 v_blank_max;
} 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 */
B_SCROLL = 1 << 0,
B_8_BIT_DAC = 1 << 1,
@@ -216,6 +237,7 @@ typedef uint32 (*dpms_capabilities)(void);
typedef uint32 (*dpms_mode)(void);
typedef status_t (*set_dpms_mode)(uint32 dpms_flags);
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 sem_id (*accelerant_retrace_semaphore)(void);
+7 -7
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2006, Haiku.
* Copyright 2001-2007, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -13,8 +13,11 @@
#include <InterfaceDefs.h>
#include <Rect.h>
class BPrivateScreen;
class BView;
class BWindow;
namespace BPrivate {
class BPrivateScreen;
}
enum {
B_BITMAP_CLEAR_TO_WHITE = 0x00000001,
@@ -91,15 +94,12 @@ class BBitmap : public BArchivable {
BBitmap& operator=(const BBitmap& source);
//----- Private or reserved -----------------------------------------//
virtual status_t Perform(perform_code d, void *arg);
private:
friend class BView;
friend class BApplication;
friend class BPrivateScreen;
friend class BPrivate::BPrivateScreen;
virtual status_t Perform(perform_code d, void *arg);
virtual void _ReservedBitmap1();
virtual void _ReservedBitmap2();
virtual void _ReservedBitmap3();
+70 -76
View File
@@ -1,101 +1,95 @@
/*******************************************************************************
/
/ File: Screen.h
/
/ 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
/
*******************************************************************************/
/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SCREEN_H
#define _SCREEN_H
#include <BeBuild.h>
#include <Accelerant.h>
#include <GraphicsDefs.h>
#include <Rect.h>
#include <OS.h>
/*----------------------------------------------------------------*/
/*----- BScreen structures and declarations ----------------------*/
class BWindow;
class BPrivateScreen;
/*----------------------------------------------------------------*/
/*----- BScreen class --------------------------------------------*/
namespace BPrivate {
class BPrivateScreen;
}
class BScreen {
public:
BScreen( screen_id id=B_MAIN_SCREEN_ID );
BScreen( BWindow *win );
~BScreen();
public:
BScreen(screen_id id = B_MAIN_SCREEN_ID);
BScreen(BWindow* window);
~BScreen();
bool IsValid();
status_t SetToNext();
color_space ColorSpace();
BRect Frame();
screen_id ID();
bool IsValid();
status_t SetToNext();
status_t WaitForRetrace();
status_t WaitForRetrace(bigtime_t timeout);
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 );
color_space ColorSpace();
BRect Frame();
screen_id ID();
const color_map* ColorMap();
status_t WaitForRetrace();
status_t WaitForRetrace(bigtime_t timeout);
status_t GetBitmap( BBitmap **screen_shot,
bool draw_cursor = true,
BRect *bound = NULL);
status_t ReadBitmap( BBitmap *buffer,
bool draw_cursor = true,
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 );
uint8 IndexForColor(rgb_color color);
uint8 IndexForColor(uint8 red, uint8 green, uint8 blue,
uint8 alpha = 255);
rgb_color ColorForIndex(uint8 index);
uint8 InvertIndex(uint8 index);
status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high);
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);
const color_map* ColorMap();
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 -----------------------------------------*/
private:
status_t ProposeDisplayMode(display_mode *target, const display_mode *low, const display_mode *high);
BScreen &operator=(const BScreen &screen);
BScreen(const BScreen &screen);
void* BaseAddress();
uint32 BytesPerRow();
rgb_color DesktopColor();
rgb_color DesktopColor(uint32 index);
void SetDesktopColor(rgb_color color, bool makeDefault = true);
void SetDesktopColor(rgb_color color, uint32 index,
bool makeDefault = true);
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 definitions ---------------------------------------*/
inline uint8
BScreen::IndexForColor(rgb_color color)
{
return IndexForColor(color.red, color.green, color.blue, color.alpha);
}
inline uint8 BScreen::IndexForColor( rgb_color rgb )
{ return IndexForColor(rgb.red,rgb.green,rgb.blue,rgb.alpha); }
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _SCREEN_H */
#endif // _SCREEN_H