Skip to content

Commit 1a4be38

Browse files
committed
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. ...
2 parents c51e034 + c1f415c commit 1a4be38

31 files changed

+536
-292
lines changed

Documentation/DocBook/gpu.tmpl

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ void intel_crt_init(struct drm_device *dev)
18161816
<td valign="top" >Description/Restrictions</td>
18171817
</tr>
18181818
<tr>
1819-
<td rowspan="37" valign="top" >DRM</td>
1819+
<td rowspan="42" valign="top" >DRM</td>
18201820
<td valign="top" >Generic</td>
18211821
<td valign="top" >“rotation”</td>
18221822
<td valign="top" >BITMASK</td>
@@ -2068,7 +2068,7 @@ void intel_crt_init(struct drm_device *dev)
20682068
<td valign="top" >property to suggest an Y offset for a connector</td>
20692069
</tr>
20702070
<tr>
2071-
<td rowspan="3" valign="top" >Optional</td>
2071+
<td rowspan="8" valign="top" >Optional</td>
20722072
<td valign="top" >“scaling mode”</td>
20732073
<td valign="top" >ENUM</td>
20742074
<td valign="top" >{ "None", "Full", "Center", "Full aspect" }</td>
@@ -2092,6 +2092,61 @@ void intel_crt_init(struct drm_device *dev)
20922092
<td valign="top" >TBD</td>
20932093
</tr>
20942094
<tr>
2095+
<td valign="top" >“DEGAMMA_LUT”</td>
2096+
<td valign="top" >BLOB</td>
2097+
<td valign="top" >0</td>
2098+
<td valign="top" >CRTC</td>
2099+
<td valign="top" >DRM property to set the degamma lookup table
2100+
(LUT) mapping pixel data from the framebuffer before it is
2101+
given to the transformation matrix. The data is an interpreted
2102+
as an array of struct drm_color_lut elements. Hardware might
2103+
choose not to use the full precision of the LUT elements nor
2104+
use all the elements of the LUT (for example the hardware
2105+
might choose to interpolate between LUT[0] and LUT[4]). </td>
2106+
</tr>
2107+
<tr>
2108+
<td valign="top" >“DEGAMMA_LUT_SIZE”</td>
2109+
<td valign="top" >RANGE | IMMUTABLE</td>
2110+
<td valign="top" >Min=0, Max=UINT_MAX</td>
2111+
<td valign="top" >CRTC</td>
2112+
<td valign="top" >DRM property to gives the size of the lookup
2113+
table to be set on the DEGAMMA_LUT property (the size depends
2114+
on the underlying hardware).</td>
2115+
</tr>
2116+
<tr>
2117+
<td valign="top" >“CTM”</td>
2118+
<td valign="top" >BLOB</td>
2119+
<td valign="top" >0</td>
2120+
<td valign="top" >CRTC</td>
2121+
<td valign="top" >DRM property to set the current
2122+
transformation matrix (CTM) apply to pixel data after the
2123+
lookup through the degamma LUT and before the lookup through
2124+
the gamma LUT. The data is an interpreted as a struct
2125+
drm_color_ctm.</td>
2126+
</tr>
2127+
<tr>
2128+
<td valign="top" >“GAMMA_LUT”</td>
2129+
<td valign="top" >BLOB</td>
2130+
<td valign="top" >0</td>
2131+
<td valign="top" >CRTC</td>
2132+
<td valign="top" >DRM property to set the gamma lookup table
2133+
(LUT) mapping pixel data after to the transformation matrix to
2134+
data sent to the connector. The data is an interpreted as an
2135+
array of struct drm_color_lut elements. Hardware might choose
2136+
not to use the full precision of the LUT elements nor use all
2137+
the elements of the LUT (for example the hardware might choose
2138+
to interpolate between LUT[0] and LUT[4]).</td>
2139+
</tr>
2140+
<tr>
2141+
<td valign="top" >“GAMMA_LUT_SIZE”</td>
2142+
<td valign="top" >RANGE | IMMUTABLE</td>
2143+
<td valign="top" >Min=0, Max=UINT_MAX</td>
2144+
<td valign="top" >CRTC</td>
2145+
<td valign="top" >DRM property to gives the size of the lookup
2146+
table to be set on the GAMMA_LUT property (the size depends on
2147+
the underlying hardware).</td>
2148+
</tr>
2149+
<tr>
20952150
<td rowspan="20" valign="top" >i915</td>
20962151
<td rowspan="2" valign="top" >Generic</td>
20972152
<td valign="top" >"Broadcast RGB"</td>

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
497497
}
498498
}
499499

500-
static bool ast_crtc_mode_fixup(struct drm_crtc *crtc,
501-
const struct drm_display_mode *mode,
502-
struct drm_display_mode *adjusted_mode)
503-
{
504-
return true;
505-
}
506-
507500
/* ast is different - we will force move buffers out of VRAM */
508501
static int ast_crtc_do_set_base(struct drm_crtc *crtc,
509502
struct drm_framebuffer *fb,
@@ -617,7 +610,6 @@ static void ast_crtc_commit(struct drm_crtc *crtc)
617610

618611
static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = {
619612
.dpms = ast_crtc_dpms,
620-
.mode_fixup = ast_crtc_mode_fixup,
621613
.mode_set = ast_crtc_mode_set,
622614
.mode_set_base = ast_crtc_mode_set_base,
623615
.disable = ast_crtc_disable,

drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,6 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
121121
cfg);
122122
}
123123

124-
static bool atmel_hlcdc_crtc_mode_fixup(struct drm_crtc *crtc,
125-
const struct drm_display_mode *mode,
126-
struct drm_display_mode *adjusted_mode)
127-
{
128-
return true;
129-
}
130-
131124
static void atmel_hlcdc_crtc_disable(struct drm_crtc *c)
132125
{
133126
struct drm_device *dev = c->dev;
@@ -261,7 +254,6 @@ static void atmel_hlcdc_crtc_atomic_flush(struct drm_crtc *crtc,
261254
}
262255

263256
static const struct drm_crtc_helper_funcs lcdc_crtc_helper_funcs = {
264-
.mode_fixup = atmel_hlcdc_crtc_mode_fixup,
265257
.mode_set = drm_helper_crtc_mode_set,
266258
.mode_set_nofb = atmel_hlcdc_crtc_mode_set_nofb,
267259
.mode_set_base = drm_helper_crtc_mode_set_base,
@@ -349,4 +341,3 @@ int atmel_hlcdc_crtc_create(struct drm_device *dev)
349341
atmel_hlcdc_crtc_destroy(&crtc->base);
350342
return ret;
351343
}
352-

drivers/gpu/drm/bochs/bochs_kms.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ static void bochs_crtc_dpms(struct drm_crtc *crtc, int mode)
3030
}
3131
}
3232

33-
static bool bochs_crtc_mode_fixup(struct drm_crtc *crtc,
34-
const struct drm_display_mode *mode,
35-
struct drm_display_mode *adjusted_mode)
36-
{
37-
return true;
38-
}
39-
4033
static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
4134
struct drm_framebuffer *old_fb)
4235
{
@@ -135,7 +128,6 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
135128

136129
static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
137130
.dpms = bochs_crtc_dpms,
138-
.mode_fixup = bochs_crtc_mode_fixup,
139131
.mode_set = bochs_crtc_mode_set,
140132
.mode_set_base = bochs_crtc_mode_set_base,
141133
.prepare = bochs_crtc_prepare,

drivers/gpu/drm/cirrus/cirrus_mode.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,6 @@ static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode)
9191
WREG_GFX(0xe, gr0e);
9292
}
9393

94-
/*
95-
* The core passes the desired mode to the CRTC code to see whether any
96-
* CRTC-specific modifications need to be made to it. We're in a position
97-
* to just pass that straight through, so this does nothing
98-
*/
99-
static bool cirrus_crtc_mode_fixup(struct drm_crtc *crtc,
100-
const struct drm_display_mode *mode,
101-
struct drm_display_mode *adjusted_mode)
102-
{
103-
return true;
104-
}
105-
10694
static void cirrus_set_start_address(struct drm_crtc *crtc, unsigned offset)
10795
{
10896
struct cirrus_device *cdev = crtc->dev->dev_private;
@@ -372,7 +360,6 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
372360

373361
static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
374362
.dpms = cirrus_crtc_dpms,
375-
.mode_fixup = cirrus_crtc_mode_fixup,
376363
.mode_set = cirrus_crtc_mode_set,
377364
.mode_set_base = cirrus_crtc_mode_set_base,
378365
.prepare = cirrus_crtc_prepare,

drivers/gpu/drm/drm_atomic.c

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include <drm/drmP.h>
3030
#include <drm/drm_atomic.h>
31+
#include <drm/drm_mode.h>
3132
#include <drm/drm_plane_helper.h>
3233

3334
/**
@@ -375,6 +376,59 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
375376
}
376377
EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
377378

379+
/**
380+
* drm_atomic_replace_property_blob - replace a blob property
381+
* @blob: a pointer to the member blob to be replaced
382+
* @new_blob: the new blob to replace with
383+
* @expected_size: the expected size of the new blob
384+
* @replaced: whether the blob has been replaced
385+
*
386+
* RETURNS:
387+
* Zero on success, error code on failure
388+
*/
389+
static void
390+
drm_atomic_replace_property_blob(struct drm_property_blob **blob,
391+
struct drm_property_blob *new_blob,
392+
bool *replaced)
393+
{
394+
struct drm_property_blob *old_blob = *blob;
395+
396+
if (old_blob == new_blob)
397+
return;
398+
399+
if (old_blob)
400+
drm_property_unreference_blob(old_blob);
401+
if (new_blob)
402+
drm_property_reference_blob(new_blob);
403+
*blob = new_blob;
404+
*replaced = true;
405+
406+
return;
407+
}
408+
409+
static int
410+
drm_atomic_replace_property_blob_from_id(struct drm_crtc *crtc,
411+
struct drm_property_blob **blob,
412+
uint64_t blob_id,
413+
ssize_t expected_size,
414+
bool *replaced)
415+
{
416+
struct drm_device *dev = crtc->dev;
417+
struct drm_property_blob *new_blob = NULL;
418+
419+
if (blob_id != 0) {
420+
new_blob = drm_property_lookup_blob(dev, blob_id);
421+
if (new_blob == NULL)
422+
return -EINVAL;
423+
if (expected_size > 0 && expected_size != new_blob->length)
424+
return -EINVAL;
425+
}
426+
427+
drm_atomic_replace_property_blob(blob, new_blob, replaced);
428+
429+
return 0;
430+
}
431+
378432
/**
379433
* drm_atomic_crtc_set_property - set property on CRTC
380434
* @crtc: the drm CRTC to set a property on
@@ -397,6 +451,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
397451
{
398452
struct drm_device *dev = crtc->dev;
399453
struct drm_mode_config *config = &dev->mode_config;
454+
bool replaced = false;
400455
int ret;
401456

402457
if (property == config->prop_active)
@@ -407,8 +462,31 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
407462
ret = drm_atomic_set_mode_prop_for_crtc(state, mode);
408463
drm_property_unreference_blob(mode);
409464
return ret;
410-
}
411-
else if (crtc->funcs->atomic_set_property)
465+
} else if (property == config->degamma_lut_property) {
466+
ret = drm_atomic_replace_property_blob_from_id(crtc,
467+
&state->degamma_lut,
468+
val,
469+
-1,
470+
&replaced);
471+
state->color_mgmt_changed = replaced;
472+
return ret;
473+
} else if (property == config->ctm_property) {
474+
ret = drm_atomic_replace_property_blob_from_id(crtc,
475+
&state->ctm,
476+
val,
477+
sizeof(struct drm_color_ctm),
478+
&replaced);
479+
state->color_mgmt_changed = replaced;
480+
return ret;
481+
} else if (property == config->gamma_lut_property) {
482+
ret = drm_atomic_replace_property_blob_from_id(crtc,
483+
&state->gamma_lut,
484+
val,
485+
-1,
486+
&replaced);
487+
state->color_mgmt_changed = replaced;
488+
return ret;
489+
} else if (crtc->funcs->atomic_set_property)
412490
return crtc->funcs->atomic_set_property(crtc, state, property, val);
413491
else
414492
return -EINVAL;
@@ -444,6 +522,12 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
444522
*val = state->active;
445523
else if (property == config->prop_mode_id)
446524
*val = (state->mode_blob) ? state->mode_blob->base.id : 0;
525+
else if (property == config->degamma_lut_property)
526+
*val = (state->degamma_lut) ? state->degamma_lut->base.id : 0;
527+
else if (property == config->ctm_property)
528+
*val = (state->ctm) ? state->ctm->base.id : 0;
529+
else if (property == config->gamma_lut_property)
530+
*val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
447531
else if (crtc->funcs->atomic_get_property)
448532
return crtc->funcs->atomic_get_property(crtc, state, property, val);
449533
else

0 commit comments

Comments
 (0)