cregit-Linux how code gets into the kernel

Release 4.18 drivers/gpu/drm/amd/display/dc/core/dc_stream.c

/*
 * Copyright 2012-15 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: AMD
 *
 */

#include "dm_services.h"
#include "dc.h"
#include "core_types.h"
#include "resource.h"
#include "ipp.h"
#include "timing_generator.h"

/*******************************************************************************
 * Private functions
 ******************************************************************************/

void update_stream_signal(struct dc_stream_state *stream) { struct dc_sink *dc_sink = stream->sink; if (dc_sink->sink_signal == SIGNAL_TYPE_NONE) stream->signal = stream->sink->link->connector_signal; else stream->signal = dc_sink->sink_signal; if (dc_is_dvi_signal(stream->signal)) { if (stream->ctx->dc->caps.dual_link_dvi && stream->timing.pix_clk_khz > TMDS_MAX_PIXEL_CLOCK && stream->sink->sink_signal != SIGNAL_TYPE_DVI_SINGLE_LINK) stream->signal = SIGNAL_TYPE_DVI_DUAL_LINK; else stream->signal = SIGNAL_TYPE_DVI_SINGLE_LINK; } }

Contributors

PersonTokensPropCommitsCommitProp
Jerry (Fangzhi) Zuo8989.00%133.33%
Harry Wentland1111.00%266.67%
Total100100.00%3100.00%


static void construct(struct dc_stream_state *stream, struct dc_sink *dc_sink_data) { uint32_t i = 0; stream->sink = dc_sink_data; stream->ctx = stream->sink->ctx; dc_sink_retain(dc_sink_data); /* Copy audio modes */ /* TODO - Remove this translation */ for (i = 0; i < (dc_sink_data->edid_caps.audio_mode_count); i++) { stream->audio_info.modes[i].channel_count = dc_sink_data->edid_caps.audio_modes[i].channel_count; stream->audio_info.modes[i].format_code = dc_sink_data->edid_caps.audio_modes[i].format_code; stream->audio_info.modes[i].sample_rates.all = dc_sink_data->edid_caps.audio_modes[i].sample_rate; stream->audio_info.modes[i].sample_size = dc_sink_data->edid_caps.audio_modes[i].sample_size; } stream->audio_info.mode_count = dc_sink_data->edid_caps.audio_mode_count; stream->audio_info.audio_latency = dc_sink_data->edid_caps.audio_latency; stream->audio_info.video_latency = dc_sink_data->edid_caps.video_latency; memmove( stream->audio_info.display_name, dc_sink_data->edid_caps.display_name, AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS); stream->audio_info.manufacture_id = dc_sink_data->edid_caps.manufacturer_id; stream->audio_info.product_id = dc_sink_data->edid_caps.product_id; stream->audio_info.flags.all = dc_sink_data->edid_caps.speaker_flags; if (dc_sink_data->dc_container_id != NULL) { struct dc_container_id *dc_container_id = dc_sink_data->dc_container_id; stream->audio_info.port_id[0] = dc_container_id->portId[0]; stream->audio_info.port_id[1] = dc_container_id->portId[1]; } else { /* TODO - WindowDM has implemented, other DMs need Unhardcode port_id */ stream->audio_info.port_id[0] = 0x5558859e; stream->audio_info.port_id[1] = 0xd989449; } /* EDID CAP translation for HDMI 2.0 */ stream->timing.flags.LTE_340MCSC_SCRAMBLE = dc_sink_data->edid_caps.lte_340mcsc_scramble; stream->status.link = stream->sink->link; update_stream_signal(stream); stream->out_transfer_func = dc_create_transfer_func(); stream->out_transfer_func->type = TF_TYPE_BYPASS; }

Contributors

PersonTokensPropCommitsCommitProp
Harry Wentland29479.46%233.33%
Duke Du5514.86%116.67%
Anthony Koo154.05%116.67%
Jerry (Fangzhi) Zuo51.35%116.67%
Dave Airlie10.27%116.67%
Total370100.00%6100.00%


static void destruct(struct dc_stream_state *stream) { dc_sink_release(stream->sink); if (stream->out_transfer_func != NULL) { dc_transfer_func_release(stream->out_transfer_func); stream->out_transfer_func = NULL; } }

Contributors

PersonTokensPropCommitsCommitProp
Harry Wentland1843.90%250.00%
Anthony Koo1536.59%125.00%
Yongqiang Sun819.51%125.00%
Total41100.00%4100.00%


void dc_stream_retain(struct dc_stream_state *stream) { kref_get(&stream->refcount); }

Contributors

PersonTokensPropCommitsCommitProp
Harry Wentland844.44%233.33%
Dave Airlie422.22%116.67%
Jerry (Fangzhi) Zuo316.67%116.67%
Andrey Grodzovsky211.11%116.67%
Leo (Sunpeng) Li15.56%116.67%
Total18100.00%6100.00%


static void dc_stream_free(struct kref *kref) { struct dc_stream_state *stream = container_of(kref, struct dc_stream_state, refcount); destruct(stream); kfree(stream); }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie2980.56%125.00%
Harry Wentland38.33%125.00%
Jerry (Fangzhi) Zuo25.56%125.00%
Andrey Grodzovsky25.56%125.00%
Total36100.00%4100.00%


void dc_stream_release(struct dc_stream_state *stream) { if (stream != NULL) { kref_put(&stream->refcount, dc_stream_free); } }

Contributors

PersonTokensPropCommitsCommitProp
Harry Wentland1864.29%233.33%
Dave Airlie414.29%116.67%
Leo (Sunpeng) Li27.14%116.67%
Jerry (Fangzhi) Zuo27.14%116.67%
Andrey Grodzovsky27.14%116.67%
Total28100.00%6100.00%


struct dc_stream_state *dc_create_stream_for_sink( struct dc_sink *sink) { struct dc_stream_state *stream; if (sink == NULL) return NULL; stream = kzalloc(sizeof(struct dc_stream_state), GFP_KERNEL); if (stream == NULL) return NULL; construct(stream, sink); kref_init(&stream->refcount); return stream; }

Contributors

PersonTokensPropCommitsCommitProp
Harry Wentland5278.79%457.14%
Dave Airlie1116.67%228.57%
Jerry (Fangzhi) Zuo34.55%114.29%
Total66100.00%7100.00%


struct dc_stream_status *dc_stream_get_status( struct dc_stream_state *stream) { uint8_t i; struct dc *dc = stream->ctx->dc; for (i = 0; i < dc->current_state->stream_count; i++) { if (stream == dc->current_state->streams[i]) return &dc->current_state->stream_status[i]; } return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Aric Cyr6488.89%116.67%
Harry Wentland34.17%233.33%
Jerry (Fangzhi) Zuo34.17%116.67%
Bhawanpreet Lakha11.39%116.67%
Leo (Sunpeng) Li11.39%116.67%
Total72100.00%6100.00%

/** * Update the cursor attributes and set cursor surface address */
bool dc_stream_set_cursor_attributes( struct dc_stream_state *stream, const struct dc_cursor_attributes *attributes) { int i; struct dc *core_dc; struct resource_context *res_ctx; struct pipe_ctx *pipe_to_program = NULL; if (NULL == stream) { dm_error("DC: dc_stream is NULL!\n"); return false; } if (NULL == attributes) { dm_error("DC: attributes is NULL!\n"); return false; } if (attributes->address.quad_part == 0) { dm_output_to_console("DC: Cursor address is 0!\n"); return false; } core_dc = stream->ctx->dc; res_ctx = &core_dc->current_state->res_ctx; stream->cursor_attributes = *attributes; for (i = 0; i < MAX_PIPES; i++) { struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; if (pipe_ctx->stream != stream) continue; if (pipe_ctx->top_pipe && pipe_ctx->plane_state != pipe_ctx->top_pipe->plane_state) continue; if (!pipe_to_program) { pipe_to_program = pipe_ctx; core_dc->hwss.pipe_control_lock(core_dc, pipe_to_program, true); } core_dc->hwss.set_cursor_attribute(pipe_ctx); } if (pipe_to_program) core_dc->hwss.pipe_control_lock(core_dc, pipe_to_program, false); return true; }

Contributors

PersonTokensPropCommitsCommitProp
Aric Cyr11050.23%17.69%
Martin Tsai4821.92%17.69%
Yongqiang Sun198.68%17.69%
Dmytro Laktyushkin177.76%17.69%
Eric Yang104.57%17.69%
Yue Hin Lau62.74%17.69%
Harry Wentland31.37%215.38%
Leo (Sunpeng) Li20.91%17.69%
Jerry (Fangzhi) Zuo10.46%17.69%
Andrew Jiang10.46%17.69%
Leon Elazar10.46%17.69%
Bhawanpreet Lakha10.46%17.69%
Total219100.00%13100.00%


bool dc_stream_set_cursor_position( struct dc_stream_state *stream, const struct dc_cursor_position *position) { int i; struct dc *core_dc; struct resource_context *res_ctx; struct pipe_ctx *pipe_to_program = NULL; if (NULL == stream) { dm_error("DC: dc_stream is NULL!\n"); return false; } if (NULL == position) { dm_error("DC: cursor position is NULL!\n"); return false; } core_dc = stream->ctx->dc; res_ctx = &core_dc->current_state->res_ctx; stream->cursor_position = *position; for (i = 0; i < MAX_PIPES; i++) { struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; if (pipe_ctx->stream != stream || (!pipe_ctx->plane_res.mi && !pipe_ctx->plane_res.hubp) || !pipe_ctx->plane_state || (!pipe_ctx->plane_res.xfm && !pipe_ctx->plane_res.dpp) || !pipe_ctx->plane_res.ipp) continue; if (!pipe_to_program) { pipe_to_program = pipe_ctx; core_dc->hwss.pipe_control_lock(core_dc, pipe_to_program, true); } core_dc->hwss.set_cursor_position(pipe_ctx); } if (pipe_to_program) core_dc->hwss.pipe_control_lock(core_dc, pipe_to_program, false); return true; }

Contributors

PersonTokensPropCommitsCommitProp
Aric Cyr10245.13%16.25%
Martin Tsai4821.24%16.25%
Yue Hin Lau3013.27%425.00%
Dmytro Laktyushkin167.08%16.25%
Eric Yang104.42%16.25%
Shirish S73.10%16.25%
Yongqiang Sun52.21%16.25%
Harry Wentland41.77%318.75%
Leo (Sunpeng) Li20.88%16.25%
Bhawanpreet Lakha10.44%16.25%
Jerry (Fangzhi) Zuo10.44%16.25%
Total226100.00%16100.00%


uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream) { uint8_t i; struct dc *core_dc = stream->ctx->dc; struct resource_context *res_ctx = &core_dc->current_state->res_ctx; for (i = 0; i < MAX_PIPES; i++) { struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg; if (res_ctx->pipe_ctx[i].stream != stream) continue; return tg->funcs->get_frame_count(tg); } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Aric Cyr8993.68%116.67%
Harry Wentland33.16%233.33%
Jerry (Fangzhi) Zuo11.05%116.67%
Bhawanpreet Lakha11.05%116.67%
Leo (Sunpeng) Li11.05%116.67%
Total95100.00%6100.00%


bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream, uint32_t *v_blank_start, uint32_t *v_blank_end, uint32_t *h_position, uint32_t *v_position) { uint8_t i; bool ret = false; struct dc *core_dc = stream->ctx->dc; struct resource_context *res_ctx = &core_dc->current_state->res_ctx; for (i = 0; i < MAX_PIPES; i++) { struct timing_generator *tg = res_ctx->pipe_ctx[i].stream_res.tg; if (res_ctx->pipe_ctx[i].stream != stream) continue; tg->funcs->get_scanoutpos(tg, v_blank_start, v_blank_end, h_position, v_position); ret = true; break; } return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Aric Cyr9372.66%114.29%
Sylvia Tsai2922.66%114.29%
Harry Wentland32.34%228.57%
Leo (Sunpeng) Li10.78%114.29%
Bhawanpreet Lakha10.78%114.29%
Jerry (Fangzhi) Zuo10.78%114.29%
Total128100.00%7100.00%


void dc_stream_log( const struct dc_stream_state *stream, struct dal_logger *dm_logger, enum dc_log_type log_type) { dm_logger_write(dm_logger, log_type, "core_stream 0x%x: src: %d, %d, %d, %d; dst: %d, %d, %d, %d, colorSpace:%d\n", stream, stream->src.x, stream->src.y, stream->src.width, stream->src.height, stream->dst.x, stream->dst.y, stream->dst.width, stream->dst.height, stream->output_color_space); dm_logger_write(dm_logger, log_type, "\tpix_clk_khz: %d, h_total: %d, v_total: %d, pixelencoder:%d, displaycolorDepth:%d\n", stream->timing.pix_clk_khz, stream->timing.h_total, stream->timing.v_total, stream->timing.pixel_encoding, stream->timing.display_color_depth); dm_logger_write(dm_logger, log_type, "\tsink name: %s, serial: %d\n", stream->sink->edid_caps.display_name, stream->sink->edid_caps.serial_number); dm_logger_write(dm_logger, log_type, "\tlink: %d\n", stream->sink->link->link_index); }

Contributors

PersonTokensPropCommitsCommitProp
Aric Cyr13079.27%125.00%
Leo (Sunpeng) Li1810.98%125.00%
Charlene Liu159.15%125.00%
Harry Wentland10.61%125.00%
Total164100.00%4100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Aric Cyr59537.56%12.63%
Harry Wentland43527.46%1026.32%
Jerry (Fangzhi) Zuo1117.01%37.89%
Martin Tsai966.06%12.63%
Duke Du553.47%12.63%
Dave Airlie493.09%25.26%
Yue Hin Lau362.27%410.53%
Dmytro Laktyushkin332.08%12.63%
Yongqiang Sun322.02%37.89%
Anthony Koo301.89%25.26%
Sylvia Tsai291.83%12.63%
Leo (Sunpeng) Li281.77%25.26%
Eric Yang201.26%12.63%
Charlene Liu150.95%12.63%
Shirish S70.44%12.63%
Andrey Grodzovsky60.38%12.63%
Bhawanpreet Lakha50.32%12.63%
Leon Elazar10.06%12.63%
Andrew Jiang10.06%12.63%
Total1584100.00%38100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.