accelerant/radeon_hd: Allow failure to init card

* Previously, any accelerants failing would cause an
  app_server crash.. so we would do everything in our
  power to get "something"
* After hrev56252, the app_server properly handles
  accelerant failures and vesa / framebuffer accelerants
  should will be used.
* Thus, if no monitors were detected (due to none being
  plugged-in, or some other fault), bail and return B_ERROR
  so vesa fallback can give it a try.

Change-Id: Ib9695dd7cf1914e50547ca8661c55b80152a66a4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5442
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
Alexander von Gluck IV 2022-07-08 19:07:01 -05:00 committed by Alex von Gluck IV
parent 4043ac1867
commit 65462c8c81
2 changed files with 19 additions and 23 deletions

View File

@ -41,6 +41,8 @@
# define TRACE(x...) ;
#endif
#define ERROR(x...) _sPrintf("radeon_hd: " x)
struct accelerant_info* gInfo;
display_info* gDisplay[MAX_DISPLAY];
@ -228,7 +230,8 @@ radeon_init_accelerant(int device)
}
if (status != B_OK) {
TRACE("%s: couldn't detect supported connectors!\n", __func__);
ERROR("%s: couldn't detect supported connectors!\n", __func__);
radeon_uninit_accelerant();
return status;
}
@ -246,18 +249,20 @@ radeon_init_accelerant(int device)
// detect attached displays
status = detect_displays();
//if (status != B_OK)
// return status;
if (status != B_OK) {
radeon_uninit_accelerant();
return status;
}
// print found displays
debug_displays();
// create initial list of video modes
status = create_mode_list();
//if (status != B_OK) {
// radeon_uninit_accelerant();
// return status;
//}
if (status != B_OK) {
radeon_uninit_accelerant();
return status;
}
radeon_gpu_mc_setup();

View File

@ -377,23 +377,14 @@ detect_displays()
displayIndex++;
}
// fallback if no attached monitors were found
// fail if no attached monitors were found
if (displayIndex == 0) {
// This is a hack, however as we don't support HPD just yet,
// it tries to prevent a "no displays" situation.
ERROR("%s: ERROR: 0 attached monitors were found on display connectors."
" Injecting first connector as a last resort.\n", __func__);
for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) {
// skip TV DAC connectors as likely fallback isn't for TV
if (gConnector[id]->encoder.type == VIDEO_ENCODER_TVDAC)
continue;
gDisplay[0]->attached = true;
gDisplay[0]->connectorIndex = id;
init_registers(gDisplay[0]->regs, 0);
if (detect_crt_ranges(0) == B_OK)
gDisplay[0]->foundRanges = true;
break;
}
// TODO: In the future we might want to accept this condition.. however
// without monitor hot plugging, we're most likely going to fail to bring
// up a display here.
ERROR("%s: ERROR: 0 attached monitors were found on display connectors.",
__func__);
return B_ERROR;
}
// Initial boot state is the first two crtc's powered