~ci-train-bot/mir/mir-ubuntu-zesty-2735

« back to all changes in this revision

Viewing changes to src/client/mir_connection.cpp

  • Committer: Bileto Bot
  • Date: 2017-02-09 21:46:11 UTC
  • mfrom: (1160.2680.216 mir-dev)
  • Revision ID: ci-train-bot@canonical.com-20170209214611-npcbbl3ivh2x981r
* New upstream release 0.26.1 (https://launchpad.net/mir/+milestone/0.26.1)
  - ABI summary:
    . mirclient ABI unchanged at 9
    . mirserver ABI unchanged at 43
    . mircommon ABI unchanged at 7
    . mirplatform ABI bumped to 15
    . mirprotobuf ABI unchanged at 3
    . mirplatformgraphics ABI bumped to 12
    . mirclientplatform ABI unchanged at 5
    . mirinputplatform ABI unchanged at 6
    . mircore ABI unchanged at 1
  - Enhancements:
    . Support for MirBuffer API that allows for better management of
      hardware/software buffers.
    . Support for MirPresentationChain API that allows better control
      over {de}queueing of individual buffers {from}to the server.
    . Interim support for MirRenderSurface API that provides a unit of
      renderable for lower level content such as MirBufferStreams and
      MirPresentationChains, etc.. MirRenderSurface API is marked
      deprecated as it (and the relevant entry points) will be renamed to
      MirSurface before general availability. It will initially be used for
      revamping support for EGL drivers.
    . Synchronous version of mir_prompt_session_new_fds_for_prompt_providers()
      API (mir_prompt_session_new_fds_for_prompt_providers_sync()) added for
      convenience.
    . Better name for MirPersistentId-->MirWindowId. MirPersistentId has now
      been deprecated.
  - Bugs fixed:
    . [regression] Unity8 stutters constantly (like half frame rate).
      (LP: #1661128)
    . mir 0.26 - spinner loading animation, minimize, maximize too fast.
      (LP: #1661072)
    . [regression] Nested server segfaults or rapidly logs exceptions when a
      fullscreen client starts [in mir_presentation_chain_set_dropping_mode
      ... std::exception::what: Operation not permitted] (LP: #1661508)
    . mir_window_request_persistent_id_sync seg faults when called twice.
      (LP: #1661704)
    . [regression] Windowed clients of nested servers are all black.
      (LP: #1661521)
    . Mir graphics platform ABI broke in series 0.26 but sonames never
      changed (LP: #1662455)
    . Fixes for 0.26 changelog.
    . [regression] mirscreencast hangs during screencast creation. (LP: #1662997)
    . libmirclient-dev missing build dependency on libmircore-dev. (LP: #1662942)
    . mir_window_spec_set_cursor_name() doesn't trigger
      mir::scene::SurfaceObserver::cursor_image_set_to. (LP: #1663197)
    . [regression] Software clients of nested servers are all black in Mir 0.25.0
      and later. (LP: #1663062)
    . New and improved client APIs: MirInputConfig, MirWindow, DisplayConfig,
      MirScreencastSpec.
    . Support for setting the input configuration.
    . Introduced an extension mechanism for platform-specific APIs.
    . Support for screencasting to a specific MirBuffer.
    . Added DisplayConfigurationController::base_configuration() so
      downstreams can get the base configuration (weirdly they can already
      set it).
    . X11 platform: Allow adjustable scale parameter.
    . Added monitor EDID support to both the client API and server-side.
    . mirout: Now shows scaling factor, subpixel arrangement, form factor and
      EDID.
    . mirout: Can now change the monitor configuration as well as report it.
    . Introduced client-side vsync which dramatically reduces latency
      from the client to the screen, by up to 44ms.
    . Removed all input resampling logic. We now expect toolkits to do their
      own, if at all. This reduces input lag by up to 16.9ms, or 8.4ms on
      average.

Show diffs side-by-side

added added

removed removed

Lines of Context:
291
291
    }
292
292
}
293
293
 
 
294
mcl::ClientContext* mcl::to_client_context(MirConnection* connection)
 
295
{
 
296
    return connection;
 
297
}
 
298
 
294
299
MirConnection::MirConnection(std::string const& error_message) :
295
300
    deregisterer{this},
296
301
    channel(),
892
897
    }
893
898
}
894
899
 
 
900
#pragma GCC diagnostic push
 
901
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
895
902
MirWaitHandle* MirConnection::create_client_buffer_stream(
896
903
    int width, int height,
897
904
    MirPixelFormat format,
942
949
    surface_map->insert(render_surface->stream_id(), stream);
943
950
    return stream;
944
951
}
 
952
#pragma GCC diagnostic pop
945
953
 
946
954
void MirConnection::render_surface_error(std::string const& error_msg, std::shared_ptr<RenderSurfaceCreationRequest> const& request)
947
955
{
951
959
    auto rs = std::make_shared<mcl::ErrorRenderSurface>(error_msg, this);
952
960
    surface_map->insert(request->native_window.get(), rs);
953
961
 
 
962
#pragma GCC diagnostic push
 
963
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
954
964
    if (request->callback)
955
965
        request->callback(
956
966
            static_cast<MirRenderSurface*>(request->native_window.get()),
957
967
            request->context);
 
968
#pragma GCC diagnostic pop
958
969
 
959
970
    request->wh->result_received();
960
971
}
1237
1248
    return display_configuration->take_snapshot();
1238
1249
}
1239
1250
 
 
1251
#pragma GCC diagnostic push
 
1252
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1240
1253
std::shared_ptr<mcl::PresentationChain> MirConnection::create_presentation_chain_with_id(
1241
1254
    MirRenderSurface* render_surface,
1242
1255
    mir::protobuf::BufferStream const& a_protobuf_bs)
1249
1262
    surface_map->insert(render_surface->stream_id(), chain);
1250
1263
    return chain;
1251
1264
}
 
1265
#pragma GCC diagnostic pop
1252
1266
 
1253
1267
void MirConnection::allocate_buffer(
1254
 
    geom::Size size, MirPixelFormat format, MirBufferUsage usage,
 
1268
    geom::Size size, MirPixelFormat format,
1255
1269
    MirBufferCallback callback, void* context)
1256
1270
{
1257
1271
    mp::BufferAllocation request;
1260
1274
    buffer_request->set_width(size.width.as_int());
1261
1275
    buffer_request->set_height(size.height.as_int());
1262
1276
    buffer_request->set_pixel_format(format);
1263
 
    buffer_request->set_buffer_usage(usage);
1264
 
 
1265
 
    if (!client_buffer_factory)
1266
 
        client_buffer_factory = platform->create_buffer_factory();
1267
 
    buffer_factory->expect_buffer(
1268
 
        client_buffer_factory, this,
1269
 
        size, format, usage,
 
1277
    buffer_request->set_buffer_usage(mir_buffer_usage_software);
 
1278
 
 
1279
    if (!client_buffer_factory)
 
1280
        client_buffer_factory = platform->create_buffer_factory();
 
1281
    buffer_factory->expect_buffer(
 
1282
        client_buffer_factory, this,
 
1283
        size, format, mir_buffer_usage_software,
 
1284
        callback, context);
 
1285
    server.allocate_buffers(&request, ignored.get(), gp::NewCallback(ignore));
 
1286
}
 
1287
 
 
1288
void MirConnection::allocate_buffer(
 
1289
    geom::Size size, uint32_t native_format, uint32_t native_flags,
 
1290
    MirBufferCallback callback, void* context)
 
1291
{
 
1292
    mp::BufferAllocation request;
 
1293
    request.mutable_id()->set_value(-1);
 
1294
    auto buffer_request = request.add_buffer_requests();
 
1295
    buffer_request->set_width(size.width.as_int());
 
1296
    buffer_request->set_height(size.height.as_int());
 
1297
    buffer_request->set_native_format(native_format);
 
1298
    buffer_request->set_flags(native_flags);
 
1299
 
 
1300
    if (!client_buffer_factory)
 
1301
        client_buffer_factory = platform->create_buffer_factory();
 
1302
    buffer_factory->expect_buffer(
 
1303
        client_buffer_factory, this,
 
1304
        size, native_format, native_flags,
1270
1305
        callback, context);
1271
1306
    server.allocate_buffers(&request, ignored.get(), gp::NewCallback(ignore));
1272
1307
}
1311
1346
        google::protobuf::NewCallback(this, &MirConnection::released, stream_release));
1312
1347
}
1313
1348
 
 
1349
#pragma GCC diagnostic push
 
1350
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1314
1351
void MirConnection::render_surface_created(RenderSurfaceCreationRequest* request_raw)
1315
1352
{
1316
1353
    std::string static const error_msg = "Error creating MirRenderSurface: ";
1400
1437
 
1401
1438
    return static_cast<MirRenderSurface*>(nw.get());
1402
1439
}
 
1440
#pragma GCC diagnostic pop
1403
1441
 
1404
1442
void* MirConnection::request_interface(char const* name, int version)
1405
1443
{