intel: set dri_format field for all images
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Mon, 30 Apr 2012 09:32:45 +0000 (12:32 +0300)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 30 Apr 2012 17:18:16 +0000 (13:18 -0400)
Only images created with intel_create_image() had the field properly
set. Set it also on intel_dup_image(), intel_create_image_from_name()
and intel_create_image_from_renderbuffer().

src/mesa/drivers/dri/intel/intel_screen.c

index ac21e96c6536de646ee793fd0226242c8f016059..ac6b22f7e06cdea8bd7102825265f8b787702e8b 100644 (file)
@@ -188,6 +188,8 @@ intel_create_image_from_name(__DRIscreen *screen,
     if (image == NULL)
        return NULL;
 
+    image->dri_format = format;
+
     switch (format) {
     case __DRI_IMAGE_FORMAT_RGB565:
        image->format = MESA_FORMAT_RGB565;
@@ -255,6 +257,21 @@ intel_create_image_from_renderbuffer(__DRIcontext *context,
    image->data = loaderPrivate;
    intel_region_reference(&image->region, irb->mt->region);
 
+   switch (image->format) {
+   case MESA_FORMAT_RGB565:
+      image->dri_format = __DRI_IMAGE_FORMAT_RGB565;
+      break;
+   case MESA_FORMAT_XRGB8888:
+      image->dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
+      break;
+   case MESA_FORMAT_ARGB8888:
+      image->dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
+      break;
+   case MESA_FORMAT_RGBA8888_REV:
+      image->dri_format = __DRI_IMAGE_FORMAT_ABGR8888;
+      break;
+   }
+
    return image;
 }
 
@@ -365,6 +382,7 @@ intel_dup_image(__DRIimage *orig_image, void *loaderPrivate)
    }
 
    image->internal_format = orig_image->internal_format;
+   image->dri_format      = orig_image->dri_format;
    image->format          = orig_image->format;
    image->data_type       = orig_image->data_type;
    image->data            = loaderPrivate;