st/dri: pass dri2_format_mapping directly to dri2_create_image_from_winsys
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 29 May 2019 20:56:30 +0000 (16:56 -0400)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 1 Jul 2019 22:16:56 +0000 (15:16 -0700)
this makes the entire struct available for use here

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/state_trackers/dri/dri2.c

index 5caaa9d..1507170 100644 (file)
@@ -781,7 +781,7 @@ dri2_update_tex_buffer(struct dri_drawable *drawable,
 
 static __DRIimage *
 dri2_create_image_from_winsys(__DRIscreen *_screen,
-                              int width, int height, enum pipe_format pf,
+                              int width, int height, const struct dri2_format_mapping *map,
                               int num_handles, struct winsys_handle *whandle,
                               void *loaderPrivate)
 {
@@ -791,6 +791,7 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
    struct pipe_resource templ;
    unsigned tex_usage = 0;
    int i;
+   enum pipe_format pf = map->pipe_format;
 
    if (pscreen->is_format_supported(pscreen, pf, screen->target, 0, 0,
                                     PIPE_BIND_RENDER_TARGET))
@@ -889,7 +890,7 @@ dri2_create_image_from_name(__DRIscreen *_screen,
 
    whandle.stride = pitch * util_format_get_blocksize(map->pipe_format);
 
-   img = dri2_create_image_from_winsys(_screen, width, height, map->pipe_format,
+   img = dri2_create_image_from_winsys(_screen, width, height, map,
                                        1, &whandle, loaderPrivate);
 
    if (!img)
@@ -962,7 +963,7 @@ dri2_create_image_from_fd(__DRIscreen *_screen,
       map = dri2_get_mapping_by_fourcc(fourcc);
    }
 
-   img = dri2_create_image_from_winsys(_screen, width, height, map->pipe_format,
+   img = dri2_create_image_from_winsys(_screen, width, height, map,
                                        num_fds, whandles, loaderPrivate);
    if(img == NULL) {
       err = __DRI_IMAGE_ERROR_BAD_ALLOC;
@@ -1249,7 +1250,7 @@ dri2_from_names(__DRIscreen *screen, int width, int height, int format,
    whandle.offset = offsets[0];
    whandle.modifier = DRM_FORMAT_MOD_INVALID;
 
-   img = dri2_create_image_from_winsys(screen, width, height, map->pipe_format,
+   img = dri2_create_image_from_winsys(screen, width, height, map,
                                        1, &whandle, loaderPrivate);
    if (img == NULL)
       return NULL;