Added smallest skeletons of future nvidia and radeon OpenGL renderers.

For the moment, these two just does a quick check for nvidia or radeon drivers been loaded and running.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21229 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin 2007-05-24 21:29:01 +00:00
parent 361a19cd94
commit 8f53078de4
5 changed files with 146 additions and 0 deletions

View File

@ -1,4 +1,6 @@
SubDir HAIKU_TOP src add-ons opengl ;
SubInclude HAIKU_TOP src add-ons opengl mesa_software_renderer ;
# SubInclude HAIKU_TOP src add-ons opengl nvidia ;
# SubInclude HAIKU_TOP src add-ons opengl radeon ;

View File

@ -0,0 +1,24 @@
SubDir HAIKU_TOP src add-ons opengl nvidia ;
SetSubDirSupportedPlatformsBeOSCompatible ;
if $(TARGET_PLATFORM) != haiku {
UseHeaders [ FDirName $(HAIKU_TOP) headers os opengl ] : true ;
# We need our public GL headers also when not compiling for Haiku.
}
UsePrivateHeaders opengl ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa main ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa glapi ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa tnl ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa x86 ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa ppc ] ;
Addon NVidia\ Hardware\ Renderer : opengl :
NVidiaHardwareRenderer.cpp
: false
: libGL.so libmesa.a be
;

View File

@ -0,0 +1,43 @@
/*
* Copyright 2006, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <stdio.h>
#include <Screen.h>
#include <GLRenderer.h>
extern "C" _EXPORT BGLRenderer *
instanciate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher)
{
if (!view)
return NULL;
BWindow *window = view->Window();
if (!window)
return NULL;
BScreen screen(window);
if (!screen.IsValid())
return NULL;
accelerant_device_info adi;
if (screen.GetDeviceInfo(&adi) !=B_OK)
return NULL;
fprintf(stderr, "Accelerant device info:\n"
" version: %ud\n"
" name: %s\n"
" chipset: %s\n"
" serial#: %s\n", (unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no);
flush(stderr);
// Check the view is attached to a screen driven by a NVidia chip:
if (strncmp(adi.name, "Nvidia", 6) == 0) {
// return new NVidiaHardwareRenderer(view, options, dispatcher);
return NULL;
}
return NULL;
}

View File

@ -0,0 +1,24 @@
SubDir HAIKU_TOP src add-ons opengl radeon ;
SetSubDirSupportedPlatformsBeOSCompatible ;
if $(TARGET_PLATFORM) != haiku {
UseHeaders [ FDirName $(HAIKU_TOP) headers os opengl ] : true ;
# We need our public GL headers also when not compiling for Haiku.
}
UsePrivateHeaders opengl ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa main ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa glapi ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa tnl ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa x86 ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa ppc ] ;
Addon Radeon\ Hardware\ Renderer : opengl :
RadeonHardwareRenderer.cpp
: false
: libGL.so libmesa.a be
;

View File

@ -0,0 +1,53 @@
/*
* Copyright 2006, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <stdio.h>
#include <Screen.h>
#include <GLRenderer.h>
extern "C" _EXPORT BGLRenderer *
instanciate_gl_renderer(BGLView *view, ulong options, BGLDispatcher *dispatcher)
{
if (!view) {
printf("view = NULL!\n");
return NULL;
}
BWindow *window = view->Window();
if (!window) {
printf("view's window = NULL!\n");
return NULL;
}
BScreen screen(window);
if (!screen.IsValid()) {
printf("Failed to get window's screen!\n");
return NULL;
}
accelerant_device_info adi;
if (screen.GetDeviceInfo(&adi) != B_OK) {
printf("screen.GetDeviceInfo() failed!\n");
return NULL;
}
printf("Accelerant device info:\n"
" version: %ud\n"
" name: %s\n"
" chipset: %s\n"
" serial#: %s\n", (unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no);
// Check the view is attached to a screen driven by a Radeon chip:
if (strcasecmp(adi.chipset, "radeon") == 0 ||
strcasecmp(adi.chipset, "radeon") == 0) {
// return new RadeonHardwareRenderer(view, options, dispatcher);
return NULL;
}
// We can't be a renderer for this view, sorry.
return NULL;
}