app_server & BWindowScreen: Do away with AS_GET_FRAME_BUFFER_CONFIG.

It can't work if the framebuffer is mapped per-application.
Instead, use the accelerant hook to get the framebuffer.

The BScreen methods this disables were deprecated and marked
private already, so no Haiku applications should be affected.
(If really necessary they could be reimplemented with BWindowScreen.)

Remove first _GetCardInfo in BWindowScreen; we invoke it
later, closer to where the buffer is actually used.

Tested with ParticlesII (which uses BWindowScreen) on VESA
with the new user-only-mapping accelerant.

Change-Id: I405bcfa8cb1eb2d0c346fafbc6233bef15196134
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10572
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2026-03-24 14:01:11 +00:00
committed by waddlesplash
parent f6be811473
commit 861f644f19
18 changed files with 11 additions and 151 deletions
-1
View File
@@ -170,7 +170,6 @@ enum {
AS_GET_RETRACE_SEMAPHORE, AS_GET_RETRACE_SEMAPHORE,
AS_GET_ACCELERANT_INFO, AS_GET_ACCELERANT_INFO,
AS_GET_MONITOR_INFO, AS_GET_MONITOR_INFO,
AS_GET_FRAME_BUFFER_CONFIG,
AS_SET_DPMS, AS_SET_DPMS,
AS_GET_DPMS_STATE, AS_GET_DPMS_STATE,
@@ -85,9 +85,6 @@ public:
status_t GetBrightness(float*); status_t GetBrightness(float*);
status_t SetBrightness(float); status_t SetBrightness(float);
void* BaseAddress();
uint32 BytesPerRow();
private: private:
friend class BObjectList<BPrivateScreen, true>; friend class BObjectList<BPrivateScreen, true>;
@@ -98,8 +95,6 @@ private:
bool _Release(); bool _Release();
sem_id _RetraceSemaphore(); sem_id _RetraceSemaphore();
status_t _GetFrameBufferConfig(
frame_buffer_config& config);
static BPrivateScreen* _Get(int32 id, bool check); static BPrivateScreen* _Get(int32 id, bool check);
static bool _IsValid(int32 id); static bool _IsValid(int32 id);
+9 -15
View File
@@ -41,6 +41,8 @@ using BPrivate::AppServerLink;
// Acceleration hooks pointers // Acceleration hooks pointers
static get_frame_buffer_config sGetFrameBufferConfigHook;
static fill_rectangle sFillRectHook; static fill_rectangle sFillRectHook;
static screen_to_screen_blit sBlitRectHook; static screen_to_screen_blit sBlitRectHook;
static screen_to_screen_transparent_blit sTransparentBlitHook; static screen_to_screen_transparent_blit sTransparentBlitHook;
@@ -610,10 +612,6 @@ BWindowScreen::_InitData(uint32 space, uint32 attributes)
if (status < B_OK) if (status < B_OK)
throw status; throw status;
status = _GetCardInfo();
if (status < B_OK)
throw status;
fDebugSem = create_sem(1, "WindowScreen debug sem"); fDebugSem = create_sem(1, "WindowScreen debug sem");
if (fDebugSem < B_OK) if (fDebugSem < B_OK)
throw (status_t)fDebugSem; throw (status_t)fDebugSem;
@@ -690,11 +688,12 @@ status_t
BWindowScreen::_Activate() BWindowScreen::_Activate()
{ {
CALLED(); CALLED();
status_t status = _AssertDisplayMode(fDisplayMode);
status_t status = _SetupAccelerantHooks();
if (status < B_OK) if (status < B_OK)
return status; return status;
status = _SetupAccelerantHooks(); status = _AssertDisplayMode(fDisplayMode);
if (status < B_OK) if (status < B_OK)
return status; return status;
@@ -760,6 +759,8 @@ BWindowScreen::_SetupAccelerantHooks()
_ResetAccelerantHooks(); _ResetAccelerantHooks();
if (status == B_OK) { if (status == B_OK) {
sGetFrameBufferConfigHook = (get_frame_buffer_config)
fGetAccelerantHook(B_GET_FRAME_BUFFER_CONFIG, NULL);
sWaitIdleHook = fWaitEngineIdle = (wait_engine_idle) sWaitIdleHook = fWaitEngineIdle = (wait_engine_idle)
fGetAccelerantHook(B_WAIT_ENGINE_IDLE, NULL); fGetAccelerantHook(B_WAIT_ENGINE_IDLE, NULL);
sReleaseEngineHook sReleaseEngineHook
@@ -792,6 +793,7 @@ BWindowScreen::_ResetAccelerantHooks()
if (fWaitEngineIdle) if (fWaitEngineIdle)
fWaitEngineIdle(); fWaitEngineIdle();
sGetFrameBufferConfigHook = NULL;
sFillRectHook = NULL; sFillRectHook = NULL;
sBlitRectHook = NULL; sBlitRectHook = NULL;
sTransparentBlitHook = NULL; sTransparentBlitHook = NULL;
@@ -854,16 +856,8 @@ BWindowScreen::_GetCardInfo()
if (mode.flags & B_PARALLEL_ACCESS) if (mode.flags & B_PARALLEL_ACCESS)
fCardInfo.flags |= B_PARALLEL_BUFFER_ACCESS; fCardInfo.flags |= B_PARALLEL_BUFFER_ACCESS;
AppServerLink link;
link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
link.Attach<screen_id>(screen.ID());
status_t result = B_ERROR;
if (link.FlushWithReply(result) < B_OK || result < B_OK)
return result;
frame_buffer_config config; frame_buffer_config config;
link.Read<frame_buffer_config>(&config); sGetFrameBufferConfigHook(&config);
fCardInfo.frame_buffer = config.frame_buffer; fCardInfo.frame_buffer = config.frame_buffer;
fCardInfo.bytes_per_row = config.bytes_per_row; fCardInfo.bytes_per_row = config.bytes_per_row;
-39
View File
@@ -693,28 +693,6 @@ BPrivateScreen::SetBrightness(float brightness)
} }
void *
BPrivateScreen::BaseAddress()
{
frame_buffer_config config;
if (_GetFrameBufferConfig(config) != B_OK)
return NULL;
return config.frame_buffer;
}
uint32
BPrivateScreen::BytesPerRow()
{
frame_buffer_config config;
if (_GetFrameBufferConfig(config) != B_OK)
return 0;
return config.bytes_per_row;
}
// #pragma mark - private methods // #pragma mark - private methods
@@ -753,23 +731,6 @@ BPrivateScreen::_RetraceSemaphore()
} }
status_t
BPrivateScreen::_GetFrameBufferConfig(frame_buffer_config& config)
{
BPrivate::AppServerLink link;
link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
link.Attach<int32>(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(int32 id) BPrivateScreen::BPrivateScreen(int32 id)
: :
fID(id), fID(id),
+2 -6
View File
@@ -372,9 +372,7 @@ BScreen::ProposeDisplayMode(display_mode* target, const display_mode* low,
void* void*
BScreen::BaseAddress() BScreen::BaseAddress()
{ {
if (fScreen != NULL) // deprecated
return fScreen->BaseAddress();
return NULL; return NULL;
} }
@@ -382,8 +380,6 @@ BScreen::BaseAddress()
uint32 uint32
BScreen::BytesPerRow() BScreen::BytesPerRow()
{ {
if (fScreen != NULL) // deprecated
return fScreen->BytesPerRow();
return 0; return 0;
} }
@@ -149,7 +149,6 @@ string_for_message_code(uint32 code)
CODE(AS_GET_RETRACE_SEMAPHORE); CODE(AS_GET_RETRACE_SEMAPHORE);
CODE(AS_GET_ACCELERANT_INFO); CODE(AS_GET_ACCELERANT_INFO);
CODE(AS_GET_MONITOR_INFO); CODE(AS_GET_MONITOR_INFO);
CODE(AS_GET_FRAME_BUFFER_CONFIG);
CODE(AS_SET_DPMS); CODE(AS_SET_DPMS);
CODE(AS_GET_DPMS_STATE); CODE(AS_GET_DPMS_STATE);
-21
View File
@@ -3252,27 +3252,6 @@ 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...
int32 id;
link.Read<int32>(&id);
frame_buffer_config config;
// TODO: I wonder if there should be a "desktop" lock...
status_t status = fDesktop->HWInterface()->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()));
@@ -101,13 +101,6 @@ BitmapHWInterface::GetDeviceInfo(accelerant_device_info* info)
} }
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)
{ {
@@ -32,8 +32,6 @@ public:
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** _modeList, virtual status_t GetModeList(display_mode** _modeList,
uint32* _count); uint32* _count);
-2
View File
@@ -81,8 +81,6 @@ public:
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** _modeList, virtual status_t GetModeList(display_mode** _modeList,
uint32* _count) = 0; uint32* _count) = 0;
virtual status_t GetPixelClockLimits(display_mode* mode, virtual status_t GetPixelClockLimits(display_mode* mode,
@@ -731,14 +731,6 @@ AccelerantHWInterface::GetDeviceInfo(accelerant_device_info* info)
} }
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)
{ {
@@ -34,8 +34,6 @@ public:
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** _modeList, virtual status_t GetModeList(display_mode** _modeList,
uint32* _count); uint32* _count);
@@ -423,14 +423,6 @@ RemoteHWInterface::GetDeviceInfo(accelerant_device_info* info)
} }
status_t
RemoteHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
{
// We don't actually have a frame buffer.
return B_UNSUPPORTED;
}
status_t status_t
RemoteHWInterface::GetModeList(display_mode** _modes, uint32* _count) RemoteHWInterface::GetModeList(display_mode** _modes, uint32* _count)
{ {
@@ -40,8 +40,6 @@ virtual void GetMode(display_mode* mode);
virtual status_t GetPreferredMode(display_mode* mode); virtual status_t GetPreferredMode(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** _modeList, virtual status_t GetModeList(display_mode** _modeList,
uint32* _count); uint32* _count);
@@ -756,20 +756,6 @@ DWindowHWInterface::GetDeviceInfo(accelerant_device_info* info)
} }
status_t
DWindowHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
{
if (!fFrontBuffer.IsSet())
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
DWindowHWInterface::GetModeList(display_mode** _modes, uint32* _count) DWindowHWInterface::GetModeList(display_mode** _modes, uint32* _count)
{ {
@@ -35,8 +35,6 @@ public:
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** _modeList, virtual status_t GetModeList(display_mode** _modeList,
uint32* _count); uint32* _count);
@@ -609,20 +609,6 @@ ViewHWInterface::GetDeviceInfo(accelerant_device_info* info)
} }
status_t
ViewHWInterface::GetFrameBufferConfig(frame_buffer_config& config)
{
if (!fFrontBuffer.IsSet())
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)
{ {
@@ -30,8 +30,6 @@ public:
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** _modeList, virtual status_t GetModeList(display_mode** _modeList,
uint32* _count); uint32* _count);