603
607
case __DRI_IMAGE_ATTRIB_FORMAT:
604
608
*value = image->dri_format;
610
case __DRI_IMAGE_ATTRIB_WIDTH:
611
*value = image->texture->width0;
613
case __DRI_IMAGE_ATTRIB_HEIGHT:
614
*value = image->texture->height0;
616
case __DRI_IMAGE_ATTRIB_COMPONENTS:
617
if (image->dri_components == 0)
619
*value = image->dri_components;
621
636
pipe_resource_reference(&img->texture, image->texture);
622
637
img->level = image->level;
623
638
img->layer = image->layer;
639
/* This should be 0 for sub images, but dup is also used for base images. */
640
img->dri_components = image->dri_components;
624
641
img->loader_private = loaderPrivate;
647
dri2_validate_usage(__DRIimage *image, unsigned int use)
650
* Gallium drivers are bad at adding usages to the resources
651
* once opened again in another process, which is the main use
652
* case for this, so we have to lie.
661
dri2_from_names(__DRIscreen *screen, int width, int height, int format,
662
int *names, int num_names, int *strides, int *offsets,
666
int stride, dri_components;
674
case __DRI_IMAGE_FOURCC_RGB565:
675
format = __DRI_IMAGE_FORMAT_RGB565;
676
dri_components = __DRI_IMAGE_COMPONENTS_RGB;
678
case __DRI_IMAGE_FOURCC_ARGB8888:
679
format = __DRI_IMAGE_FORMAT_ARGB8888;
680
dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
682
case __DRI_IMAGE_FOURCC_XRGB8888:
683
format = __DRI_IMAGE_FORMAT_XRGB8888;
684
dri_components = __DRI_IMAGE_COMPONENTS_RGB;
686
case __DRI_IMAGE_FOURCC_ABGR8888:
687
format = __DRI_IMAGE_FORMAT_ABGR8888;
688
dri_components = __DRI_IMAGE_COMPONENTS_RGBA;
690
case __DRI_IMAGE_FOURCC_XBGR8888:
691
format = __DRI_IMAGE_FORMAT_XBGR8888;
692
dri_components = __DRI_IMAGE_COMPONENTS_RGB;
698
/* Strides are in bytes not pixels. */
699
stride = strides[0] /4;
701
img = dri2_create_image_from_name(screen, width, height, format,
702
names[0], stride, loaderPrivate);
706
img->dri_components = dri_components;
711
dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate)
718
if (image->dri_components == 0)
721
img = dri2_dup_image(image, loaderPrivate);
725
/* set this to 0 for sub images. */
726
img->dri_components = 0;
630
731
dri2_destroy_image(__DRIimage *img)