Skip to content

Commit

Permalink
drm: xlnx: zynqmp_dpsub: Minimize usage of global flag
Browse files Browse the repository at this point in the history
Avoid usage of global zynqmp_dpsub.dma_enabled flag in DPSUB layer
context. This flag signals whether the driver runs in DRM CRTC or DRM
bridge mode, assuming that all display layers share the same live or
non-live mode of operation. Using per-layer mode instead of global flag
will simplify future support of the hybrid scenario.

Remove redundant checks in DMA request/release contexts as
zynqmp_disp_layer.info is well-defined for all layer types, including the
correct number of DMA channels required for each particular layer.

Signed-off-by: Anatoliy Klymenko <anatoliy.klymenko@amd.com>
Reviewed-by: Tomi Valkeinen <tomi.valkainen@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240416-dp-live-fmt-v4-5-c7f379b7168e@amd.com
  • Loading branch information
Anatoliy Klymenko authored and Tomi Valkeinen committed Apr 24, 2024
1 parent b0f0469 commit 1836fd5
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions drivers/gpu/drm/xlnx/zynqmp_disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer)
{
unsigned int i;

if (layer->disp->dpsub->dma_enabled) {
if (layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE) {
for (i = 0; i < layer->drm_fmt->num_planes; i++)
dmaengine_terminate_sync(layer->dmas[i].chan);
}
Expand All @@ -1052,7 +1052,7 @@ void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer,

zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt);

if (!layer->disp->dpsub->dma_enabled)
if (layer->mode == ZYNQMP_DPSUB_LAYER_LIVE)
return;

/*
Expand Down Expand Up @@ -1090,7 +1090,7 @@ int zynqmp_disp_layer_update(struct zynqmp_disp_layer *layer,
const struct drm_format_info *info = layer->drm_fmt;
unsigned int i;

if (!layer->disp->dpsub->dma_enabled)
if (layer->mode == ZYNQMP_DPSUB_LAYER_LIVE)
return 0;

for (i = 0; i < info->num_planes; i++) {
Expand Down Expand Up @@ -1140,9 +1140,6 @@ static void zynqmp_disp_layer_release_dma(struct zynqmp_disp *disp,
{
unsigned int i;

if (!layer->info || !disp->dpsub->dma_enabled)
return;

for (i = 0; i < layer->info->num_channels; i++) {
struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];

Expand Down Expand Up @@ -1183,9 +1180,6 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp,
unsigned int i;
int ret;

if (!disp->dpsub->dma_enabled)
return 0;

for (i = 0; i < layer->info->num_channels; i++) {
struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];
char dma_channel_name[16];
Expand Down

0 comments on commit 1836fd5

Please sign in to comment.