Skip to content

Commit

Permalink
drm: xlnx: zynqmp_dpsub: Allow configuration of layer mode
Browse files Browse the repository at this point in the history
Add a mode parameter to the zynqmp_disp_layer_enable() to set the layer
mode, to prepare for live mode support.

Signed-off-by: Laurent Pinchart <[email protected]>
  • Loading branch information
pinchartl committed Oct 19, 2022
1 parent 52c2cf1 commit 3662bbf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
30 changes: 9 additions & 21 deletions drivers/gpu/drm/xlnx/zynqmp_disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ struct zynqmp_disp_format {
const u32 *sf;
};

/**
* enum zynqmp_disp_layer_mode - Layer mode
* @ZYNQMP_DISP_LAYER_NONLIVE: non-live (memory) mode
* @ZYNQMP_DISP_LAYER_LIVE: live (stream) mode
*/
enum zynqmp_disp_layer_mode {
ZYNQMP_DISP_LAYER_NONLIVE,
ZYNQMP_DISP_LAYER_LIVE
};

/**
* struct zynqmp_disp_layer_dma - DMA channel for one data plane of a layer
* @chan: DMA channel
Expand Down Expand Up @@ -131,7 +121,7 @@ struct zynqmp_disp_layer {

const struct zynqmp_disp_format *disp_fmt;
const struct drm_format_info *drm_fmt;
enum zynqmp_disp_layer_mode mode;
enum zynqmp_dpsub_layer_mode mode;
};

/**
Expand Down Expand Up @@ -519,27 +509,25 @@ static void zynqmp_disp_avbuf_disable_audio(struct zynqmp_disp *disp)
* zynqmp_disp_avbuf_enable_video - Enable a video layer
* @disp: Display controller
* @layer: The layer
* @mode: Operating mode of layer
*
* Enable the video/graphics buffer for @layer.
*/
static void zynqmp_disp_avbuf_enable_video(struct zynqmp_disp *disp,
struct zynqmp_disp_layer *layer,
enum zynqmp_disp_layer_mode mode)
struct zynqmp_disp_layer *layer)
{
u32 val;

val = zynqmp_disp_avbuf_read(disp, ZYNQMP_DISP_AV_BUF_OUTPUT);
if (zynqmp_disp_layer_is_video(layer)) {
val &= ~ZYNQMP_DISP_AV_BUF_OUTPUT_VID1_MASK;
if (mode == ZYNQMP_DISP_LAYER_NONLIVE)
if (layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE)
val |= ZYNQMP_DISP_AV_BUF_OUTPUT_VID1_MEM;
else
val |= ZYNQMP_DISP_AV_BUF_OUTPUT_VID1_LIVE;
} else {
val &= ~ZYNQMP_DISP_AV_BUF_OUTPUT_VID2_MASK;
val |= ZYNQMP_DISP_AV_BUF_OUTPUT_VID2_MEM;
if (mode == ZYNQMP_DISP_LAYER_NONLIVE)
if (layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE)
val |= ZYNQMP_DISP_AV_BUF_OUTPUT_VID2_MEM;
else
val |= ZYNQMP_DISP_AV_BUF_OUTPUT_VID2_LIVE;
Expand Down Expand Up @@ -914,17 +902,17 @@ u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer,
/**
* zynqmp_disp_layer_enable - Enable a layer
* @layer: The layer
* @mode: Operating mode of layer
*
* Enable the @layer in the audio/video buffer manager and the blender. DMA
* channels are started separately by zynqmp_disp_layer_update().
*/
void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer)
void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer,
enum zynqmp_dpsub_layer_mode mode)
{
zynqmp_disp_avbuf_enable_video(layer->disp, layer,
ZYNQMP_DISP_LAYER_NONLIVE);
layer->mode = mode;
zynqmp_disp_avbuf_enable_video(layer->disp, layer);
zynqmp_disp_blend_layer_enable(layer->disp, layer);

layer->mode = ZYNQMP_DISP_LAYER_NONLIVE;
}

/**
Expand Down
13 changes: 12 additions & 1 deletion drivers/gpu/drm/xlnx/zynqmp_disp.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ enum zynqmp_dpsub_layer_id {
ZYNQMP_DPSUB_LAYER_GFX,
};

/**
* enum zynqmp_dpsub_layer_mode - Layer mode
* @ZYNQMP_DPSUB_LAYER_NONLIVE: non-live (memory) mode
* @ZYNQMP_DPSUB_LAYER_LIVE: live (stream) mode
*/
enum zynqmp_dpsub_layer_mode {
ZYNQMP_DPSUB_LAYER_NONLIVE,
ZYNQMP_DPSUB_LAYER_LIVE,
};

void zynqmp_disp_enable(struct zynqmp_disp *disp);
void zynqmp_disp_disable(struct zynqmp_disp *disp);
int zynqmp_disp_setup_clock(struct zynqmp_disp *disp,
Expand All @@ -52,7 +62,8 @@ void zynqmp_disp_blend_set_global_alpha(struct zynqmp_disp *disp,

u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer,
unsigned int *num_formats);
void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer);
void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer,
enum zynqmp_dpsub_layer_mode mode);
void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer);
void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer,
const struct drm_format_info *info);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/xlnx/zynqmp_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void zynqmp_dpsub_plane_atomic_update(struct drm_plane *plane,

/* Enable or re-enable the plane if the format has changed. */
if (format_changed)
zynqmp_disp_layer_enable(layer);
zynqmp_disp_layer_enable(layer, ZYNQMP_DPSUB_LAYER_NONLIVE);
}

static const struct drm_plane_helper_funcs zynqmp_dpsub_plane_helper_funcs = {
Expand Down

0 comments on commit 3662bbf

Please sign in to comment.