drm/radeon: Store PCI controller in struct radeon_device.hose
[linux-2.6-microblaze.git] / drivers / gpu / drm / drm_atomic_helper.c
index ddd0e32..a84dc42 100644 (file)
@@ -122,7 +122,8 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
                        continue;
 
                if (funcs->atomic_best_encoder)
-                       new_encoder = funcs->atomic_best_encoder(connector, new_conn_state);
+                       new_encoder = funcs->atomic_best_encoder(connector,
+                                                                state);
                else if (funcs->best_encoder)
                        new_encoder = funcs->best_encoder(connector);
                else
@@ -345,8 +346,7 @@ update_connector_routing(struct drm_atomic_state *state,
        funcs = connector->helper_private;
 
        if (funcs->atomic_best_encoder)
-               new_encoder = funcs->atomic_best_encoder(connector,
-                                                        new_connector_state);
+               new_encoder = funcs->atomic_best_encoder(connector, state);
        else if (funcs->best_encoder)
                new_encoder = funcs->best_encoder(connector);
        else
@@ -1313,7 +1313,7 @@ static void drm_atomic_helper_commit_writebacks(struct drm_device *dev,
 
                if (new_conn_state->writeback_job && new_conn_state->writeback_job->fb) {
                        WARN_ON(connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK);
-                       funcs->atomic_commit(connector, new_conn_state);
+                       funcs->atomic_commit(connector, old_state);
                }
        }
 }
@@ -2040,6 +2040,9 @@ crtc_or_fake_commit(struct drm_atomic_state *state, struct drm_crtc *crtc)
  * should always call this function from their
  * &drm_mode_config_funcs.atomic_commit hook.
  *
+ * Drivers that need to extend the commit setup to private objects can use the
+ * &drm_mode_config_helper_funcs.atomic_commit_setup hook.
+ *
  * To be able to use this support drivers need to use a few more helper
  * functions. drm_atomic_helper_wait_for_dependencies() must be called before
  * actually committing the hardware state, and for nonblocking commits this call
@@ -2083,8 +2086,11 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
        struct drm_plane *plane;
        struct drm_plane_state *old_plane_state, *new_plane_state;
        struct drm_crtc_commit *commit;
+       const struct drm_mode_config_helper_funcs *funcs;
        int i, ret;
 
+       funcs = state->dev->mode_config.helper_private;
+
        for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
                commit = kzalloc(sizeof(*commit), GFP_KERNEL);
                if (!commit)
@@ -2169,6 +2175,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
                new_plane_state->commit = drm_crtc_commit_get(commit);
        }
 
+       if (funcs && funcs->atomic_commit_setup)
+               return funcs->atomic_commit_setup(state);
+
        return 0;
 }
 EXPORT_SYMBOL(drm_atomic_helper_setup_commit);
@@ -3499,76 +3508,6 @@ fail:
 }
 EXPORT_SYMBOL(drm_atomic_helper_page_flip_target);
 
-/**
- * drm_atomic_helper_legacy_gamma_set - set the legacy gamma correction table
- * @crtc: CRTC object
- * @red: red correction table
- * @green: green correction table
- * @blue: green correction table
- * @size: size of the tables
- * @ctx: lock acquire context
- *
- * Implements support for legacy gamma correction table for drivers
- * that support color management through the DEGAMMA_LUT/GAMMA_LUT
- * properties. See drm_crtc_enable_color_mgmt() and the containing chapter for
- * how the atomic color management and gamma tables work.
- */
-int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
-                                      u16 *red, u16 *green, u16 *blue,
-                                      uint32_t size,
-                                      struct drm_modeset_acquire_ctx *ctx)
-{
-       struct drm_device *dev = crtc->dev;
-       struct drm_atomic_state *state;
-       struct drm_crtc_state *crtc_state;
-       struct drm_property_blob *blob = NULL;
-       struct drm_color_lut *blob_data;
-       int i, ret = 0;
-       bool replaced;
-
-       state = drm_atomic_state_alloc(crtc->dev);
-       if (!state)
-               return -ENOMEM;
-
-       blob = drm_property_create_blob(dev,
-                                       sizeof(struct drm_color_lut) * size,
-                                       NULL);
-       if (IS_ERR(blob)) {
-               ret = PTR_ERR(blob);
-               blob = NULL;
-               goto fail;
-       }
-
-       /* Prepare GAMMA_LUT with the legacy values. */
-       blob_data = blob->data;
-       for (i = 0; i < size; i++) {
-               blob_data[i].red = red[i];
-               blob_data[i].green = green[i];
-               blob_data[i].blue = blue[i];
-       }
-
-       state->acquire_ctx = ctx;
-       crtc_state = drm_atomic_get_crtc_state(state, crtc);
-       if (IS_ERR(crtc_state)) {
-               ret = PTR_ERR(crtc_state);
-               goto fail;
-       }
-
-       /* Reset DEGAMMA_LUT and CTM properties. */
-       replaced  = drm_property_replace_blob(&crtc_state->degamma_lut, NULL);
-       replaced |= drm_property_replace_blob(&crtc_state->ctm, NULL);
-       replaced |= drm_property_replace_blob(&crtc_state->gamma_lut, blob);
-       crtc_state->color_mgmt_changed |= replaced;
-
-       ret = drm_atomic_commit(state);
-
-fail:
-       drm_atomic_state_put(state);
-       drm_property_blob_put(blob);
-       return ret;
-}
-EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set);
-
 /**
  * drm_atomic_helper_bridge_propagate_bus_fmt() - Propagate output format to
  *                                               the input end of a bridge