anv,i965: Stop warning about incomplete gen11 support
[mesa.git] / src / mesa / drivers / dri / swrast / swrast.c
index e66b2257de85e8eea7864175d3e7f79285546988..94758e60862056b0ae2489db492aa27929d52ff1 100644 (file)
@@ -208,6 +208,8 @@ static const __DRI2rendererQueryExtension swrast_query_renderer_extension = {
 static const __DRIextension *dri_screen_extensions[] = {
     &swrastTexBufferExtension.base,
     &swrast_query_renderer_extension.base,
+    &dri2ConfigQueryExtension.base,
+    &dri2NoErrorExtension.base,
     NULL
 };
 
@@ -221,11 +223,8 @@ swrastFillInModes(__DRIscreen *psp,
     unsigned back_buffer_factor;
     mesa_format format;
 
-    /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
-     * support pageflipping at all.
-     */
     static const GLenum back_buffer_modes[] = {
-       GLX_NONE, GLX_SWAP_UNDEFINED_OML
+       __DRI_ATTRIB_SWAP_NONE, __DRI_ATTRIB_SWAP_UNDEFINED
     };
 
     uint8_t depth_bits_array[4];
@@ -273,7 +272,7 @@ swrastFillInModes(__DRIscreen *psp,
                               depth_bits_array, stencil_bits_array,
                               depth_buffer_factor, back_buffer_modes,
                               back_buffer_factor, msaa_samples_array, 1,
-                              GL_TRUE, GL_FALSE);
+                              GL_TRUE, GL_FALSE, GL_FALSE);
     if (configs == NULL) {
        fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
                __LINE__);
@@ -471,13 +470,17 @@ swrast_map_renderbuffer(struct gl_context *ctx,
                        GLuint x, GLuint y, GLuint w, GLuint h,
                        GLbitfield mode,
                        GLubyte **out_map,
-                       GLint *out_stride)
+                       GLint *out_stride,
+                       bool flip_y)
 {
    struct dri_swrast_renderbuffer *xrb = dri_swrast_renderbuffer(rb);
    GLubyte *map = xrb->Base.Buffer;
    int cpp = _mesa_get_format_bytes(rb->Format);
    int stride = rb->Width * cpp;
 
+   /* driver does not support GL_FRAMEBUFFER_FLIP_Y_MESA */
+   assert((rb->Name == 0) == flip_y);
+
    if (rb->AllocStorage == swrast_alloc_front_storage) {
       __DRIdrawable *dPriv = xrb->dPriv;
       __DRIscreen *sPriv = dPriv->driScreenPriv;
@@ -676,6 +679,9 @@ swrast_check_and_update_window_size( struct gl_context *ctx, struct gl_framebuff
 {
     GLsizei width, height;
 
+    if (!fb)
+        return;
+
     get_window_size(fb, &width, &height);
     if (fb->Width != width || fb->Height != height) {
        _mesa_resize_framebuffer(ctx, fb, width, height);
@@ -750,10 +756,7 @@ static GLboolean
 dri_create_context(gl_api api,
                   const struct gl_config * visual,
                   __DRIcontext * cPriv,
-                  unsigned major_version,
-                  unsigned minor_version,
-                  uint32_t flags,
-                  bool notify_reset,
+                  const struct __DriverContextConfig *ctx_config,
                   unsigned *error,
                   void *sharedContextPrivate)
 {
@@ -767,7 +770,13 @@ dri_create_context(gl_api api,
 
     /* Flag filtering is handled in dri2CreateContextAttribs.
      */
-    (void) flags;
+    (void) ctx_config->flags;
+
+    /* The swrast driver doesn't understand any of the attributes */
+    if (ctx_config->attribute_mask != 0) {
+       *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+       return false;
+    }
 
     ctx = CALLOC_STRUCT(dri_context);
     if (ctx == NULL) {
@@ -781,6 +790,7 @@ dri_create_context(gl_api api,
     /* build table of device driver functions */
     _mesa_init_driver_functions(&functions);
     swrast_init_driver_functions(&functions);
+    _tnl_init_driver_draw_function(&functions);
 
     if (share) {
        sharedCtx = &share->Base;
@@ -794,7 +804,7 @@ dri_create_context(gl_api api,
        goto context_fail;
     }
 
-    driContextSetFlags(mesaCtx, flags);
+    driContextSetFlags(mesaCtx, ctx_config->flags);
 
     /* create module contexts */
     _swrast_CreateContext( mesaCtx );
@@ -812,6 +822,7 @@ dri_create_context(gl_api api,
     _mesa_meta_init(mesaCtx);
     _mesa_enable_sw_extensions(mesaCtx);
 
+   _mesa_override_extensions(mesaCtx);
     _mesa_compute_version(mesaCtx);
 
     _mesa_initialize_dispatch_tables(mesaCtx);
@@ -853,32 +864,26 @@ dri_make_current(__DRIcontext * cPriv,
                 __DRIdrawable * driReadPriv)
 {
     struct gl_context *mesaCtx;
-    struct gl_framebuffer *mesaDraw;
-    struct gl_framebuffer *mesaRead;
+    struct gl_framebuffer *mesaDraw = NULL;
+    struct gl_framebuffer *mesaRead = NULL;
     TRACE;
 
     if (cPriv) {
-       struct dri_context *ctx = dri_context(cPriv);
-       struct dri_drawable *draw;
-       struct dri_drawable *read;
-
-       if (!driDrawPriv || !driReadPriv)
-           return GL_FALSE;
-
-       draw = dri_drawable(driDrawPriv);
-       read = dri_drawable(driReadPriv);
-       mesaCtx = &ctx->Base;
-       mesaDraw = &draw->Base;
-       mesaRead = &read->Base;
-
-       /* check for same context and buffer */
-       if (mesaCtx == _mesa_get_current_context()
-           && mesaCtx->DrawBuffer == mesaDraw
-           && mesaCtx->ReadBuffer == mesaRead) {
-           return GL_TRUE;
-       }
-
-       _glapi_check_multithread();
+        mesaCtx = &dri_context(cPriv)->Base;
+
+       if (driDrawPriv && driReadPriv) {
+           struct dri_drawable *draw = dri_drawable(driDrawPriv);
+           struct dri_drawable *read = dri_drawable(driReadPriv);
+           mesaDraw = &draw->Base;
+           mesaRead = &read->Base;
+        }
+
+        /* check for same context and buffer */
+        if (mesaCtx == _mesa_get_current_context()
+            && mesaCtx->DrawBuffer == mesaDraw
+            && mesaCtx->ReadBuffer == mesaRead) {
+            return GL_TRUE;
+        }
 
        swrast_check_and_update_window_size(mesaCtx, mesaDraw);
        if (mesaRead != mesaDraw)
@@ -964,7 +969,6 @@ static const __DRIextension *swrast_driver_extensions[] = {
     &driCoreExtension.base,
     &driSWRastExtension.base,
     &driCopySubBufferExtension.base,
-    &dri2ConfigQueryExtension.base,
     &swrast_vtable.base,
     NULL
 };