#include "nouveau_driver.h"
#include "nouveau_context.h"
#include "nouveau_fbo.h"
+#include "nouveau_texture.h"
#include "nouveau_drmif.h"
#include "nv04_driver.h"
#include "nv10_driver.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
+#include "swrast/s_renderbuffer.h"
static const __DRIextension *nouveau_screen_extensions[];
static void
nouveau_destroy_screen(__DRIscreen *dri_screen);
-static void
-nouveau_channel_flush_notify(struct nouveau_channel *chan)
-{
- struct nouveau_screen *screen = chan->user_private;
- struct nouveau_context *nctx = screen->context;
-
- if (nctx && nctx->fallback < SWRAST)
- nouveau_state_emit(&nctx->base);
-}
-
static const __DRIconfig **
nouveau_get_configs(void)
{
back_buffer_modes,
Elements(back_buffer_modes),
msaa_samples,
- Elements(msaa_samples));
+ Elements(msaa_samples),
+ GL_TRUE);
assert(config);
configs = configs ? driConcatConfigs(configs, config)
if (!screen)
return NULL;
- dri_screen->private = screen;
+ dri_screen->driverPrivate = screen;
dri_screen->extensions = nouveau_screen_extensions;
screen->dri_screen = dri_screen;
goto fail;
}
- ret = nouveau_channel_alloc(screen->device, 0xbeef0201, 0xbeef0202,
- &screen->chan);
- if (ret) {
- nouveau_error("Error initializing the FIFO.\n");
- goto fail;
- }
- screen->chan->flush_notify = nouveau_channel_flush_notify;
- screen->chan->user_private = screen;
-
- /* Do the card specific initialization */
+ /* Choose the card specific function pointers. */
switch (screen->device->chipset & 0xf0) {
case 0x00:
- ret = nv04_screen_init(screen);
+ screen->driver = &nv04_driver;
break;
case 0x10:
- ret = nv10_screen_init(screen);
+ screen->driver = &nv10_driver;
break;
case 0x20:
- ret = nv20_screen_init(screen);
+ screen->driver = &nv20_driver;
break;
default:
assert(0);
}
- if (!ret) {
- nouveau_error("Error initializing the hardware.\n");
- goto fail;
- }
configs = nouveau_get_configs();
- if (!configs) {
- nouveau_error("Error creating the framebuffer configs.\n");
+ if (!configs)
goto fail;
- }
return configs;
fail:
static void
nouveau_destroy_screen(__DRIscreen *dri_screen)
{
- struct nouveau_screen *screen = dri_screen->private;
+ struct nouveau_screen *screen = dri_screen->driverPrivate;
if (!screen)
return;
- screen->driver->screen_destroy(screen);
-
- if (screen->chan) {
- screen->chan->flush_notify = NULL;
- nouveau_channel_free(&screen->chan);
- }
-
if (screen->device)
nouveau_device_close(&screen->device);
FREE(screen);
- dri_screen->private = NULL;
+ dri_screen->driverPrivate = NULL;
}
static GLboolean
nouveau_create_buffer(__DRIscreen *dri_screen,
__DRIdrawable *drawable,
- const __GLcontextModes *visual,
+ const struct gl_config *visual,
GLboolean is_pixmap)
{
- struct gl_renderbuffer *rb;
+ struct gl_renderbuffer *rb;
struct gl_framebuffer *fb;
GLenum color_format;
}
/* Software renderbuffers. */
- _mesa_add_soft_renderbuffers(fb, GL_FALSE, GL_FALSE, GL_FALSE,
- visual->accumRedBits > 0,
- GL_FALSE, GL_FALSE);
+ _swrast_add_soft_renderbuffers(fb, GL_FALSE, GL_FALSE, GL_FALSE,
+ visual->accumRedBits > 0,
+ GL_FALSE, GL_FALSE);
drawable->driverPrivate = fb;
(struct gl_framebuffer **)&drawable->driverPrivate, NULL);
}
+static void
+nouveau_drawable_flush(__DRIdrawable *draw)
+{
+}
+
+static const struct __DRI2flushExtensionRec nouveau_flush_extension = {
+ { __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
+ nouveau_drawable_flush,
+ dri2InvalidateDrawable,
+};
+
+static const struct __DRItexBufferExtensionRec nouveau_texbuffer_extension = {
+ { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
+ NULL,
+ nouveau_set_texbuffer,
+};
+
static const __DRIextension *nouveau_screen_extensions[] = {
+ &nouveau_flush_extension.base,
+ &nouveau_texbuffer_extension.base,
+ &dri2ConfigQueryExtension.base,
NULL
};
const struct __DriverAPIRec driDriverAPI = {
- .InitScreen2 = nouveau_init_screen2,
+ .InitScreen = nouveau_init_screen2,
.DestroyScreen = nouveau_destroy_screen,
.CreateBuffer = nouveau_create_buffer,
.DestroyBuffer = nouveau_destroy_buffer,