Mercurial > sdl-ios-xcode
comparison src/video/qnxgf/SDL_qnxgf.c @ 3185:44d5474c2c8a
Continue working on QNX GF and Photon support.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Wed, 10 Jun 2009 08:09:04 +0000 |
parents | 7f684f249ec9 |
children | 51750b7a966f |
comparison
equal
deleted
inserted
replaced
3184:68d3b48a6002 | 3185:44d5474c2c8a |
---|---|
45 /* This is real pain in the ass. GF is just wrapper around a selected driver */ | 45 /* This is real pain in the ass. GF is just wrapper around a selected driver */ |
46 /* some drivers could support double scan modes, like 320x200, 512x384, etc */ | 46 /* some drivers could support double scan modes, like 320x200, 512x384, etc */ |
47 /* but some drivers are not. Later we can distinguish one driver from another */ | 47 /* but some drivers are not. Later we can distinguish one driver from another */ |
48 /* Feel free to add any new custom graphics mode */ | 48 /* Feel free to add any new custom graphics mode */ |
49 /******************************************************************************/ | 49 /******************************************************************************/ |
50 static SDL_DisplayMode generic_mode[] = { | 50 static const SDL_DisplayMode generic_mode[] = { |
51 {0, 320, 200, 70, NULL}, /* 320x200 modes are 70Hz and 85Hz */ | 51 {0, 320, 200, 70, NULL}, /* 320x200 modes are 70Hz and 85Hz */ |
52 {0, 320, 200, 85, NULL}, | 52 {0, 320, 200, 85, NULL}, |
53 {0, 320, 240, 70, NULL}, /* 320x240 modes are 70Hz and 85Hz */ | 53 {0, 320, 240, 70, NULL}, /* 320x240 modes are 70Hz and 85Hz */ |
54 {0, 320, 240, 85, NULL}, | 54 {0, 320, 240, 85, NULL}, |
55 {0, 400, 300, 60, NULL}, /* 400x300 mode is 60Hz only */ | 55 {0, 400, 300, 60, NULL}, /* 400x300 mode is 60Hz only */ |
98 {0, 2048, 1080, 60, NULL}, /* 2048x1080 mode is 60Hz only */ | 98 {0, 2048, 1080, 60, NULL}, /* 2048x1080 mode is 60Hz only */ |
99 {0, 0, 0, 0, NULL} /* End of generic mode list */ | 99 {0, 0, 0, 0, NULL} /* End of generic mode list */ |
100 }; | 100 }; |
101 | 101 |
102 /* Low level device graphics driver names, which they are reporting */ | 102 /* Low level device graphics driver names, which they are reporting */ |
103 GF_DeviceCaps gf_devicename[] = { | 103 static const GF_DeviceCaps gf_devicename[] = { |
104 /* ATI Rage 128 graphics driver (devg-ati_rage128) */ | 104 /* ATI Rage 128 graphics driver (devg-ati_rage128) */ |
105 {"ati_rage128", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | 105 {"ati_rage128", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | |
106 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, | 106 SDL_GF_UNACCELERATED_3D | SDL_GF_VIDEOMEMORY}, |
107 /* Fujitsu Carmine graphics driver (devg-carmine.so) */ | 107 /* Fujitsu Carmine graphics driver (devg-carmine.so) */ |
108 {"carmine", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | | 108 {"carmine", SDL_GF_ACCELERATED | SDL_GF_NOLOWRESOLUTION | |
642 mode.format = | 642 mode.format = |
643 qnxgf_gf_to_sdl_pixelformat(modeinfo.primary_format); | 643 qnxgf_gf_to_sdl_pixelformat(modeinfo.primary_format); |
644 mode.driverdata = NULL; | 644 mode.driverdata = NULL; |
645 SDL_AddDisplayMode(_this->current_display, &mode); | 645 SDL_AddDisplayMode(_this->current_display, &mode); |
646 | 646 |
647 /* If mode is RGBA8888, add the same mode as RGBx888 */ | |
648 if (modeinfo.primary_format==GF_FORMAT_BGRA8888) { | |
649 mode.w = generic_mode[jt].w; | |
650 mode.h = generic_mode[jt].h; | |
651 mode.refresh_rate = generic_mode[jt].refresh_rate; | |
652 mode.format = SDL_PIXELFORMAT_RGB888; | |
653 mode.driverdata = NULL; | |
654 SDL_AddDisplayMode(_this->current_display, &mode); | |
655 } | |
656 /* If mode is RGBA1555, add the same mode as RGBx555 */ | |
657 if (modeinfo.primary_format==GF_FORMAT_PACK_ARGB1555) { | |
658 mode.w = generic_mode[jt].w; | |
659 mode.h = generic_mode[jt].h; | |
660 mode.refresh_rate = generic_mode[jt].refresh_rate; | |
661 mode.format = SDL_PIXELFORMAT_RGB555; | |
662 mode.driverdata = NULL; | |
663 SDL_AddDisplayMode(_this->current_display, &mode); | |
664 } | |
665 | |
647 jt++; | 666 jt++; |
648 } while (1); | 667 } while (1); |
649 } else { | 668 } else { |
650 /* Add this display mode as is in case if it is non-generic */ | 669 /* Add this display mode as is in case if it is non-generic */ |
651 /* But go through the each refresh rate, supported by gf */ | 670 /* But go through the each refresh rate, supported by gf */ |
658 mode.format = | 677 mode.format = |
659 qnxgf_gf_to_sdl_pixelformat(modeinfo. | 678 qnxgf_gf_to_sdl_pixelformat(modeinfo. |
660 primary_format); | 679 primary_format); |
661 mode.driverdata = NULL; | 680 mode.driverdata = NULL; |
662 SDL_AddDisplayMode(_this->current_display, &mode); | 681 SDL_AddDisplayMode(_this->current_display, &mode); |
682 | |
683 /* If mode is RGBA8888, add the same mode as RGBx888 */ | |
684 if (modeinfo.primary_format==GF_FORMAT_BGRA8888) { | |
685 mode.w = modeinfo.xres; | |
686 mode.h = modeinfo.yres; | |
687 mode.refresh_rate = modeinfo.refresh[jt]; | |
688 mode.format = SDL_PIXELFORMAT_RGB888; | |
689 mode.driverdata = NULL; | |
690 SDL_AddDisplayMode(_this->current_display, &mode); | |
691 } | |
692 /* If mode is RGBA1555, add the same mode as RGBx555 */ | |
693 if (modeinfo.primary_format==GF_FORMAT_PACK_ARGB1555) { | |
694 mode.w = modeinfo.xres; | |
695 mode.h = modeinfo.yres; | |
696 mode.refresh_rate = modeinfo.refresh[jt]; | |
697 mode.format = SDL_PIXELFORMAT_RGB555; | |
698 mode.driverdata = NULL; | |
699 SDL_AddDisplayMode(_this->current_display, &mode); | |
700 } | |
701 | |
663 jt++; | 702 jt++; |
664 } else { | 703 } else { |
665 break; | 704 break; |
666 } | 705 } |
667 } while (1); | 706 } while (1); |
821 } | 860 } |
822 | 861 |
823 /* Mark main display layer is attached */ | 862 /* Mark main display layer is attached */ |
824 didata->layer_attached = SDL_TRUE; | 863 didata->layer_attached = SDL_TRUE; |
825 | 864 |
826 /* Set layer source and destination viewport */ | 865 /* Set layer source and destination viewports */ |
827 gf_layer_set_src_viewport(didata->layer, 0, 0, mode->w - 1, mode->h - 1); | 866 gf_layer_set_src_viewport(didata->layer, 0, 0, mode->w - 1, mode->h - 1); |
828 gf_layer_set_dst_viewport(didata->layer, 0, 0, mode->w - 1, mode->h - 1); | 867 gf_layer_set_dst_viewport(didata->layer, 0, 0, mode->w - 1, mode->h - 1); |
829 | 868 |
830 /* Create main visible on display surface */ | 869 /* Create main visible on display surface */ |
831 status = | 870 status = |
1462 | 1501 |
1463 /* Check if nothing has been found, try "don't care" settings */ | 1502 /* Check if nothing has been found, try "don't care" settings */ |
1464 if (configs == 0) { | 1503 if (configs == 0) { |
1465 int32_t it; | 1504 int32_t it; |
1466 int32_t jt; | 1505 int32_t jt; |
1467 GLint depthbits[4] = { 32, 24, 16, EGL_DONT_CARE }; | 1506 static const GLint depthbits[4] = { 32, 24, 16, EGL_DONT_CARE }; |
1468 | 1507 |
1469 for (it = 0; it < 4; it++) { | 1508 for (it = 0; it < 4; it++) { |
1470 for (jt = 16; jt >= 0; jt--) { | 1509 for (jt = 16; jt >= 0; jt--) { |
1471 /* Don't care about color buffer bits, use what exist */ | 1510 /* Don't care about color buffer bits, use what exist */ |
1472 /* Replace previous data set with EGL_DONT_CARE */ | 1511 /* Replace previous data set with EGL_DONT_CARE */ |
1518 wdata->gles_attributes, | 1557 wdata->gles_attributes, |
1519 wdata->gles_configs, | 1558 wdata->gles_configs, |
1520 SDL_VIDEO_GF_OPENGLES_CONFS, &configs); | 1559 SDL_VIDEO_GF_OPENGLES_CONFS, &configs); |
1521 if (status != EGL_TRUE) { | 1560 if (status != EGL_TRUE) { |
1522 SDL_SetError | 1561 SDL_SetError |
1523 ("Photon: Can't find closest configuration for OpenGL ES"); | 1562 ("GF: Can't find closest configuration for OpenGL ES"); |
1524 return NULL; | 1563 return NULL; |
1525 } | 1564 } |
1526 if (configs != 0) { | 1565 if (configs != 0) { |
1527 break; | 1566 break; |
1528 } | 1567 } |
1533 } | 1572 } |
1534 | 1573 |
1535 /* No available configs */ | 1574 /* No available configs */ |
1536 if (configs == 0) { | 1575 if (configs == 0) { |
1537 SDL_SetError | 1576 SDL_SetError |
1538 ("Photon: Can't find any configuration for OpenGL ES"); | 1577 ("GF: Can't find any configuration for OpenGL ES"); |
1539 return NULL; | 1578 return NULL; |
1540 } | 1579 } |
1541 } | 1580 } |
1542 | 1581 |
1543 /* Initialize config index */ | 1582 /* Initialize config index */ |