Commit 1a4be38a authored by Dave Airlie's avatar Dave Airlie

Merge tag 'topic/drm-misc-2016-03-14' of git://anongit.freedesktop.org/drm-intel into drm-next

* tag 'topic/drm-misc-2016-03-14' of git://anongit.freedesktop.org/drm-intel: (27 commits)
  drm: atomic helper: do not unreference error pointer
  drm/edid: Extract SADs properly from multiple audio data blocks
  drm: fix blob pointer check
  drm: introduce pipe color correction properties
  drm/atomic: Clean up update_connector_routing.
  drm/atomic: Clean up steal_encoder, v2.
  drm/atomic: Handle encoder assignment conflicts in a separate check, v3.
  drm/atomic: Handle encoder stealing from set_config better.
  drm/atomic: Always call steal_encoder, v2.
  drm/ast: removed optional dummy crtc mode_fixup function.
  drm/bochs: removed optional dummy crtc mode_fixup function.
  drm/fsl-dcu: removed optional dummy crtc mode_fixup function.
  drm/virtio: removed optional dummy crtc mode_fixup function.
  drm/nouveau/dispnv04: removed optional dummy crtc mode_fixup function.
  drm/atmel-hlcdc: remove optional dummy crtc mode_fixup function.
  drm/sti: removed optional dummy crtc mode_fixup function.
  drm/shmobile: removed optional dummy crtc mode_fixup function.
  drm/msm/mdp: removed optional dummy crtc mode_fixup function.
  drm/omapdrm: removed optional dummy crtc mode_fixup function.
  drm/rcar-du: removed optional dummy crtc mode_fixup function.
  ...
parents c51e034f c1f415c9
...@@ -1816,7 +1816,7 @@ void intel_crt_init(struct drm_device *dev) ...@@ -1816,7 +1816,7 @@ void intel_crt_init(struct drm_device *dev)
<td valign="top" >Description/Restrictions</td> <td valign="top" >Description/Restrictions</td>
</tr> </tr>
<tr> <tr>
<td rowspan="37" valign="top" >DRM</td> <td rowspan="42" valign="top" >DRM</td>
<td valign="top" >Generic</td> <td valign="top" >Generic</td>
<td valign="top" >“rotation”</td> <td valign="top" >“rotation”</td>
<td valign="top" >BITMASK</td> <td valign="top" >BITMASK</td>
...@@ -2068,7 +2068,7 @@ void intel_crt_init(struct drm_device *dev) ...@@ -2068,7 +2068,7 @@ void intel_crt_init(struct drm_device *dev)
<td valign="top" >property to suggest an Y offset for a connector</td> <td valign="top" >property to suggest an Y offset for a connector</td>
</tr> </tr>
<tr> <tr>
<td rowspan="3" valign="top" >Optional</td> <td rowspan="8" valign="top" >Optional</td>
<td valign="top" >“scaling mode”</td> <td valign="top" >“scaling mode”</td>
<td valign="top" >ENUM</td> <td valign="top" >ENUM</td>
<td valign="top" >{ "None", "Full", "Center", "Full aspect" }</td> <td valign="top" >{ "None", "Full", "Center", "Full aspect" }</td>
...@@ -2092,6 +2092,61 @@ void intel_crt_init(struct drm_device *dev) ...@@ -2092,6 +2092,61 @@ void intel_crt_init(struct drm_device *dev)
<td valign="top" >TBD</td> <td valign="top" >TBD</td>
</tr> </tr>
<tr> <tr>
<td valign="top" >“DEGAMMA_LUT”</td>
<td valign="top" >BLOB</td>
<td valign="top" >0</td>
<td valign="top" >CRTC</td>
<td valign="top" >DRM property to set the degamma lookup table
(LUT) mapping pixel data from the framebuffer before it is
given to the transformation matrix. The data is an interpreted
as an array of struct drm_color_lut elements. Hardware might
choose not to use the full precision of the LUT elements nor
use all the elements of the LUT (for example the hardware
might choose to interpolate between LUT[0] and LUT[4]). </td>
</tr>
<tr>
<td valign="top" >“DEGAMMA_LUT_SIZE”</td>
<td valign="top" >RANGE | IMMUTABLE</td>
<td valign="top" >Min=0, Max=UINT_MAX</td>
<td valign="top" >CRTC</td>
<td valign="top" >DRM property to gives the size of the lookup
table to be set on the DEGAMMA_LUT property (the size depends
on the underlying hardware).</td>
</tr>
<tr>
<td valign="top" >“CTM”</td>
<td valign="top" >BLOB</td>
<td valign="top" >0</td>
<td valign="top" >CRTC</td>
<td valign="top" >DRM property to set the current
transformation matrix (CTM) apply to pixel data after the
lookup through the degamma LUT and before the lookup through
the gamma LUT. The data is an interpreted as a struct
drm_color_ctm.</td>
</tr>
<tr>
<td valign="top" >“GAMMA_LUT”</td>
<td valign="top" >BLOB</td>
<td valign="top" >0</td>
<td valign="top" >CRTC</td>
<td valign="top" >DRM property to set the gamma lookup table
(LUT) mapping pixel data after to the transformation matrix to
data sent to the connector. The data is an interpreted as an
array of struct drm_color_lut elements. Hardware might choose
not to use the full precision of the LUT elements nor use all
the elements of the LUT (for example the hardware might choose
to interpolate between LUT[0] and LUT[4]).</td>
</tr>
<tr>
<td valign="top" >“GAMMA_LUT_SIZE”</td>
<td valign="top" >RANGE | IMMUTABLE</td>
<td valign="top" >Min=0, Max=UINT_MAX</td>
<td valign="top" >CRTC</td>
<td valign="top" >DRM property to gives the size of the lookup
table to be set on the GAMMA_LUT property (the size depends on
the underlying hardware).</td>
</tr>
<tr>
<td rowspan="20" valign="top" >i915</td> <td rowspan="20" valign="top" >i915</td>
<td rowspan="2" valign="top" >Generic</td> <td rowspan="2" valign="top" >Generic</td>
<td valign="top" >"Broadcast RGB"</td> <td valign="top" >"Broadcast RGB"</td>
......
...@@ -497,13 +497,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -497,13 +497,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
} }
} }
static bool ast_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
/* ast is different - we will force move buffers out of VRAM */ /* ast is different - we will force move buffers out of VRAM */
static int ast_crtc_do_set_base(struct drm_crtc *crtc, static int ast_crtc_do_set_base(struct drm_crtc *crtc,
struct drm_framebuffer *fb, struct drm_framebuffer *fb,
...@@ -617,7 +610,6 @@ static void ast_crtc_commit(struct drm_crtc *crtc) ...@@ -617,7 +610,6 @@ static void ast_crtc_commit(struct drm_crtc *crtc)
static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = {
.dpms = ast_crtc_dpms, .dpms = ast_crtc_dpms,
.mode_fixup = ast_crtc_mode_fixup,
.mode_set = ast_crtc_mode_set, .mode_set = ast_crtc_mode_set,
.mode_set_base = ast_crtc_mode_set_base, .mode_set_base = ast_crtc_mode_set_base,
.disable = ast_crtc_disable, .disable = ast_crtc_disable,
......
...@@ -121,13 +121,6 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) ...@@ -121,13 +121,6 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
cfg); cfg);
} }
static bool atmel_hlcdc_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static void atmel_hlcdc_crtc_disable(struct drm_crtc *c) static void atmel_hlcdc_crtc_disable(struct drm_crtc *c)
{ {
struct drm_device *dev = c->dev; struct drm_device *dev = c->dev;
...@@ -261,7 +254,6 @@ static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc, ...@@ -261,7 +254,6 @@ static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc,
} }
static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = {
.mode_fixup = atmel_hlcdc_crtc_mode_fixup,
.mode_set = drm_helper_crtc_mode_set, .mode_set = drm_helper_crtc_mode_set,
.mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb, .mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb,
.mode_set_base = drm_helper_crtc_mode_set_base, .mode_set_base = drm_helper_crtc_mode_set_base,
...@@ -349,4 +341,3 @@ int atmel_hlcdc_crtc_create(struct drm_device *dev) ...@@ -349,4 +341,3 @@ int atmel_hlcdc_crtc_create(struct drm_device *dev)
atmel_hlcdc_crtc_destroy(&crtc->base); atmel_hlcdc_crtc_destroy(&crtc->base);
return ret; return ret;
} }
...@@ -30,13 +30,6 @@ static void bochs_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -30,13 +30,6 @@ static void bochs_crtc_dpms(struct drm_crtc *crtc, int mode)
} }
} }
static bool bochs_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
struct drm_framebuffer *old_fb) struct drm_framebuffer *old_fb)
{ {
...@@ -135,7 +128,6 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = { ...@@ -135,7 +128,6 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
static const struct drm_crtc_helper_funcs bochs_helper_funcs = { static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
.dpms = bochs_crtc_dpms, .dpms = bochs_crtc_dpms,
.mode_fixup = bochs_crtc_mode_fixup,
.mode_set = bochs_crtc_mode_set, .mode_set = bochs_crtc_mode_set,
.mode_set_base = bochs_crtc_mode_set_base, .mode_set_base = bochs_crtc_mode_set_base,
.prepare = bochs_crtc_prepare, .prepare = bochs_crtc_prepare,
......
...@@ -91,18 +91,6 @@ static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -91,18 +91,6 @@ static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode)
WREG_GFX(0xe, gr0e); WREG_GFX(0xe, gr0e);
} }
/*
* The core passes the desired mode to the CRTC code to see whether any
* CRTC-specific modifications need to be made to it. We're in a position
* to just pass that straight through, so this does nothing
*/
static bool cirrus_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static void cirrus_set_start_address(struct drm_crtc *crtc, unsigned offset) static void cirrus_set_start_address(struct drm_crtc *crtc, unsigned offset)
{ {
struct cirrus_device *cdev = crtc->dev->dev_private; struct cirrus_device *cdev = crtc->dev->dev_private;
...@@ -372,7 +360,6 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = { ...@@ -372,7 +360,6 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
static const struct drm_crtc_helper_funcs cirrus_helper_funcs = { static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
.dpms = cirrus_crtc_dpms, .dpms = cirrus_crtc_dpms,
.mode_fixup = cirrus_crtc_mode_fixup,
.mode_set = cirrus_crtc_mode_set, .mode_set = cirrus_crtc_mode_set,
.mode_set_base = cirrus_crtc_mode_set_base, .mode_set_base = cirrus_crtc_mode_set_base,
.prepare = cirrus_crtc_prepare, .prepare = cirrus_crtc_prepare,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_atomic.h> #include <drm/drm_atomic.h>
#include <drm/drm_mode.h>
#include <drm/drm_plane_helper.h> #include <drm/drm_plane_helper.h>
/** /**
...@@ -375,6 +376,59 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, ...@@ -375,6 +376,59 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
} }
EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc); EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
/**
* drm_atomic_replace_property_blob - replace a blob property
* @blob: a pointer to the member blob to be replaced
* @new_blob: the new blob to replace with
* @expected_size: the expected size of the new blob
* @replaced: whether the blob has been replaced
*
* RETURNS:
* Zero on success, error code on failure
*/
static void
drm_atomic_replace_property_blob(struct drm_property_blob **blob,
struct drm_property_blob *new_blob,
bool *replaced)
{
struct drm_property_blob *old_blob = *blob;
if (old_blob == new_blob)
return;
if (old_blob)
drm_property_unreference_blob(old_blob);
if (new_blob)
drm_property_reference_blob(new_blob);
*blob = new_blob;
*replaced = true;
return;
}
static int
drm_atomic_replace_property_blob_from_id(struct drm_crtc *crtc,
struct drm_property_blob **blob,
uint64_t blob_id,
ssize_t expected_size,
bool *replaced)
{
struct drm_device *dev = crtc->dev;
struct drm_property_blob *new_blob = NULL;
if (blob_id != 0) {
new_blob = drm_property_lookup_blob(dev, blob_id);
if (new_blob == NULL)
return -EINVAL;
if (expected_size > 0 && expected_size != new_blob->length)
return -EINVAL;
}
drm_atomic_replace_property_blob(blob, new_blob, replaced);
return 0;
}
/** /**
* drm_atomic_crtc_set_property - set property on CRTC * drm_atomic_crtc_set_property - set property on CRTC
* @crtc: the drm CRTC to set a property on * @crtc: the drm CRTC to set a property on
...@@ -397,6 +451,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, ...@@ -397,6 +451,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_mode_config *config = &dev->mode_config; struct drm_mode_config *config = &dev->mode_config;
bool replaced = false;
int ret; int ret;
if (property == config->prop_active) if (property == config->prop_active)
...@@ -407,8 +462,31 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, ...@@ -407,8 +462,31 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
ret = drm_atomic_set_mode_prop_for_crtc(state, mode); ret = drm_atomic_set_mode_prop_for_crtc(state, mode);
drm_property_unreference_blob(mode); drm_property_unreference_blob(mode);
return ret; return ret;
} } else if (property == config->degamma_lut_property) {
else if (crtc->funcs->atomic_set_property) ret = drm_atomic_replace_property_blob_from_id(crtc,
&state->degamma_lut,
val,
-1,
&replaced);
state->color_mgmt_changed = replaced;
return ret;
} else if (property == config->ctm_property) {
ret = drm_atomic_replace_property_blob_from_id(crtc,
&state->ctm,
val,
sizeof(struct drm_color_ctm),
&replaced);
state->color_mgmt_changed = replaced;
return ret;
} else if (property == config->gamma_lut_property) {
ret = drm_atomic_replace_property_blob_from_id(crtc,
&state->gamma_lut,
val,
-1,
&replaced);
state->color_mgmt_changed = replaced;
return ret;
} else if (crtc->funcs->atomic_set_property)
return crtc->funcs->atomic_set_property(crtc, state, property, val); return crtc->funcs->atomic_set_property(crtc, state, property, val);
else else
return -EINVAL; return -EINVAL;
...@@ -444,6 +522,12 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, ...@@ -444,6 +522,12 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
*val = state->active; *val = state->active;
else if (property == config->prop_mode_id) else if (property == config->prop_mode_id)
*val = (state->mode_blob) ? state->mode_blob->base.id : 0; *val = (state->mode_blob) ? state->mode_blob->base.id : 0;
else if (property == config->degamma_lut_property)
*val = (state->degamma_lut) ? state->degamma_lut->base.id : 0;
else if (property == config->ctm_property)
*val = (state->ctm) ? state->ctm->base.id : 0;
else if (property == config->gamma_lut_property)
*val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
else if (crtc->funcs->atomic_get_property) else if (crtc->funcs->atomic_get_property)
return crtc->funcs->atomic_get_property(crtc, state, property, val); return crtc->funcs->atomic_get_property(crtc, state, property, val);
else else
......
This diff is collapsed.
...@@ -430,9 +430,7 @@ EXPORT_SYMBOL(drm_framebuffer_init); ...@@ -430,9 +430,7 @@ EXPORT_SYMBOL(drm_framebuffer_init);
static void __drm_framebuffer_unregister(struct drm_device *dev, static void __drm_framebuffer_unregister(struct drm_device *dev,
struct drm_framebuffer *fb) struct drm_framebuffer *fb)
{ {
mutex_lock(&dev->mode_config.idr_mutex); drm_mode_object_put(dev, &fb->base);
idr_remove(&dev->mode_config.crtc_idr, fb->base.id);
mutex_unlock(&dev->mode_config.idr_mutex);
fb->base.id = 0; fb->base.id = 0;
} }
...@@ -1554,6 +1552,41 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) ...@@ -1554,6 +1552,41 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
return -ENOMEM; return -ENOMEM;
dev->mode_config.prop_mode_id = prop; dev->mode_config.prop_mode_id = prop;
prop = drm_property_create(dev,
DRM_MODE_PROP_BLOB,
"DEGAMMA_LUT", 0);
if (!prop)
return -ENOMEM;
dev->mode_config.degamma_lut_property = prop;
prop = drm_property_create_range(dev,
DRM_MODE_PROP_IMMUTABLE,
"DEGAMMA_LUT_SIZE", 0, UINT_MAX);
if (!prop)
return -ENOMEM;
dev->mode_config.degamma_lut_size_property = prop;
prop = drm_property_create(dev,
DRM_MODE_PROP_BLOB,
"CTM", 0);
if (!prop)
return -ENOMEM;
dev->mode_config.ctm_property = prop;
prop = drm_property_create(dev,
DRM_MODE_PROP_BLOB,
"GAMMA_LUT", 0);
if (!prop)
return -ENOMEM;
dev->mode_config.gamma_lut_property = prop;
prop = drm_property_create_range(dev,
DRM_MODE_PROP_IMMUTABLE,
"GAMMA_LUT_SIZE", 0, UINT_MAX);
if (!prop)
return -ENOMEM;
dev->mode_config.gamma_lut_size_property = prop;
return 0; return 0;
} }
......
...@@ -1075,3 +1075,36 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -1075,3 +1075,36 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
return drm_plane_helper_commit(plane, plane_state, old_fb); return drm_plane_helper_commit(plane, plane_state, old_fb);
} }
EXPORT_SYMBOL(drm_helper_crtc_mode_set_base); EXPORT_SYMBOL(drm_helper_crtc_mode_set_base);
/**
* drm_helper_crtc_enable_color_mgmt - enable color management properties
* @crtc: DRM CRTC
* @degamma_lut_size: the size of the degamma lut (before CSC)
* @gamma_lut_size: the size of the gamma lut (after CSC)
*
* This function lets the driver enable the color correction properties on a
* CRTC. This includes 3 degamma, csc and gamma properties that userspace can
* set and 2 size properties to inform the userspace of the lut sizes.
*/
void drm_helper_crtc_enable_color_mgmt(struct drm_crtc *crtc,
int degamma_lut_size,
int gamma_lut_size)
{
struct drm_device *dev = crtc->dev;
struct drm_mode_config *config = &dev->mode_config;
drm_object_attach_property(&crtc->base,
config->degamma_lut_property, 0);
drm_object_attach_property(&crtc->base,
config->ctm_property, 0);
drm_object_attach_property(&crtc->base,
config->gamma_lut_property, 0);
drm_object_attach_property(&crtc->base,
config->degamma_lut_size_property,
degamma_lut_size);
drm_object_attach_property(&crtc->base,
config->gamma_lut_size_property,
gamma_lut_size);
}
EXPORT_SYMBOL(drm_helper_crtc_enable_color_mgmt);
...@@ -3308,7 +3308,7 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) ...@@ -3308,7 +3308,7 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
u8 *cea; u8 *cea;
u8 *name; u8 *name;
u8 *db; u8 *db;
int sad_count = 0; int total_sad_count = 0;
int mnl; int mnl;
int dbl; int dbl;
...@@ -3322,6 +3322,7 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) ...@@ -3322,6 +3322,7 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
name = NULL; name = NULL;
drm_for_each_detailed_block((u8 *)edid, monitor_name, &name); drm_for_each_detailed_block((u8 *)edid, monitor_name, &name);
/* max: 13 bytes EDID, 16 bytes ELD */
for (mnl = 0; name && mnl < 13; mnl++) { for (mnl = 0; name && mnl < 13; mnl++) {
if (name[mnl] == 0x0a) if (name[mnl] == 0x0a)
break; break;
...@@ -3350,11 +3351,15 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) ...@@ -3350,11 +3351,15 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
dbl = cea_db_payload_len(db); dbl = cea_db_payload_len(db);
switch (cea_db_tag(db)) { switch (cea_db_tag(db)) {
int sad_count;
case AUDIO_BLOCK: case AUDIO_BLOCK:
/* Audio Data Block, contains SADs */ /* Audio Data Block, contains SADs */
sad_count = dbl / 3; sad_count = min(dbl / 3, 15 - total_sad_count);
if (dbl >= 1) if (sad_count >= 1)
memcpy(eld + 20 + mnl, &db[1], dbl); memcpy(eld + 20 + mnl + total_sad_count * 3,
&db[1], sad_count * 3);
total_sad_count += sad_count;
break; break;
case SPEAKER_BLOCK: case SPEAKER_BLOCK:
/* Speaker Allocation Data Block */ /* Speaker Allocation Data Block */
...@@ -3371,13 +3376,13 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) ...@@ -3371,13 +3376,13 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
} }
} }
} }
eld[5] |= sad_count << 4; eld[5] |= total_sad_count << 4;
eld[DRM_ELD_BASELINE_ELD_LEN] = eld[DRM_ELD_BASELINE_ELD_LEN] =
DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4); DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4);
DRM_DEBUG_KMS("ELD size %d, SAD count %d\n", DRM_DEBUG_KMS("ELD size %d, SAD count %d\n",
drm_eld_size(eld), sad_count); drm_eld_size(eld), total_sad_count);
} }
EXPORT_SYMBOL(drm_edid_to_eld); EXPORT_SYMBOL(drm_edid_to_eld);
......
...@@ -62,13 +62,6 @@ static void fsl_dcu_drm_crtc_enable(struct drm_crtc *crtc) ...@@ -62,13 +62,6 @@ static void fsl_dcu_drm_crtc_enable(struct drm_crtc *crtc)
DCU_UPDATE_MODE_READREG); DCU_UPDATE_MODE_READREG);
} }
static bool fsl_dcu_drm_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) static void fsl_dcu_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
...@@ -127,7 +120,6 @@ static const struct drm_crtc_helper_funcs fsl_dcu_drm_crtc_helper_funcs = { ...@@ -127,7 +120,6 @@ static const struct drm_crtc_helper_funcs fsl_dcu_drm_crtc_helper_funcs = {
.atomic_flush = fsl_dcu_drm_crtc_atomic_flush, .atomic_flush = fsl_dcu_drm_crtc_atomic_flush,
.disable = fsl_dcu_drm_disable_crtc, .disable = fsl_dcu_drm_disable_crtc,
.enable = fsl_dcu_drm_crtc_enable, .enable = fsl_dcu_drm_crtc_enable,
.mode_fixup = fsl_dcu_drm_crtc_mode_fixup,
.mode_set_nofb = fsl_dcu_drm_crtc_mode_set_nofb, .mode_set_nofb = fsl_dcu_drm_crtc_mode_set_nofb,
}; };
......
...@@ -116,7 +116,7 @@ static const struct gma_limit_t cdv_intel_limits[] = { ...@@ -116,7 +116,7 @@ static const struct gma_limit_t cdv_intel_limits[] = {
.p1 = {.min = 1, .max = 10}, .p1 = {.min = 1, .max = 10},
.p2 = {.dot_limit = 225000, .p2_slow = 10, .p2_fast = 10}, .p2 = {.dot_limit = 225000, .p2_slow = 10, .p2_fast = 10},
.find_pll = cdv_intel_find_dp_pll, .find_pll = cdv_intel_find_dp_pll,
} }
}; };
#define _wait_for(COND, MS, W) ({ \ #define _wait_for(COND, MS, W) ({ \
...@@ -245,7 +245,7 @@ cdv_dpll_set_clock_cdv(struct drm_device *dev, struct drm_crtc *crtc, ...@@ -245,7 +245,7 @@ cdv_dpll_set_clock_cdv(struct drm_device *dev, struct drm_crtc *crtc,
/* We don't know what the other fields of these regs are, so /* We don't know what the other fields of these regs are, so
* leave them in place. * leave them in place.
*/ */
/* /*
* The BIT 14:13 of 0x8010/0x8030 is used to select the ref clk * The BIT 14:13 of 0x8010/0x8030 is used to select the ref clk
* for the pipe A/B. Display spec 1.06 has wrong definition. * for the pipe A/B. Display spec 1.06 has wrong definition.
* Correct definition is like below: * Correct definition is like below:
...@@ -256,7 +256,7 @@ cdv_dpll_set_clock_cdv(struct drm_device *dev, struct drm_crtc *crtc, ...@@ -256,7 +256,7 @@ cdv_dpll_set_clock_cdv(struct drm_device *dev, struct drm_crtc *crtc,
* *
* if DPLLA sets 01 and DPLLB sets 02, both use clk from DPLLA * if DPLLA sets 01 and DPLLB sets 02, both use clk from DPLLA
* *
*/ */
ret = cdv_sb_read(dev, ref_sfr, &ref_value); ret = cdv_sb_read(dev, ref_sfr, &ref_value);
if (ret) if (ret)
return ret; return ret;
...@@ -646,7 +646,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc, ...@@ -646,7 +646,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
* for DP/eDP. When using SSC clock, the ref clk is 100MHz.Otherwise * for DP/eDP. When using SSC clock, the ref clk is 100MHz.Otherwise
* it will be 27MHz. From the VBIOS code it seems that the pipe A choose * it will be 27MHz. From the VBIOS code it seems that the pipe A choose
* 27MHz for DP/eDP while the Pipe B chooses the 100MHz. * 27MHz for DP/eDP while the Pipe B chooses the 100MHz.
*/ */
if (pipe == 0) if (pipe == 0)
refclk = 27000; refclk = 27000;
else else
...@@ -659,7 +659,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc, ...@@ -659,7 +659,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
} }
drm_mode_debug_printmodeline(adjusted_mode); drm_mode_debug_printmodeline(adjusted_mode);
limit = gma_crtc->clock_funcs->limit(crtc, refclk); limit = gma_crtc->clock_funcs->limit(crtc, refclk);
ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk, ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk,
...@@ -721,7 +721,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc, ...@@ -721,7 +721,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
pipeconf |= PIPE_6BPC; pipeconf |= PIPE_6BPC;
} else } else
pipeconf |= PIPE_8BPC; pipeconf |= PIPE_8BPC;
/* Set up the display plane register */ /* Set up the display plane register */
dspcntr = DISPPLANE_GAMMA_ENABLE; dspcntr = DISPPLANE_GAMMA_ENABLE;
...@@ -974,7 +974,6 @@ struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev, ...@@ -974,7 +974,6 @@ struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev,
const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = { const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = {
.dpms = gma_crtc_dpms, .dpms = gma_crtc_dpms,
.mode_fixup = gma_crtc_mode_fixup,
.mode_set = cdv_intel_crtc_mode_set, .mode_set = cdv_intel_crtc_mode_set,
.mode_set_base = gma_pipe_set_base, .mode_set_base = gma_pipe_set_base,
.prepare = gma_crtc_prepare, .prepare = gma_crtc_prepare,
......
...@@ -478,13 +478,6 @@ int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) ...@@ -478,13 +478,6 @@ int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
return 0; return 0;
} }
bool gma_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
void gma_crtc_prepare(struct drm_crtc *crtc) void gma_crtc_prepare(struct drm_crtc *crtc)
{ {
const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
......
...@@ -75,9 +75,6 @@ extern void gma_crtc_load_lut(struct drm_crtc *crtc); ...@@ -75,9 +75,6 @@ extern void gma_crtc_load_lut(struct drm_crtc *crtc);
extern void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, extern void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
u16 *blue, u32 start, u32 size); u16 *blue, u32 start, u32 size);
extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode); extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
extern bool gma_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
extern void gma_crtc_prepare(struct drm_crtc *crtc); extern void gma_crtc_prepare(struct drm_crtc *crtc);
extern void gma_crtc_commit(struct drm_crtc *crtc); extern void gma_crtc_commit(struct drm_crtc *crtc);
extern void gma_crtc_disable(struct drm_crtc *crtc); extern void gma_crtc_disable(struct drm_crtc *crtc);
......
...@@ -1026,10 +1026,8 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, ...@@ -1026,10 +1026,8 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
const struct drm_crtc_helper_funcs mdfld_helper_funcs = { const struct drm_crtc_helper_funcs mdfld_helper_funcs = {
.dpms = mdfld_crtc_dpms, .dpms = mdfld_crtc_dpms,
.mode_fixup = gma_crtc_mode_fixup,
.mode_set = mdfld_crtc_mode_set, .mode_set = mdfld_crtc_mode_set,
.mode_set_base = mdfld__intel_pipe_set_base, .mode_set_base = mdfld__intel_pipe_set_base,
.prepare = gma_crtc_prepare, .prepare = gma_crtc_prepare,
.commit = gma_crtc_commit, .commit = gma_crtc_commit,
}; };
...@@ -657,7 +657,6 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc, ...@@ -657,7 +657,6 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
const struct drm_crtc_helper_funcs oaktrail_helper_funcs = { const struct drm_crtc_helper_funcs oaktrail_helper_funcs = {
.dpms = oaktrail_crtc_dpms, .dpms = oaktrail_crtc_dpms,
.mode_fixup = gma_crtc_mode_fixup,
.mode_set = oaktrail_crtc_mode_set, .mode_set = oaktrail_crtc_mode_set,
.mode_set_base = oaktrail_pipe_set_base, .mode_set_base = oaktrail_pipe_set_base,
.prepare = gma_crtc_prepare, .prepare = gma_crtc_prepare,
......
...@@ -430,7 +430,6 @@ struct drm_display_mode *psb_intel_crtc_mode_get(struct drm_device *dev, ...@@ -430,7 +430,6 @@ struct drm_display_mode *psb_intel_crtc_mode_get(struct drm_device *dev,
const struct drm_crtc_helper_funcs psb_intel_helper_funcs = { const struct drm_crtc_helper_funcs psb_intel_helper_funcs = {
.dpms = gma_crtc_dpms, .dpms = gma_crtc_dpms,
.mode_fixup = gma_crtc_mode_fixup,
.mode_set = psb_intel_crtc_mode_set, .mode_set = psb_intel_crtc_mode_set,
.mode_set_base = gma_pipe_set_base, .mode_set_base = gma_pipe_set_base,
.prepare = gma_crtc_prepare, .prepare = gma_crtc_prepare,
......
...@@ -92,18 +92,6 @@ static inline void mga_wait_busy(struct mga_device *mdev) ...@@ -92,18 +92,6 @@ static inline void mga_wait_busy(struct mga_device *mdev)
} while ((status & 0x01) && time_before(jiffies, timeout)); } while ((status & 0x01) && time_before(jiffies, timeout));
} }
/*
* The core passes the desired mode to the CRTC code to see whether any
* CRTC-specific modifications need to be made to it. We're in a position
* to just pass that straight through, so this does nothing
*/
static bool mga_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
#define P_ARRAY_SIZE 9 #define P_ARRAY_SIZE 9
static int mga_g200se_set_plls(struct mga_device *mdev, long clock) static int mga_g200se_set_plls(struct mga_device *mdev, long clock)
...@@ -1410,7 +1398,6 @@ static const struct drm_crtc_funcs mga_crtc_funcs = { ...@@ -1410,7 +1398,6 @@ static const struct drm_crtc_funcs mga_crtc_funcs = {
static const struct drm_crtc_helper_funcs mga_helper_funcs = { static const struct drm_crtc_helper_funcs mga_helper_funcs = {
.disable = mga_crtc_disable, .disable = mga_crtc_disable,
.dpms = mga_crtc_dpms, .dpms = mga_crtc_dpms,
.mode_fixup = mga_crtc_mode_fixup,
.mode_set = mga_crtc_mode_set, .mode_set = mga_crtc_mode_set,
.mode_set_base = mga_crtc_mode_set_base, .mode_set_base = mga_crtc_mode_set_base,
.prepare = mga_crtc_prepare, .prepare = mga_crtc_prepare,
......
...@@ -147,13 +147,6 @@ static void mdp4_crtc_destroy(struct drm_crtc *crtc) ...@@ -147,13 +147,6 @@ static void mdp4_crtc_destroy(struct drm_crtc *crtc)
kfree(mdp4_crtc); kfree(mdp4_crtc);
} }
static bool mdp4_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
/* statically (for now) map planes to mixer stage (z-order): */ /* statically (for now) map planes to mixer stage (z-order): */
static const int idxs[] = { static const int idxs[] = {
[VG1] = 1, [VG1] = 1,
...@@ -501,7 +494,6 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = { ...@@ -501,7 +494,6 @@ static const struct drm_crtc_funcs mdp4_crtc_funcs = {
}; };
static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
.mode_fixup = mdp4_crtc_mode_fixup,
.mode_set_nofb = mdp4_crtc_mode_set_nofb, .mode_set_nofb = mdp4_crtc_mode_set_nofb,
.disable = mdp4_crtc_disable, .disable = mdp4_crtc_disable,
.enable = mdp4_crtc_enable, .enable = mdp4_crtc_enable,
......
...@@ -185,13 +185,6 @@ static void mdp5_crtc_destroy(struct drm_crtc *crtc) ...@@ -185,13 +185,6 @@ static void mdp5_crtc_destroy(struct drm_crtc *crtc)
kfree(mdp5_crtc); kfree(mdp5_crtc);
} }
static bool mdp5_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
/* /*
* blend_setup() - blend all the planes of a CRTC * blend_setup() - blend all the planes of a CRTC
* *
...@@ -627,7 +620,6 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = { ...@@ -627,7 +620,6 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = {
}; };
static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
.mode_fixup = mdp5_crtc_mode_fixup,
.mode_set_nofb = mdp5_crtc_mode_set_nofb, .mode_set_nofb = mdp5_crtc_mode_set_nofb,
.disable = mdp5_crtc_disable, .disable = mdp5_crtc_disable,
.enable = mdp5_crtc_enable, .enable = mdp5_crtc_enable,
......
...@@ -227,13 +227,6 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -227,13 +227,6 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode)
NVWriteVgaCrtc(dev, nv_crtc->index, NV_CIO_CRE_RPC1_INDEX, crtc1A); NVWriteVgaCrtc(dev, nv_crtc->index, NV_CIO_CRE_RPC1_INDEX, crtc1A);
} }
static bool
nv_crtc_mode_fixup(struct drm_crtc *crtc, const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static void static void
nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode) nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode)
{ {
...@@ -1093,7 +1086,6 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = { ...@@ -1093,7 +1086,6 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = {
.dpms = nv_crtc_dpms, .dpms = nv_crtc_dpms,
.prepare = nv_crtc_prepare, .prepare = nv_crtc_prepare,
.commit = nv_crtc_commit, .commit = nv_crtc_commit,
.mode_fixup = nv_crtc_mode_fixup,
.mode_set = nv_crtc_mode_set, .mode_set = nv_crtc_mode_set,
.mode_set_base = nv04_crtc_mode_set_base, .mode_set_base = nv04_crtc_mode_set_base,
.mode_set_base_atomic = nv04_crtc_mode_set_base_atomic, .mode_set_base_atomic = nv04_crtc_mode_set_base_atomic,
......
...@@ -332,13 +332,6 @@ static void omap_crtc_destroy(struct drm_crtc *crtc) ...@@ -332,13 +332,6 @@ static void omap_crtc_destroy(struct drm_crtc *crtc)
kfree(omap_crtc); kfree(omap_crtc);
} }
static bool omap_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static void omap_crtc_enable(struct drm_crtc *crtc) static void omap_crtc_enable(struct drm_crtc *crtc)
{ {
struct omap_crtc *omap_crtc = to_omap_crtc(crtc); struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
...@@ -475,7 +468,6 @@ static const struct drm_crtc_funcs omap_crtc_funcs = { ...@@ -475,7 +468,6 @@ static const struct drm_crtc_funcs omap_crtc_funcs = {
}; };
static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = {
.mode_fixup = omap_crtc_mode_fixup,
.mode_set_nofb = omap_crtc_mode_set_nofb, .mode_set_nofb = omap_crtc_mode_set_nofb,
.disable = omap_crtc_disable, .disable = omap_crtc_disable,
.enable = omap_crtc_enable, .enable = omap_crtc_enable,
......
...@@ -491,14 +491,6 @@ static void rcar_du_crtc_disable(struct drm_crtc *crtc) ...@@ -491,14 +491,6 @@ static void rcar_du_crtc_disable(struct drm_crtc *crtc)
rcrtc->outputs = 0; rcrtc->outputs = 0;
} }
static bool rcar_du_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
/* TODO Fixup modes */
return true;
}
static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc, static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc,
struct drm_crtc_state *old_crtc_state) struct drm_crtc_state *old_crtc_state)
{ {
...@@ -531,7 +523,6 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc, ...@@ -531,7 +523,6 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc,
} }
static const struct drm_crtc_helper_funcs crtc_helper_funcs = { static const struct drm_crtc_helper_funcs crtc_helper_funcs = {
.mode_fixup = rcar_du_crtc_mode_fixup,
.disable = rcar_du_crtc_disable, .disable = rcar_du_crtc_disable,
.enable = rcar_du_crtc_enable, .enable = rcar_du_crtc_enable,
.atomic_begin = rcar_du_crtc_atomic_begin, .atomic_begin = rcar_du_crtc_atomic_begin,
......
...@@ -359,13 +359,6 @@ static void shmob_drm_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -359,13 +359,6 @@ static void shmob_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
scrtc->dpms = mode; scrtc->dpms = mode;
} }
static bool shmob_drm_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static void shmob_drm_crtc_mode_prepare(struct drm_crtc *crtc) static void shmob_drm_crtc_mode_prepare(struct drm_crtc *crtc)
{ {
shmob_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); shmob_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
...@@ -431,7 +424,6 @@ static int shmob_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -431,7 +424,6 @@ static int shmob_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
static const struct drm_crtc_helper_funcs crtc_helper_funcs = { static const struct drm_crtc_helper_funcs crtc_helper_funcs = {
.dpms = shmob_drm_crtc_dpms, .dpms = shmob_drm_crtc_dpms,
.mode_fixup = shmob_drm_crtc_mode_fixup,
.prepare = shmob_drm_crtc_mode_prepare, .prepare = shmob_drm_crtc_mode_prepare,
.commit = shmob_drm_crtc_mode_commit, .commit = shmob_drm_crtc_mode_commit,
.mode_set = shmob_drm_crtc_mode_set, .mode_set = shmob_drm_crtc_mode_set,
......
...@@ -51,14 +51,6 @@ static void sti_crtc_disabling(struct drm_crtc *crtc) ...@@ -51,14 +51,6 @@ static void sti_crtc_disabling(struct drm_crtc *crtc)
mixer->status = STI_MIXER_DISABLING; mixer->status = STI_MIXER_DISABLING;
} }
static bool sti_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
/* accept the provided drm_display_mode, do not fix it up */
return true;
}
static int static int
sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode) sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode)
{ {
...@@ -229,7 +221,6 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc, ...@@ -229,7 +221,6 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = {
.enable = sti_crtc_enable, .enable = sti_crtc_enable,
.disable = sti_crtc_disabling, .disable = sti_crtc_disabling,
.mode_fixup = sti_crtc_mode_fixup,
.mode_set = drm_helper_crtc_mode_set, .mode_set = drm_helper_crtc_mode_set,
.mode_set_nofb = sti_crtc_mode_set_nofb, .mode_set_nofb = sti_crtc_mode_set_nofb,
.mode_set_base = drm_helper_crtc_mode_set_base, .mode_set_base = drm_helper_crtc_mode_set_base,
......
...@@ -279,14 +279,6 @@ static void udl_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -279,14 +279,6 @@ static void udl_crtc_dpms(struct drm_crtc *crtc, int mode)
} }
static bool udl_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
#if 0 #if 0
static int static int
udl_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, udl_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
...@@ -402,7 +394,6 @@ static void udl_crtc_commit(struct drm_crtc *crtc) ...@@ -402,7 +394,6 @@ static void udl_crtc_commit(struct drm_crtc *crtc)
static const struct drm_crtc_helper_funcs udl_helper_funcs = { static const struct drm_crtc_helper_funcs udl_helper_funcs = {
.dpms = udl_crtc_dpms, .dpms = udl_crtc_dpms,
.mode_fixup = udl_crtc_mode_fixup,
.mode_set = udl_crtc_mode_set, .mode_set = udl_crtc_mode_set,
.prepare = udl_crtc_prepare, .prepare = udl_crtc_prepare,
.commit = udl_crtc_commit, .commit = udl_crtc_commit,
......
...@@ -237,13 +237,6 @@ virtio_gpu_framebuffer_init(struct drm_device *dev, ...@@ -237,13 +237,6 @@ virtio_gpu_framebuffer_init(struct drm_device *dev,
return 0; return 0;
} }
static bool virtio_gpu_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc) static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
...@@ -277,7 +270,6 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, ...@@ -277,7 +270,6 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
.enable = virtio_gpu_crtc_enable, .enable = virtio_gpu_crtc_enable,
.disable = virtio_gpu_crtc_disable, .disable = virtio_gpu_crtc_disable,
.mode_fixup = virtio_gpu_crtc_mode_fixup,
.mode_set_nofb = virtio_gpu_crtc_mode_set_nofb, .mode_set_nofb = virtio_gpu_crtc_mode_set_nofb,
.atomic_check = virtio_gpu_crtc_atomic_check, .atomic_check = virtio_gpu_crtc_atomic_check,
}; };
......
...@@ -146,6 +146,9 @@ __drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, ...@@ -146,6 +146,9 @@ __drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
struct drm_connector_state *state); struct drm_connector_state *state);
void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
struct drm_connector_state *state); struct drm_connector_state *state);
void drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
u16 *red, u16 *green, u16 *blue,
uint32_t start, uint32_t size);
/** /**
* drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
......
...@@ -305,6 +305,8 @@ struct drm_plane_helper_funcs; ...@@ -305,6 +305,8 @@ struct drm_plane_helper_funcs;
* @mode_changed: crtc_state->mode or crtc_state->enable has been changed * @mode_changed: crtc_state->mode or crtc_state->enable has been changed
* @active_changed: crtc_state->active has been toggled. * @active_changed: crtc_state->active has been toggled.
* @connectors_changed: connectors to this crtc have been updated * @connectors_changed: connectors to this crtc have been updated
* @color_mgmt_changed: color management properties have changed (degamma or
* gamma LUT or CSC matrix)
* @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
* @connector_mask: bitmask of (1 << drm_connector_index(connector)) of attached connectors * @connector_mask: bitmask of (1 << drm_connector_index(connector)) of attached connectors
* @encoder_mask: bitmask of (1 << drm_encoder_index(encoder)) of attached encoders * @encoder_mask: bitmask of (1 << drm_encoder_index(encoder)) of attached encoders
...@@ -312,6 +314,11 @@ struct drm_plane_helper_funcs; ...@@ -312,6 +314,11 @@ struct drm_plane_helper_funcs;
* update to ensure framebuffer cleanup isn't done too early * update to ensure framebuffer cleanup isn't done too early
* @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
* @mode: current mode timings * @mode: current mode timings
* @degamma_lut: Lookup table for converting framebuffer pixel data
* before apply the conversion matrix
* @ctm: Transformation matrix
* @gamma_lut: Lookup table for converting pixel data after the
* conversion matrix
* @event: optional pointer to a DRM event to signal upon completion of the * @event: optional pointer to a DRM event to signal upon completion of the
* state update * state update
* @state: backpointer to global drm_atomic_state * @state: backpointer to global drm_atomic_state
...@@ -333,6 +340,7 @@ struct drm_crtc_state { ...@@ -333,6 +340,7 @@ struct drm_crtc_state {
bool mode_changed : 1; bool mode_changed : 1;
bool active_changed : 1; bool active_changed : 1;
bool connectors_changed : 1; bool connectors_changed : 1;
bool color_mgmt_changed : 1;
/* attached planes bitmask: /* attached planes bitmask:
* WARNING: transitional helpers do not maintain plane_mask so * WARNING: transitional helpers do not maintain plane_mask so
...@@ -355,6 +363,11 @@ struct drm_crtc_state { ...@@ -355,6 +363,11 @@ struct drm_crtc_state {
/* blob property to expose current mode to atomic userspace */ /* blob property to expose current mode to atomic userspace */
struct drm_property_blob *mode_blob; struct drm_property_blob *mode_blob;
/* blob property to expose color management to userspace */
struct drm_property_blob *degamma_lut;
struct drm_property_blob *ctm;
struct drm_property_blob *gamma_lut;
struct drm_pending_vblank_event *event; struct drm_pending_vblank_event *event;
struct drm_atomic_state *state; struct drm_atomic_state *state;
...@@ -757,7 +770,7 @@ struct drm_crtc { ...@@ -757,7 +770,7 @@ struct drm_crtc {
int x, y; int x, y;
const struct drm_crtc_funcs *funcs; const struct drm_crtc_funcs *funcs;
/* CRTC gamma size for reporting to userspace */ /* Legacy FB CRTC gamma size for reporting to userspace */
uint32_t gamma_size; uint32_t gamma_size;
uint16_t *gamma_store; uint16_t *gamma_store;
...@@ -1677,6 +1690,7 @@ struct drm_bridge { ...@@ -1677,6 +1690,7 @@ struct drm_bridge {
* @dev: parent DRM device * @dev: parent DRM device
* @allow_modeset: allow full modeset * @allow_modeset: allow full modeset
* @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics * @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics
* @legacy_set_config: Disable conflicting encoders instead of failing with -EINVAL.
* @planes: pointer to array of plane pointers * @planes: pointer to array of plane pointers
* @plane_states: pointer to array of plane states pointers * @plane_states: pointer to array of plane states pointers
* @crtcs: pointer to array of CRTC pointers * @crtcs: pointer to array of CRTC pointers
...@@ -1690,6 +1704,7 @@ struct drm_atomic_state { ...@@ -1690,6 +1704,7 @@ struct drm_atomic_state {
struct drm_device *dev; struct drm_device *dev;
bool allow_modeset : 1; bool allow_modeset : 1;
bool legacy_cursor_update : 1; bool legacy_cursor_update : 1;
bool legacy_set_config : 1;
struct drm_plane **planes; struct drm_plane **planes;
struct drm_plane_state **plane_states; struct drm_plane_state **plane_states;
struct drm_crtc **crtcs; struct drm_crtc **crtcs;
...@@ -2026,6 +2041,15 @@ struct drm_mode_config_funcs { ...@@ -2026,6 +2041,15 @@ struct drm_mode_config_funcs {
* @property_blob_list: list of all the blob property objects * @property_blob_list: list of all the blob property objects
* @blob_lock: mutex for blob property allocation and management * @blob_lock: mutex for blob property allocation and management
* @*_property: core property tracking * @*_property: core property tracking
* @degamma_lut_property: LUT used to convert the framebuffer's colors to linear
* gamma
* @degamma_lut_size_property: size of the degamma LUT as supported by the
* driver (read-only)
* @ctm_property: Matrix used to convert colors after the lookup in the
* degamma LUT
* @gamma_lut_property: LUT used to convert the colors, after the CSC matrix, to
* the gamma space of the connected screen (read-only)
* @gamma_lut_size_property: size of the gamma LUT as supported by the driver
* @preferred_depth: preferred RBG pixel depth, used by fb helpers * @preferred_depth: preferred RBG pixel depth, used by fb helpers
* @prefer_shadow: hint to userspace to prefer shadow-fb rendering * @prefer_shadow: hint to userspace to prefer shadow-fb rendering
* @async_page_flip: does this device support async flips on the primary plane? * @async_page_flip: does this device support async flips on the primary plane?
...@@ -2128,6 +2152,13 @@ struct drm_mode_config { ...@@ -2128,6 +2152,13 @@ struct drm_mode_config {
struct drm_property *aspect_ratio_property; struct drm_property *aspect_ratio_property;
struct drm_property *dirty_info_property; struct drm_property *dirty_info_property;
/* Optional color correction properties */
struct drm_property *degamma_lut_property;
struct drm_property *degamma_lut_size_property;
struct drm_property *ctm_property;
struct drm_property *gamma_lut_property;
struct drm_property *gamma_lut_size_property;
/* properties for virtual machine layout */ /* properties for virtual machine layout */
struct drm_property *suggested_x_property; struct drm_property *suggested_x_property;
struct drm_property *suggested_y_property; struct drm_property *suggested_y_property;
...@@ -2554,6 +2585,21 @@ static inline struct drm_property *drm_property_find(struct drm_device *dev, ...@@ -2554,6 +2585,21 @@ static inline struct drm_property *drm_property_find(struct drm_device *dev,
return mo ? obj_to_property(mo) : NULL; return mo ? obj_to_property(mo) : NULL;
} }
/*
* Extract a degamma/gamma LUT value provided by user and round it to the
* precision supported by the hardware.
*/
static inline uint32_t drm_color_lut_extract(uint32_t user_input,
uint32_t bit_precision)
{
uint32_t val = user_input + (1 << (16 - bit_precision - 1));
uint32_t max = 0xffff >> (16 - bit_precision);
val >>= 16 - bit_precision;
return clamp_val(val, 0, max);
}
/* Plane list iterator for legacy (overlay only) planes. */ /* Plane list iterator for legacy (overlay only) planes. */
#define drm_for_each_legacy_plane(plane, dev) \ #define drm_for_each_legacy_plane(plane, dev) \
list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \ list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
......
...@@ -48,6 +48,9 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ...@@ -48,6 +48,9 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
struct drm_display_mode *mode, struct drm_display_mode *mode,
int x, int y, int x, int y,
struct drm_framebuffer *old_fb); struct drm_framebuffer *old_fb);
extern void drm_helper_crtc_enable_color_mgmt(struct drm_crtc *crtc,
int degamma_lut_size,
int gamma_lut_size);
extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder); extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
......
...@@ -487,6 +487,21 @@ struct drm_mode_crtc_lut { ...@@ -487,6 +487,21 @@ struct drm_mode_crtc_lut {
__u64 blue; __u64 blue;
}; };
struct drm_color_ctm {
/* Conversion matrix in S31.32 format. */
__s64 matrix[9];
};
struct drm_color_lut {
/*
* Data is U0.16 fixed point format.
*/
__u16 red;
__u16 green;
__u16 blue;
__u16 reserved;
};
#define DRM_MODE_PAGE_FLIP_EVENT 0x01 #define DRM_MODE_PAGE_FLIP_EVENT 0x01
#define DRM_MODE_PAGE_FLIP_ASYNC 0x02 #define DRM_MODE_PAGE_FLIP_ASYNC 0x02
#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT|DRM_MODE_PAGE_FLIP_ASYNC) #define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT|DRM_MODE_PAGE_FLIP_ASYNC)
......
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