Skip to content

Commit

Permalink
Merge pull request #3123 from MirServer/more-renaming
Browse files Browse the repository at this point in the history
More better names
  • Loading branch information
AlanGriffiths authored Nov 15, 2023
2 parents 47d782f + 077a804 commit 248f5b2
Show file tree
Hide file tree
Showing 55 changed files with 337 additions and 428 deletions.
42 changes: 0 additions & 42 deletions examples/mir_demo_server/as_render_target.h

This file was deleted.

14 changes: 7 additions & 7 deletions include/platform/mir/graphics/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace mir
namespace graphics
{

class DisplayBuffer;
class DisplaySink;
class DisplayConfiguration;
class Cursor;
class EventHandlerRegister;
Expand All @@ -46,16 +46,16 @@ typedef std::function<void()> DisplayConfigurationChangeHandler;
* Android).
* Using a DisplaySyncGroup with multiple screens on a platform whose post()
* blocks for vsync often results in stuttering, and so should be avoided.
* Although using DisplaySyncGroup with a single DisplayBuffer remains safe
* Although using DisplaySyncGroup with a single DisplaySink remains safe
* for any platform.
*/
class DisplaySyncGroup
{
public:
/**
* Executes a functor that allows the DisplayBuffer contents to be updated
* Executes a functor that allows the DisplaySink contents to be updated
**/
virtual void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f) = 0;
virtual void for_each_display_sink(std::function<void(DisplaySink&)> const& f) = 0;

/** Post the content of the DisplayBuffers associated with this DisplaySyncGroup.
* The content of all the DisplayBuffers in this DisplaySyncGroup are guaranteed to be onscreen
Expand Down Expand Up @@ -107,14 +107,14 @@ class Display
/**
* Applying a display configuration only if it will not invalidate existing DisplayBuffers
*
* The Display must guarantee that the references to the DisplayBuffer acquired via
* DisplaySyncGroup::for_each_display_buffer() remain valid until the Display is destroyed or
* The Display must guarantee that the references to the DisplaySink acquired via
* DisplaySyncGroup::for_each_display_sink() remain valid until the Display is destroyed or
* Display::configure() is called.
*
* If this function returns \c true then the new display configuration has been applied.
* If this function returns \c false then the new display configuration has not been applied.
*
* In either case this function guarantees that existing DisplayBuffer references will remain
* In either case this function guarantees that existing DisplaySink references will remain
* valid.
*
* \param conf [in] Configuration to possibly apply.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MIR_GRAPHICS_DISPLAY_BUFFER_H_
#define MIR_GRAPHICS_DISPLAY_BUFFER_H_
#ifndef MIR_GRAPHICS_DISPLAY_SINK_H_
#define MIR_GRAPHICS_DISPLAY_SINK_H_

#include "mir/graphics/platform.h"
#include <mir/geometry/rectangle.h>
Expand Down Expand Up @@ -49,14 +49,14 @@ struct DisplayElement
std::shared_ptr<Framebuffer> buffer;
};
/**
* Interface to an output framebuffer.
* Interface to an output sink.
*/
class DisplayBuffer
class DisplaySink
{
public:
virtual ~DisplayBuffer() = default;
virtual ~DisplaySink() = default;

/** The area the DisplayBuffer occupies in the virtual screen space. */
/** The area the DisplaySink occupies in the virtual screen space. */
virtual geometry::Rectangle view_area() const = 0;

/** The size in pixels of the underlying display */
Expand Down Expand Up @@ -84,7 +84,7 @@ class DisplayBuffer
* and guarantees. Namely:
* * The Framebuffer must be exactly view_area().size big, and
* * The DisplayPlatform guarantees that this call will succeed with a framebuffer
* allocated for this DisplayBuffer
* allocated for this DisplaySink
*
* \param content
*/
Expand All @@ -100,7 +100,7 @@ class DisplayBuffer
virtual glm::mat2 transformation() const = 0;

/**
* Attempt to acquire a platform-specific provider from this DisplayBuffer
* Attempt to acquire a platform-specific provider from this DisplaySink
*
* Any given platform is not guaranteed to implement any specific interface,
* and the set of supported interfaces may depend on the runtime environment.
Expand All @@ -111,11 +111,11 @@ class DisplayBuffer
* \tparam Allocator
* \return On success: a non-null pointer to an Allocator implementation.
* The lifetime of this Allocator implementation is bound
* to that of the parent DisplayBuffer.
* to that of the parent DisplaySink.
* On failure: nullptr
*/
template<typename Allocator>
auto acquire_allocator() -> Allocator*
auto acquire_compatible_allocator() -> Allocator*
{
static_assert(
std::is_convertible_v<Allocator*, DisplayAllocator*>,
Expand Down Expand Up @@ -149,12 +149,12 @@ class DisplayBuffer
virtual auto maybe_create_allocator(DisplayAllocator::Tag const& type_tag)
-> DisplayAllocator* = 0;

DisplayBuffer() = default;
DisplayBuffer(DisplayBuffer const& c) = delete;
DisplayBuffer& operator=(DisplayBuffer const& c) = delete;
DisplaySink() = default;
DisplaySink(DisplaySink const& c) = delete;
DisplaySink& operator=(DisplaySink const& c) = delete;
};

}
}

#endif /* MIR_GRAPHICS_DISPLAY_BUFFER_H_ */
#endif /* MIR_GRAPHICS_DISPLAY_SINK_H_ */
18 changes: 9 additions & 9 deletions include/platform/mir/graphics/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace graphics
class Buffer;
class Framebuffer;
class Display;
class DisplayBuffer;
class DisplaySink;
class DisplayReport;
class DisplayConfigurationPolicy;
class GraphicBufferAllocator;
Expand Down Expand Up @@ -120,7 +120,7 @@ class RenderingProvider
* Some buffer types can be passed as-is to the display hardware. If this
* buffer can be used in this way (on the DisplayInterfaceProvider associated
* with this FramebufferProvider), this method creates a handle that can be
* passed to the overlay method of an associated DisplayBuffer.
* passed to the overlay method of an associated DisplaySink.
*
* \note The returned Framebuffer may share ownership of the provided Buffer.
* It is not necessary for calling code to retain a reference to the Buffer.
Expand All @@ -133,9 +133,9 @@ class RenderingProvider
};

/**
* Check how well this Renderer can support a particular display target
* Check how well this Renderer can support a particular display sink
*/
virtual auto suitability_for_display(DisplayBuffer& target)
virtual auto suitability_for_display(DisplaySink& sink)
-> probe::Result = 0;

/**
Expand All @@ -144,7 +144,7 @@ class RenderingProvider
virtual auto suitability_for_allocator(std::shared_ptr<GraphicBufferAllocator> const& target)
-> probe::Result = 0;

virtual auto make_framebuffer_provider(DisplayBuffer& target)
virtual auto make_framebuffer_provider(DisplaySink& sink)
-> std::unique_ptr<FramebufferProvider> = 0;
};

Expand All @@ -163,8 +163,8 @@ class GLRenderingProvider : public RenderingProvider

virtual auto as_texture(std::shared_ptr<Buffer> buffer) -> std::shared_ptr<gl::Texture> = 0;

virtual auto surface_for_output(
DisplayBuffer& target,
virtual auto surface_for_sink(
DisplaySink& sink,
geometry::Size size,
GLConfig const& config) -> std::unique_ptr<gl::OutputSurface> = 0;
};
Expand Down Expand Up @@ -333,9 +333,9 @@ class GBMDisplayProvider : public DisplayProvider
virtual auto is_same_device(mir::udev::Device const& render_device) const -> bool = 0;

/**
* Check if this DisplayBuffer is driven by this DisplayProvider
* Check if this DisplaySink is driven by this DisplayProvider
*/
virtual auto on_this_device(DisplayBuffer& target) const -> bool = 0;
virtual auto on_this_sink(DisplaySink& sink) const -> bool = 0;

/**
* Get the GBM device for this display
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct HeadlessDisplayBufferCompositorFactory : mir::compositor::DisplayBufferCo
std::shared_ptr<PassthroughTracker> const& tracker);

std::unique_ptr<mir::compositor::DisplayBufferCompositor> create_compositor_for(
mir::graphics::DisplayBuffer& display_buffer) override;
mir::graphics::DisplaySink& display_sink) override;
private:
std::shared_ptr<mir::graphics::GLRenderingProvider> const render_platform;
std::shared_ptr<mir::graphics::GLConfig> const gl_config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace mir
{
namespace graphics
{
class DisplayBuffer;
class DisplaySink;
}
namespace compositor
{
Expand All @@ -35,7 +35,7 @@ class DisplayBufferCompositorFactory
public:
virtual ~DisplayBufferCompositorFactory() = default;

virtual std::unique_ptr<DisplayBufferCompositor> create_compositor_for(graphics::DisplayBuffer& display_buffer) = 0;
virtual std::unique_ptr<DisplayBufferCompositor> create_compositor_for(graphics::DisplaySink& display_sink) = 0;

protected:
DisplayBufferCompositorFactory() = default;
Expand Down
18 changes: 9 additions & 9 deletions src/platforms/eglstream-kms/server/buffer_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "buffer_allocator.h"
#include "cpu_copy_output_surface.h"
#include "mir/anonymous_shm_file.h"
#include "mir/graphics/display_buffer.h"
#include "mir/graphics/display_sink.h"
#include "mir/graphics/drm_formats.h"
#include "mir/graphics/egl_resources.h"
#include "mir/graphics/gl_config.h"
Expand Down Expand Up @@ -729,12 +729,12 @@ auto mir::graphics::eglstream::GLRenderingProvider::as_texture(std::shared_ptr<B
return std::dynamic_pointer_cast<gl::Texture>(std::move(buffer));
}

auto mge::GLRenderingProvider::surface_for_output(
DisplayBuffer& target,
auto mge::GLRenderingProvider::surface_for_sink(
DisplaySink& sink,
geom::Size size,
mg::GLConfig const& gl_config) -> std::unique_ptr<gl::OutputSurface>
{
if (auto stream_platform = target.acquire_allocator<EGLStreamDisplayAllocator>())
if (auto stream_platform = sink.acquire_compatible_allocator<EGLStreamDisplayAllocator>())
{
try
{
Expand All @@ -752,7 +752,7 @@ auto mge::GLRenderingProvider::surface_for_output(
err.what());
}
}
if (auto cpu_provider = target.acquire_allocator<CPUAddressableDisplayAllocator>())
if (auto cpu_provider = sink.acquire_compatible_allocator<CPUAddressableDisplayAllocator>())
{
auto fb_context = ctx->make_share_context();
fb_context->make_current();
Expand All @@ -777,20 +777,20 @@ auto mge::GLRenderingProvider::suitability_for_allocator(std::shared_ptr<Graphic
return probe::unsupported;
}

auto mge::GLRenderingProvider::suitability_for_display(DisplayBuffer& target) -> probe::Result
auto mge::GLRenderingProvider::suitability_for_display(DisplaySink& sink) -> probe::Result
{
if (target.acquire_allocator<EGLStreamDisplayAllocator>())
if (sink.acquire_compatible_allocator<EGLStreamDisplayAllocator>())
{
return probe::best;
}
if (target.acquire_allocator<CPUAddressableDisplayAllocator>())
if (sink.acquire_compatible_allocator<CPUAddressableDisplayAllocator>())
{
return probe::supported;
}
return probe::unsupported;
}

auto mge::GLRenderingProvider::make_framebuffer_provider(DisplayBuffer& /*target*/)
auto mge::GLRenderingProvider::make_framebuffer_provider(DisplaySink& /*sink*/)
-> std::unique_ptr<FramebufferProvider>
{
// TODO: *Can* we provide overlay support?
Expand Down
8 changes: 4 additions & 4 deletions src/platforms/eglstream-kms/server/buffer_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ class GLRenderingProvider : public graphics::GLRenderingProvider

auto suitability_for_allocator(std::shared_ptr<GraphicBufferAllocator> const& target) -> probe::Result override;

auto suitability_for_display(DisplayBuffer& target) -> probe::Result override;
auto suitability_for_display(DisplaySink& sink) -> probe::Result override;

auto make_framebuffer_provider(DisplayBuffer& target) -> std::unique_ptr<FramebufferProvider> override;
auto make_framebuffer_provider(DisplaySink& sink) -> std::unique_ptr<FramebufferProvider> override;

auto surface_for_output(
DisplayBuffer& target,
auto surface_for_sink(
DisplaySink& sink,
geometry::Size size,
GLConfig const& gl_config) -> std::unique_ptr<gl::OutputSurface> override;
private:
Expand Down
16 changes: 8 additions & 8 deletions src/platforms/eglstream-kms/server/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "mir/graphics/overlapping_output_grouping.h"
#include "mir/graphics/gl_config.h"
#include "mir/graphics/egl_error.h"
#include "mir/graphics/display_buffer.h"
#include "mir/graphics/display_sink.h"
#include "mir/graphics/transformation.h"
#include "mir/graphics/egl_extensions.h"
#include "mir/graphics/display_report.h"
Expand Down Expand Up @@ -122,13 +122,13 @@ EGLContext create_context(EGLDisplay display, EGLConfig config, EGLContext share
return context;
}

class DisplayBuffer
class DisplaySink
: public mg::DisplaySyncGroup,
public mg::DisplayBuffer,
public mg::DisplaySink,
public mg::EGLStreamDisplayAllocator
{
public:
DisplayBuffer(
DisplaySink(
mir::Fd drm_node,
EGLDisplay dpy,
EGLContext ctx,
Expand Down Expand Up @@ -180,7 +180,7 @@ class DisplayBuffer
pending_flip = satisfied_promise.get_future();
}

~DisplayBuffer()
~DisplaySink()
{
if (output_stream != EGL_NO_STREAM_KHR)
{
Expand Down Expand Up @@ -210,7 +210,7 @@ class DisplayBuffer
return output->transformation();
}

void for_each_display_buffer(const std::function<void(mir::graphics::DisplayBuffer&)>& f) override
void for_each_display_sink(const std::function<void(mir::graphics::DisplaySink&)>& f) override
{
f(*this);
}
Expand Down Expand Up @@ -509,7 +509,7 @@ void mge::Display::configure(DisplayConfiguration const& conf)
{
output->configure(output->current_mode_index);
active_sync_groups.emplace_back(
std::make_unique<::DisplayBuffer>(
std::make_unique<::DisplaySink>(
drm_node,
display,
context,
Expand Down Expand Up @@ -563,7 +563,7 @@ void mge::Display::resume()
{
for (auto& group : active_sync_groups)
{
dynamic_cast<::DisplayBuffer*>(group.get())->resume();
dynamic_cast<::DisplaySink*>(group.get())->resume();
}
}

Expand Down
Loading

0 comments on commit 248f5b2

Please sign in to comment.