Commit ab422b01 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

drm/qxl: move shadow handling to new qxl_prepare_shadow()

parent cb981987
Loading
Loading
Loading
Loading
+34 −27
Original line number Diff line number Diff line
@@ -771,23 +771,12 @@ static void qxl_calc_dumb_shadow(struct qxl_device *qdev,
		DRM_DEBUG("%dx%d\n", surf->width, surf->height);
}

static int qxl_plane_prepare_fb(struct drm_plane *plane,
				struct drm_plane_state *new_state)
static void qxl_prepare_shadow(struct qxl_device *qdev, struct qxl_bo *user_bo,
			       int crtc_index)
{
	struct qxl_device *qdev = to_qxl(plane->dev);
	struct drm_gem_object *obj;
	struct qxl_bo *user_bo;
	struct qxl_surface surf;

	if (!new_state->fb)
		return 0;

	obj = new_state->fb->obj[0];
	user_bo = gem_to_qxl_bo(obj);

	if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
	    user_bo->is_dumb) {
		qxl_update_dumb_head(qdev, new_state->crtc->index,
	qxl_update_dumb_head(qdev, crtc_index,
			     user_bo);
	qxl_calc_dumb_shadow(qdev, &surf);
	if (!qdev->dumb_shadow_bo ||
@@ -815,6 +804,24 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
	}
}

static int qxl_plane_prepare_fb(struct drm_plane *plane,
				struct drm_plane_state *new_state)
{
	struct qxl_device *qdev = to_qxl(plane->dev);
	struct drm_gem_object *obj;
	struct qxl_bo *user_bo;

	if (!new_state->fb)
		return 0;

	obj = new_state->fb->obj[0];
	user_bo = gem_to_qxl_bo(obj);

	if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
	    user_bo->is_dumb) {
		qxl_prepare_shadow(qdev, user_bo, new_state->crtc->index);
	}

	return qxl_bo_pin(user_bo);
}