From 9ec0b2a45e18c045fd3dbcdf846fad7faf97494c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 22 Sep 2010 15:07:15 -0400 Subject: [PATCH] dri2: Make createImageFromName() take a __DRIscreen instead of __DRIcontext 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 --- include/GL/internal/dri_interface.h | 2 +- src/egl/drivers/dri2/egl_dri2.c | 6 ++---- src/gallium/state_trackers/dri/drm/dri2.c | 4 ++-- src/mesa/drivers/dri/intel/intel_screen.c | 6 +++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index ff83ff145e7..5351a2ba4ab 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -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); diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 856029091a2..083f796f430 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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, diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 596309bfbd9..135f66c61da 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -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; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 0a542a7303d..6d66a25ca1f 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -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) { -- 2.30.2