1 /* 2 * Virtio GPU Device 3 * 4 * Copyright Red Hat, Inc. 2013-2014 5 * 6 * Authors: 7 * Dave Airlie <airlied@redhat.com> 8 * Gerd Hoffmann <kraxel@redhat.com> 9 * 10 * This work is licensed under the terms of the GNU GPL, version 2 or later. 11 * See the COPYING file in the top-level directory. 12 */ 13 14 #ifndef HW_VIRTIO_GPU_PIXMAN_H 15 #define HW_VIRTIO_GPU_PIXMAN_H 16 17 #include "ui/qemu-pixman.h" 18 #include "standard-headers/linux/virtio_gpu.h" 19 20 static inline pixman_format_code_t virtio_gpu_get_pixman_format(uint32_t virtio_gpu_format)21virtio_gpu_get_pixman_format(uint32_t virtio_gpu_format) 22 { 23 switch (virtio_gpu_format) { 24 case VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM: 25 return PIXMAN_BE_b8g8r8x8; 26 case VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM: 27 return PIXMAN_BE_b8g8r8a8; 28 case VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM: 29 return PIXMAN_BE_x8r8g8b8; 30 case VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM: 31 return PIXMAN_BE_a8r8g8b8; 32 case VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM: 33 return PIXMAN_BE_r8g8b8x8; 34 case VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM: 35 return PIXMAN_BE_r8g8b8a8; 36 case VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM: 37 return PIXMAN_BE_x8b8g8r8; 38 case VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM: 39 return PIXMAN_BE_a8b8g8r8; 40 default: 41 return 0; 42 } 43 } 44 45 #endif 46