implemented client/server side support for BScreen::GetDeviceInfo() and WaitForRetrace(), and (only client side) support for Bscreen::ProposeMode()
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13266 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -130,6 +130,7 @@ enum {
|
||||
// Screen methods
|
||||
AS_SCREEN_GET_MODE,
|
||||
AS_SCREEN_SET_MODE,
|
||||
AS_PROPOSE_MODE,
|
||||
AS_GET_MODE_LIST,
|
||||
|
||||
AS_SCREEN_GET_COLORMAP,
|
||||
@@ -138,6 +139,7 @@ enum {
|
||||
AS_SET_DESKTOP_COLOR,
|
||||
|
||||
AS_GET_RETRACE_SEMAPHORE,
|
||||
AS_GET_ACCELERANT_INFO,
|
||||
|
||||
// Global function call defs
|
||||
AS_SET_UI_COLORS,
|
||||
|
||||
@@ -261,10 +261,27 @@ BPrivateScreen::SetDesktopColor(rgb_color color, uint32 workspace, bool makeDefa
|
||||
|
||||
|
||||
status_t
|
||||
BPrivateScreen::ProposeMode(display_mode *target, const display_mode *low, const display_mode *high)
|
||||
BPrivateScreen::ProposeMode(display_mode *target,
|
||||
const display_mode *low, const display_mode *high)
|
||||
{
|
||||
// TODO: Implement
|
||||
return B_ERROR;
|
||||
// We can't return B_BAD_VALUE here, because it's used to indicate
|
||||
// that the mode returned is supported, but it doesn't fall
|
||||
// within the limit (see ProposeMode() documentation)
|
||||
if (target == NULL || low == NULL || high == NULL)
|
||||
return B_ERROR;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_PROPOSE_MODE);
|
||||
link.Attach<screen_id>(ID());
|
||||
int32 reply;
|
||||
status_t status = B_ERROR;
|
||||
if (link.FlushWithReply(reply) == B_OK && reply == SERVER_TRUE) {
|
||||
link.Read<display_mode>(target);
|
||||
// The status is important here. See documentation
|
||||
link.Read<status_t>(&status);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -345,7 +362,18 @@ BPrivateScreen::SetMode(uint32 workspace, display_mode *mode, bool makeDefault)
|
||||
status_t
|
||||
BPrivateScreen::GetDeviceInfo(accelerant_device_info *info)
|
||||
{
|
||||
// TODO: Implement
|
||||
if (info == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_ACCELERANT_INFO);
|
||||
link.Attach<screen_id>(ID());
|
||||
int32 code;
|
||||
if (link.FlushWithReply(code) == B_OK && code == SERVER_TRUE) {
|
||||
link.Read<accelerant_device_info>(info);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -1948,6 +1948,43 @@ status_t ret = B_ERROR;
|
||||
root->Unlock();
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_GET_ACCELERANT_INFO:
|
||||
{
|
||||
STRACE(("ServerApp %s: get accelerant info\n", fSignature.String()));
|
||||
|
||||
// We aren't using the screen_id for now...
|
||||
screen_id id;
|
||||
link.Read<screen_id>(&id);
|
||||
|
||||
accelerant_device_info accelerantInfo;
|
||||
// TODO: I wonder if there should be a "desktop" lock...
|
||||
if (gDesktop->GetHWInterface()->GetDeviceInfo(&accelerantInfo) == B_OK) {
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
fLink.Attach<accelerant_device_info>(accelerantInfo);
|
||||
} else
|
||||
fLink.StartMessage(SERVER_FALSE);
|
||||
|
||||
fLink.Flush();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case AS_GET_RETRACE_SEMAPHORE:
|
||||
{
|
||||
STRACE(("ServerApp %s: get retrace semaphore\n", fSignature.String()));
|
||||
|
||||
// We aren't using the screen_id for now...
|
||||
screen_id id;
|
||||
link.Read<screen_id>(&id);
|
||||
|
||||
sem_id semaphore = gDesktop->GetHWInterface()->RetraceSemaphore();
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
fLink.Attach<sem_id>(semaphore);
|
||||
fLink.Flush();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
printf("ServerApp %s received unhandled message code offset %s\n",
|
||||
|
||||
@@ -558,6 +558,17 @@ AccelerantHWInterface::ProposeMode(display_mode *candidate, const display_mode *
|
||||
return fAccProposeDisplayMode(candidate, &this_low, &this_high);
|
||||
}
|
||||
|
||||
// RetraceSemaphore
|
||||
sem_id
|
||||
AccelerantHWInterface::RetraceSemaphore()
|
||||
{
|
||||
accelerant_retrace_semaphore AccelerantRetraceSemaphore = (accelerant_retrace_semaphore)fAccelerantHook(B_ACCELERANT_RETRACE_SEMAPHORE, NULL);
|
||||
if (!AccelerantRetraceSemaphore)
|
||||
return B_UNSUPPORTED;
|
||||
|
||||
return AccelerantRetraceSemaphore();
|
||||
}
|
||||
|
||||
// WaitForRetrace
|
||||
status_t
|
||||
AccelerantHWInterface::WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT)
|
||||
|
||||
@@ -42,6 +42,7 @@ 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);
|
||||
|
||||
@@ -51,6 +51,7 @@ class HWInterface : public MultiLocker {
|
||||
const display_mode *low,
|
||||
const display_mode *high) = 0;
|
||||
|
||||
virtual sem_id RetraceSemaphore() = 0;
|
||||
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT) = 0;
|
||||
|
||||
virtual status_t SetDPMSMode(const uint32 &state) = 0;
|
||||
|
||||
@@ -643,6 +643,13 @@ ViewHWInterface::DPMSCapabilities()
|
||||
return BScreen().DPMSCapabilites();
|
||||
}
|
||||
|
||||
// RetraceSemaphore
|
||||
sem_id
|
||||
ViewHWInterface::RetraceSemaphore()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// WaitForRetrace
|
||||
status_t
|
||||
ViewHWInterface::WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT)
|
||||
|
||||
@@ -42,6 +42,7 @@ class ViewHWInterface : public HWInterface {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user