Skip to content

Commit

Permalink
fix build with 6.6 kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaa-bbaa committed Oct 8, 2024
1 parent cf882e3 commit 3e2186a
Show file tree
Hide file tree
Showing 16 changed files with 190 additions and 33 deletions.
17 changes: 15 additions & 2 deletions drivers/gpu/drm/i915/display/intel_atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* See intel_atomic_plane.c for the plane-specific atomic functionality.
*/

#include <linux/version.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_fourcc.h>
Expand Down Expand Up @@ -67,9 +69,11 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
*val = intel_conn_state->force_audio;
else if (property == dev_priv->display.properties.broadcast_rgb)
*val = intel_conn_state->broadcast_rgb;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
else if (property == dev_priv->display.properties.border)
*val = (intel_conn_state->border) ?
intel_conn_state->border->base.id : 0;
#endif
else {
drm_dbg_atomic(&dev_priv->drm,
"Unknown property [PROP:%d:%s]\n",
Expand Down Expand Up @@ -98,8 +102,10 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_digital_connector_state *intel_conn_state =
to_intel_digital_connector_state(state);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
bool replaced;
int ret;
#endif

if (property == dev_priv->display.properties.force_audio) {
intel_conn_state->force_audio = val;
Expand All @@ -110,7 +116,7 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
intel_conn_state->broadcast_rgb = val;
return 0;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
if (property == dev_priv->display.properties.border) {
ret = drm_property_replace_blob_from_id(dev,
&intel_conn_state->border,
Expand All @@ -119,12 +125,14 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
&replaced);
return ret;
}
#endif

drm_dbg_atomic(&dev_priv->drm, "Unknown property [PROP:%d:%s]\n",
property->base.id, property->name);
return -EINVAL;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
static bool intel_connector_blob_equal(struct drm_property_blob *old_blob,
struct drm_property_blob *new_blob)
{
Expand All @@ -136,6 +144,7 @@ static bool intel_connector_blob_equal(struct drm_property_blob *old_blob,

return !memcmp(old_blob->data, new_blob->data, old_blob->length);
}
#endif

int intel_digital_connector_atomic_check(struct drm_connector *conn,
struct drm_atomic_state *state)
Expand Down Expand Up @@ -168,8 +177,12 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
new_conn_state->base.content_type != old_conn_state->base.content_type ||
new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode ||
new_conn_state->base.privacy_screen_sw_state != old_conn_state->base.privacy_screen_sw_state ||
!drm_connector_atomic_hdr_metadata_equal(old_state, new_state) ||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
!drm_connector_atomic_hdr_metadata_equal(old_state, new_state))
#else
!drm_connector_atomic_hdr_metadata_equal(old_state, new_state) ||
!intel_connector_blob_equal(old_conn_state->border, new_conn_state->border))
#endif
crtc_state->mode_changed = true;

return 0;
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/i915/display/intel_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/version.h>

#include <drm/drm_atomic_helper.h>
#include <drm/drm_edid.h>
Expand Down Expand Up @@ -354,6 +355,7 @@ intel_attach_scaling_mode_property(struct drm_connector *connector)
connector->state->scaling_mode = DRM_MODE_SCALE_ASPECT;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
void
intel_attach_border_property(struct drm_connector *connector)
{
Expand All @@ -373,3 +375,4 @@ intel_attach_border_property(struct drm_connector *connector)

drm_object_attach_property(&connector->base, prop, 0);
}
#endif
3 changes: 3 additions & 0 deletions drivers/gpu/drm/i915/display/intel_connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define __INTEL_CONNECTOR_H__

#include <linux/types.h>
#include <linux/version.h>

struct drm_connector;
struct drm_edid;
Expand Down Expand Up @@ -35,6 +36,8 @@ void intel_attach_aspect_ratio_property(struct drm_connector *connector);
void intel_attach_hdmi_colorspace_property(struct drm_connector *connector);
void intel_attach_dp_colorspace_property(struct drm_connector *connector);
void intel_attach_scaling_mode_property(struct drm_connector *connector);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
void intel_attach_border_property(struct drm_connector *connector);
#endif

#endif /* __INTEL_CONNECTOR_H__ */
9 changes: 9 additions & 0 deletions drivers/gpu/drm/i915/display/intel_crt.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/dmi.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/version.h>

#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
Expand Down Expand Up @@ -669,12 +670,20 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
drm_edid = intel_crt_get_edid(connector, connector->ddc);

if (drm_edid) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
const struct edid *edid = drm_edid_raw(drm_edid);
bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL;
#endif
/*
* This may be a DVI-I connector with a shared DDC
* link between analog and digital outputs, so we
* have to check the EDID input spec of the attached device.
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
if (is_digital) {
#else
if (drm_edid_is_digital(drm_edid)) {
#endif
drm_dbg_kms(&dev_priv->drm,
"CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
} else {
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/i915/display/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -4689,8 +4689,9 @@ intel_modeset_pipe_config(struct intel_atomic_state *state,
ret = compute_baseline_pipe_bpp(state, crtc);
if (ret)
return ret;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
crtc_state->fec_enable = limits->force_fec_pipes & BIT(crtc->pipe);
#endif
crtc_state->max_link_bpp_x16 = limits->max_bpp_x16[crtc->pipe];

if (crtc_state->pipe_bpp > to_bpp_int(crtc_state->max_link_bpp_x16)) {
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/i915/display/intel_display_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ struct intel_display {
struct {
struct drm_property *broadcast_rgb;
struct drm_property *force_audio;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
struct drm_property *border;
#endif
} properties;

struct {
Expand Down
7 changes: 6 additions & 1 deletion drivers/gpu/drm/i915/display/intel_display_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,8 +1250,10 @@ static int i915_dsc_fec_support_show(struct seq_file *m, void *data)
DP_DSC_YCbCr420_Native)),
str_yes_no(drm_dp_dsc_sink_supports_format(connector->dp.dsc_dpcd,
DP_DSC_YCbCr444)));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
seq_printf(m, "DSC_Sink_BPP_Precision: %d\n",
drm_dp_dsc_sink_bpp_incr(connector->dp.dsc_dpcd));
#endif
seq_printf(m, "Force_DSC_Enable: %s\n",
str_yes_no(intel_dp->force_dsc_en));
if (!intel_dp_is_edp(intel_dp))
Expand Down Expand Up @@ -1444,6 +1446,7 @@ static const struct file_operations i915_dsc_output_format_fops = {
.write = i915_dsc_output_format_write
};

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
static int i915_dsc_fractional_bpp_show(struct seq_file *m, void *data)
{
struct drm_connector *connector = m->private;
Expand Down Expand Up @@ -1522,6 +1525,7 @@ static const struct file_operations i915_dsc_fractional_bpp_fops = {
.release = single_release,
.write = i915_dsc_fractional_bpp_write
};
#endif

/*
* Returns the Current CRTC's bpc.
Expand Down Expand Up @@ -1600,9 +1604,10 @@ void intel_connector_debugfs_add(struct intel_connector *intel_connector)

debugfs_create_file("i915_dsc_output_format", 0644, root,
connector, &i915_dsc_output_format_fops);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
debugfs_create_file("i915_dsc_fractional_bpp", 0644, root,
connector, &i915_dsc_fractional_bpp_fops);
#endif
}

if (connector->connector_type == DRM_MODE_CONNECTOR_DSI ||
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/i915/display/intel_display_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,9 @@ struct intel_digital_connector_state {

enum hdmi_force_audio force_audio;
int broadcast_rgb;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
struct drm_property_blob *border;
#endif
};

#define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
Expand Down
Loading

0 comments on commit 3e2186a

Please sign in to comment.