<div dir="ltr">Drp... replied to an old patch.<br><br>The userspace mesa patches to produce Y_TILED_CCS surfaces have been reviewed for a couple of weeks now. So long as kmscube counts as userspace, I think this should be good to land.<br><br>Acked-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 1, 2017 at 9:58 AM, Ben Widawsky <span dir="ltr"><<a href="mailto:ben@bwidawsk.net" target="_blank">ben@bwidawsk.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Ville Syrjälä <<a href="mailto:ville.syrjala@linux.intel.com">ville.syrjala@linux.intel.com</a><wbr>><br>
<br>
SKL+ display engine can scan out certain kinds of compressed surfaces<br>
produced by the render engine. This involved telling the display engine<br>
the location of the color control surfae (CCS) which describes which<br>
parts of the main surface are compressed and which are not. The location<br>
of CCS is provided by userspace as just another plane with its own offset.<br>
<br>
By providing our own format information for the CCS formats, we should<br>
be able to make framebuffer_check() do the right thing for the CCS<br>
surface as well.<br>
<br>
Note that we'll return the same format info for both Y and Yf tiled<br>
format as that's what happens with the non-CCS Y vs. Yf as well. If<br>
desired, we could potentially return a unique pointer for each<br>
pixel_format+tiling+ccs combination, in which case we immediately be<br>
able to tell if any of that stuff changed by just comparing the<br>
pointers. But that does sound a bit wasteful space wise.<br>
<br>
v2: Drop the 'dev' argument from the hook<br>
v3: Include the description of the CCS surface layout<br>
v4: Pretend CCS tiles are regular 128 byte wide Y tiles (Jason)<br>
<br>
Cc: Daniel Vetter <<a href="mailto:daniel@ffwll.ch">daniel@ffwll.ch</a>><br>
Cc: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>><br>
Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
Reviewed-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>> (v3)<br>
Signed-off-by: Ville Syrjä <<a href="mailto:ville.syrjala@linux.intel.com">ville.syrjala@linux.intel.com</a><wbr>><br>
Signed-off-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>><br>
---<br>
drivers/gpu/drm/drm_fourcc.c | 2 +-<br>
drivers/gpu/drm/i915/intel_<wbr>display.c | 37 ++++++++++++++++++++++++++++++<wbr>++++++<br>
include/drm/drm_mode_config.h | 3 ++-<br>
include/uapi/drm/drm_fourcc.h | 3 +++<br>
4 files changed, 43 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c<br>
index 9c0152df45ad..50da6180c495 100644<br>
--- a/drivers/gpu/drm/drm_fourcc.c<br>
+++ b/drivers/gpu/drm/drm_fourcc.c<br>
@@ -222,7 +222,7 @@ drm_get_format_info(struct drm_device *dev,<br>
const struct drm_format_info *info = NULL;<br>
<br>
if (dev->mode_config.funcs->get_<wbr>format_info)<br>
- info = dev->mode_config.funcs->get_<wbr>format_info(mode_cmd);<br>
+ info = dev->mode_config.funcs->get_<wbr>format_info(dev, mode_cmd);<br>
<br>
if (!info)<br>
info = drm_format_info(mode_cmd-><wbr>pixel_format);<br>
diff --git a/drivers/gpu/drm/i915/intel_<wbr>display.c b/drivers/gpu/drm/i915/intel_<wbr>display.c<br>
index e92fd14c06c7..6b00689ef6e0 100644<br>
--- a/drivers/gpu/drm/i915/intel_<wbr>display.c<br>
+++ b/drivers/gpu/drm/i915/intel_<wbr>display.c<br>
@@ -2433,6 +2433,42 @@ static unsigned int intel_fb_modifier_to_tiling(<wbr>uint64_t fb_modifier)<br>
}<br>
}<br>
<br>
+static const struct drm_format_info ccs_formats[] = {<br>
+ { .format = DRM_FORMAT_XRGB8888, .depth = 24, .num_planes = 2, .cpp = { 4, 1, }, .hsub = 16, .vsub = 8, },<br>
+ { .format = DRM_FORMAT_XBGR8888, .depth = 24, .num_planes = 2, .cpp = { 4, 1, }, .hsub = 16, .vsub = 8, },<br>
+ { .format = DRM_FORMAT_ARGB8888, .depth = 32, .num_planes = 2, .cpp = { 4, 1, }, .hsub = 16, .vsub = 8, },<br>
+ { .format = DRM_FORMAT_ABGR8888, .depth = 32, .num_planes = 2, .cpp = { 4, 1, }, .hsub = 16, .vsub = 8, },<br>
+};<br>
+<br>
+static const struct drm_format_info *<br>
+lookup_format_info(const struct drm_format_info formats[],<br>
+ int num_formats, u32 format)<br>
+{<br>
+ int i;<br>
+<br>
+ for (i = 0; i < num_formats; i++) {<br>
+ if (formats[i].format == format)<br>
+ return &formats[i];<br>
+ }<br>
+<br>
+ return NULL;<br>
+}<br>
+<br>
+static const struct drm_format_info *<br>
+intel_get_format_info(struct drm_device *dev,<br>
+ const struct drm_mode_fb_cmd2 *cmd)<br>
+{<br>
+ switch (cmd->modifier[0]) {<br>
+ case I915_FORMAT_MOD_Y_TILED_CCS:<br>
+ case I915_FORMAT_MOD_Yf_TILED_CCS:<br>
+ return lookup_format_info(ccs_<wbr>formats,<br>
+ ARRAY_SIZE(ccs_formats),<br>
+ cmd->pixel_format);<br>
+ default:<br>
+ return NULL;<br>
+ }<br>
+}<br>
+<br>
static int<br>
intel_fill_fb_info(struct drm_i915_private *dev_priv,<br>
struct drm_framebuffer *fb)<br>
@@ -14630,6 +14666,7 @@ static void intel_atomic_state_free(struct drm_atomic_state *state)<br>
<br>
static const struct drm_mode_config_funcs intel_mode_funcs = {<br>
.fb_create = intel_user_framebuffer_create,<br>
+ .get_format_info = intel_get_format_info,<br>
.output_poll_changed = intel_fbdev_output_poll_<wbr>changed,<br>
.atomic_check = intel_atomic_check,<br>
.atomic_commit = intel_atomic_commit,<br>
diff --git a/include/drm/drm_mode_config.<wbr>h b/include/drm/drm_mode_config.<wbr>h<br>
index 42981711189b..f0d3d3857ae2 100644<br>
--- a/include/drm/drm_mode_config.<wbr>h<br>
+++ b/include/drm/drm_mode_config.<wbr>h<br>
@@ -81,7 +81,8 @@ struct drm_mode_config_funcs {<br>
* The format information specific to the given fb metadata, or<br>
* NULL if none is found.<br>
*/<br>
- const struct drm_format_info *(*get_format_info)(const struct drm_mode_fb_cmd2 *mode_cmd);<br>
+ const struct drm_format_info *(*get_format_info)(struct drm_device *dev,<br>
+ const struct drm_mode_fb_cmd2 *mode_cmd);<br>
<br>
/**<br>
* @output_poll_changed:<br>
diff --git a/include/uapi/drm/drm_fourcc.<wbr>h b/include/uapi/drm/drm_fourcc.<wbr>h<br>
index 7586c46f68bf..ee5910944fac 100644<br>
--- a/include/uapi/drm/drm_fourcc.<wbr>h<br>
+++ b/include/uapi/drm/drm_fourcc.<wbr>h<br>
@@ -252,6 +252,9 @@ extern "C" {<br>
*/<br>
#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)<br>
<br>
+#define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4)<br>
+#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5)<br>
+<br>
/*<br>
* Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks<br>
*<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.3<br>
<br>
</font></span></blockquote></div><br></div>