Skip to content

Commit

Permalink
drm/amd/display: expand plane caps to include fp16 and scaling capabi…
Browse files Browse the repository at this point in the history
…lity

[why]
there are some scaling capabilities such as fp16 which are known to be unsupported
on a given ASIC.  exposing these static capabilities allows much simpler implementation
for OS interfaces which require to report such static capabilities to reduce the
number of dynamic validation calls

[how]
refactor the existing plane caps to be more extensible, and add fp16 and scaling
capabilities

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet Lakha@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Jun Lei authored and Alex Deucher committed Apr 15, 2019
1 parent fc8e523 commit ea36ad3
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 13 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
if (!plane->blends_with_above || !plane->blends_with_below)
continue;

if (!plane->supports_argb8888)
if (!plane->pixel_format_support.argb8888)
continue;

if (initialize_plane(dm, NULL, primary_planes + i,
Expand Down Expand Up @@ -4142,7 +4142,7 @@ static int get_plane_formats(const struct drm_plane *plane,
formats[num_formats++] = rgb_formats[i];
}

if (plane_cap && plane_cap->supports_nv12)
if (plane_cap && plane_cap->pixel_format_support.nv12)
formats[num_formats++] = DRM_FORMAT_NV12;
break;

Expand Down Expand Up @@ -4196,7 +4196,7 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
}

if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
plane_cap && plane_cap->supports_nv12) {
plane_cap && plane_cap->pixel_format_support.nv12) {
/* This only affects YUV formats. */
drm_plane_create_color_properties(
plane,
Expand Down
23 changes: 21 additions & 2 deletions drivers/gpu/drm/amd/display/dc/dc.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,27 @@ struct dc_plane_cap {
uint32_t blends_with_above : 1;
uint32_t blends_with_below : 1;
uint32_t per_pixel_alpha : 1;
uint32_t supports_argb8888 : 1;
uint32_t supports_nv12 : 1;
struct {
uint32_t argb8888 : 1;
uint32_t nv12 : 1;
uint32_t fp16 : 1;
} pixel_format_support;
// max upscaling factor x1000
// upscaling factors are always >= 1
// for example, 1080p -> 8K is 4.0, or 4000 raw value
struct {
uint32_t argb8888;
uint32_t nv12;
uint32_t fp16;
} max_upscale_factor;
// max downscale factor x1000
// downscale factors are always <= 1
// for example, 8K -> 1080p is 0.25, or 250 raw value
struct {
uint32_t argb8888;
uint32_t nv12;
uint32_t fp16;
} max_downscale_factor;
};

struct dc_caps {
Expand Down
19 changes: 18 additions & 1 deletion drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,24 @@ static const struct resource_caps res_cap = {

static const struct dc_plane_cap plane_cap = {
.type = DC_PLANE_TYPE_DCE_RGB,
.supports_argb8888 = true,

.pixel_format_support = {
.argb8888 = true,
.nv12 = false,
.fp16 = false
},

.max_upscale_factor = {
.argb8888 = 16000,
.nv12 = 1,
.fp16 = 1
},

.max_downscale_factor = {
.argb8888 = 250,
.nv12 = 1,
.fp16 = 1
}
};

#define CTX ctx
Expand Down
38 changes: 36 additions & 2 deletions drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,48 @@ static const struct dc_plane_cap plane_cap = {
.blends_with_below = true,
.blends_with_above = true,
.per_pixel_alpha = 1,
.supports_argb8888 = true,

.pixel_format_support = {
.argb8888 = true,
.nv12 = false,
.fp16 = false
},

.max_upscale_factor = {
.argb8888 = 16000,
.nv12 = 1,
.fp16 = 1
},

.max_downscale_factor = {
.argb8888 = 250,
.nv12 = 1,
.fp16 = 1
}
};

static const struct dc_plane_cap underlay_plane_cap = {
.type = DC_PLANE_TYPE_DCE_UNDERLAY,
.blends_with_above = true,
.per_pixel_alpha = 1,
.supports_nv12 = true

.pixel_format_support = {
.argb8888 = false,
.nv12 = true,
.fp16 = false
},

.max_upscale_factor = {
.argb8888 = 1,
.nv12 = 16000,
.fp16 = 1
},

.max_downscale_factor = {
.argb8888 = 1,
.nv12 = 250,
.fp16 = 1
}
};

#define CTX ctx
Expand Down
19 changes: 18 additions & 1 deletion drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,24 @@ static const struct resource_caps polaris_11_resource_cap = {

static const struct dc_plane_cap plane_cap = {
.type = DC_PLANE_TYPE_DCE_RGB,
.supports_argb8888 = true,

.pixel_format_support = {
.argb8888 = true,
.nv12 = false,
.fp16 = false
},

.max_upscale_factor = {
.argb8888 = 16000,
.nv12 = 1,
.fp16 = 1
},

.max_downscale_factor = {
.argb8888 = 250,
.nv12 = 1,
.fp16 = 1
}
};

#define CTX ctx
Expand Down
19 changes: 18 additions & 1 deletion drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,24 @@ static const struct resource_caps res_cap = {

static const struct dc_plane_cap plane_cap = {
.type = DC_PLANE_TYPE_DCE_RGB,
.supports_argb8888 = true,

.pixel_format_support = {
.argb8888 = true,
.nv12 = false,
.fp16 = false
},

.max_upscale_factor = {
.argb8888 = 16000,
.nv12 = 1,
.fp16 = 1
},

.max_downscale_factor = {
.argb8888 = 250,
.nv12 = 1,
.fp16 = 1
}
};

static const struct dc_debug_options debug_defaults = {
Expand Down
19 changes: 18 additions & 1 deletion drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,24 @@ static const struct resource_caps res_cap_83 = {

static const struct dc_plane_cap plane_cap = {
.type = DC_PLANE_TYPE_DCE_RGB,
.supports_argb8888 = true,

.pixel_format_support = {
.argb8888 = true,
.nv12 = false,
.fp16 = false
},

.max_upscale_factor = {
.argb8888 = 16000,
.nv12 = 1,
.fp16 = 1
},

.max_downscale_factor = {
.argb8888 = 250,
.nv12 = 1,
.fp16 = 1
}
};

static const struct dce_dmcu_registers dmcu_regs = {
Expand Down
20 changes: 18 additions & 2 deletions drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,24 @@ static const struct dc_plane_cap plane_cap = {
.blends_with_above = true,
.blends_with_below = true,
.per_pixel_alpha = true,
.supports_argb8888 = true,
.supports_nv12 = true

.pixel_format_support = {
.argb8888 = true,
.nv12 = true,
.fp16 = true
},

.max_upscale_factor = {
.argb8888 = 16000,
.nv12 = 16000,
.fp16 = 1
},

.max_downscale_factor = {
.argb8888 = 250,
.nv12 = 250,
.fp16 = 1
}
};

static const struct dc_debug_options debug_defaults_drv = {
Expand Down

0 comments on commit ea36ad3

Please sign in to comment.