Skip to content

Commit

Permalink
Merge branch 'gma500-next' of git://github.com/patjak/drm-gma500 into…
Browse files Browse the repository at this point in the history
… drm-next

Only two patches this time around. One trivial and one locking fix.

* 'gma500-next' of git://github.com/patjak/drm-gma500:
  drm/gma500: Lock struct_mutex around cursor updates
  drivers: gpu: Mark function as static in cdv_intel_dp.c
  • Loading branch information
airlied committed Jan 28, 2014
2 parents 76f4f41 + 631794b commit 5a0abe3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/gma500/cdv_intel_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ cdv_intel_dp_i2c_init(struct gma_connector *connector,
return ret;
}

void cdv_intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
static void cdv_intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
struct drm_display_mode *adjusted_mode)
{
adjusted_mode->hdisplay = fixed_mode->hdisplay;
Expand Down
12 changes: 10 additions & 2 deletions drivers/gpu/drm/gma500/gma_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
/* If we didn't get a handle then turn the cursor off */
if (!handle) {
temp = CURSOR_MODE_DISABLE;
mutex_lock(&dev->struct_mutex);

if (gma_power_begin(dev, false)) {
REG_WRITE(control, temp);
Expand All @@ -365,6 +366,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
gma_crtc->cursor_obj = NULL;
}

mutex_unlock(&dev->struct_mutex);
return 0;
}

Expand All @@ -374,9 +376,12 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
return -EINVAL;
}

mutex_lock(&dev->struct_mutex);
obj = drm_gem_object_lookup(dev, file_priv, handle);
if (!obj)
return -ENOENT;
if (!obj) {
ret = -ENOENT;
goto unlock;
}

if (obj->size < width * height * 4) {
dev_dbg(dev->dev, "Buffer is too small\n");
Expand Down Expand Up @@ -440,10 +445,13 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
}

gma_crtc->cursor_obj = obj;
unlock:
mutex_unlock(&dev->struct_mutex);
return ret;

unref_cursor:
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);
return ret;
}

Expand Down

0 comments on commit 5a0abe3

Please sign in to comment.