dri2: Make createImageFromName() take a __DRIscreen instead of __DRIcontext
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 22 Sep 2010 19:07:15 +0000 (15:07 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 22 Sep 2010 19:08:22 +0000 (15:08 -0400)
We can't expect to have a context when this is called, and we don't need one
so just require a __DRIscreen instead.

Reported by Yu Dai <yu.dai@intel.com>

include/GL/internal/dri_interface.h
src/egl/drivers/dri2/egl_dri2.c
src/gallium/state_trackers/dri/drm/dri2.c
src/mesa/drivers/dri/intel/intel_screen.c

index ff83ff145e7550f3f4789f16aa5e404e651b5954..5351a2ba4ab9744448dda749ecd4c6302659f805 100644 (file)
@@ -805,7 +805,7 @@ typedef struct __DRIimageExtensionRec __DRIimageExtension;
 struct __DRIimageExtensionRec {
     __DRIextension base;
 
-    __DRIimage *(*createImageFromName)(__DRIcontext *context,
+    __DRIimage *(*createImageFromName)(__DRIscreen *screen,
                                       int width, int height, int format,
                                       int name, int pitch,
                                       void *loaderPrivate);
index 856029091a2368bcf623e4a6782f7bace1f57df2..083f796f430104dbe6caa38d0d447236286a4bad 100644 (file)
@@ -1509,7 +1509,6 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
                             EGLClientBuffer buffer, const EGLint *attr_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-   struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
    struct dri2_egl_image *dri2_img;
    unsigned int attachments[1];
    xcb_drawable_t drawable;
@@ -1577,7 +1576,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
 
    stride = buffers[0].pitch / buffers[0].cpp;
    dri2_img->dri_image =
-      dri2_dpy->image->createImageFromName(dri2_ctx->dri_context,
+      dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
                                           buffers_reply->width,
                                           buffers_reply->height,
                                           format,
@@ -1628,7 +1627,6 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
                                  EGLClientBuffer buffer, const EGLint *attr_list)
 {
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-   struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
    struct dri2_egl_image *dri2_img;
    EGLint width, height, format, name, stride, pitch, i, err;
 
@@ -1697,7 +1695,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
    }
 
    dri2_img->dri_image =
-      dri2_dpy->image->createImageFromName(dri2_ctx->dri_context,
+      dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
                                           width,
                                           height,
                                           format,
index 596309bfbd9fbdad0d8f434556b089a831aa3d53..135f66c61da13f11b81182c47ba6d843c289519c 100644 (file)
@@ -305,11 +305,11 @@ dri2_lookup_egl_image(struct dri_context *ctx, void *handle)
 }
 
 static __DRIimage *
-dri2_create_image_from_name(__DRIcontext *context,
+dri2_create_image_from_name(__DRIscreen *_screen,
                             int width, int height, int format,
                             int name, int pitch, void *loaderPrivate)
 {
-   struct dri_screen *screen = dri_screen(context->driScreenPriv);
+   struct dri_screen *screen = dri_screen(_screen);
    __DRIimage *img;
    struct pipe_resource templ;
    struct winsys_handle whandle;
index 0a542a7303d71fcf988b877cdbba4cf8bfbdc17a..6d66a25ca1fa96146b2a24baaa4f5fa3a4a105dc 100644 (file)
@@ -123,12 +123,12 @@ static const struct __DRI2flushExtensionRec intelFlushExtension = {
 };
 
 static __DRIimage *
-intel_create_image_from_name(__DRIcontext *context,
+intel_create_image_from_name(__DRIscreen *screen,
                             int width, int height, int format,
                             int name, int pitch, void *loaderPrivate)
 {
+    struct intel_screen *intelScreen = screen->private;
     __DRIimage *image;
-    struct intel_context *intel = context->driverPrivate;
     int cpp;
 
     image = CALLOC(sizeof *image);
@@ -159,7 +159,7 @@ intel_create_image_from_name(__DRIcontext *context,
     image->data = loaderPrivate;
     cpp = _mesa_get_format_bytes(image->format);
 
-    image->region = intel_region_alloc_for_handle(intel->intelScreen,
+    image->region = intel_region_alloc_for_handle(intelScreen,
                                                  cpp, width, height,
                                                  pitch, name, "image");
     if (image->region == NULL) {