Commit b75e1695 authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-vmwgfx-next' of git://people.freedesktop.org/~syeh/repos_linux into drm-next

This is to address what we've discussed, moving some of the minor changes
into a drm-next request.

* 'drm-vmwgfx-next' of git://people.freedesktop.org/~syeh/repos_linux:
  drm/vmwgfx: Use kmemdup instead of kmalloc and memcpy
  drm/vmwgfx: Fix depth input into drm_mode_legacy_fb_format
  drm/vmwgfx: Fix a potential integer overflow
  drm/vmwgfx: Clear an uninitialized struct member
  drm/vmwgfx: Annotate ignored return values
  drm/vmwgfx: Clear uninitialized fields of a parameter
parents 29a73d90 5d25fde2
...@@ -980,6 +980,8 @@ svga3dsurface_get_mip_size(surf_size_struct base_level, u32 mip_level) ...@@ -980,6 +980,8 @@ svga3dsurface_get_mip_size(surf_size_struct base_level, u32 mip_level)
size.width = max_t(u32, base_level.width >> mip_level, 1); size.width = max_t(u32, base_level.width >> mip_level, 1);
size.height = max_t(u32, base_level.height >> mip_level, 1); size.height = max_t(u32, base_level.height >> mip_level, 1);
size.depth = max_t(u32, base_level.depth >> mip_level, 1); size.depth = max_t(u32, base_level.depth >> mip_level, 1);
size.pad64 = 0;
return size; return size;
} }
......
...@@ -840,7 +840,7 @@ static void vmw_move_notify(struct ttm_buffer_object *bo, ...@@ -840,7 +840,7 @@ static void vmw_move_notify(struct ttm_buffer_object *bo,
*/ */
static void vmw_swap_notify(struct ttm_buffer_object *bo) static void vmw_swap_notify(struct ttm_buffer_object *bo)
{ {
ttm_bo_wait(bo, false, false); (void) ttm_bo_wait(bo, false, false);
} }
......
...@@ -1293,7 +1293,7 @@ static void __vmw_svga_enable(struct vmw_private *dev_priv) ...@@ -1293,7 +1293,7 @@ static void __vmw_svga_enable(struct vmw_private *dev_priv)
*/ */
void vmw_svga_enable(struct vmw_private *dev_priv) void vmw_svga_enable(struct vmw_private *dev_priv)
{ {
ttm_read_lock(&dev_priv->reservation_sem, false); (void) ttm_read_lock(&dev_priv->reservation_sem, false);
__vmw_svga_enable(dev_priv); __vmw_svga_enable(dev_priv);
ttm_read_unlock(&dev_priv->reservation_sem); ttm_read_unlock(&dev_priv->reservation_sem);
} }
......
...@@ -482,8 +482,7 @@ static int vmw_fb_kms_framebuffer(struct fb_info *info) ...@@ -482,8 +482,7 @@ static int vmw_fb_kms_framebuffer(struct fb_info *info)
mode_cmd.height = var->yres; mode_cmd.height = var->yres;
mode_cmd.pitches[0] = ((var->bits_per_pixel + 7) / 8) * mode_cmd.width; mode_cmd.pitches[0] = ((var->bits_per_pixel + 7) / 8) * mode_cmd.width;
mode_cmd.pixel_format = mode_cmd.pixel_format =
drm_mode_legacy_fb_format(var->bits_per_pixel, drm_mode_legacy_fb_format(var->bits_per_pixel, depth);
((var->bits_per_pixel + 7) / 8) * mode_cmd.width);
cur_fb = par->set_fb; cur_fb = par->set_fb;
if (cur_fb && cur_fb->width == mode_cmd.width && if (cur_fb && cur_fb->width == mode_cmd.width &&
......
...@@ -757,7 +757,7 @@ static int vmw_create_dmabuf_proxy(struct drm_device *dev, ...@@ -757,7 +757,7 @@ static int vmw_create_dmabuf_proxy(struct drm_device *dev,
struct vmw_surface **srf_out) struct vmw_surface **srf_out)
{ {
uint32_t format; uint32_t format;
struct drm_vmw_size content_base_size; struct drm_vmw_size content_base_size = {0};
struct vmw_resource *res; struct vmw_resource *res;
unsigned int bytes_pp; unsigned int bytes_pp;
struct drm_format_name_buf format_name; struct drm_format_name_buf format_name;
...@@ -1671,7 +1671,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, ...@@ -1671,7 +1671,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
* 1. Bounding box (assuming 32bpp) must be < prim_bb_mem * 1. Bounding box (assuming 32bpp) must be < prim_bb_mem
* 2. Total pixels (assuming 32bpp) must be < prim_bb_mem * 2. Total pixels (assuming 32bpp) must be < prim_bb_mem
*/ */
u64 bb_mem = bounding_box.w * bounding_box.h * 4; u64 bb_mem = (u64) bounding_box.w * bounding_box.h * 4;
u64 pixel_mem = total_pixels * 4; u64 pixel_mem = total_pixels * 4;
if (bb_mem > dev_priv->prim_bb_mem) { if (bb_mem > dev_priv->prim_bb_mem) {
......
...@@ -319,18 +319,17 @@ int vmw_otables_setup(struct vmw_private *dev_priv) ...@@ -319,18 +319,17 @@ int vmw_otables_setup(struct vmw_private *dev_priv)
int ret; int ret;
if (dev_priv->has_dx) { if (dev_priv->has_dx) {
*otables = kmalloc(sizeof(dx_tables), GFP_KERNEL); *otables = kmemdup(dx_tables, sizeof(dx_tables), GFP_KERNEL);
if (*otables == NULL) if (*otables == NULL)
return -ENOMEM; return -ENOMEM;
memcpy(*otables, dx_tables, sizeof(dx_tables));
dev_priv->otable_batch.num_otables = ARRAY_SIZE(dx_tables); dev_priv->otable_batch.num_otables = ARRAY_SIZE(dx_tables);
} else { } else {
*otables = kmalloc(sizeof(pre_dx_tables), GFP_KERNEL); *otables = kmemdup(pre_dx_tables, sizeof(pre_dx_tables),
GFP_KERNEL);
if (*otables == NULL) if (*otables == NULL)
return -ENOMEM; return -ENOMEM;
memcpy(*otables, pre_dx_tables, sizeof(pre_dx_tables));
dev_priv->otable_batch.num_otables = ARRAY_SIZE(pre_dx_tables); dev_priv->otable_batch.num_otables = ARRAY_SIZE(pre_dx_tables);
} }
......
...@@ -1760,7 +1760,7 @@ void vmw_resource_unpin(struct vmw_resource *res) ...@@ -1760,7 +1760,7 @@ void vmw_resource_unpin(struct vmw_resource *res)
struct vmw_private *dev_priv = res->dev_priv; struct vmw_private *dev_priv = res->dev_priv;
int ret; int ret;
ttm_read_lock(&dev_priv->reservation_sem, false); (void) ttm_read_lock(&dev_priv->reservation_sem, false);
mutex_lock(&dev_priv->cmdbuf_mutex); mutex_lock(&dev_priv->cmdbuf_mutex);
ret = vmw_resource_reserve(res, false, true); ret = vmw_resource_reserve(res, false, true);
...@@ -1770,7 +1770,7 @@ void vmw_resource_unpin(struct vmw_resource *res) ...@@ -1770,7 +1770,7 @@ void vmw_resource_unpin(struct vmw_resource *res)
if (--res->pin_count == 0 && res->backup) { if (--res->pin_count == 0 && res->backup) {
struct vmw_dma_buffer *vbo = res->backup; struct vmw_dma_buffer *vbo = res->backup;
ttm_bo_reserve(&vbo->base, false, false, NULL); (void) ttm_bo_reserve(&vbo->base, false, false, NULL);
vmw_bo_pin_reserved(vbo, false); vmw_bo_pin_reserved(vbo, false);
ttm_bo_unreserve(&vbo->base); ttm_bo_unreserve(&vbo->base);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment