![]() |
|
|||
0001 /* 0002 * Copyright 2013 Red Hat Inc. 0003 * 0004 * Permission is hereby granted, free of charge, to any person obtaining a 0005 * copy of this software and associated documentation files (the "Software"), 0006 * to deal in the Software without restriction, including without limitation 0007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 0008 * and/or sell copies of the Software, and to permit persons to whom the 0009 * Software is furnished to do so, subject to the following conditions: 0010 * 0011 * The above copyright notice and this permission notice shall be included in 0012 * all copies or substantial portions of the Software. 0013 * 0014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0017 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 0018 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 0019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 0020 * OTHER DEALINGS IN THE SOFTWARE. 0021 * 0022 * Authors: Dave Airlie 0023 * Alon Levy 0024 */ 0025 0026 #include "qxl_drv.h" 0027 #include "qxl_object.h" 0028 0029 /* dumb ioctls implementation */ 0030 0031 int qxl_mode_dumb_create(struct drm_file *file_priv, 0032 struct drm_device *dev, 0033 struct drm_mode_create_dumb *args) 0034 { 0035 struct qxl_device *qdev = to_qxl(dev); 0036 struct qxl_bo *qobj; 0037 uint32_t handle; 0038 int r; 0039 struct qxl_surface surf; 0040 uint32_t pitch, format; 0041 0042 pitch = args->width * ((args->bpp + 1) / 8); 0043 args->size = pitch * args->height; 0044 args->size = ALIGN(args->size, PAGE_SIZE); 0045 0046 switch (args->bpp) { 0047 case 16: 0048 format = SPICE_SURFACE_FMT_16_565; 0049 break; 0050 case 32: 0051 format = SPICE_SURFACE_FMT_32_xRGB; 0052 break; 0053 default: 0054 return -EINVAL; 0055 } 0056 0057 surf.width = args->width; 0058 surf.height = args->height; 0059 surf.stride = pitch; 0060 surf.format = format; 0061 surf.data = 0; 0062 0063 r = qxl_gem_object_create_with_handle(qdev, file_priv, 0064 QXL_GEM_DOMAIN_CPU, 0065 args->size, &surf, &qobj, 0066 &handle); 0067 if (r) 0068 return r; 0069 qobj->is_dumb = true; 0070 args->pitch = pitch; 0071 args->handle = handle; 0072 return 0; 0073 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |