Commit a989ab08 authored by Leo (Sunpeng) Li's avatar Leo (Sunpeng) Li Committed by Alex Deucher

drm/amd/display: Roll stream into dc_stream

Signed-off-by: default avatarLeo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: default avatarAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4fa086b9
...@@ -30,17 +30,6 @@ ...@@ -30,17 +30,6 @@
#include "ipp.h" #include "ipp.h"
#include "timing_generator.h" #include "timing_generator.h"
/*******************************************************************************
* Private definitions
******************************************************************************/
struct stream {
struct dc_stream protected;
int ref_count;
};
#define DC_STREAM_TO_STREAM(dc_stream) container_of(dc_stream, struct stream, protected)
/******************************************************************************* /*******************************************************************************
* Private functions * Private functions
******************************************************************************/ ******************************************************************************/
...@@ -105,24 +94,22 @@ static void destruct(struct dc_stream *stream) ...@@ -105,24 +94,22 @@ static void destruct(struct dc_stream *stream)
} }
} }
void dc_stream_retain(struct dc_stream *dc_stream) void dc_stream_retain(struct dc_stream *stream)
{ {
struct stream *stream = DC_STREAM_TO_STREAM(dc_stream);
ASSERT(stream->ref_count > 0); ASSERT(stream->ref_count > 0);
stream->ref_count++; stream->ref_count++;
} }
void dc_stream_release(struct dc_stream *public) void dc_stream_release(struct dc_stream *stream)
{ {
struct stream *stream = DC_STREAM_TO_STREAM(public);
if (public != NULL) { if (stream != NULL) {
ASSERT(stream->ref_count > 0); ASSERT(stream->ref_count > 0);
stream->ref_count--; stream->ref_count--;
if (stream->ref_count == 0) { if (stream->ref_count == 0) {
destruct(public); destruct(stream);
dm_free(stream); dm_free(stream);
} }
} }
...@@ -131,22 +118,22 @@ void dc_stream_release(struct dc_stream *public) ...@@ -131,22 +118,22 @@ void dc_stream_release(struct dc_stream *public)
struct dc_stream *dc_create_stream_for_sink( struct dc_stream *dc_create_stream_for_sink(
struct dc_sink *sink) struct dc_sink *sink)
{ {
struct stream *stream; struct dc_stream *stream;
if (sink == NULL) if (sink == NULL)
goto alloc_fail; goto alloc_fail;
stream = dm_alloc(sizeof(struct stream)); stream = dm_alloc(sizeof(struct dc_stream));
if (NULL == stream) if (NULL == stream)
goto alloc_fail; goto alloc_fail;
if (false == construct(&stream->protected, sink)) if (false == construct(stream, sink))
goto construct_fail; goto construct_fail;
stream->ref_count++; stream->ref_count++;
return &stream->protected; return stream;
construct_fail: construct_fail:
dm_free(stream); dm_free(stream);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment